Relative Free Energy Function and Structural Theory of Thermoeconomics

: This paper explores the advantages of using relative free energy instead of exergy to build a mathematical theory of thermodynamic costs to diagnose malfunctions in thermal systems. This theory is based on the deﬁnition of a linearized characteristic equation that represents the physical behavior of each component. The physical structure of the system described by its energy interrelationships is called “primal”, and its derivatives are the costs and consumptions. The obtained costing structure is the mathematical “dual” of its primal. The theory explains why the F and P cost assessment rules and any other suggestion may (or may not be) rational under a given disaggregation scheme. A result of the theory is a new thermodynamic function, called the relative free energy , and a new parameter called deterioration temperature due to a component’s deterioration cause, characterized by a h-s thermodynamic trajectory describing the effects on the exiting stream. The relative free energy function allows for an exact relationship between the amount of used resources and the increase in entropy generation caused by the deterioration path of the component. This function allows the obtaining of, for the ﬁrst time, an appropriate characteristic equation for a turbine and a new deﬁnition of efﬁciency that does not depend on the environment temperature but on its deterioration temperature. Also, costing with relative free energy instead of exergy may open a new path for more precise and straightforward assessments of component deteriorations.


Introduction
The aim of this paper is challenging since it questions all the concepts that have been traditionally used in thermoeconomics, also called exergoeconomics by other authors [1]. There is a consensus among practitioners that exergy is the thermodynamic property that best distributes production costs among various streams, which then helps to establish the economic costs of the streams that interact in any energy system. However, the exergy calculation has the shortcoming that it depends on the reference environment employed, which in turn is an arbitrary selection of the user and not a physical behavior of the system under analysis. If this is so, the concept of exergy efficiency, although more precise than the first law efficiency, still depends on the reference environment. This obviously applies also to its inverse, the unit exergy consumption, which is the precursor of the Theory of the Exergy Cost [2,3]. Efficiency and costing are in effect, two sides of the same coin.
The Exergy Cost Theory (ECT) is simple to understand and easy to implement computationally, and as a result, its use has taken off since 1986 when it was first published. A year earlier, G. Tsatsaronis proposed to identify all the currents of an energy system in fuels and products and thereby generate the exergoeconomic costs. The ECT facilitated the task by proposing general Fuel-Product cost allocation rules that made the costing of energy systems a quasi-routine matter. But the problem of selecting Indeed, while economists have come a long way in mathematical applications, they have never been able to link their laws to any physical law, except for metaphors and analogies. In this way, the conventional separation between hard and soft sciences would be closer to a scale of hardness than to the hard/soft dichotomy. This paper expands upon an early keynote lecture at Nancy University [10], and its objective is to come closer to a solution to this problem and investigate the concept of relative free energy, already proposed by Valero et al., [11], but with important precursors such as Baehr [12] and Alefeld [13]. To maintain the completeness of the work, the Theory of Exergy Cost is briefly described first, followed by the Structural Theory, [14]. This leads to analyzing whether the decisions made by the process analyst are or not supported by mathematical logic. These decisions are mainly the cost allocation rules, the level of aggregation, the fuel/product/waste definitions, and of course the exergy function and the reference state. This will allow discerning mathematical reasons from reasonable assumptions and go forward to a new thermodynamic function: the relative free energy function.

