Exergy Analysis and Process Optimization with Variable Environment Temperature

In its usual definition, exergy cancels out at the ambient temperature which is thus taken both as a constant and as a reference. When the fluctuations of the ambient temperature, obviously real, are considered, the temperature where exergy cancels out can be equated, either to the current ambient temperature (thus variable), or to a constant reference temperature. Thermodynamic consequences of both approaches are mathematically derived. Only the second approach insures that minimizing the exergy loss maximizes performance in terms of energy. Moreover, it extends the notion of reversibility to the presence of an ideal heat storage. When the heat storage is real (non-ideal), the total exergy loss includes a component specifically related to the heat exchanges with variable ambient air. The design of the heat storage can then be incorporated into an optimization procedure for the whole process. That second approach with a constant reference is exemplified in the case study of heat pumping for heating a building in wintertime. The results show that the so-obtained total exergy loss is the lost mechanical energy, a property that is not verified when exergy analysis is conducted following the first approach.


Introduction
In order to reduce global warming, energy efficiency of processes has become a crucial concern. Second Law analysis is a useful tool for optimizing energy conversion processes via minimization of either entropy generation [1] or exergy losses [2]. Exergy may be defined in two ways. In the first one, exergy is the maximal amount of mechanical work that can be produced out of a given flux (or quantity) of energy by a reversible process operated between that flux and ambient air. The second definition is more formal: exergy is the considered total energy minus the corresponding entropy multiplied by the absolute temperature of ambient air. In general, there is no difference between the two definitions [1][2][3][4][5][6]. The characteristics of ambient air define a state usually called 'dead state', from which no mechanical energy can be produced: any heat flux received or supplied by ambient air has zero exergy. The latter lines, and textbooks of thermodynamics in general, consider processes in a stable environment if not in a steady state. That framework and the real world obviously differ on this point: the ambient temperature does fluctuate, and no real process exactly operates in a steady state. The typical amplitude of those fluctuations along the circadian cycle is of the order of ten Kelvin in temperate climates, i.e. 3% of its absolute value. Annual fluctuations are even more significant. How should then exergy analyses be conducted in such fluctuating conditions? Forty years ago, Wepfer et al. addressed such issues with the example of open processes. They concluded that "it is ( . . . ) unnecessary to account for the dead state ( . . . ) when the interesting quantities are differences" [7]. Exergy analyses mostly handle two quantities of interest in relation with energy efficiency: exergy losses and exergy efficiencies. Both combine exergy fluxes, the former in differences, the latter in ratios. As a matter of fact, numerous articles investigate the influence of the dead state temperature on the exergy efficiency of processes [8][9][10][11][12][13][14][15][16][17][18][19]: they study how a given process, often air conditioning, operates in various environmental conditions, especially with various values of the ambient temperature. As a main result, they show how exergy efficiency depends on the ambient temperature, an influence found to be strong especially for building applications [9,20]. The present concern is slightly different and focuses on optimization of energy efficiency when processes are operated in variable environment conditions. Indeed, these fluctuations have at least two consequences: • The processes under consideration work in dynamic conditions and thermal inertia always plays some role (it obviously plays no role in a steady state). That role may be marginal but if a heat storage is present, especially as a means for saving energy, that role becomes significant.

•
The figures of merit quantifying energy efficiency must be calculated over the whole period. For instance, if the coefficient of performance (COP) of a refrigeration cycle in a steady state is the ratio of the cooling rate to the power rate supplied to the compressor (both in Watts), in a non-stationary cycle, each of those rates must be integrated over the whole period, and the average COP (called the Energy Efficiency Ratio) is the ratio of their integrals (both in Joules).
A robust exergy analysis must account for the non-stationary behavior of the process and must integrate any exergy flux or loss over the whole cycle [21]. The present key point is to adopt a definition of exergy that preserves mathematical equivalence between the minimum of exergy losses and the maximum of energy efficiency: should exergy always cancel out at the ambient temperature (despite its fluctuations), or only at a prescribed reference temperature (which then differs from the fluctuating ambient temperature)? The literature is somehow confusing about this point. In most of the articles mentioned above [8][9][10][11][12][13][14][15][16][17][18][19][20], the variable ambient temperature is taken as 'dead state' or 'reference' (a variable 'reference' then), but without any argument for supporting this option. Some authors propose to take an ad-hoc time-averaged ambient temperature as reference, either the hourly average [10,22,23], or the monthly average [10,22], raising then the paradox that 'the dead state varies with operating time' [23] but is in fact kept constant within a given time interval. Few authors consider an absolutely fixed reference: either the average ambient temperature over the whole year [10,24,25], or a constant temperature prescribed according to the process under consideration [26,27]. The present work is a continuation of one of these articles [26] where thermodynamic arguments were first given. They are now completed with mathematical arguments and original numerical computations demonstrating convergence between exergy analysis and energy optimization.
First, the bases of the thermodynamic framework for process optimization are described. Then, the issues raised by the fluctuations of ambient temperature are presented, which leads to (i) the choice of a fixed reference, and (ii) the concept of ideal heat storage between the process and ambient air. The so-elaborated exergy analysis is then applied to a case study where a heat pump is used for heating a building in wintertime. After verification of validity of the present approach, perspectives are drawn.

