An overview of different approaches in hydrogen network optimization via mathematical programming

Goal: Hydrogen has shown increasing demand in oil refineries, due to the importance of its use as a sulfur capture element. As different oils and products require different amounts of hydrogen, their use optimally is an essential tool for refinery production scheduling. A comparison was made between the different approaches used in optimization via mathematical programming. Design / Methodology / Approach: One of the most used methods for hydrogen network optimization is through mathematical programming. Linear and non-linear models are discussed, positive aspects of each formulation and different initialization techniques for non-linear modeling were considered. Results: The optimization through the linear model was more satisfactory, taking into account the payback of the new proposed design, combined with the use of compressor rearrangement, which reduces the investment cost. Limitations of the investigation: The objective function chosen is based on the operational cost, but another approach to be considered would be the total annual cost. In addition, the parameters related to costs are obtained from the literature and may change over the years. Practical implications: The proposal is to discuss the main aspects of each model, showing which models more robust and easier to converge are capable of providing competitive results. Also, different initialization techniques that can be used in future works. Originality / Value: The main contribution is the relationship between hydrogen management and production scheduling and for that, a discussion is made about possible formulations. Linear model is sufficient to optimize the problem, due to its main characteristics discussed.


INTRODUCTION
Fossil fuels, such as crude oil and coal, are natural sources of energy. During the 20 th century, crude oil was the most widely used source, and its discovery brought revolutionary advantages to the industry. The oil industry is composed of segments that complement each other, from exploration, refining to transportation, and distribution. Oil refining comprises physical and chemical operations capable of ensuring the use of its energy potential through derivative products (such as diesel, gasoline, kerosene, propane, and butane). Linked to this, In Brazil, one of the regulatory measures imposed is the reduction of the sulfur content present in diesel produced here. Sulfur, when burned along with the hydrocarbons present in diesel, produces SOx gases that are harmful to the environment, as they increase the emissions of sulfur oxides, besides contributing to the emission of particulate matter and also decreases the service life of engines. The National Agency for Oil, Natural Gas, and Biofuels (ANP), the Brazilian agency responsible, establishes that for road transport, currently, S10 diesel (10 parts per million (ppm) sulfur) and S500 (500 ppm sulfur) should be used.
ANP regulations have gradually decreased the sulfur content allowed in diesel oil and gasoline as automotive fuel, as shown in Figure 1. In Brazil, from 1994, diesel was classified according to the region of consumption and sulfur concentration. In 2009, the use of S1800 diesel (1800 ppm of sulfur) was imposed in the interior and S500 diesel in metropolitan regions, and from 2014 Brazil uses S10 and S500 diesel (Igreja Adventista do Sétimo Dia, 2017), respectively. For comparison, in developed countries such as Japan, the permitted content is at most 10 ppm sulfur, and in the United States is in the order of 15 ppm (Confederação Nacional do Transporte, 2012). The most used technology in the removal of sulfur in diesel is through the use of hydrogen as a capture element. This process is known as hydrotreatment and is one of the stages of the oil refining industry. Therefore, refineries are dependent on the production and use of hydrogen. Figure 2 shows the evolution of the use of hydrogen in refineries in recent decades (Cruz, 2010). The advance in the use of hydrogen is supported by three factors: (i) the increase in the processing of heavier oils with high sulfur and nitrogen content; (ii) the increase in environmental restrictions; and, (iii) the production of derivatives with higher added value (Figueiredo, 2013). Thus, investments and studies that ensure better use of this input have a prominent role today. Different forms of hydrogen production, optimization of existing processes, and economic feasibility studies are examples of genuinely relevant research that assists in the environmental and economic aspects of this theme.
Within this context, this work aims to make an analysis combining the importance of the use of hydrogen and its efficient use and production in refineries. The fundamental question is, what is the best way to manage hydrogen networks? To this, existing process optimization tools that help in this issue will be discussed, through Process Integration, including production planning and retrofit of existing networks.