The Exergy Cost Theory
The exergy cost (kWh), otherwise known as cumulative exergy consumption [15,16] or presently adopted as embodied exergy according to some authors, measures the amount of exergy necessary to manufacture a product when the boundaries of the production plant, disaggregation level, and exergy efficiency of each component have been defined [2,3]. Herein, the exergy cost of a stream with exergy Ex is denoted with an asterisk, Ex * , and its unit exergy cost is expressed as follows: k * ≡ Ex * /Ex.
The process of costs allocation in productive systems requires a set of rules [3,17]: Resources Rule: The exergy cost of the flows entering a thermal system should be provided as input data. In the absence of further information, it can be assumed as equal to their exergy.
Cost Conservation Rule: For each and every system component, the exergy cost of output flows is equal to the exergy cost of the input flows.
Unspent Fuel Rule: Also known as Rule F. The unit exergy cost of an unspent fuel at the output of a system component is the same as that of the input fuel.
Co-products Rule: Also known as Rule P. All products of the same quality at the exit of a system component have the same unit exergy cost.
There are other costing rules, dealing with special cases, particularly the case of wastes, by-products, condenser outlets, etc., which are outside of this short description of the outlined theory [18].
Summarizing, the (average) exergy cost is a conservative property and the production cost must be allocated to what one wants to produce. Therefore, when a process has multiple outputs, rules F and P need to be applied, see Figure 1, depending on the productive purpose of the processes.
Let us see an example of application of these rules. Suppose first, a medium pressure steam turbine as shown in Figure 2, where the entering steam F 1 has 30 MW of exergy, it delivers a shaft work of P = 10 MW and the exit steam F 2 still has 19 MW of exergy. Then, the exergy expended to produce P is F 1 − F 2 = 11 MW, and its efficiency η = P/(F 1 − F 2 ) = 0.909.
If the turbine's objective is to produce power, the full cost of that product should be charged to the shaft work. Accordingly, the rule F means that the unit exergy cost of the flowing steam remains unaltered. Suppose that the amount of exergy expended to produce the entering steam is 2.5 times greater than its exergy content, i.e., k * 1 = 2.5 MW/MW. Then the rule F states that the unit exergy cost of the exit steam, F 2 , is that of the entering steam, F 1 , or k * 2 = k * 1 = 2.5. Consequently, the amount of exergy needed to produce the shaft work will increase in k * 3 = k * 1 /η = 2.75 MW/MW. To explain Rule P, consider an electric generator added to a distributor as in Figure 3. It delivers two currents, 9 MW of net energy output and 0.5 MW for ancillary systems, at the expenditure of 10 MW of shaft work. Its efficiency becomes η = (P 1 + P 2 )/F = 0.95. As both outlet streams are simultaneously required, the cost of its production must be allocated proportionally to both currents. Therefore, the Rule P states that the exergy cost per unit of exergy must be equal for the two currents.
If the unit exergy cost of the shaft work was k * 1 = 2.75 MW/MW, then the unit costs of the output electric streams become k * 2 = k * 3 = k * 1 /η = 2.895 MW/MW. The reader may find many examples of application of these rules to a wide-ranging class of thermal systems in [19]. As it can be seen in this simple example, these rules link the concepts of the unit exergy cost, k * , of the streams with the efficiency definition of the system's components, η = 1/k, one-to-one, where k is named the unit exergy consumption of the component. In other words, the cost of the final product increases as irreversibilities accumulate. If these increase, the efficiency of the components decreases and the costs increase accordingly. Thus, there is a direct connection between efficiency, cost, and irreversibility, when exergy is used as a measure of the energy flows of thermal systems. This is the essential message of the theory of exergy cost, which has been extensively used to assess the costs of many thermal systems.
However, a number of questions have arisen. First, based on its definition, the exergy cost depends on the plant disaggregation scheme. In other words, it cannot render a precise value because it depends on the analyst choice. For instance, a chemical plant produces ethylene and electricity, which are not produced in the same process but in the same plant; hence, either P or F rule could be applied. Therefore, the formation and type of the streams and how much and where the exergy has been consumed in the process must be analyzed. This detailed analysis provides a productive structure to which the rules can be applied in practical terms. A more detailed definition is more precise; however, there is the risk of not having measured data that corroborate the sensitivity of the obtained costs to variations in these data. There can be major discrepancies among practitioners regarding the definition of productive structures and the disaggregation method of the processes.
Second, the definition of exergy efficiency also depends on the analyst. For example, in a counter current heat exchanger, a stream becomes cooled, and another becomes heated. Hence, it heats, cools, or both, then, which stream assumes the production cost? Furthermore, not all components aim to save exergy (productive components). Certain other components in a plant are responsible for mitigating (the exergy of) wastes. Hence, it must be determined how to allocate costs to the components that process residues. Third, exergy and its related cost depend on the chosen reference environment.
However, the physical behavior of the plant does not depend on the analyst choice. Additionally, the right choice of the energy-like function for describing the plant might be in doubt: energy, exergy, (Gibbs) free energy, or any other generic function.
Moreover, are the obtained costs average costs or marginal costs? The exergy of a stream measures its potential work with respect to a given environment, and the exergy cost measures how many irreversibilities have occurred in the manufacture of a stream or product plus its remaining exergy. The exergy cost can be considered an "exergy backpack" or "exergy footprint" of a stream or product, i.e., the past exergy synopsis (history) of the stream, whereas its exergy is the future energy potential of such a stream or its remaining capacity to produce work. Finally, can the exergy costs predict future degradations or describe only past irreversibilities?
Despite these doubts, the analyst aims to obtain reasonable costs. Thus, it is necessary to disaggregate the system as far as common sense advises. However, if costs depend on the disaggregation scheme what scheme is reasonable? Second, the definition of efficiency for each component requires caution. Is it possible to find a more rational definition of efficiency? Third, choosing exergy is apparently better than other energy-like functions because it provides a proxy for the locally usable energy. Are there better energy-like functions that predict the behavior of components? Fourth, the selected reference level for exergy must be realistic. Is it possible to avoid the dependence of costs from the chosen reference environment? Finally, the average costs should be useful in predicting how many additional resources compensate for the small system perturbations. Is there a theory capable of predicting exactly small system perturbations? While the current theory does not support these prudent conventions, practice does.