The First and Second Laws Applied to Energy Conversion Processes for Optimization Purpose
where the factor X equals 0 for work, or 1/T for heat exchanged with a source at T. The First and Second Laws are: Multiplying the entropy balance by T a and subtracting it from the energy balance, leads to: from which the First Law efficiency η of the considered process is easily deduced: In this equation, ε equals ±1 with the same sign as . E u (ε = −1 for a heat engine or a heat pump, ε = +1 for a refrigerator). Equation (3) clearly evidences that any reversible cycle, i.e., with zero entropy production, has the highest possible efficiency: η rev = −ε(1 − T a X p )/(1 − T a X u ), so that the bracket on the right hand side of Equation (3) is the ratio of the effective First Law efficiency to that of the corresponding reversible process operated with the same sources, η/η rev . This ratio always lies between 0 and 1 and is called Second Law efficiency, it is denoted herein as η S because it results from entropy analysis. Appendix A shows how Second Law analysis helps in optimizing energy conversion processes by minimizing the total entropy production, . S P tot , which is the sum of all the individual entropy productions, component by component, cause by cause (entropy productions are additive).

Introduction of Exergy
In his review article [13], Hepbasli counted out as many as eighteen definitions of exergy. More generally speaking, there are mainly two definitions. In the first one, exergy is the maximal amount of work that can be produced out of a given flux of energy, . E p , (or amount of material) by a reversible process operated between that flux (or amount of material) and ambient air. Applying the conditions X u = 0 (for work) and . S P tot = 0 (for reversibility) to Equation (3) leads to: This is the linear combination of energy and entropy mentioned in the introduction as the second definition of exergy. When the flux . E p is heat delivered by a source at T p , the multiplying factor is (1 − T a /T p ) i.e., the efficiency of the Carnot cycle operated between T p and T a . Moreover, as 1 − T a X a ≡ 0, any heat flux received or supplied by ambient air has zero exergy.
Using these relations, Equation (2) is rewritten as: is the flux of exergy produced by the process and where the total loss of exergy of the process is proportional to the total entropy production: S P tot . This proportionality holds for any individual exergy loss and entropy production mentioned above. Moreover, straightforward rearrangements in Equation (3) lead to: B p is the exergy efficiency of the process, denoted as η B . The right-hand side shows that η B is identical to the Second Law efficiency η S . Considering process optimization, Equation (5) shows that it is mathematically equivalent to (i) maximize the process energy efficiency η, (ii) maximize the exergy efficiency η B (their ratio ηrev is independent from the process design), (iii) minimize the total entropy production, and (iv) minimize the total exergy loss (their ratio, T a , is independent from the process design). It is thus equivalent to minimize entropy productions or exergy losses in order to optimize processes, as done in Appendix A. Entropy and exergy analyses are perfectly equivalent, they are two sides of the same coin, the Second Law. When considering individual components, the literature never mentions any 'Second Law' efficiency (i.e., resulting from entropy balances), but their exergy efficiency is very often mentioned. The principle is similar to Equation (5): exergy leaving the component over exergy entering the component. Unfortunately, the latter definition suffers from some ambiguity. Martinaitis et al. [15,28] describe how and why the 'universal' and the 'functional' exergy efficiencies of individual heat exchangers differ. Moreover, these authors present cases where the individual exergy efficiency takes a paradoxically negative value, although the exchanger under consideration contributes positively to the energy efficiency of the whole process [15]. Lastly, if the combination of individual exergy losses into the total one is the simplest ever possible (addition), there is no rule for combining the individual exergy efficiencies into the global one, an operation which by the way is never mentioned in the literature. For all those reasons, the present article exclusively considers exergy losses and their analysis, with the purpose of minimizing them for the sake of process optimization.

Exergy Analysis with Variable Ambient Temperature
Among the many issues raised by the variations of ambient temperature, the present study considers the circadian cycle under the assumption of perfectly periodical process operation. The generic energy conversion process presented above exchanges heat with ambient air via a heat exchanger (e.g., the condenser for power plants and cooling machines, or the evaporator for heat pumps). When the ambient temperature fluctuates, the temperature field in that heat exchanger also fluctuates, although with a certain lag due to thermal inertia. Temperature changes might also affect the internal pressure, or the state of the working fluid (e.g., fractions of liquid/vapor phases). These phenomena induce changes in the total energy, E, and in the entropy, S, contained in the whole system (index sys). The following First and Second Law balances account for these changes: where all the energy/heat fluxes and the total rate of entropy production are time-dependent. The energy efficiency of the whole process is given by the ratio εE u /E p , where the amounts of energy, E • , result from time integration of the corresponding rates over the whole cycle, E • = . E • dt.

Approach with Entropy Only
The Equations (6) are integrated over the whole cycle. Assuming periodicity, and as total energy and entropy are functions of state, the integrals on the right-hand sides cancel out. This leads to: where Q a = .
Q a dt, S P tot = . S P tot dt (additivity of entropy productions also holds in time), and where the mean entropic ambient temperature, T a , is such that: . Q a (t)/T a (t) dt = Q a / T a . Combining the two Equations (7) with the factor T a leads to the average energy efficiency: Equations (7) and (8) look very similar to Equations (1) and (3), respectively. However, if the steady ambient temperature, T a , obviously did not depend on the process design, the average temperature T a now depends on how and when the process exchanges the flux, . Q a (t), with the environment at variable temperature, T a (t). As the energy efficiency, η, is a function of two design-dependent quantities, S P tot and T a , minimizing S P tot is not mathematically equivalent to maximizing η. Could the equivalence between maximal energy efficiency and minimal irreversibility be recovered by exergy analysis with an appropriate definition of exergy? Two approaches are explored here-under.

