## 3 Optimization of Annual Costs
For example, if the number of compression stages in series increases, the compressor's consumption decreases. Therefore, operating costs decrease. However, it must be considered that the greater the number of stages in series, the greater the number of equipment that needs to be purchased; therefore, the total cost increases. This is another dichotomy that justifies the optimization study. The aim of this section is to do an optimization analysis of the different scenarios previously shown. For each gas (CO\({}_{2}\) and H\({}_{2}\)) an optimization problem was solved. As a result, the optimal configuration or scenario was selected--for each gas--based on the input hypotheses showed in Table 7.  
The objective function is to minimise the TAC, which include the yearly investment cost calculated with CAPEX, interest rate, and amortization years (Equations (4)-(7), (10), and (11)). This variable takes into account the influence of pressure on the compressor, the number of stages, and the storage tank costs. It also includes the energy consumption to pressurize CO\({}_{2}\) or H\({}_{2}\) to the storage tank pressure. A similar analysis can be found in [29]. Constraints include mass and energy balances in the compressors and heat exchangers and the variables included in Table 7. So, the problem is formulated according Equation (12):  
\[ \begin{array}{ll}\text{Objective function:}&\text{Minimize TAC}\\ \text{Constraints:}&\text{Subject to: Energy balances}\\ &\text{Equipment costs}\\ &\text{Number of stages (discrete variable)}\end{array}  \tag{12}\]  
Two optimization methods (Golden Section Search and Quadratic Approximations) were used and both agrees at the storage pressure. Using CO\({}_{2}\) as the working gas, the optimized configuration is the one with four intercooling compression stages. In this optimal scenario, the storage pressure that minimises the TAC--with a value of 60.068 \(\upxi\)/year--is 72.47 bar. This value is just below the supercritical pressure. Increasing the pressure above this value increase the compressor, installation, and operational cost without reducing significantly the storage tank value and cost. For the first three scenarios it can be observed \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{2}{c}{**Carbon Dioxide**} & \multicolumn{2}{c}{**Hydrogen**} \\ \hline  & **Value** & **Unit System** & **Value** & **Unit System** \\ \hline Methane mass & 0.02 & kg/s & - & - \\ Carbon dioxide mass & 0.055 & kg/s & - & - \\ Days per week & 2 & day & 2 & day \\ Compression ratio & 1–4 & - & 1–4 & - \\ Hydrogen mass & - & - & 0.0058 & kg/s \\ Inlet gas pressure & & 1 bar & \\ Temperature between serial & & 60 \({}^{\circ}\)C & & \\ heat exchangers & & & 30 \({}^{\circ}\)C & \\ Inlet gas temperature & & & 85\% & \\ Isentropic efficiency & & & & \\ Compression ratio & & & & \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Boundary conditions for the optimization study. how the compressor ratio is over the boundary imposed (1-4), and that is why those scenarios are not considered as technically feasible (Table 8). Although the storage pressure is very similar between Scenarios 4 and 5, it must be noted, in Table 8, the final cost increment from 56,966 to 67,223 \(\epsilon\)/year economically when working with a larger number of stages. The columns related to the cost of the compressor, heat exchangers, and tank are unitary costs. In the case of hydrogen, the optimal configuration to minimise TAC is the one with three intercooling compression stages (Table 9). This is achieved for a hydrogen storage pressure of 67.64 bar and a related TAC of 83,734 \(\epsilon\)/year. For the reasons explained before, in this case the first two scenarios were considered as not valid. If we compare both gases, it is clear that the difference in costs between them is mainly due to density variances. While comparing the results between both gases, the difference in mass flow rate must be highlighted.