On the Linearity of Cost: The Structural Theory of Thermoeconomics
Any energy system that consumes resources and manufactures products can be characterized by a thermodynamic function E of the generic type, E = m(h − T x s) where m is the mass, h the enthalpy, s the entropy with respect to a certain reference, and T x the temperature to choose under certain conditions. When T x is zero, the function E is the enthalpy; when T x is the ambient temperature, E is the exergy; if T x is the temperature of the system, E is the Gibbs free energy function.
The mathematical behavior of any component u can be described through functions of the type: where i ∈ E u are the input flows of component u and j ∈ S u the output flows of component u, and {x} is the set of its internal governing parameters, for instance, internal efficiencies, pressure relationships, temperature increases, geometric parameters, structural parameters, fluid dynamic parameters or heat transfer parameters. If the system environment is considered as the component "0", then E 0 is the set of the system outputs, and S 0 is the set of input resources to the system. Function Equation (1) does generally not relate inputs and outputs linearly. Because the only degree of freedom is the choice of T x (i.e., the choice of energy, exergy, Gibbs function, or any other function), it is likely that the complexity of the equation cannot be reduced to a linear relationship. However, such a continuous function allows for a Taylor series approximation. In addition, by choosing sufficiently small linear intervals, second-order terms can be discarded. The smaller the interval, the closer is the proposed behavior to reality. By applying this step, the following is obtained: which relates the inputs and outputs linearly through parameters k ij , which substitute the internal parameters for each identified component. Furthermore, the coefficients k ij take the name of technical production coefficients in the input-output theory [20]. They are the (average) unit consumption of resource i necessary to produce stream j.
Owing to the linearity, the coefficients k ij coincide with derivatives (ceteris paribus) of the following type: the advantage of a linear analysis is that it enables the understanding of many underlying assumptions in any cost allocation theory: herein, this expression is called the component's characteristic equation.
On the other hand, the globally considered plant will receive some resources, be these E 0 , defined as: where S 0 is the set of flows entering the plant (or leaving the environment).
The cost allocation is a basic application of the chain rule for derivative calculation, which is independent on the characteristic equations are linear or not, then the following expression for each flow of the system is satisfied: If we identify the marginal unit cost with the derivative: the marginal unit cost of flows, could be determined by means of Equation (6), as follows: in other words, the unit cost of process u outputs are linearly related with the unit cost of input streams by means of the technical coefficients. In case of the system's inputs, the marginal costs are known or made equal to one, which correspond to the external resources rule in the exergy cost theory. The application of this equation explains the previously mentioned Rules F and P as a particular case. For example, a turbine ( Figure 2) with the following defined efficiency is considered: Suppose now, it is assumed that the characteristic equation of the turbine coincides with the exergy definition of the turbine. In the simulations of the turbine for a reasonably small working interval, k can be considered constant. By applying the unit cost Equation (8), the costs of outputs #2 and #3 are obtained: hence, the result is Rule F, i.e., if a resource has not been totally consumed (stream 2), its unit cost is equal to that of the input resource (stream 1). However, if a typical electric power distribution system is considered, see Figure 3 its efficiency can be expressed as follows: Again, it is assumed that the characteristic equation of the distribution system coincides with its exergy definition. If k is constant, applying the unit cost Equation (2) results in: which explains why Rule P applies; that is, the unit costs of the products of the same nature produced in the same process are equal. In general, the disaggregation of the process in Figure 4 can be described by the following system of characteristic Equation (11): Subsequently, according to the rule of the chain of the derivatives, the following expressions are obtained: Equation (2) can be rewritten in the matrix form: where [K] is the matrix of unit consumption's, and Ω the vector of system's outputs values, and Equation (8) becomes: where k * 0 is the unit cost of the system's input flows. In the analyzed case, these matrix variables are: Please note that the matrix of the unit consumption [K] is common and transposed between Equations (13) and (14). Equation (13) is the primal model of the structure and Equation (14) is its dual model. Every productive structure or linear input-output interpretation of a system exhibits a primal representation with a corresponding single dual and vice versa [21]. Figure 5 shows the dual cost structure of system in Figure 4. While the arrows in the productive process (primal) point from the resources toward the products, the cost structure (or dual) point from the products toward the resources. The costs search for the origin (causa materialis), while the products search for the final objective (causa finalis). [22]. The cost of the productive structure is a conservative property, this is to say, the cost of the inputs of any component are entirely transferred among its outputs Equation (15). It is a mathematical consequence of the founded hypotheses: For instance, the case of component #1 is chosen, and the input equation: is combined with its output equations k * 2 = k 12 k * 1 and k * 2 = k 12 k * 1 , consequently: In general, applying Equations (2) and (8) to Equation (15) the cost balance is satisfied: and the cost balance for the global plant, will be: Therefore, the plant's incidence matrix A, can be defined as: hence, the analyzed case can be described as follows: In general, the following expression holds: and Equation (19) shows the cost conservation rule. It is a mathematical consequence of the founded hypotheses. This result is quite remarkable because the following equations summarize straightforwardly the equilibrium thermodynamics for open systems: Mass Balance (20)  (19). The presented structural theory explains the previously presented exergy cost theory.