First Approach for Exergy: Combination Energy-Entropy with the Fluctuating Temperature T a (t)
This first exergy function, denoted as B 1 , is defined by dB 1 = dE − T a (t)dS. This combination of Equations (6) results in: As the term in . Q a is eliminated, this function B 1 cancels out for any heat flux exchanged by ambient air. Integration of Equation (9) over the whole daily cycle leads to: Integrating the fluxes S P tot along the cycle and not only on their integrals E p , E u , and S P tot . On the right-hand side, the integral of dE sys over a cycle surely cancels out (total energy is a function of state), but the second integral does not. Indeed, the variation, dS sys , of the entropy contained in the system depends on the thermal inertia of each component, including the heat exchanger in contact with ambient air. The integral of dS sys over a cycle does cancel out (entropy is a function of state), but not the integral T a (t)dS sys , except by chance and even with a perfectly periodical behavior of the system and environment. According to the definition of B 1 , the right-hand side should represent the variation over a cycle of the exergy contained in the system, i.e., dB 1sys , and it occurs to be finite (non-zero). Gathering all those considerations, the exergy balance (10) is rewritten as: B 1p + B 1u − B L 1tot = dB 1sys 0. This leads to the following expression for the exergy efficiency of the process: where the numerator involves, in addition to the total loss of exergy, B L 1tot , a finite term related to thermal inertia, the sign of which cannot be known a priori. Because of that finite term, minimizing B L 1tot does not mathematically entail that η B1 is maximal.

Intermediate Discussion
In this first approach, the heat fluxes exchanged by ambient air always have zero exergy. The mathematical derivations of the previous sub-section present several differences with the exergy analysis in a steady state. Indeed, the mathematical equivalence between (i) maximal energy efficiency, (ii) maximal exergy efficiency, and (iii) minimal total exergy loss, is lost. Moreover, the ratio between the rates of entropy production and of exergy loss, T a (t), is time-dependent. Mathematically speaking, those exergy losses give more weight to the entropy productions occurring when T a is high: they do not obey the same additivity rule as entropy productions. Moreover, minimizing those exergy losses does not entail that entropy productions are also minimal, which breaks the consistency between entropy and exergy analyses.
The derivations of Section 3.2 show that those serious drawbacks stem from the time-dependence of the factor multiplying the entropy equation when constructing the exergy B 1 . Those drawbacks disappear if a constant factor, namely T 0 , is used instead of the time varying T a (t). But, then, the exergy of the heat fluxes exchanged by ambient air, . Q a , does not cancel out (except at the exact moments when T a (t) = T 0 ). This comes in frontal contradiction with a property of exergy, usually seen as central in exergy analyses. As the rest of this article relies on this unusual definition of exergy, it is important to argue and justify that choice from the point of view of energy efficiency.
When the weather is too hot at daytime in summer, but the outdoor temperature fortunately cooler at night, it is a common practice to keep windows wide open at night in order to favor ventilation and reduce the indoor temperature. On the other hand, at daytime, windows are shut and ventilation is kept minimal in order to prevent the hot outdoor air to carry heat inside. Beyond the individual practice, this process is referred to as 'night ventilation' [29] and is also related to heat storage [30][31][32]. The thermal inertia of the building (possibly enhanced by a heat storage) limits the temperature rise induced by the heat inputs at daytime (solar gains, convective exchange from hot outdoor air, etc.) while the so-stored heat is released at night toward cool outdoor air, the flowrate of which is often enhanced on purpose. In other words, heat exchanges with outdoor air are favored at night and avoided at daytime for the two-fold sake of comfort and energy savings. Still in the field of refrigeration, Helm et al. experimentally tested the effect of a low-temperature latent heat storage on the energy efficiency of a solar powered LiBr absorption chiller [33]. The heat storage replaces the hot outdoor air as heat sink at daytime and is cooled to a low temperature by outdoor air at night. The idea had been suggested some years before by Boubakri [34]. Compingt et al. describe a secondary refrigeration system designed and installed in an industrial kitchen [35]. In such a system, cold is produced by a primary cooling unit at night, stored, and distributed when needed via a secondary loop. An ice slurry is the storage and transport medium. The heat storage allows to separate the periods of cold distribution (when meals are prepared) and those of cold production (when the outdoor temperature is minimal). This strategy reduces the electricity consumption of the primary cooling unit [35]. More recently, Mosaffa et al. described a similar beneficial effect of thermal energy storage on the efficiency of an air-conditioner [36]. All of those studies share two notions: • Sensitivity of energy efficiency to the value of ambient air temperature while the fluxes are exchanged. Indeed, in those examples, not all the heat exchanges with outdoor air are equivalent in terms of energy efficiency: some exchanges are worth more than others. The most worthwhile exchanges occur when the outdoor temperature is the most favorable with respect to energy efficiency of the process under consideration. If exergy is intended to represent the quality of heat fluxes in terms of energy efficiency, and if the quality of the fluxes exchanged with ambient air depends on the value of ambient temperature while they are exchanged, then it becomes thermodynamically consistent to let the exergy of these fluxes depend on that temperature too, instead of being systematically null.