Hydrogen
The industrial interest on hydrogen started after the advent of ammonia synthesis in 1913 and World War I. However, it only began to be produced in higher quantities after World War II, as technological development was able to reduce production costs coupled with the low price of natural gas. The main ways of obtaining hydrogen are: (i) from primary energy sources, such as fossil fuels (oil, natural gas); (ii) from chemical intermediates, such as refinery and ethanol products; and, (iii) from alternative sources such as biomass and biogas (Silva and Marvulle, 2006). Despite its range of applications, approximately 99% of the hydrogen produced is used in the chemical and petrochemical industries, causing most hydrogen producing units to be installed within refineries and petrochemical centers, the so-called hydrogen generation units (HGU) (Cruz, 2010). In addition to the units that produce hydrogen, there are purification units and consumer units, mainly hydrotreatment processing. Together, these units form the so-called Hydrogen Networks.
Hydrogen Generation Units (HGU) have become crucial in refineries due to the importance of hydrotreatment units because their function is to supply the hydrogen demand complementing that generated in the catalytic reform. The main processes of hydrogen production are steam reform, catalytic reform, partial oxidation of heavy hydrocarbons, and gasification of waste (Brasil et al., 2012). The primary process to obtain hydrogen directly and continuously is Steam Reform. Also, it is the most economically competitive process (Silva and Hydrocracking is based on the same principle of hydrotreating but with greater severity. However, the high cost of hydrogen production made it impossible to use in oil refining in the past. Simultaneously to the breakage, hydrogenation reactions occur, which leads to reduced formation of heavy waste materials and increased production of gasoline when reacting with cracked products. Thus, the use of hydrogen reduces coke deposition and, by hydrogenating polynucleated aromatic compounds, in addition to mono and di-olefins, increases the chemical stability of the final products, producing high-quality medium distillates. The main difference between hydrotreatment and hydrocracking processes is in the selectivity of the catalyst.
There is also the isomerization process, which is a process of converting normal paraffinic chains into branched chains; in this case, light naphtha from direct distillation can be converted into isomerized naphtha. This process is used to improve the quality of naphtha by exempting it from aromatic and olefinic contaminants and hydrocarbons. The reaction is carried out in a hydrogen atmosphere to minimize coke formation and deposition. Although the consumption of H 2 is reduced, its presence is fundamental to guarantee that the temperature and pressure conditions are mild, and the catalyst maintains its high activity.
Besides, hydrogen is used in Catalytic Cracking. This process is the most used in oil refining to convert heavy fractions into valuable fractions such as gasoline and liquefied petroleum gas (GLP). Hydrogen consumption is linked to the need to desulfurize the loads from oil processing, avoiding the formation of heavy waste materials, and increasing process yield (Borges, 2009;Cruz, 2010). Figure 3 shows a generic flowchart of a refinery, including the units mentioned above. Distillation of crude oil is the main process at the refinery. Distillation of oil is the main process at the refinery. From it, the fractions of naphtha, kerosene, diesel, and atmoférico residue are sent to the other units, aiming at other treatments and reactions. The principal hydrogen consumers, hydrotreatment, isomerization, catalytic cracking, hydrocracking (in red), and principal hydrogen sources, HGU and purge gas (in blue) are shown. This diagram is handy for mapping the hydrogen inside the refinery.

Process Integration
Process integration is a methodology used for the design, modification, and optimization of processes and operations, aiming for better use of energy and mass inside the process. That is, it is a way of analyzing inefficiencies, evaluating the overall process, and the interaction between the steps. The process integration methodology encompasses synthesis, analysis, and optimization steps.
The purpose of the process synthesis step is to optimize the chemical process structure, the choice of raw material, and streams source and destination. As a result, the synthesis provides a flowchart that represents the best configuration found, requiring further process analysis. Mathematical models, correlations, and computational tools for process simulation are used in the analysis stage.
Optimization is used to integrate process synthesis and analysis. Optimization is one of the most powerful tools in process integration based on selecting the 'best' solution by choosing an objective function (e.g., cost or profit) that should be minimized or maximized. The objective function can be subject to several constraints that include material and energy balances, constitutive equations, and logical operational constraints.
Mass and Energy integration are typical examples of process integration methodology. Furthermore, for this, different approaches can be used, such as mathematical programming, pinch method, and even heuristic approach. This type of methodology can be applied in different cases, such as reducing energy consumption and raw materials, water consumption, and effluent generation (El-Halwagi, 2006;Kemp, 2007).
In this work, the focus is on the efficient use of hydrogen through the synthesis and optimization of the hydrogen network. The primary step is to make a representation of the whole process to facilitate understanding and map the process streams and possible bottlenecks. Efficient hydrogen management within a refinery is critical in both economic and safety terms. Therefore, hydrogen network management has a vital appeal and, when done efficiently, generates a production with minimal hydrogen clearance and satisfactory financial returns.
The need for hydrogen network optimization in refineries was recognized in the 1990s, and since then, many methodologies have emerged. These are mainly pinch-segmentation methods and mathematical programming approaches based on network design.
Pinch technology has been widely used in energy integration but ended up being applied in mass integration with the aim of reuse industrial aqueous streams. The main objectives of this technique, in this case, is to maximize the reuse of water, reducing the effluents generated and consequently reduce the costs of wastewater treatment. In the case of hydrogen, pinch analysis is a rigorous and structured approach capable of determining the minimum hydrogen consumption and also allows us to define the best way to integrate the units and identify the bottlenecks of the system (Borges, 2009).
The pinch method is perhaps the most used due to its simplicity. This method uses a graphical tool, the pinch diagram. In the pinch method, refinery processes should be classified into sources and consumers. For this, a mapping of these streams is performed, evaluating the flow rate and composition. Based on those values, a hydrogen purity profile graph as a function of flowrate is created and is called Hydrogen Composite Curve. With these values, one can calculate the excess hydrogen and build a new graph, concentration versus excess (Hydrogen Surplus). The latter allows us to identify the bottleneck (pinch), which occurs when at least one point of the diagram is null. Any reduction in hydrogen supply, in this case, causes a negative flow (Figueiredo, 2013). Figure 4 shows an example of the Hydrogen Composite Curve and Hydrogen Surplus curve used to apply the pinch method in the process. Pinch is reached when the excess of hydrogen is equal to zero, in Figure   "Adapted: Designed from Hallale and Liu (2001)." The first systematic approach to hydrogen network evaluation was developed by Towler et al. (1996). Cost and value composite curves were generated for refinery processes that produce or consume hydrogen. Cost and value composite curves can be used for the economic analysis of a refinery hydrogen network. However, this approach does not provide a systematic method for retrofitting or designing hydrogen networks. The analysis is based on the availability of economic data, such as the added value to refinery products per unit of hydrogen consumption, which is not always available. After that, Alves and Towler (2002) proposed a systematic approach that defines a hydrogen distribution system based on the minimum hydrogen supply. The purity charts of the source and consumers are built based on the consumed value of fresh hydrogen.
Many other recent studies on hydrogen distribution management and analysis based on graphical analysis of the pinch method have been found in the literature. However, this method is very good at defining achievable goals; however, the synthesis stage is performed with the help of heuristic rules requiring much experience of the designer, so the focus in this work is the mathematical programming approach.
Another way to solve problems of mass integration is through the formulation of optimization problems or mathematical programming, by choosing an objective function and defining a set of restrictions for which possible solutions must satisfy, which is not achieved in the pinch approach (Williams, 2013).
Mathematical programming offers advantages when compared to pinch, as it is more flexible, easy to apply to different cases, and the synthesis of the network occurs automatically because of the problem. In the pinch technique, it is necessary to use another technique to evaluate the synthesis of the process. Also, in mathematical programming, it is possible to consider numerous constraints and variables when seeking solutions in the optimization problem. Limitations such as pressure, capacity, operating costs, and investments with new equipment are some of the constraints that can be included in the mathematical problem. The general methodology to develop mathematical programming is: (i) the definition of the superstructure (which units are involved and classification as sources and consumers, in addition to existing compressors and purifiers); (ii) the formulation of the mathematical model capable of representing it (choice of the objective function to be minimized or maximized including constraints, if necessary); and, (iii) the resolution of the optimization problem (Jia, 2010).
Generally, the optimization problem can be formulated as linear programming (LP), Mixed-Integer Linear Programming (MILP), Non-linear Programming (NLP), or Mixed-Integer Non-linear Programming (MINLP) problem. If the objective function and constraints can be expressed by linear combinations of variables, the problem is considered a linear optimization problem. Otherwise, the optimization problem is non-linear. Furthermore, if, in addition to the real variables such as flow, composition, temperature, pressure, among others, integer (or binary) variables are used in the development of the mathematical problem, this is considered mixed-integer programming and can be linear or non-linear. In process synthesis, binary variables are used to aid decision making or to model logical constraints. There are many optimization software used to solve such problems that already include the solvers for several types of optimization problems (Williams, 2013).
MINLP problems are more challenging to solve because they combine the NLP and MILP models and their characteristics. According to the literature review, the use of MILP is not very recurrent. Most of the articles found in the literature use non-linear models to optimize the hydrogen network, for example Hallale and Liu (2001), Liao et al. (2010) and Saleh et al. (2012). The advantages of using MILP are linearity, which facilitates the resolution of the optimization problem, the achievement of the global optimal, and is less dependent on initialization. Towler et al. (1996) proposed a linear programming method to improve the approach to the costs of hydrogen recovery of gaseous currents in refineries using PSA's. Here the method was similar to heat recovery in processes. Alves (1999) developed a linear model to optimize a hydrogen network, intending to minimize the total import of hydrogen as an external utility.
Two procedures for relaxing problems are proposed. The disadvantages of this method are that pressure restrictions are considered negligible, and the flowrate mixture must be performed manually. Fonseca et al. (2008) employed the linear programming model to optimize a refinery's hydrogen network, including pressure considerations. They achieved a 30% reduction in hydrogen use, intending to minimize the total flow of fresh hydrogen. The work also addresses the limitations of the graphic technique in real hydrogen network projects.
Considering the non-linear programming, Hallale and Liu (2001) developed a mathematical model (NLP) to reduce the network's hydrogen consumption. The model considered pressure restrictions, existing compressors, and the strategy to install a purifier. The objective function was to minimize the total cost, including operating and capital costs. Shahraki and Kashi (2005) pursues a non-linear approach in which pressure constraints were also considered. However, the project is based on the optimization of a hydrogen superstructure within the refinery. It is limited to viable changes in the pipes, where there is no consideration for the installation of new equipment. Liao et al. (2010) developed an MINLP model, using an existing hydrogen network with a purifier. The objective function was the total annual cost, and the model was solved in GAMS using DICOPT. The total annual cost decreased by 22.6%, and the new compressor and pressure swing adsorption (PSA) was incorporated.
In Kumar et al., (2010), mathematical models were developed based on pressure constraints, sources, consumers, purity, and total operating cost and capital cost. For this, two case studies were conducted that compared the types of programming (LP, NLP, MILP, and MINLP) to obtain the best optimization problem for each case. Using the LP model, the reduction in hydrogen consumption was 15.76%. The NLP model incorporated a compressor and PSA and took into account the concept of return and export cost because the objective function was to minimize the total cost. The ideal network reduced hydrogen consumption by 33.2%. MILP included binary variables to denote the existence of a connection between a source and a consumer, and this model provided for a simpler network than the LP model, with a 15.76% reduction in fresh hydrogen consumption. However, the MILP model did not include the use of compressors. The MINLP model was used to minimize the operational cost, and discrete variables were used to predict the existence of units. This model achieved a reduction of 22% in operating costs and 21% of total hydrogen consumption. Yunqiang et al. (2011) proposed two mathematical techniques that include two-step optimization for hydrogen networks and a simultaneous optimization process to modernize the hydrogen system. Due to the complexity, a mixed inline non-linear programming model (MINLP) was used. Also, a simultaneous optimization process is configured to linearize the bilinear terms that represent the hydrogen balance in MINLP models, which could be avoided using MILP linearization techniques. Saleh et al. (2012) formulated an MINLP model intending to minimize fresh hydrogen and total annual cost. The model was solved in GAMS, and the new network included a new PSA generating a reduction of 20% and 31% in hydrogen consumption in the two refineries considered.
Sardashti Birjandi et al. (2014) developed a methodology for optimizing a hydrogen network based on a problem solved simultaneously by MINLP and NLP. Linearization techniques for non-linear models were used to facilitate resolution, transforming non-linear equality restrictions into inequality constraints. Global optimization has reduced operating costs.
Matijašević and Petric, (2016) presented a hydrogen network integration methodology in a case study of a local refinery. Therefore, the superstructure was modeled using a non-linear mathematical model whose objective function was to minimize total operating costs. The issue has been solved with gams software. Zhang et al. (2016) make a relative hydrogen concentration approach considering impurities in this source (sulfide, nitrogen, and carbon) and through a MILP model is made the synthesis of the network of this hydrogen. Hydrogen consumption is related to different oil processing, and the model evaluates the trend in the variation of the hydrogen used, so the objective function here minimizes the hydrogen available at the source. The model is developed in GAMS using the BARON solver. The results show that the relative concentration approach is better than traditional methods based on the absolute concentration of hydrogen available in the sources. Deng et al. (2017) use as a case study two hydrogen-rich plants that can supply the need for a refinery with a hydrogen deficit. Three different models are tested for the optimization of the proposed hydrogen network. The first model is considered MILP and addresses the direct reuse of hydrogen from the two plants to minimize the amount of hydrogen available as used in the refinery. The other two models are MINLP and consider the use of a purification unit with different objective functions: minimize the amount of hydrogen from the refinery and decrease the total annual cost. Jagannath et al. (2018) addressed a hydrogen network modernization project through an MINLP model to reduce the total annual cost. Nonlinearity is due to bilinear terms and the pressures that vary in compressors. A heuristic method for assigning these pressures is used, and with this, the nonlinearity remains only due to bilinear terms.
Bringing together all these concepts, mathematical programming can be used in the synthesis of hydrogen networks through their optimization. Usually, the amount of hydrogen produced is higher than the amount consumed. As it is not economically feasible to produce and burn the product with high added value, space is opened for studies of an optimized production of hydrogen in refineries.
Additionally, the optimization of the hydrogen network from mathematical programming can be a tool used in the production programming of the various products produced in a refinery. In other words, in the refining industry, factors such as the type of crude oil to be processed and the products to be produced cause variation in production planning and scheduling. The use of hydrogen is related to these factors, as they affect the amount of hydrogen that must be produced or imported to meet the demand of the consuming units. Depending on the type of crude oil and the final product, e.g., diesel and its sulfur concentration derivations, the amount of hydrogen needed for the hydrotreating process also varies. Figure 5 represents the interconnection between the production planning and optimization of hydrogen networks. Production scheduling involves the production sequence of a given product, considering all steps, inputs, and production times to achieve the production goals set by the production planning step. Given an individual hydrogen demand based on production planning and scheduling for a given period, the hydrogen network can be managed to achieve the demands more efficiently.
The approach of this work is based on the evaluation of different optimization models, through mathematical programming, developed for retrofit of hydrogen networks, to identify the advantages and deficiencies of each formulation. Although the focus is operational, the problem addressed here is broader and has a significant industrial interest, since hydrogen is not easy to handle and because its overproduction is not economically viable. Furthermore, it is an essential tool used in production scheduling in a refinery.

METHODOLOGY
Here we briefly discuss the methodology developed by our research group and wholly presented in (Silva et al., 2020). The first step towards optimization through mathematical programming is the elaboration of a scheme capable of representing the hydrogen network and all possible connections, shown in Figure 6. It should include a set of sources (i ϵ hydrogen sources ( ) HS ), a set of consumers (j ϵ hydrogen consumers ( HC )), a set of purification units (k ϵ hydrogen purifiers ( ) HP ) and the hydrogen excess burning system (w), which are considered the units of the hydrogen network. Besides, existing lines and compressors should also be included.
For each source is given the maximum and minimum flowrate, the hydrogen composition, and the outlet pressure. For each consumer is given the inlet flowrate demand, pressure, and composition, the outlet purge flow, pressure, and composition. For each purifier is given the maximum flow capacity, the composition of purified flowrate and purge flowrate, the pressure of purification, and the hydrogen recovery. It is also considered a fuel system in which waste streams can be burned and used as fuel to the process. For each unit present in the network, flow, purity, and operating pressure are represented by the letters F, y, and P. The material balance can be applied to all units represented in the schema (sources, consumers, and purifiers). The flow provided by a hydrogen source, respecting its minimum and maximum limits, can be sent to the consumer, to the purifier, or to burn the excess. Consumers have a purity that must be met ( j YJ ) and purity of the purge flow ( P ).
The purge flow of the consumer, that is, what was not necessary for the hydrotreatment reaction, can be forwarded to the purification system, to another consumer, or to the excess burning system. The purification unit aims to increase the concentration of hydrogen in the currents, usually making it 99.9% pure. Therefore, purified hydrogen can be directed to consumers or the excess burning system. As each purifier has a flow limit that can operate and a recovery rate, the unpurified quantity is also routed to the firing system, having a purity much lower than the purified flow.
Some considerations were made to simplify the model. The flow is considered only a binary mixture of hydrogen and methane, and the compressors are associated with each possible connection individually in the linear problem. Therefore, it is not allowed to merge flows before the compressor units, which would result in an unknown inlet hydrogen composition. Hence, a non-linear material balance would be necessary. The partial pressure of the hydrogen and the flow are constant at the entrance and exit of the consuming units.
The same procedure can be done for the development of non-linear mathematical programming. Based on the units that make up the network, now including the compressor as a unit. In this case, there are mixtures of flows at the compressor inlet, generating bilinearity, and the pressure of the compressor is variable. Figure 7 schematizes the hydrogen network for the development of a non-linear model. The material balance is carried out in the same way as in the linear, in all units, including compressors. Sources, consumers, and purifiers can send flows to consumers, should they need it due to the pressure difference. Compressors send flows to consumers, purifiers, or to burn. As the pressures vary in the non-linear model, pressure restrictions must be included, which guarantees the compressor's inlet and outlet pressures. For a given compressor unit, the inlet pressure is set as lower than the minimum pressure among the pressure of the mixed streams entering the compressor. The outlet pressure is set as higher than the maximum pressure among the pressure of the streams leaving the compressor according to the pressure of the stream destination.
Because the focus is retrofit of existing hydrogen networks, existing lines and the distance between units and compressors should also be supplied as parameters. But also, new equipment can be installed, being new pipelines, compressors, or purification units. For this, it is necessary, in addition to the material balance equations, logical disjunctions capable of ensuring the installation. For this, binary variables associated with new lines, new compressors, and new purification units were created, making the MILP (mixed-integer linear programming) and MINLP (mixed-integer nonlinear programming) models.
The choice of the objective function is an essential factor. In this case, the goal is to minimize the operational cost of the hydrogen network, which includes the cost of supplying hydrogen through its source, the cost of electricity by the use of compressors to achieve the different pressures, the cost of purification and the cost related to burning excess hydrogen. The operating cost should be calculated on an annual basis, so the total hours of operation should be considered.
As the installation of new equipment is allowed, this cost is called capital cost. It includes the costs of new compressors, pipelines, and purification units. The cost of capital is also calculated on an annual basis and, therefore, should be corrected by an annualization rate, which considers the return on investment time and the interest rate.
The values of the parameters of equations in operating cost and capital cost, as well as these costs, are calculated in this article, are summarized in Chart 1.
With this, there are two mathematical approaches developed based on the hydrogen networks represented in Figures 6 and 7. The proposed linear model has the advantage of being linear, for which very robust solvers can be used. Some examples of solvers used in GAMS are CPLEX, Gurobi, CBC (GAMS, 2020). However, the main disadvantage is that a compressor is associated with each possible connection individually, to avoid non-linear material balances. In this case, the streams cannot be mixed to use the same compressor, and the resulting network may end up with more compressor units than an alternative NLP model, in which the streams can be mixed. The non-linear model, on the other hand, does not guarantee the achievement of the global optimum, but allows the mixing of flowrates in the units and variable pressure in the compressors.
The main difference from the MILP model to the MINLP is how the compressors are treated. In MILP, the compressors are associated with each flowrate. In MINLP, the compressor is treated as an independent unit, not associated with a flowrate. Then the stream can be mixed to enter the compressor and splitted when leaving some unit. Besides the class of the resulting model (either linear or non-linear), the linear model may result in a network with more compressors and pipelines than the non-linear model. On the other hand, the linear model is simpler to initialize, solve, and the global solution is guaranteed.
The focus of this work is not the complete description of the model used. For this, all equations and logical constraints were described in Silva et al. (2020). As in the article, optimization through the linear model is named HNS-LM (hydrogen network synthesis-linear model) and that of the non-linear, HNS-NLM (hydrogen network synthesis-non-linear model). The aim is to evaluate different approaches developed for the optimization of hydrogen networks, comparing their differences and results. In addition to the two different models for optimization proposed, different initialization techniques were also evaluated to evaluate the convergence of non-linear models.

RESULTS AND DISCUSSION
The proposed models were validated using a case study of the literature, according to Silva et al. (2020). The mathematical programming models were implemented in the modeling system GAMS on a 3.6 GHz Intel ® Core ™ I7 CPU. The solver used for all the MILP models was CPLEX and DICOPT for the MINLP model.
The original network was simulated so that its operating cost could be used as a base value for calculating the savings of future optimized networks. All parameters and conditions used are also described in detail in the article. Figure 8 represents the original network. Hydrogen network optimization through linear mathematical programming (HNS-LM) achieves savings of 11.2 million in operating cost (reduction from 39.862 to 28.649 million $/year). For this to be possible, it is necessary to change the design of the original network, installing new 12 lines, 3 new compressors, and a purification unit, since the network has none.
The highest capital cost here is due to the new PSA (83%). Using additional constraints, for example, investment cost limited, the capital cost value can be decreased, but this also increases the operating cost, because the minimum value of the operating cost was guaranteed by the optimization up to the global optimum.
In the network optimized through the non-linear model (HNS-NLM), no significant changes in the economy and cost of capital are achieved. Savings are almost equal to the linear model (11.8 million $/year) with a capital cost of $7.8 million per year without installing new compressors, only lines, and PSA. Operating cost and capital costs are summarized in Chart 2.
Chart 2: Operating and capital costs obtained through the two optimization models. Thus, the factor that differs between the two models, and that was observed in the methodology, that non-linear models allow the mixture between currents in the units, here is not relevant. However, it should be noted that linear optimization ensures the achievement of the global optimum, which does not happen in HNS-NLM. Optimization via non-linear formulation provides a reduction of almost 4% in operating cost compared to linear. Nevertheless, a satisfactory economy is achieved with the linear model, linked to its easiness of elaboration, resolution, and convergence. Figure 9 shows the hydrogen network design obtained by HNS-NLM. The new hydrogen network obtained through the optimization of the HNS-LM model, in addition to the two existing compressors, installed 3 more new compressors. This is because, as already mentioned, here is not allowed to merge flows at the entrance of the units. An alternative to reduce this number, and consequently the cost related to it is to join the flowrates that have the same unit as origin or destination, making a rearrangement. This technique was developed and explained in Silva et al. (2020), represented here by HNS-LM*. This reduces the cost of capital by 11% (from 8.209 to 7.342 million $ per year). Figure 10 shows the hydrogen network design obtained by HNS-LM*. To facilitate the convergence of the non-linear model (HNS-NLM) and try to obtain better results of operational cost, an initialization strategy was used based on the result obtained through the linear model. This was done in two ways, the actual optimized network by HNS-LM (which will be called strategy A) and the optimized network with compressor rearrangement by HNS-LM * (strategy B).

HNS-NLM MINLP OPTIMIZED
Hydrogen network optimization through the non-linear model (HNS-NLM), using strategy A as an initialization, ensures an operating cost of $28.472 million per year (only 0.6% lower) and 6% higher capital cost. With this, it is observed that even using an initialization strategy and a non-linear model, does not show a competitive alternative to linear.
Using the initialization strategy B in optimization with the non-linear model (HNS-NLM), more satisfactory results are achieved. Savings of 12.4 million per year (4.3% reduction in operating cost), but for this, a more significant investment of 9.5 million per year is required. Chart 3 summarized all capital costs and operating costs discussed above.
Chart 3: Operating and capital costs obtained through the two optimization models. The technique of rearrangement in compressors, applied in the result obtained through HNS-LM, proves to be a competitive alternative because a significant reduction in capital cost is achieved. When used to initialize non-linear optimization, the lowest operating cost is achieved among all the tested alternatives.

HNS-LM HNS-NLM
The non-linear formulation provides an optimized network with fewer connections, that is, less complicated and more realistic hydrogen networks, which is a positive aspect. With this, fewer new lines and compressors are installed, which is observed evaluating the cost of capital. However, it was noted that only optimizing via non-linear model did not guarantee a lower operational cost, and initialization strategies were necessary to assure convergence. With this, the lowest operating cost was obtained, but with the highest cost of capital.
The linear formulation, despite inserting a compressor for each current and with this more pipelines, when submitted to the rearrangement of compressors, proves to be a highly competitive alternative to the non-linear, with second-lowest operating cost and lowest capital cost. Through payback, it can be compared that this is the best result obtained. Also, other positive aspects are the ease of resolution, the guarantee of the overall optimum, and the robustness of the solvers available.
Besides, by combining this linear method of optimization with production programming, a more robust tool is achieved, with faster optimization and easier to solve. Thus, the refinery's production schedule, based on the desired products in a predetermined time interval, can feed the necessary information in the mathematical programming developed for the hydrogen network, making it produced and used as efficiently as possible.

CONCLUSION
Undoubtedly, hydrogen is a crucial raw material within the refinery used to adapt the properties of fuels, such as diesel. Because of this, its use efficiently has economic and environmental relevance. With this, it is vital to manage the hydrogen network in refineries, seeking their optimal production.
The use of hydrogen is also linked to the refinery's production schedule because different products and different crude oils require different amounts of hydrogen, used as a sulfur capture element. The elaboration of production programming and its interconnection with hydrogen supply becomes an essential tool for process optimization.
For this, different approaches can be used in the optimization of hydrogen networks. Mathematical programming is an excellent tool for optimizing hydrogen networks, as proven through the results. The different forms of hydrogen network optimization, both through linear (HNS-LM) and non-linear (HNS-NLM) mathematical programming can provide good results. What matters is to know how to evaluate the strengths and weaknesses of each formulation.
The lowest operational cost was obtained through optimization via a non-linear model, but only using an initialization strategy based on the MILP formulation. On the other side, the linear model, although it is simpler to be solved, since it does not require initialization, can underachieve the best profitable result. This illustrates the pros and cons discussed above.
Analyzing the payback time, it is possible to identify that optimization via linear model provides very satisfactory savings in operational cost, combined with the lower cost of capital. With this, mathematical programming developed linearly is an excellent tool for retrofit hydrogen networks.