Outcomes
The presented theory mitigates several important deficiencies of the conventional exergy costing theories. First, its results do not depend on a disaggregation scheme. For example, the system in Figure 4 is aggregated into a single component Figure 6.  (1) and (2). However, neither the Rule P or F can be applied between streams #4 or #5. In other words, k * 4 is not equal to k * 5 , nor to k * 1 . Therefore, the theory provides many hints how to explore the cost relationships and suggests that greater disaggregation schemes are required.
The main idea originates from the difference between the characteristic equation, and the efficiency equation (e.g., Figure 2 or Figure 3). The former reflects the physical behavior of the component while the second is a definition, (i.e., an identity). For instance, the linear characteristic equation of Figure 6 is expressed as follows: meanwhile, its efficiency equation could be of the following type: The similarity is evident; however, the more the analyst aggregates, the more deviates the physical behavior of the system from the aggregated efficiency definition. Note also that the reference environment of the exergy depends on the practitioner choice, whereas Equation (2) should be independent.
The structural theory, first presented in [14,23], has been largely ignored in the study of different alternate rules for costing allocations, such as in the allocation of the costs of wastes or by-products. This might be due to the difficulties of determining the fundamental equations of components as in Equation (1) or their linearized equations, Equation (2). Rather, the theory has been used to check the logic of rules F and P.
Please note that Odum's Emergy Analysis [24,25] does not satisfy Equation (19) because it considers that when a biological system produces simultaneously two products, the same amount of solar energy is required for each product. This does not deny the idea of emergy; it simply states that this is not a regular cost.
In the same way, a non-linear theory does not satisfy Equation (4) because the primal would be of the following type: rather than as Equation (19). However, Equation (24) enables a generalization of the theory, For example, in [23], the costs are the Lagrange multipliers of an optimization of the plant. The structural theory formally relates to the input-output theory [20]; however, the characteristic equation makes the difference because it deeply connects the thermodynamic behavior of an energy system to the stream costs such as in a transparent box. Instead of the economic performance of highly aggregated economy sectors, their input-output flows are obtained outside the black boxes, which constitute each sector of the economy. In addition, the second law exergy analysis appears as a natural connection between physical behavior and cost, because it locates and accounts for irreversibilities occurring in a plant; thus, it relates the physical losses to the costs. Please note that "cost" is a concept that originates from economics, while "irreversibility" originates from thermodynamics. The structural theory can be considered a sought-after bridge between classical economics and physics. Thus, we consider the term "thermoeconomics" is more appropriate than alternatives such as exergoeconomics [17].