•
Presence of a heat storage. When a process is designed without heat storage, there is no means of choosing those most favorable moments for exchanging heat with outdoor air: the energy efficiency is entirely subjected to the fluctuations of ambient temperature. To the contrary, a heat storage offers a degree of freedom for exchanging heat with ambient air at the most favorable moments (while avoiding the least favorable ones) in order to improve the energy efficiency. Absence or presence, and design of heat storage, therefore contribute to energy efficiency. This contribution becomes part of the exergy analysis and of process optimization.
If these two notions can be completely ignored in steady state analyses (they would be irrelevant), they play an important thermodynamic role as soon as ambient temperature fluctuates. The second approach developed here-under relies on them.

Second Exergy Approach: Combination with Constant Temperature T 0
In this second approach, the entropy balance is multiplied by a constant temperature, T 0 . This leads to the exergy function denoted as B 2 such that dB 2 = dE − T 0 dS, and to the exergy flux E. Combination of the Equations (6) thus leads to: where there remains a term in . Q a . Integration over the whole cycle results in: As the factors T 0 , (1 − T 0 X p ), and (1 − T 0 X u ) are constant, this equation may be rewritten as: where the right-hand side cancels out because E and S are state functions. In this second approach, B 2 is a linear combination of state functions, and also is one. This equation introduces integral exergy fluxes B 2p and B 2u , which are exactly proportional to the energy fluxes E p and E u (the ratios only depend on the corresponding sources of energy). Similarly, the exergy loss T 0 S P tot is exactly proportional to the total entropy production. This second approach solves all the reservations raised by the first approach, but the cost is that the flux . Q a remains in the exergy balance: the term . Q a dt no longer cancels out by construction. The intermediate discussion above shows that the distribution of the heat flux . Q a (t) with respect to the fluctuations of T a (t) has consequences on the energy efficiency. It is then thermodynamically relevant to study whether this new term can be a loss of exergy and whether it can be cancelled out.

Introduction of an Ideal Heat Storage and Reversible Process
. Q a dt to be lost exergy, the integrand cannot be positive: . Q a and (T a (t) − T 0 ) must have opposite signs. For consistency with the steady state analysis of Section 2, it must also be insured that T 0 = T a when T a is constant. T 0 is then unambiguously defined as: Typically, the former case applies to heat pumps that extract heat from ambient air, while the latter applies to processes which release heat to ambient air: engines, cooling machines, etc. It can also be said that T 0 takes the value of the ambient air temperature that is the most favorable to the process under consideration. Seen as an exergy loss, the product . Q a ] corresponds to the transfer of the heat flux . Q a between T 0 and T a (t). Although this transfer does not occur in the process (the corresponding heat exchanger is not at T 0 ), that loss of exergy can nevertheless be reduced by exchanging as much heat as possible with ambient air when the distance T 0 − T a (t) is minimal, and as little heat as possible when that distance is maximal. This strategy improves the energy efficiency of the process, as described in Section 3.3, and reduces the value of − (1 − T 0 /T a (t)) . Q a dt. It requires the presence of a heat storage. When the process includes a heat storage, the circadian cycle can be divided into two sub-periods. In the first one, when the distance T 0 − T a (t) is globally large, the process is isolated from ambient air. It nevertheless delivers its duty thanks to the heat storage. In the second sub-period, when the distance T 0 − T a (t) is globally small, the whole process exchanges with ambient air more heat than strictly required for delivering the duty because meanwhile, the heat storage must recover its initial state.
The notion of ideal heat storage was introduced in Reference [26]: it is constantly maintained at T 0 along the whole cycle, and it transfers all the heat to be exchanged with ambient air at the exact moment when T a (t) = T 0 . With this ideal procedure, the integral − (1 − T 0 /T a (t)) . Q a dt cancels out. Like for the Carnot cycle, this ideal heat storage, free from irreversibility, represents an unreachable limit which can be approached by increasing both the heat transfer areas for storing or recovering heat, and the thermal mass of the storage (i.e. its inertia) toward infinity.
In this framework, the total irreversibility of a real energy conversion process can be divided into three parts. The first and usual one occurs in the basic process designed without considering heat storage. This exergy loss is herein denoted as internal (with i as first index), although it encompasses the heat transfer resistances with the external heat sources. The second part is due to the heat transfer resistance between ambient air and the heat storage (finite transfer area for heat transfer with a non-zero temperature difference; the first index is s). The third part (with a as first index), introduced by the present analysis, is the term . Q a . According to Equation (14), the summation of those three exergy losses equates the difference between the power exergy supplied to the process and the useful exergy it delivers. Those exergy losses are denoted with a second index: a for the case without heat storage, and s for the case with heat storage.
This analysis is now applied to a heat pump operated in wintertime for heating a building. W. Without any loss of generality for the present purpose, some simplifying assumptions are adopted thanks to which the solution of the problem is partially analytical:

•
The operation is perfectly cyclic, with the period ∆tD = 86,400 s.

•
The delivered heating power, ε . Q u , is constant and equal to 10 kW.

•
The heat pump control succeeds in maintaining the indoor temperature constant (T u = 20 • C).

•
At any moment, the heating COP of the heat pump is proportional to the Carnot COP given by the current temperatures of the heat sources. The heat pump extracts heat from ambient air or from the heat-storage. The ratio HCOP/HCOP rev may then take two values, η ia or η is respectively, in order to account for possibly different heat transfer parameters in either case. The same value (0.4) is, however, adopted herein.

