CET vol 99 DOI: 10.3303/CET2399105 Paper Received: 20 November 2022; Revised: 28 March 2023; Accepted: 10 May 2023 Please cite this article as: Salano L., Galeazzi A., Prifti K., Manenti F., 2023, Automated Development of Manual Startup and Shutdown Procedures by a Non-linear Non-derivative Optimization Algorithm, Chemical Engineering Transactions, 99, 625-630 DOI:10.3303/CET2399105 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 Automated Development of Manual Startup and Shutdown Procedures by a Non-linear Non-derivative Optimization Algorithm Loretta Salanoa, Andrea Galeazzia, Kristiano Priftia, 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 most critical phases of plant operativity are the start-up and shutdown, which are usually implemented by following an experience-based sequential manual procedure. This work aims to develop an optimizing route for the unsteady states of a chemical plant through non-derivative local minimization algorithms. The proposed library for such development is NLopt, an open-source collection of optimization algorithms that can be implemented in C++ and Python languages. The definition of the problem followed a Monte Carlo initialization approach and optimization with a successive algorithm validation to test the optimizer potentiality. The case studies implemented describe common units in chemical plants and show the prospects of the route for the automation of such phases, in order to transform obsolete manual sequences into non-time-consuming and energy-saving routes to be implemented in plant activity. 1. Introduction In the field of chemical engineering, the relevance of optimal operativity conditions is crucial, due to the high costs of the equipment, raw materials, and manual work; the safety concerns and regulations that must be followed to avoid dangerous situations, losses of money and operative time, energy consumption and environmental impact. Current applications focus on the steady phases of the process, leaving a big area for improvement in the study of dynamic situations. In particular, the study of the start-up and shutdown of a plant is a fundamental step to prevent machinery failure and guarantee plant productivity. Currently, in literature, many foci on the usage of control system theory approaches, such as model predictive control (Larsson et al., 2013), fuzzy control logic (Ali and Abu Khalaf, 2003) and hybrid control systems (Verwijs et al., 1995), which require high computational time due to the tuning requirement and complexity of the dynamic problem. This leaves a grey area for the development of optimized sequential procedures without the aid of control theory. Problem’s definition The study focused on the development of an optimal routine for the time optimization of the start-up of chemical plants’ standard units. An objective function f(x) was developed for each case study, translating physical and safety constraints into equality h(x) and inequality constraints g(x), following the standard for the optimization problem, reported in (1). min x0,…,xn f(x) h(x)=0 g(x)≤0 x=[x1,x2,…, xn] , xi∈{0,100} (1) 625 mailto:flavio.manenti@polimi.it The problem is based upon n variables, which represent the discretization of a physical value over the time domain. In both cases analyzed in this work, such value is the opening percentage of a process valve for flowrate control. 2. Materials and methods Case studies Two chemical plants units were taken under study for the testing of the optimizer’s capability to find convergence for time-discretized models. Methods The models of the units were based on mass and energy balances (2), and implemented as a set of differential equations over time to study the dynamics of the systems. ∑ ṁi,in - ∑ ṁi,out +ṁgen=Acc. ∑ ( 1 2 ṁ v2+m ̇ gh+Ḣ) i,in - ∑ ( 1 2 m ̇ v2+m ̇ gh+Ḣ) i,out + ∑ Qj +Ẇs=Acc (2) The PDEs were simplified through the help of the method of lines, which allowed reducing them to a set of ODEs by discretizing one of the partial derivates by finite differences, as shown in the set of equations in (3). ∂Ci ∂t =- ν0∂Ci ∂V +ri ∂C ∂V = Ck+1-Ck Vk+1-Vk , k=1,…,n (3) NLopt was chosen as the optimization tool, which is a free/open-source library for nonlinear optimization, providing one interface for several free optimization routines available online as well as original implementations of various other algorithms. It addresses general nonlinear optimization problems of the form (1). In order to feed an appropriate first guess to the optimizer, a Monte Carlo analysis was included. This technique relies on repeated random sampling to obtain numerical results (Kroese at al., 2014). Figure 1 - Problem's definition block scheme The algorithm’s performance was then evaluated through a benchmark study, through accuracy and robustness results. It was carried out by providing a comparison between the capability of the algorithm to converge to a minimum, how fast this was achieved, and which one would overall seem best suited for the problem. In terms of computational time invested the algorithms were tested to reach the optimal value for the same number of iterations allowable from the optimizer, as well as testing the accuracy towards the minimum convergence. Tools As already stated, the problem was constructed in the high-level, general-purpose programming Python language, which provides a range class of free and open-source libraries. Between these, the SciPy was implemented for the differential system's resolution, both through the aid of the ‘solve_ivp’ function. 626 NLopt was set up according to the library’s requirements for algorithm choice, boundary conditions and tolerance for convergence, which are reported in Algorithm 1. Algorithm 1 NLopt Optimization 1: initialization 2: opt.nlopt.opt(nlopt.algorithm, n_steps) 3: set lower bounds 4: set upper bounds 5: set minimization of the objective function 6: set of tolerance for the minimization 7: x = opt.optimize(initial guess) 3. Models Atmospheric tank The first case taken under study was the emptying of a tank, in which the variable is the opening of the valve for the fluid exiting the vessel. The unit was modelled through a mass balance to obtain the liquid’s height profile over time. The velocity was expressed with Torricelli’s law for a fluid exiting a recipient in a uniform gravitational field. In this case, the goal was to minimize the overall time of emptying the tank, so the set-point was the level of the liquid in the tank equal to zero. The solver was given a goal to minimize the total time invested in emptying through the objective function expressed in (5). The function is solved over the whole time domain, rather than at every time step the function is the sum of each integrating time step until the set point is met. f(x)= ∑ dti SP fulfilment i=0 (5) Steam reforming reactor The second case study regards the warm start-up of a steam reforming unit, based on a manual procedure obtained from a biogas real plant reacting unit, Figure 3. In this case, the unit was studied to provide an automated sequential procedure, in the scenario of which a new catalyst is to be inserted as packing material into the reforming tubes. The overall goal was still to successfully bring the system to nominal conditions with the least amount of time invested. This was to be carried out following a group of set points, obtained from the physical constraints applied to the system. The most relevant one regards the time required for the system to maintain the steady-state conditions, set to 10 minutes for the case study. The case study's physical values were taken from previous work (Quirino et al., 2020), modelling the catalytic tubes inside the reformer as packed PFRs. The variables to be manipulated were the flow rates of water and methane fed to the steam reforming of the methane reactor, always through the percentage of valve opening. In this case, the approach that was taken involved a double optimization, to first find the optimal sequence to follow the precise procedure given, and an external optimization on the time interval upon which every controlled variable could spend, allowing to find the same trajectory within a shorter time, the overall scheme of the objective function setup can be found in Figure 2. To develop such procedure, two objective functions where here taken into consideration, rather than the single one for the first case study; both are reported in Figure 2. Figure 2 – Optimization route for the steam reformer case study 627 The first one stated as MSE (Minimum Squared Error), brings the system from the operating conditions to the required set points by minimizing the quadratic difference between the values of the methane and water flowrates (Fi) and the required flowrate values (Fsp). Afterwards, the second optimization routine is recalled, working on optimizing the overall time taken by the system to meet nominal operating conditions, similar to the one used for the first case study. Table 1 - Physical constraints of the system Physical constraint Value UoM S/C 3 - FH2O max 48 l/h FCH4 max 25 Nm3/h The physical constraints that allow optimal operativity and minimize risks are the steam-to-carbon ratio (S/C), for optimal productivity, and the maximum inlet flow rate’s consumption, given from the piece of equipment, these were implemented as numerical constraints to feed to the solver, values are reported in Table 1. Figure 3 - Startup of a reformer unit from real company procedure 4. Results and discussion The results here discussed focus on the use of a non-derivative local minimum finding algorithm for the optimization of a non-linear objective function subject to linear constraints and its outcome. The main focus of the first case study was on the testing of the library's capability to solve the problem of the minimum time of emptying is trivial to obtain with a full opening of the valve. Monte Carlo’s results show already an initial guess very close to the solution. The optimizer tested successfully, in fact in Figure 5b the profile of emptying matches the wanted solution. Some limits can be found in the profile’s behaviour since once this had reached the set point required, the objective function isn’t able to give further information to the system. The algorithms’ comparison showed fast convergence for Powell’s based methods, COBYLA (Powell, 1994) and BOBYQA (Powell, 2009) and bad performance for Brent’s method PRAXIS (Richard, 2002). This brought to the conclusion that for this case the best compromise between all the aspects considered for the performance evaluation is the COBYLA algorithm. For the second case study, a reference for the required set points to be followed during the start-up procedure was provided from a biogas facility. The procedure’s profiles are reported in Figure 3. After the double optimization routine, the system shows good results in terms of total time spent by the system to reach the nominal operative conditions. The fundamental aspect to carry this optimization out was the decision of the constraints for the minimum time at which each set-point needed to be maintained. In this case, the Monte Carlo initialization verges from the optimal trajectory, due to the presence of the multiple set-points, but with a high number of runs and time discretization intervals, the method still provided a good starting point for the optimization. The algorithms behaviour was tested for the overall optimization of the two objective functions; having a limit within the library settings, the only algorithm to be able to receive equality and inequality constraints from the NLopt setup is the COBYLA, so to carry out the comparison between the class of algorithms the constraints had to be implemented within the objective function. Also, in this case, the BOBYQA and NEWOUA bound 628 (Powell,2004) provided good convergence after a number of iterations benchmark. The tradeoff between accuracy, convergence and CPU time invested pointed at BOBYQA as the optimal algorithm for this problem. Figure 4 - Algorithm’s performance analysis a) convergence capability for maximum iterations allowed to the solver; b) total CPU time for each set run with respect to the maximum number of iterations Figure 5 - Tank's optimization results a) Monte Carlo initialization profile compared to the ideal profile; b) Monte Carlo initialization valve openings; c) Optimal profile compared with the ideal one; d) Optimized valve opening 5. Conclusions In conclusion, this study tried to provide a starting base for the study of optimization for unsteady phases of start-up and shutdown in industrial plants and their automation. The work provides an alternative approach to the obtaining of manual and sequential procedures currently followed by industrial companies, which require experimental knowledge for each unit. Through the aid of the open-source library NLopt, the algorithm is able to provide a sequence of action to bring the system close to nominal conditions. c) d) b) a) 629 The study has still room for further investigation, especially regarding the implementation of more complex process systems as well as the implementation of additional optimization tools, such as reinforcement learning algorithms, could be investigated. Figure 6 - Optimized profiles for reformer start-up procedure a) Flowrates profile; b) Valve opening requirement Nomenclature Ci – ith component concentration, mol/m3 ri reaction rate, mol/m3/s g – gravity acceleration, m/s2 Q – heat exchanged in the system, J Ḣ – enthalpy of the system, J PDE – partial differential equation h – height, m PFR – plug flow reactor ṁi – ith component mass flowrate, kg/s V – volume of the system, m3 ṁgen – generation term kg/s v – velocity of the mass, m/s ODE – ordinary differential equation W – work consumed by the system, J References Ali E.M., Abu Khalaf A.M., 2004, Fuzzy Control for the Start-up of a Non-isothermal CSTR, J. King Saud Univ. - Eng. Sci., vol. 17, 25–45. Kroese D.P., Brereton T., Taimre, T. and Botev Z.I., 2014, Why the Monte Carlo method is so important today, Wiley Interdiscip. Rev. Comput. Stat., vol. 6, 386–392. Larsson P.O., Casella F., Magnusson F.,Andersson J., Diehl M., and Åkesson J., 2013, A framework for nonlinear model-predictive control using object-oriented modeling with a case study in power plant start-up, Proc. IEEE Int. Symp. Comput. Control Syst. Des., 346–351 Steven G. Johnson, The NLopt nonlinear-optimization package, github.com/stevengj/nlopt, accessed 02.03.2021. Powell M.J.D., 2004, The NEWUOA software for unconstrained optimization without derivatives, Nonconvex Optimization and Its Applications, 83. Powell M., A Direct Search Optimization Method That Models,1994,1, Advances in Optimization and Numerical Analysis: Mathematics and Its Applications 51–67. Powell M., The BOBYQA algorithm for bound constrained optimization without derivatives, 2009, NA Rep. NA2009/06, Centre for Mathematical Sciences, University of Cambrdige (UK) 39. Quirino P.P.S., A. Amaral, K. V. Pontes, F. Rossi, and F. Manenti, 2020, Modeling and Simulation of an Industrial Top-Fired Methane Steam Reforming Unit, Ind. Eng. Chem. Res., 59, 11250–11264 Richard B., 2002, Algorithms for Minimization without Derivatives, Dover, Prentice-Hall, Englewood Cliffs, New Jersey. Verwijs J.W., Kösters P.H., Van Den Berg H., Westerterp K.R., 1995, Reactor operating procedures for startup of continuously‐operated chemical plants, AIChE J., 41, 148–158. a) b) 630 229salano.pdf Automated Development of Manual Startup and Shutdown Procedures by a Non-linear Non-derivative Optimization Algorithm