Drawbacks of Exergy?
One important result of the structural theory is that any energy function of the type E = H − T x S, may be used to assess different sets of costs. Thus, why should exergy that uses a fixed T 0 instead of a variable T x be considered? The most important objective of this study is to question the exergy directly to assess costs.
Mythologizing exergy is not convenient, it only measures the number of times that a product is potentially equivalent to another. Therefore, the kilograms of natural gas; mass of steam at a certain temperature and pressure; and kinetic, magnetic, or mechanical energies are possible units for measuring exergy. Certainly, it does not reflect the product value. A broken glass has practically the same exergy as a new one, and the exergy of gold at T 0 is zero as taken by reference. Moreover, everybody would prefer 1 g diamond than 1 g pure graphite, even though they practically have the same exergy.
In addition, the manufacture of a continuous and broken thread costs the same exergy although the latter would not be saleable. Exergy reduces a probably irreducible object to a single numerical value. The color, taste, form, texture, or artistic impression (i.e., properties that human beings value) have no distinguishable exergy. The exergy and exergy cost are only a measure of reality, which should not supplant other possible analyses.
Can the concept of value be assessed by thermodynamics? Does it make sense to go beyond the exergy cost when it comes to knowing the cost of objects? It has been claimed many times that exergy is a measure of the quality of things, which is false; it is a measure of the energy imbalance that a system has with respect to a reference environment. It is a measure of the thermodynamic quality of energy and not of objects. Moreover, the quality specification is much more complex. A dose of carbon monoxide may have the same exergy as a certain amount of food; however, everybody knows which one to ingest or burn in a boiler. The same food can present a disgusting or an extraordinary aspect and contain the same amount of exergy. Based on the many possible examples, it seems strange to confuse exergy with quality.
Assessing thermodynamic quality requires many specifications such as the pressure, temperature, composition, height, and speed. Quality also depends on the context, whereas exergy does not. In general, thermodynamic equivalence is not a measure of the equivalence of values. Even circumstances and the moment make a thing seem more or less valuable. Researchers should distance themselves from neo-energeticism (or even better "exergeticism"), which regards exergy rather as a measure of the value of objects than as their monetary value. The exergy and exergy costs provide complementary information on the human footprint on Earth; ignoring them is as dangerous as extolling them as a unique instrument for managing the natural resources and environment.
Furthermore, the second law has not exhausted its message regarding exergy. The following equation: identifies product, waste, and what is (or is not) a usable resource. Certainly, every real-world process experiences an irreversibility. The Gouy-Stodola theorem relates the entropy generation to irreversibility: Regardless of the way the quality of every stream, product, or service is defined (generalized exergy function), it is easier to identify the quantity. Thus, the magnitude of a property X is always a product of its quantity q x multiplied by its specific quality x: It would be interesting to determine the amount of resources required to compensate for a deterioration of any component in a constant production for a set of quality specifications for each flow interacting in a system.

The Relative Free Energy Function
Before generalizing the problem, a simple case should be analyzed: for example, the expanding flow of a turbine produces work on the shaft. In an (h, s) diagram, Figure 7, the actual process evolves from state 1 to state 2.
The energy and entropy balances of the process (first and second laws) are as follows: If the turbine degrades, at a rate equal to the specifications of the inflow #1, an increase in the entropy generation evidently results in an increase in the amount of entering fuel (path 1) to keep the production constant. Owing to the degradation, the new state of the outflow #2' is characterized by (h 2 , s 2 ).
A differential analysis under the conditions: W=const., h 1 =const., and s 1 =const., leads to the following expressions: Subsequently, if the deterioration temperature of flow #2 is defined as a quotient: the result is as follows: where r is the deterioration path, as it shown is Figure 7. Equation (32) is the mathematical expression of the existing relationship between any local degradation and the increase in associated resources if the production of the component should remain constant.
These equations and the function ≡ (h 1 − h 2 ) − T d (s 1 − s 2 ) were presented in [11]. Valero called it the relative free energy [26,27], and T d the deterioration temperature (In 1994, Prof E. Sciubba proposed to name it "dissipation" temperature. However, the authors consider the word "deterioration" more precise, since that word always relates to a component rather than to a process).
The expression "relative free energy" (RFE) originates from its similarity to the Gibbs free energy function. Equation (32) states that any deterioration process in an energy component has an associated T d in the exit stream of supplying fuel. This parameter possesses temperature dimensions even if it is not a gauging temperature; it can be calculated by measuring the quotient dh 2 /ds 2 experienced by the output stream of the component's fuel.
The heat exchanger Figure 8 experiences the same procedure. In that case, the enthalpy and entropy balances are written as follows: If the heat source degrades, at equal to the specifications of the inflow #1, an increase in the entropy generation results evidently in an increase in the amount of entering fuel #1 to maintain a constant production; thus, m 3 , (h 3 , s 3 ), and (h 4 , s 4 ) are constant. Owing to the degradation, the new state of outflow #2' is characterized by (h 2 , s 2 ). A differential analysis under the condition (h 1 , s 1 ) are constant, leads to: If the dissipation temperature of flow #2 is defined as a quotient: subsequently Equation (32) is also satisfied. According to the second law, dS g is always positive; therefore, more fuel must be used to obtain the same product, and dm > 0. Because T d,2 is positive, the term (h 1 − h 2 ) − T d,2 (s 1 − s 2 ) must be positive; in other words, T d,2 (s 1 − s 2 ) is always lower than h 1 − h 2 . Also note that in a low pressure steam turbine of a Rankine cycle, T d,2 coincides with the condenser temperature which is fully logical. More examples could be found in [27].