•
Temperature is assumed uniform in the heat storage.

•
For heat pumping, the most favorable value of the ambient temperature is its maximum, then T 0 = T a + ∆T a = 10 • C.

Heat Pump without Heat Storage
This configuration, where the heat pump extracts heat from ambient air only, is denoted with the index a. in Equation (17), are deduced from the heating COP given by: The internal irreversibility in the heat pump itself, L ia B  , is obtained from the usual entropy balance once multiplied by T 0 and where 1 a Q  is given by Equation (17). The term commented above, L aa B  , is also deduced from Equation (17). As there is no heat storage, the total exergy loss only involves the two terms:

Heat Pump Operated with Heat Storage
The following conventions are adopted for describing the cycle. At t = t A , the first sub-period begins: the heat pump is isolated from outdoor air and extracts heat from the heat storage alone, see Figure 1b. At t = t B , that first sub-period ends and the second one begins: the heat pump now extracts heat from outdoor air and so does the heat storage as long as it is colder than ambient air, see Figure  1c. The moment when the storage temperature equates the ambient one is denoted as t C . Depending on the storage design, this moment may occur either before the beginning of the next sub-period, or simultaneously. The order relationships are then: Figure 2 shows examples of temperature evolution and helps in understanding the following descriptions.

Heat Pump without Heat Storage
This configuration, where the heat pump extracts heat from ambient air only, is denoted with the index a. The electrical power consumed by the compressor and the heat flux received from ambient air, . W a and . Q a1 in Equation (17), are deduced from the heating COP given by: .
The internal irreversibility in the heat pump itself, . B L ia , is obtained from the usual entropy balance once multiplied by T 0 and where . Q a1 is given by Equation (17). The term −(1 − T 0 /T a (t)) .

Q a1
commented above, . B L aa , is also deduced from Equation (17). As there is no heat storage, the total exergy loss only involves the two terms:

Heat Pump Operated with Heat Storage
The following conventions are adopted for describing the cycle. At t = t A , the first sub-period begins: the heat pump is isolated from outdoor air and extracts heat from the heat storage alone, see Figure 1b. At t = t B , that first sub-period ends and the second one begins: the heat pump now extracts heat from outdoor air and so does the heat storage as long as it is colder than ambient air, see Figure 1c. The moment when the storage temperature equates the ambient one is denoted as t C . Depending on the storage design, this moment may occur either before the beginning of the next sub-period, or simultaneously. The order relationships are then: t A < t B < t C ≤ t A + ∆t D . Figure 2 shows examples of temperature evolution and helps in understanding the following descriptions.

First Sub-Period, t A → t B
During this sub-period, the whole process is isolated from ambient air, . Q a = 0, and the heat pump extracts the flux . Q s from the heat storage. The Equations (17) are adapted to this situation: The evolution of the storage temperature, T s , is given by: . Q s = −MC s (dT s /dt). A combination with the second Equation (19) leads to a differential equation, the integration of which, under the assumption of constant MC s , results in: with T s• = T s (t • ). The moment when this first sub-period takes end, t B , is defined by equality of the power rates . W s and . W a (it is not worth using the storage afterwards), i.e., when: As the heat pump extracts heat from ambient air, the Equations (17) apply. Moreover, as long as T s <T a , the heat storage also extracts heat from ambient air. Its temperature, T s , is then ruled by the differential equation: MC s (dT s /dt) = . Q a2 = UA s (T a (t) − T s (t)). Assuming that UA s is constant, the solution has the form: T s (t) = T a + ∆T ss sin(ωt) + ∆T sc cos(ωt) + ∆T se exp(−t/τ s ) (22) with ∆T ss = ∆T a [cos(ωt * ) − τ s ω sin(ωt * )]/(1 + τ s 2 ω 2 ), ∆T sc = ∆T a [− sin(ωt * ) − τ s ω cos(ωt * )]/(1 + τ s 2 ω 2 ), τ s = MC s /UA s , and ∆T se such that T s (t) given by Equation (22) at t = t B , equates T sB given by Equation (21). This heat exchange proceeds until the moment t C defined by the equality T s (t C ) = T a (t C ) = T sC , i.e.,: [∆T ss − ∆T a cos(ωt * )] sin(ωt C ) + [∆T sc + ∆T a sin(ωt * )] cos(ωt C ) + ∆T se exp(−t C /τ s ) = 0 When the conductance UA s is the limiting factor, the next first sub-period begins at t = t C = t A + ∆t D , see the curve T s1 in Figure 2. In this case, only one pair (t A , t B ) makes the conditions (20) to (23) satisfied. When the heat capacity MC s is the limiting factor, t C is strictly smaller than t A + ∆t D : it takes less time than a full cycle for using the heat storage and reloading it. Between t C and t A + ∆t D , the heat storage is isolated from the heat pump and ambient air, in order to maintain its temperature: T sA = T sC . However, the delay between t C and t A + ∆t D is not given a priori and must be determined. Keeping in mind the concern of energy efficiency, that delay is herein chosen for minimizing the total energy consumed by the compressor. As can be guessed from the discussion above, this procedure substitutes the heat storage to ambient air when the temperature of the latter is the coldest (when the distance T 0 − T a (t) is maximal), herein almost symmetrically around 06:00. Such a case is described by the curve T s2 in Figure 2. quasi-ideal (T s1 ), likely (T s2 ), and reference for non-dimensionalization (T sRef ).

