## 2 Modelling, Analysis and Optimization of a System
### Thermodynamic Analysis  
It is well known that the three balance equations namely mass, energy and exergy balance equations are used to find the heat input, the rate of exergy decrease, the rate of irreversibility, and the energy and exergy efficiencies for a general steady-state, steady-flow process. In general, the mass balance equation can be expressed in the rate form as:  
\[\sum\dot{\mathrm{m}}_{\mathrm{in}}=\sum\dot{\mathrm{m}}_{\mathrm{out}} \tag{1}\]  
where \(\dot{\mathrm{m}}\) is the mass flow rate, and the subscript \"in\" stands for inlet and \"out\" for outlet. The general energy balance can be expressed by all energy terms as follows as below where the changes in kinetic and potential energy are neglected:  
\[\dot{\mathrm{Q}}+\sum\dot{\mathrm{m}}_{\mathrm{in}}\mathrm{h}_{\mathrm{in}}= \dot{\mathrm{W}}+\sum\dot{\mathrm{m}}_{\mathrm{out}}\mathrm{h}_{\mathrm{out}} \tag{2}\]  
where \(\dot{\mathrm{Q}}=\dot{\mathrm{Q}}_{\mathrm{net,in}}=\dot{\mathrm{Q}}_{\mathrm{ in}}-\dot{\mathrm{Q}}_{\mathrm{out}}\) is the rate of net heat input, \(\dot{\mathrm{W}}=\dot{\mathrm{W}}_{\mathrm{net,out}}=\dot{\mathrm{W}}_{ \mathrm{out}}-\dot{\mathrm{W}}_{\mathrm{in}}\) in is the rate of net work output, and \(\mathrm{h}\) is the specific enthalpy. Assuming no changes in kinetic and potential energies with no heat or work transfers, the energy balance given in Equation (2) can be simplified to flow enthalpies only:  
\[\sum\dot{\mathrm{m}}_{\mathrm{in}}\mathrm{h}_{\mathrm{in}}=\sum\dot{\mathrm{ m}}_{\mathrm{out}}\mathrm{h}_{\mathrm{out}} \tag{3}\]  
Exergy analysis shows the locations and causes of inefficiency and losses in an energy conversion system. Exergy analysis of a system creates a general equation for the whole system and balance equations representing the balance component level of a system. Thus for a system the general exergy rate balance can be expressed as [46]:  
\[\dot{\mathrm{E}}_{\mathrm{F,tot}}=\dot{\mathrm{E}}_{\mathrm{F,tot}}+\sum_{ \mathrm{k}}\dot{\mathrm{E}}_{\mathrm{D,k}}+\dot{\mathrm{E}}_{\mathrm{xL,tot}} \tag{4}\]  
Figure 2: T-s diagrams for the (**a**) level I and (**b**) level II in the running of the real geothermal binary ORC power plant (Sinem GFP) (\(n\)-pentane for ORC in red, geofluid in green and air in blue). and more explicitly:  
\[\sum\biggl{(}1-\frac{\mathrm{T}_{0}}{\mathrm{T}_{\mathrm{k}}}\biggr{)}\,\dot{ \mathrm{Q}}_{\mathrm{k}}-\dot{\mathrm{W}}+\sum\dot{\mathrm{m}}_{\mathrm{in}} \psi_{\mathrm{in}}-\sum\dot{\mathrm{m}}_{\mathrm{out}}\psi_{\mathrm{out}}=\dot {\mathrm{E}}\mathrm{x}_{\mathrm{D}} \tag{5}\]  
where \(\dot{\mathrm{E}}\mathrm{x}_{\mathrm{F}}\), \(\dot{\mathrm{E}}\mathrm{x}_{\mathrm{P}}\), \(\dot{\mathrm{E}}\mathrm{x}_{\mathrm{D}}\) and \(\dot{\mathrm{E}}\mathrm{x}_{\mathrm{L}}\) are the exergy rates associated with the fuel, product, exergy destruction and exergy loss of the overall system, respectively. In addition, \(\dot{\mathrm{Q}}_{\mathrm{k}}\) is the heat transfer rate crossing the boundary at temperature \(\mathrm{T}_{\mathrm{k}}\) at location \(\mathrm{k}\), \(\dot{\mathrm{W}}\) is the work rate, \(\psi\) is the flow exergy, and the subscript zero indicates properties at the restricted dead state of \(\mathrm{P}_{0}\) and \(\mathrm{T}_{0}\). Their values are taken as 18 \({}^{\circ}\)C and 1 bar in the dead state. The unit exergy rate is expressed by:  
\[\dot{\mathrm{E}}\mathrm{x}_{\mathrm{j}}=\dot{\mathrm{m}}_{\mathrm{j}}\,\psi_{ \mathrm{j}} \tag{6}\]  
where \(\dot{\mathrm{E}}\mathrm{x}_{\mathrm{j}}\) is the unit exergy rate of the \(j\)th location in kW and \(\psi_{\mathrm{j}}\) is the specific flow exergy in kJ/kg as follows:  
\[\psi=(\mathrm{h}-\mathrm{h}_{0})-\mathrm{T}_{0}(\mathrm{s}-\mathrm{s}_{0}) \tag{7}\]  
where \(\mathrm{h}_{0}\), \(\mathrm{T}_{0}\) and \(\mathrm{s}_{0}\) denote the enthalpy (in kJ/kg K), temperature (in \({}^{\circ}\)C or K) and entropy (in kJ/kg K) in the reference case, respectively.