h-s Deterioration(s) Path(s) of an Energy System
Man-made energy systems transform the energy flows into other flows with a purpose. Commonly, the name of a component describes its function: a boiler boils water, a condenser condenses steam, and a heat exchanger exchanges heat. The understanding of how nature behaves is the basis of the component design. The entering flow performs a purposive path through which its thermodynamic properties change progressively until the flow exits the component. This path is never strictly determined, either because of possible changes in the quantity/quality of the entering flow or because of changes in the behavior of the component itself. This path variation results in a change in the properties of the exiting flow with respect to its design conditions. There are as many new exit states as causes of change, which are called "malfunctions" and are classified into two categories: intrinsic and induced [28][29][30]. The term "intrinsic" refers to the internal deterioration of the component; the term "induced" refers to its off-design conditions (not the optimal operating conditions). A good component design foresees most of these off-design conditions. Literature and some manufacturers provide governing equations and control parameters based on semi-empirical models of the machines. The function h 2 = h 2 (s 2 , r)) can be regarded as the mathematical description of the effects on the exiting flow caused by the component deterioration cause r. This function always exists for a given differential malfunction interval. Moreover, under actual machine conditions, this function is a composite curve of the different paths caused by the concurrent deteriorations acting simultaneously on the component [28]. The next section focuses on this function.