The Three Sources of Irreversibility
When introducing the Boolean function δ a1 , equal to 0 when t A < t < t B and to 1 otherwise, and when adapting the expression (18) of L ia B to heat extraction from the storage when δ a1 = 0, the internal loss of exergy with heat storage is described by: The second kind of exergy loss takes place in the heat transfer from ambient air to heat storage when t B < t < t C . Introducing the Boolean function δ a2 equal to 1 when t B < t < t C and to 0 otherwise, this heat flux is , and the second exergy loss is: The exergy loss of the third kind is  (26) which is introduced into the third exergy loss:

Non-Dimensionalization and Time Integration
In the following, the amounts of work consumed by the compressor and the exergy losses are non-dimensionalized with respect to the mechanical power consumed by the reversible process: . The non-dimensional notations are w  for power rates, and b  for rates of exergy losses:

The Three Sources of Irreversibility
When introducing the Boolean function δ a1 , equal to 0 when t A < t < t B and to 1 otherwise, and when adapting the expression (18) of B L ia to heat extraction from the storage when δ a1 = 0, the internal loss of exergy with heat storage is described by: The second kind of exergy loss takes place in the heat transfer from ambient air to heat storage when t B < t < t C . Introducing the Boolean function δ a2 equal to 1 when t B < t < t C and to 0 otherwise, this heat flux is . Q a2 = δ a2 UA s (T a (t) − T s (t)), and the second exergy loss is: The exergy loss of the third kind is −(1 − T 0 /T a (t)) . Q a . As mentioned above, . Q a = 0 during the first sub-period, and . Q a = . Q a1 + . Q a2 during the second one. The flux . Q a can be developed as: which is introduced into the third exergy loss:

Non-Dimensionalization and Time Integration
In the following, the amounts of work consumed by the compressor and the exergy losses are non-dimensionalized with respect to the mechanical power consumed by the reversible process:  Figure 3 presents the curves of the internal and total exergy losses occurring in the whole process, first without (dashed lines), and then with heat storage (solid lines calculated for the configuration T s2 of Figure 2). Without storage, the exergy loss of the third kind, shown by the area between the dashed curves 'i' (internal) and 't' (total), is non-negligible in the total budget. The heat storage permits to significantly reduce the internal irreversibility during the first sub-period from A to B (solid lines), while cancelling out the exergy loss of the third kind (no difference between the 'i' and 't' curves). When the heat storage extracts heat from ambient air (first part of the second sub-period), the exergy loss of the second kind adds to the other ones (area between the two 't' curves from B to C). This extra loss is, however, much smaller than the gain during the sub-period AB. From C to A, both processes behave the same.  Figure 3 presents the curves of the internal and total exergy losses occurring in the whole process, first without (dashed lines), and then with heat storage (solid lines calculated for the configuration T s2 of Figure 2). Without storage, the exergy loss of the third kind, shown by the area between the dashed curves 'i' (internal) and 't' (total), is non-negligible in the total budget. The heat storage permits to significantly reduce the internal irreversibility during the first sub-period from A to B (solid lines), while cancelling out the exergy loss of the third kind (no difference between the 'i' and 't' curves). When the heat storage extracts heat from ambient air (first part of the second subperiod), the exergy loss of the second kind adds to the other ones (area between the two 't' curves from B to C). This extra loss is, however, much smaller than the gain during the sub-period AB. From C to A, both processes behave the same.
Lastly, the design parameters of the heat storage, MC s and UA s , are non-dimensionalized as mc and ua. The reference heat storage is arbitrarily chosen such that it is used from 22:00 (t C = 79,200 s) to 10:00 (t B = 36,000 s) with a temperature amplitude half that of ambient:  L aa , respectively. The total exergy loss is then easily obtained: Lastly, the design parameters of the heat storage, MC s and UA s , are non-dimensionalized as mc and ua. The reference heat storage is arbitrarily chosen such that it is used from 22:00 (t C = 79,200 s) to 10:00 (t B = 36,000 s) with a temperature amplitude half that of ambient: T C = T a + ∆T a /2 = T A and T B = T a − ∆T a /2. This case is shown by the thin dot-dashed curve T sRef in Figure 2. Numerical calculations have been done with values of mc and ua ranging from 0.01 to 100. Figure 4 shows how the total exergy loss, b L tot,s , depends on mc and ua in the main region of interest. The two axes are the locus for the system without storage, for which the total exergy loss equals 2.75 according to the equation , depends on mc and ua in the main region of interest. The two axes are the locus for the system without storage, for which the total exergy loss equals 2.75 according to the equation: In the ideal case of heat storage kept at T 0 , the minimal exergy loss (internal loss) equals 1.5 according to: . In the vicinity of the mc axis (respectively ua axis), the dependence on ua (respectively on mc) is quasi linear and uniform, except when approaching the line 2 ua mc = .
Beyond the limits of this graph, approaching the asymptotic value of 1.5 requires extreme values of mc and ua, as shown in Table 1. In the framework of this second approach, the design of the heat storage (choice of mc and ua) can be included into the procedure for optimizing the process described in the Appendix. Indeed, the data of Figure 4 give way to the partial derivatives economic data about investment cost, which are far beyond the scope of the present work, these two parameters mc and ua can be compared to other design parameters of the heat pump in order to globally optimize the whole process of heat pump + storage.

