CET vol 99 DOI: 10.3303/CET2399104 Paper Received: 30 January 2023; Revised: 8 March 2023; Accepted: 19 April 2023 Please cite this article as: Bozzini M., Prifti K., Galeazzi A., Manenti F., 2023, Capex Opex Robust Optimization: a Software for Well-founded Economic Estimations and Process Optimization, Chemical Engineering Transactions, 99, 619-624 DOI:10.3303/CET2399104 CHEMICAL ENGINEERING TRANSACTIONS VOL. 99, 2023 A publication of The Italian Association of Chemical Engineering Online at www.cetjournal.it Guest Editors: Sauro Pierucci, Flavio Manenti Copyright © 2023, AIDIC Servizi S.r.l. ISBN 978-88-95608-98-3; ISSN 2283-9216 Capex Opex Robust Optimization: a Software for Well- Founded Economic Estimations and Process Optimization Marcello Bozzinia, Kristiano Priftia,b, Andrea Galeazzia,b, Flavio Manentia,b* aCMIC Department "Giulio Natta", Politecnico di Milano, Piazza Leonardo da Vinci 32, Milan 20133, Italy bConsorzio Interuniversitario Nazionale per la Scienza e Tecnologia dei Materiali, Via Giusti 9, Florence 50121, Italy flavio.manenti@polimi.it The preliminary stages of a project’s development and the early stages of the optimal design of a process often rely on an inaccurate and restricted amount of data. As the project goes through, the influence of design decisions on the project costs decreases and this creates an incentive to get the most precise cost information to guide the design at as early stage as possible. These are the concepts on which the Capex Opex Robust Optimization (CORO) is based on. CORO relies on a process simulation made in the commonly used commercial simulation package Aspen HYSYS to perform a rigorous economic evaluation of both CAPEX and OPEX. CORO allows to immediately get an initial economic evaluation and, most importantly, with a lower risk of human error. Microsoft Excel acts as GUI because of its broad applicability and user-friendly interface and it is well interconnected with the simulation package. In addition, CORO is able to execute a process’ optimization according to the degrees of freedom chosen by the user. The software is written in different programming languages; the macro for the data extraction from Aspen HYSYS’s simulation is written in Visual Basic for Application, while the economic evaluation and the optimization of the process are carried out by DLLs in C++ and Visual Basic.NET. An XML data sheet is used to carry the information from Microsoft Excel to the DLLs. In the long run, the data extraction from other simulation packages is expected to be implemented. This article exhibits the interconnection between the simulation package, Microsoft Excel and CORO and focuses on the mathematical tools implemented for the optimization of a process so far. 1. Introduction At the beginning of project development, engineers do not have a lot of data, and most of it is not accurate. As a matter of fact, economic analyses are frequently imprecise and not fully adequate. As pointed out by Gibson and Hamilton (1994), as the development proceeds, design decisions become less and less influential, economically wise. This creates an incentive to get reliable economics in the early stages of development, when decision-making is at its cheapest and most influential. In addition, the economic analysis of a process is a crucial step in assessing the feasibility of a project. This concept is illustrated in Figure 1. The creation of process simulators allows engineers to virtually represent the process and to acquire lots of data, which would normally require a great effort in terms of time and money. Thus, process simulation software can be an invaluable tool to compare alternatives during the preliminary stages of the project. In parallel, economic packages have been developed and distributed along with process simulators to automatically estimate the cost of the simulated process, such as Aspen One. However, precisely because they are additional packages of the simulation software, these solutions have some disadvantages: • Since the simulation software is very flexible, cost estimation is significantly wrong when the unit's characteristic variable is outside the cost correlations' boundaries; • Correlations are mostly not modifiable by the user and are protected as they belong to a commercial economic package; • The cost estimation fails when the simulation includes special units as well as custom units added by the user. 619 mailto:flavio.manenti@polimi.it Figure 1: Decision influence over costs during project’s stages The main objective of this project is to provide a useful tool able to perform the cost estimation and the process optimization of a project, relying on a variable amount of information. CORO has been built to ensure flexibility and robustness to the user, who is allowed to customize the cost estimation based on available additional information. The use of CORO software, compared to commercial packages integrated with process simulators, has some important advantages: • The user can choose between different economic packages available in the literature, which can be entirely customized to better evaluate the cost of the unit; • Conventional simulation blocks can be used to represent unconventional or peculiar units, directly adding their cost or the parameters of the cost curve. The current state of the art of the application allows to get an economic estimation and the optimization only starting from a simulation developed with Aspen HYSYS package. The chosen simulation software provides a type library that can be registered in Visual Basic for Application and Visual Basic.NET. This tool allows a quick and easy exchange of information between Excel and the software. Hence, during the feasibility stage of this project, Aspen HYSYS has been temporarily chosen to deeply investigate its applicability. In the long run, the software will be implemented following the CAPE-OPEN standard to achieve a common framework for every commercial software. Finally, it is planned to create a cloud computing solution, improving its flexibility from the end user's point of view. The main structure of CORO (reported in Figure 2) is made up of the following items: • An Excel pre-defined workbook which acts as Graphical User Interface (GUI). This workbook includes all the macros which interconnect the commercial process simulation software Aspen HYSYS with the workbook itself; • Extensible Markup Language (XML) files where data are stored and, consequently, transferred between different programming languages and the Excel workbook; • A Dynamic Link Library (DLL) developed in C++. This DLL contains the procedure of cost’s estimation and the numerical algorithm for the optimization of the process; • A Dynamic Link Library developed in Visual Basic.NET, which is necessary for updating variable’ values during process optimization. The main items of the software have been completely decoupled to ensure high flexibility and independence of the application core from the process simulator. 2. General Framework The structure of the CORO software has a high level of complexity due to the different operating systems involved; Figure 3 illustrates the flowchart of the algorithm. The only prerequisite needed by CORO to operate is a process simulation compatible with Aspen HYSYS V11. 620 Figure 2: CORO structure The process of cost estimation and process optimization is completed by three different modules: the simulation package, the economic package, and the optimization package. Each of these packages performs a specific function and operates independently. The simulation package allows to physically and chemically describe the entire process and to size the units that are part of it. These data are stored and transferred into an eXtensible Markup Language file (xml) making them available for the following packages. The xml file is structured to organize all the information describing the process in an orderly and absolute manner. Therefore, modifying the simulation package alone would allow to extend the application to all process simulators, following CAPE-OPEN logic, because the process is standardized thanks to these xml files. The economic package consists of a database of correlations that allow the evaluation of the Capex, Opex and payback time of a process, starting from information available in the process simulator and information added by the user. The user can choose the correlations out of the most well-known ones in the literature implemented on the application. The cost of the units, as well as the overall costs of the process, are displayed in the Microsoft Excel workbook. The methodology by which costs are estimated will be explained in more detail in a dedicated section. The optimization package contains the procedure for the optimization of the process based on degrees of freedom chosen by the user. The objective function is the payback time of the process and the iterative procedure’s aim is to find the minimum value of this financial indicator. The optimization procedure is defined by equality and inequality constraints, fixed both by the user and by the process simulator’s models. The algorithm has been built only from a numerical point of view; therefore, it does not take into account the physical aspect of the process. The optimization procedure will be discussed in more detail in an exclusive section, given its complexity and importance. 2.1 The Microsoft Excel pre-defined workbook Microsoft Excel has been chosen as Graphical User Interface because of its broad applicability, user-friendly interface and interconnection with Aspen HYSYS. The pre-defined Microsoft Excel workbook contains the function for the extrapolation of all relevant data from Aspen HYSYS simulation for a complete description of the process. CORO retrieves from Aspen HYSYS both streams’ and unit operations’ variables, which are arranged into different worksheets according to their class. Thus, the user has to interface with Excel adding information (User Option in Figure 3) about the material used to build each unit operation and its type, the stream type (process stream, raw stream, product, waste or utility) and its cost or value. At this stage of the process, the user can customize the future economic evaluation by adding specific information. Units’ cost evaluation can be further personalized by using the functions “Custom Unit” or “Neglected Unit”: • The function “Custom Unit” allows the user to custom one or more operating units of the process by adding its cost or the cost curve’s parameters; • The function “Neglected unit” permits the user to neglect one or more units in the economic estimation. In the Microsoft Excel workbook, the user has the possibility to choose the degrees of freedom (DOF) between the variables of the simulation, and its boundaries, on which the software optimization procedure will operate to get the optimized process. • If DOF = 0, CORO performs only the economical estimation of the process, following the black line of Figure 3; 621 • If DOF > 0, CORO calls the iterative optimization procedure, described by the red line in Figure 3 up to reach the global optimum of the process. The data and the information are automatically arranged into a structured xml file making them available to the following procedures. This xml is divided into several nodes and attributes to better organize the information of the process. In particular, the xml is divided into nodes as follows: • Options: this node includes the name of the simulation, the name of the chosen economic package, the preferred unit of measures and the values of the parameters which can be modified by the user; • Streams: this node includes the information regarding the material streams of the process. The thermodynamic variable of each stream, as well as the type of the stream and its cost or value are arranged into this node; • UnitsList: this node includes the parameters that completely describe each unit operation of the process; • Utilities: this node includes the data regarding the energy streams of the process and its respective cost; • Specifications: this node includes particular unit operation specifications, which can be used as degrees of freedom for the optimization procedure. 2.2 Capex/Opex estimation The economic analysis of the project is executed by a Dynamic link Library written in C++ based on the information inside the xml file describing the overall process. The economic package is made by a database containing the correlations for the evaluation of the Capex and the Opex of the process. These correlations are available in the literature. The economic libraries implemented in CORO are the Bare Module Cost technique developed by Turton et al. (2018) and the Percentage of Delivered Equipment Cost technique presented by Peters et al. (2003). Both economic libraries allow to estimate the direct and indirect costs of the process knowing the characteristic dimension of each unit operation. In particular, the Bare Module Cost technique is based on specific parameters of each unit used to estimate the indirect and general costs related to the plant. On the other hand, the Percentage of Delivered Equipment Cost technique estimates each item of the capital expenditure as a percentage of the delivered equipment cost. The direct cost of each unit is evaluated by applying specific correlations and factors, taking into account the following variables: the characteristic dimension, the material of construction and the operating condition. The correlations are purely empirical, therefore, when the characteristic dimension of the units exceeds the range of application, the cost of the unit is scaled by applying the commonly known six-tenth rule. Regarding the operative expenditure, this cost is evaluated as a function of the main costs added by the user, such as raw material, waste treatment and utilities. According to Turton et al. (2018) and Peters et al. (2003), the accuracy range of the economic evaluation goes from +25% to -25% if the project definition is low. This range narrows from +12% to -8% if the definition of the process is almost complete. This methodology can be applied to any process simulated in Aspen HYSYS to get an indicative cost estimation of the project. For instance, the electrified biogas reforming process (Maporti et al. 2022) could be easily analyzed even using different parameters to assess the economic sensibility of the project. 3. Robust Optimization procedure The variable chosen as the objective function of the optimization procedure is the payback time of the process, defined as the ratio between the capital expenditure and the yearly revenues of the process, reported in Eq(1). Payback Time = 𝐶𝐴𝑃𝐸𝑋 𝐴𝑛𝑛𝑢𝑎𝑙 𝐶𝑎𝑠ℎ 𝐼𝑛𝑓𝑙𝑜𝑤𝑠 (1) The objective function is minimized using the BzzMath library developed by Buzzi-Ferraris and Manenti (2013) in C++. The BzzMath contains several functions to solve a wide variety of problems related to the chemical industry. In particular, the minimization of the objective function is carried out using the BzzMinimizationRobust numerical algorithm for non-linear multi-variable constrained minimization problems. This algorithm applies the penalty function method to use an unconstrained optimization technique to a constrained problem. The degrees of freedom can be chosen by the user between the main variables of the simulation. Regarding the streams, the user can choose between temperature, pressure and molar flow. Each operating unit has its optimization variable based on the specifications added by the user, such as the split ratio for splitters or the reflux ratio for distillation columns. The user must also set the boundaries of the degrees of freedom, within which the optimization procedure will search for the best operating condition, corresponding to particular values of both independent and dependent variables. The constraints of the optimization function are both equality and inequality constraints, which are respectively the balances of the process, defined and solved by the process 622 simulator, and the boundaries imposed on the independent variables by the user. The BzzMinimizationRobust procedure is implemented only from a strictly numerical point of view. Therefore, this procedure must be coupled with the process simulator, to ensure that the balances describing the process are solved during the research of the optimal operating point. This objective is achieved by the joint application of two DLLs: the first one is written in C++ for the minimization of the objective function, and the second one is written in Visual Basic.NET for reconciling the data on the process simulator. The iterative algorithm followed by CORO to perform this task is described by the red line in Figure 3. Figure 3: CORO iterative algorithm The first part of the iterative procedure goes through the same steps of the standard procedure up to the estimation of the payback time of the process. Consequently, CORO calls back the BzzMinimizationRobust algorithm. The inputs of this function are the evaluated payback time, the value of the degrees of freedom and the lower and upper bounds entered by the user in the Microsoft Excel workbook. The value of the degrees of freedom is changed, from a numerical point of view, to search for the optimal values. The modified values must 623 be uploaded on the process simulator to solve the balances and collect the values of the dependent variables of the process. The coupling of the optimization algorithm with the process simulator is done through a module written in Visual Basic.NET using the type libraries provided by the simulation package only for this programming language. The value of each degree of freedom is uploaded individually, so that the process simulator can converge more easily. After loading, the simulation is described by new variables which lie between the specified boundaries and meet user-imposed specifications. The parameters of the simulation, which differ from the previous one, are updated to perform a new economical estimation. The reconciled values are stored in the xml file, making them available to the economic package, which will estimate the payback time of the i-th simulation. The iterative procedure ends when the minimization algorithm finds the minimum value of the objective function. The overall economic analysis of the optimal process is reported in the Microsoft Excel workbook through an xml file in dedicated worksheets. The cost of each unit operation, process-related indirect as well as the capital and operative expenditure of the process are available to the user in the GUI. 4. Conclusion The presented structure, on which CORO has been developed, guarantees high flexibility and a user-friendly application. The flexibility of the application is ensured by the customization functions and the possibility of changing any parameter of the economic estimation through the user interface. CORO allows the user to have a clear visualization of the process through the worksheets, where material streams and units are arranged. These characteristics make CORO a unique and novel application, if compared to the similar tools available on the market. It has been described the interconnection between the application and the process simulation software, which is essential to ensure fast and multiples resolutions of the same process during the process optimization. The entire application has been developed in Visual Basic for Application, C++ and Visual Basic.Net and coupled with the simulation package Aspen HYSYS. The software is being tried and tested with simulations to expand the package offered to the user. Further developments of the application aim to meet CAPE-OPEN standards. In particular, the development of a common interface for every commercial simulation software is planned. References Battisti, R., Galeazzi, A., Prifti, K., Manenti, F., Machado, R.A.F., Marangoni, C., 2021. Techno-economic and energetic assessment of an innovative pilot-scale thermosyphon-assisted falling film distillation unit for sanitizer-grade ethanol recovery. Applied Energy, 297, art. no. 117185. Buzzi-Ferraris, G., Manenti, F., 2014. Nonlinear systems and optimization for the chemical engineer: Solving numerical problems. Wiley-VCH Verlag, Weinheim, Germany. Galeazzi, A., Nasti, R., Bozzano, G.L., Verotta, L., Marzorati, S., Manenti, F., 2021. A Cloud Computing Application for the Supercritical Carbon Dioxide Extraction Using Coffee Grounds Silverskin. Computer Aided Chemical Engineering, 50, pp. 1035-1040. Gibson, G.E., Hamilton, M.R., 1994. Analysis of Pre-project Planning Effort and Success Variables for Capital Facility Projects. The Institute. Maporti D., Nardi R., Guffanti S., Vianello C., Mocellin P., Pauletto G., 2022, Techno-economic Analysis of Electrified Biogas Reforming, Chemical Engineering Transactions, 96, 163-168 DOI:10.3303/CET2296028 Peters, M. S., Timmerhaus, K. D., West, R. E., 2003. Plant design and economics for chemical engineers, 5th Edition. McGraw-Hill Professional, New York, NY. Prifti, K., Galeazzi, A., Barbieri, M., Manenti, F., 2022. A Capex Opex Simultaneous Robust Optimizer: Process Simulation-based Generalized Framework for Reliable Economic Estimations. Ludovic Montastruc, Stephane Negny, Toulouse, France. Turton, R., Shaeiwitz, J. A., Bhattacharyya, D., 2018. Analysis, synthesis and design of chemical processes, 5th Edition. Prentice Hall. 624 226bozzini.pdf Capex Opex Robust Optimization: a Software for Well-Founded Economic Estimations and Process Optimization