The Legendre Transform of a Deterioration Path
For each deterioration cause, r, the existence of a function h = h(s) of the exiting flow can be assumed, which can be described in the h − s plane with the conventional point geometry or Plücker line geometry for strictly convex functions as a convolution of the tangents of the original curve. This technique is named the Legendre transform of the function h = h(s) and is widely used in classical thermodynamics [31,32]. As it is shown in Figure 9, the intersection of the tangent line of the deterioration path r with the h-axis is and its slope is T d : Equation (37) is the Legendre transform of the deterioration path h 2 = h 2 (s 2 , r). In fact, pairs of ( 2 , T d,2 ) for each exit state, #2', of the component provide the same information as pairs (h 2 , s 2 ). Since the relationship 2 = 2 (T d,2 ) is mathematically equivalent to the relationship h 2 = h 2 (s 2 , r), it can also be considered the description of the deterioration path. More in general, h r = h r (s r ), is the deterioration function in the h-representation; whereas r = r (T d , r) is the deterioration function in the -representation. In other words, r and T d,r , are inseparable in a deterioration path, r, such as h r and s r do. Note also that h and s do not represent absolute values because they refer h 0 and s 0 values. Unless otherwise stated h and s represent h − h 0 and s − s 0 .
According to the definition of relative free exergy Equation (37), expression Equation (32) could be written as: The deterioration temperature, T d , is not a physical temperature, it is a parameter and derivative with temperature dimensions: It can be interpreted as the entropic cost of the deterioration. The greater T d , the lower the relative free energy of the exiting flow. Well-known contributors to technical thermodynamics such as Baehr [12] have defined the "friction work" or "loss work" for an expander as follows: This loss work is energy that has not been dissipated into the environment at T 0 and contributes to the degradation of the exiting flow of the expander. It increases the enthalpy and entropy of the exiting stream and reduces the work produced by the turbine, thereby decreasing its efficiency.
In the example of the turbine, Figure 7, a differential analysis of the exergy Equation (25) under the conditions (h 1 , s 1 ) and W constants, results in: Therefore, the following expression is obtained: Another important antecedent was the work of Alefeld [13], who worked on heat pumps and refrigeration systems: he questioned the use of the reference ambient temperature T 0 instead of a variable temperature T x associated with the whole system. In particular, he proposed for the case of a Rankine cycle, where this temperature T x be equal to that of the condenser vacuum, T vac . Alefeld was highly criticized by the community of exergy practitioners, because the holistic vision that exergy provides was lost in his proposal. This article is a recognition to his work because mathematical proofs are stronger than reasonable assumptions.
The relative free energy function, , represents the local free energy conditioned by the deterioration path, r. It is an intensive property, and its corresponding extensive property: is the amount of energy of the exiting stream in a fuel of the type E 1 − E 2 , which is not affected by the deterioration of the component. This is because when the exit flow changes its state owing to the deterioration, h and s, vary by following the path h r = h r (s r ). Consequently, the following expression is obtained: In addition, the function h r = h r (s r ) is neither a straight curve nor a slope T 0 . Therefore, , exceptionally coincides with the specific exergy of the stream, and the exergy increase in the output stream in the turbine is: In the example of the turbine, (h 1 , s 1 ) and W are constant, then applying differential analysis to the unit exergy consumption definition: k ≡ F/P, it follows: Combining both Equations (41) and (45): and applying Equation (38), it follows: This expression is quite important, because it relates the loss of exergy efficiency in the turbine with the additional mass of fuel to compensate it at constant production. In other words, it relates the malfunction of the turbine with the need for more entering fuel. Also, this expression opens the way of changing the paradigm of exergy by relative free energy.
Therefore, a new definition of the efficiency (or its inverse specific consumption) of the turbine appears: This new definition of efficiency of the turbine has the important property that if the turbine malfunction following a r path, its characteristic equation becomes: this constant might be selected as the standard reference state for h and s calculations (h 0 , s 0 ). When a malfunction in the turbine follows a trajectory r at W constant, it follows: because 1 − 2 is constant along trajectory r. Therefore: in other words, any additional percentage of malfunction following a trajectory r at W constant result in an additional percentage of mass of fuel entering the turbine. Also note that exergy does not fulfill Equation (51), because: Equation (49) is not a mere efficiency definition, as it is the unit exergy consumption definition k ≡ F/P. It corresponds to a physical description of the turbine system and what is more important, it does not depend on the reference environment temperature T 0 , but on the behavior of the turbine. The structural theory, as explained in this paper, together with the relative free energy function allows the obtaining of an interesting characteristic function of the behavior of thermodynamic systems. If under the structural theory, the coefficients k ij are the precursors of costs k * j , should these costs be their "natural" costs? or perhaps they should be named "regular" costs? In any case these costs are directly related to the additional amount of resources needed to compensate the malfunction.
The expression Equation (38) shows that the second law has not yet said the last word regarding the relationship between the thermodynamic quantity, quality, cost and irreversibility. In general, the reason of why T d instead of T 0 , stems from the fact that the additional degraded energy not used in producing the product becomes part to the exiting streaming instead of going directly to the environment at T 0 . The value of T d depends on how great the additional irreversibility is created.
Such interpretation of T d , allows understand that its lowest attainable value is T 0 , while, apparently, has no highest limit.
In other words, the deterioration lowers the free energy of the exiting stream. As this deterioration always relates to some component, this is why we name this function relative free energy. In the same way that the Gibbs free energy relates to some chemical reaction, the RFE relates to some component deterioration in a system.
The key problem of diagnosis of energy systems stems in how to assess, as precisely as possible, the relationship between local irreversibilities and additional consumption of resources. At constant production, a local irreversibility needs additional resources to compensate it, but also modifies the exiting streams, affecting downstream enthalpies and entropies and eventually the upstream ones, if recycling. A certainty derives from the Second Law: Any inefficiency in a process increases the entropy generation. This means that any mechanical, thermal or chemical loss generates entropy and reduces efficiency. However, any efficiency decrease means more resources (at equal quality) to get the same product. If one knows the amount of local resources needed to compensate a local deterioration, r, i.e., ∂m local ∂S g r and knows how the global system's resources is related with local resources, i.e., ∂m global ∂m local r one may have a new theory of energy system diagnosis. We will present this theory with due examples in a following paper; however, an early analysis was published in [33].