Verification
The purpose of this section is to check whether the statements above about agreement between energy efficiency and exergy analysis are verified by the present numerical calculations. The power energy for heat pumping is electricity. It can thus be stated that (i) the exergy B p consumed by the process is identical to the power energy E p , also denoted as W herein, and (ii) this power energy is In the ideal case of heat storage kept at T 0 , the minimal exergy loss (internal loss) equals 1.5 In the vicinity of the mc axis (respectively ua axis), the dependence of b L tot,s on ua (respectively on mc) is quasi linear and uniform, except when approaching the line ua = 2mc.
Beyond the limits of this graph, approaching the asymptotic value of 1.5 requires extreme values of mc and ua, as shown in Table 1. In the framework of this second approach, the design of the heat storage (choice of mc and ua) can be included into the procedure for optimizing the process described in the Appendix. Indeed, the data of Figure 4 give way to the partial derivatives (∂b L tot,s /∂mc) Q u and (∂b L tot,s /∂ua) Q u , which are the exergy version of the derivatives (∂S P tot /∂Z i ) E u in Equation (A1). When complemented with economic data about investment cost, which are far beyond the scope of the present work, these two parameters mc and ua can be compared to other design parameters of the heat pump in order to globally optimize the whole process of heat pump + storage.

Verification
The purpose of this section is to check whether the statements above about agreement between energy efficiency and exergy analysis are verified by the present numerical calculations. The power energy for heat pumping is electricity. It can thus be stated that (i) the exergy B p consumed by the process is identical to the power energy E p , also denoted as W herein, and (ii) this power energy is expected to decompose into W = W rev + B L tot , where the reversible power energy W rev should equate the exergy supplied to the user (−B u ).

Verification for the First Approach with the Exergy Function
In the first approach, the actual exergy balance is: B 1p = −B 1u + B L 1tot + dB 1sys , see Equation (11). The difference with the usually accepted exergy balance (B 1p = −B 1u + B L 1tot ) is here-under non-dimensionalized as: ∆b 1 = dB 1sys /(−B 1u ) where dB 1sys = − T a (t)dS sys (see Section 3.2). As the only inertia accounted for in the present simulation is that of the heat storage, one has herein: dS sys = MC s dLn(T s (t)). Figure 5 displays the values of ∆b 1 versus w as dashed curves calculated in the same mc-ua domain as in Figure 4. Firstly, as ∆b 1 is negative, it cannot be a loss of exergy. Actually, ∆b 1 acts as a correction that reduces an overestimated sum (−B 1u + B L 1tot ). Secondly, this correction may be not negligible at all, even when the size of the heat storage is limited. Lastly, it grows when the storage design approaches the ideal one (large values of mc in Figure 5). Any exergy analysis following this first approach should therefore include that correction.
In the first approach, the actual exergy balance is: . Figure 5 displays the values of Δb 1 versus w as dashed curves calculated in the same mc-ua domain as in Figure 4. Firstly, as Δb 1 is negative, it cannot be a loss of exergy. Actually, Δb 1 acts as a correction that reduces an overestimated sum 1 1 ( ) Secondly, this correction may be not negligible at all, even when the size of the heat storage is limited. Lastly, it grows when the storage design approaches the ideal one (large values of mc in Figure 5). Any exergy analysis following this first approach should therefore include that correction.
.  Figure 5 (symbols +). The deviation from zero does not exceed 10 -4 , which is consistent with the fact that time is discretized in elements of 10 s. This second approach thus offers a framework where (i) a reversible process can be defined, also when the ambient temperature fluctuates, and (ii) all the exergy losses are clearly identified and in such a way that minimizing their sum does maximize the energy efficiency of the process. Lastly, it does not need any correction.

Verification for the Second Approach with the Exergy Function
In this approach, the non-dimensional version of W = W rev + B L tot is: w = 1 + b L tot,s , with a total exergy loss calculated as described in Section 6.2. The values of (w − 1 − b L tot,s ) calculated in the same domain as above are plotted in Figure 5 (symbols +). The deviation from zero does not exceed 10 −4 , which is consistent with the fact that time is discretized in elements of 10 s. This second approach thus offers a framework where (i) a reversible process can be defined, also when the ambient temperature fluctuates, and (ii) all the exergy losses are clearly identified and in such a way that minimizing their sum does maximize the energy efficiency of the process. Lastly, it does not need any correction.

Comparison of Two Examples of Dimensional Exergy Balances
In order to show the practical entailments of the two approaches, dimensional exergy balances established for the case of the reference heat storage (mc = ua = 1) are further detailed. In the present case of heat pumping, comparison is simplified thanks to the equality W = −B 1p = −B 2p . The concern is: how does the energy (W = 97.14 MJ) consumed for supplying the heating rate ε . Q u = 10kW decompose? In the first approach, the balance of interest is: W = −B 1u + B L 1tot + dB 1sys (see Section 3.2). In the second approach, the balance is: W = W rev + B L is + B L s + B L as (see Sections 3.4 and 6.1), where B L as is the unusual exergy loss of the third kind introduced herein, Equation (27).
The numerical values are given in Table 2. First of all, the two approaches disagree about the exergy supplied to the user, i.e., the amount of exergy assumed to be ever minimal for supplying the prescribed duty. Indeed, one has −B 1u = (εQ u ) 1 − T a /T u and W rev = −B 2u = (εQ u )(1 − T 0 /T u ).
The ratio −B 1u /W rev , always larger than 1, equals 1.5 herein (T u = 20 • C, T 0 = 10 • C, and T a = 5 • C). The second approach does give way to the most efficient reversible process (that equipped with the ideal heat storage), when the process considered in the first approach, although reversible, is less efficient for not using thermal inertia as efficiently as possible. When following the distinction introduced by Tsatsaronis and Park [37], the first approach includes into the supplied exergy an exergy loss that can be avoided. Herein, the over-evaluation is significant. As the exergy losses B L 1tot and B L is + B L s do not significantly differ, the over-evaluation due to the first approach must be compensated by the non-negligible negative corrective term related to thermal inertia inside the process. On the contrary, the second approach adds an irreversibility due to heat exchanges with ambient air that tends to vanish when the design approaches the ideal one.  second approach does give way to the most efficient reversible process (that equipped with the ideal heat storage), when the process considered in the first approach, although reversible, is less efficient for not using thermal inertia as efficiently as possible. When following the distinction introduced by Tsatsaronis and Park [37], the first approach includes into the supplied exergy an exergy loss that can be avoided. Herein, the over-evaluation is significant. As the exergy losses 1 and L L is s B B + do not significantly differ, the over-evaluation due to the first approach must be compensated by the nonnegligible negative corrective term related to thermal inertia inside the process. On the contrary, the second approach adds an irreversibility due to heat exchanges with ambient air that tends to vanish when the design approaches the ideal one.    These figures are very similar to Figures 4 and 5, except for the numerical values that change by 5%-10% due to non-linear effects. This shows that the conclusions of the present study do not rely on the constancy, or time variation, of the heating rate.

Conclusions and Perspectives
When the ambient temperature fluctuates, exergy should be defined by T 0 is a constant temperature that takes the most favorable value of the ambient temperature with respect to energy efficiency of the process under consideration. In this framework (i) the so-defined function B is a state function, (ii) the notion of ideal heat storage (always maintained at T 0 while exchanging heat reversibly) adds to that of reversible cycles, and (iii) the total exergy loss does sum These figures are very similar to Figures 4 and 5, except for the numerical values that change by 5%-10% due to non-linear effects. This shows that the conclusions of the present study do not rely on the constancy, or time variation, of the heating rate.

Conclusions and Perspectives
When the ambient temperature fluctuates, exergy should be defined by dB = dE − T 0 dS, where T 0 is a constant temperature that takes the most favorable value of the ambient temperature with respect to energy efficiency of the process under consideration. In this framework (i) the so-defined function B is a state function, (ii) the notion of ideal heat storage (always maintained at T 0 while exchanging heat reversibly) adds to that of reversible cycles, and (iii) the total exergy loss does sum up all the causes of irreversibility, including an unusual one related to the heat exchanges with ambient air. This unusual exergy loss accounts for the effect of non-ideality and finite size of the heat storage and is maximal in cases without heat storage. The so-obtained exergy balances are robust and can be safely used for global optimization of the whole process, including the heat storage.
As perspectives, it will be interesting to explore cases closer to reality, e.g., that would account for complex heating demands or actual values of the ambient temperature. However, the most interesting perspective for the theory of Second Law will consist of introducing the following piece of reality. In the process modelled herein, the moment when the first sub-period AB begins is decided by maximizing the benefit of using the heat storage instead of ambient air. In reality, such an optimum can never be calculated exactly, because the future evolution of the ambient temperature is still unknown when the decision must be taken: the actual decision will therefore always be uncertain. Only once the cycle is achieved will it be possible to know which decision would have been optimal, and the subsequent loss of efficiency. This introduces a fourth kind of exergy loss (and entropy production), the one due to uncertainty. This will bridge the gap between energy analysis (usually quite deterministic) and the profound meaning of entropy as a lack of information.
Funding: This research received no external funding.

Conflicts of Interest:
The authors declare no conflict of interest.

Nomenclature
Usual notations (such as T for temperature, t for time, Q for heat, etc.) are not recalled here. Dotted quantities are time-derivatives, e.g., Q is a heat quantity (J) and . Q is a heat flux (W). b Non-dimensional exergy (-) B Exergy (J) B L Exergy loss (J) E Energy (J) mc Non-dimensional heat capacity (-)

MC
Heat capacity of the heat storage (J·K −1 ) S Entropy (J·K −1 ) S P Entropy production (J·K −1 ) T a Mean ambient temperature (K) T a Mean entropic ambient temperature (K) ∆T sc , ∆T se , ∆T ss Parameters in Equation (22)

Appendix A. Optimization of Energy Conversion Processes
The generic process described above is optimized when the power flux, . E p , is minimized under both constraints of prescribed duty, ε . E u , and given total investment cost I, i.e., I = I 0 . From Equation (3), simple algebra shows that . E p is minimized when the total entropy production, . S P tot , is minimized too. The Lagrangian of the problem is then: . S P tot + Λ(I − I 0 ). Canceling out any of its partial derivatives with respect to the non-discrete design parameter, Z i , and at constant, . E u , leads to the optimal design via the relations: These relations also prescribe the common value of the Lagrange multiplier Λ. Equation (A1) just states that the process is optimized when a small extra investment cost, ∆I, induces exactly the same reduction of the total entropy production regardless of the parameter which is modified. The Second Law contributes to process optimization via the dependence of the total entropy production to any design parameter.