Conclusions
The definition of efficiency plays a fundamental role in the process of calculating average exergy costs. So, efficiency and cost became closely linked. In such a way, the theory of exergy cost [2,3] was extensively used to assess costs on many thermoeconomic/thermodynamic applications. However, the exergy cost depends on the plant disaggregation scheme. It is necessary to look after the cost formation process, by searching how much exergy has been consumed in the processes and where they have consumed it. The result of this activity is a given productive structure. However, if exergy depends on a chosen reference state, exergy efficiencies and their closely related costs will depend on such selection. Notwithstanding, any deterioration that increases entropy generation results in an additional expense of resources used to produce the same product. Both the entropy increase and the additional resources are measurable and free from analyst selections. Therefore, something fails in the conventional theory.
The use of exergy instead of enthalpy or the Gibbs function for obtaining costs increase the overall, coherent and systematic view of a set of stream costs in a productive structure. To what extent one could use these costs to assess component malfunctions? In other words, can average costs be used as marginal costs?
The exergy cost is the exergy backpack, embodied exergy or the exergy footprint of a commodity; in fact, Szargut named it as "cumulative exergy consumption", [16] i.e., its "past" characterization (history), while exergy is the potential energy of such a commodity, or its remaining capacity for doing something else. Can average costs predict future degradations or only past irreversibilities?
The purpose of Thermoeconomics is to obtain a coherent and significant set of costs in a given structure. That is because its applications are directed towards the optimization and diagnosis of productive structures. Therefore, the costs of internal streams are quite important to analyze the behavior of the system. Consequently, internal costs ought to be as sensitive as possible to system degradation. A theory that would provide exact costs would be the objective of thermoeconomic diagnosis. In fact, one can obtain the costs of final products or commodities, without performing very detailed analyses. In other words, in no way Thermoeconomics, as it is already known, is far from being finished. Moreover, the analyst needs to look for the cost formation process of wastes, [18], not mentioned here even when some ideas developed here could be used to clarify it. This paper presents a general theory of (linear) costing, demonstrating and answering questions like:

•
To what extent the linear characteristic equation Equation (2)  A costing theory applicable to any thermodynamic function like, enthalpy, exergy, Gibbs free energy or any other.

•
In analyzing this last point, we proposed a new thermodynamic function, called the relative free energy, , and introduced a new parameter T d called deterioration temperature due to a component's deterioration cause r, characterized by a thermodinamic trajectory h = h(s, r) describing the effects on the exiting stream.
In other words, the pairs r and T d,r , are so inseparable in a deterioration path, r, as the pairs (h r , s r ) do.

•
The general formula (38) applies for different flowing streams in energy systems under each particular deterioration path, r i . A given component may have several deterioration paths, not only one. Therefore, the concept of component malfunction need be associated with that of deterioration paths. Besides that, this formula can be applied to any system -under the defined conditions-no matter its aggregation level. Each degradation will have its deterioration temperature as well as its corresponding RFE efficiency. • A way for assessing appropriate characteristic equations of thermal systems as it was obtained here for the case of turbines.

•
As the component's deterioration does not depend on the analyst's decision on the chosen reference state, the deterioration temperature no longer depends on the chosen reference temperature. Neither does the new definition of efficiency using the RFE. This fact does not isolate the plant from environmental conditions, but eliminates the arbitrary selection of any reference state. That idea clarifies the role of the environmental conditions onto the plant.
The Exergy Cost Theory provides reasonable costs. Will relative free energy provide a set of natural (or perhaps named regular) costs? In fact, the cost of a deterioration is directly related to the physical behavior of that deterioration. This way it also means that these costs are in fact marginal costs, since they incorporate the future malfunction behavior of the component.
The theory sketched here opens new fields of knowledge, since new questions appear: Is exergy the best thermodynamic function when diagnosing systems? Why T 0 needs to be the same for each component of a given structure? Can we use this theory to assess objective average costs of deteriorations free from assumptions? The deterioration behavior of an energy system relates with internal marginal costs while exergy costs with history. Should we change our definitions of efficiency under the light of the relative free energy function? Etc. Even if described early in the 1990s, all these ideas are tools for future, [34]. Cost is a measure of expended resources to produce something, then, costing with the relative free energy instead of exergy would open a new field of a more precise theory of Thermoeconomics. We presently work in such ideas.
Author Contributions: Ideas, formulation of overarching research goals and aims, creation of models, writing of the initial draft, A.V.; verification of the overall reproducibility of results, C.T.; preparation of the published work specifically data presentation, C.T. All authors have read and agreed to the published version of the manuscript.
Funding: This research received no external funding.