CET vol 99 DOI: 10.3303/CET2399098 Paper Received: 1 December 2022; Revised: 27 March 2023; Accepted: 6 May 2023 Please cite this article as: Ward O.M.G., Galvanin F., Jurado N., Clements C., Abdallah M., Blackburn D., Fraga E.S., 2023, Optimization of a PID Controller within a Dynamic Model of a Steam Rankine Cycle with Coupled Energy Storage, Chemical Engineering Transactions, 99, 583- 588 DOI:10.3303/CET2399098 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 Optimization of a PID Controller within a Dynamic Model of a Steam Rankine Cycle with Coupled Energy Storage Oliver M. G. Warda, Federico Galvanina, Nelia Juradob, Chris Clementsc, Mohamad Abdallahc, Daniel Blackburnd, Eric S. Fragaa,* aDepartment of Chemical Engineering, University College London, Torrington Place, London, WC1E 7JE, UK bDepartment of Mechanical Engineering, University College London, Torrington Place, London, WC1E 7JE, UK cFormerly at United Kingdom Atomic Energy Authority, Culham Science Centre, Abingdon, OX14 3DB, UK dUnited Kingdom Atomic Energy Authority, Culham Science Centre, Abingdon, OX14 3DB, UK e.fraga@ucl.ac.uk Fusion energy is an appealing option for future energy generation, but also presents unique design challenges. The UK Atomic Energy Authority is leading the Spherical Tokamak for Energy Production (STEP) programme to build a fusion power plant capable of net electricity generation. This work addresses the use of dynamic models in an optimization framework for the design of the thermal power generation cycle for STEP. The optimization of a proportional-integral-derivative controller regulating the power output of a steam Rankine cycle with a coupled thermal energy storage system is presented. A lumped-parameter dynamic model of the system has been implemented. The effectiveness of a controller design is evaluated by simulating the system under a perturbation to the power demand on the system. By minimizing the mean absolute power deviation, there is a reduction of 97 % compared to the initial controller design, as well as a reduction of 95 % in the maximum absolute power deviation and a faster return to setpoint. The optimized design does introduce more oscillations in the system, which are undesirable for control systems and are challenging for the optimization procedure. 1. Introduction Spherical Tokamak for Energy Production (STEP) is a programme run by the United Kingdom Atomic Energy Authority (UKAEA) to design and build a nuclear fusion power plant capable of generating net electricity (UKAEA, 2023). Fusion is an attractive possibility for energy generation, with the expectation of low carbon emissions, abundant fuels that can be extracted from water or produced within the reactor, and safe operation. The design of STEP will differ from conventional power plants, for example due to a potentially transient heat supply from the reactor, and the heat being divided between multiple heat sources of varying grades for the power conversion system. These unique features will need to be addressed when integrating the design of the power plant with the reactor; the large parasitic loads of the reactor mean that a high cycle efficiency is essential for net electricity generation. The power generation profile of the reactor is not yet known definitively, so it is desirable to develop a framework that can generate potential designs from arbitrary input profiles. Dynamic models of the integrated thermal power cycle are necessary to cater for the potentially varying power input. Further, dynamic models are necessary to investigate the response of the power generation cycle, to incorporate control systems, and to evaluate the performance of alternative designs. Two aspects of the design can then be considered: the process side, such as unit sizing and configurations; and the control system side, including the choice of controlled and measured variables and the tuning parameters of the controllers. This work demonstrates the use of dynamic models within an optimisation framework to optimise the performance of the design for a given input perturbation to the system. Here, the optimisation is limited to the parameters of a single proportional-integral-derivative (PID) controller within a steam Rankine cycle coupled to a thermal energy storage system. 583 mailto:e.fraga@ucl.ac.uk 2. Power plant model The model considered in this work is a steam Rankine cycle, with a 100 MW nominal capacity turbine neglecting any generator losses, coupled to an indirect thermal energy storage system using molten salt as the storage medium, as shown in figure 1. The molten salt receives a fixed heat flow rate of 335 MW from the reactor throughout the simulation. All models are implemented in the Modelica modelling language (Modelica Association, 2021), the numerical solutions for which are calculated using the OpenModelica tool (Open Source Modelica Consortium, 2023). Figure 1: The structure of the steam Rankine cycle with integrated molten salt energy storage system and control system considered for optimisation. A fixed power flow from the reactor to the molten salt is assumed here. The heat exchangers in the Rankine loop are represented by lumped-parameter dynamic models to improve the robustness and computational speed of simulations relative to more detailed discretized models like the finite-volume model. Lumped-parameter models are necessary to allow for the potentially large number of alternative designs which must be evaluated when using optimization-based design methodologies. Heat transfer is modelled using a robust formulation of the logarithmic mean temperature difference for dynamic modelling (AltΓ©s-Buch et al., 2015). The turbine is modelled as a static component using the Stodola equation and constant isentropic efficiency (Hefni and Bouskela, 2019). The pumps are modelled as in the Modelica Standard Library (Modelica Association, 2021), providing an ideally controlled mass flow rate. The molten salt tanks are modelled using lumped dynamic mass and energy conservation equations with no heat loss to the environment (Kannaiyan et al., 2019). The valve is modelled as in Hefni and Bouskela (2019) with a linear characteristic. Pressure drops are modelled before the inlet of each molten salt tank and at the superheater outlet with a proportionality to the mass flow rate squared (Hefni and Bouskela, 2019). A control system is also implemented in the model. Proportional-integral (PI) and proportional-integral-derivative (PID) controllers are used here, the latter of which is represented by the following equation: 𝑒(𝑑) = 𝑒0 + π‘˜πΆ [𝑒(𝑑) + 1 𝜏𝐼 ∫ 𝑒(π‘‘βˆ—)π‘‘π‘‘βˆ— 𝑑 0 + 𝜏𝐷 𝑑 𝑑𝑑 𝑒(𝑑) ] (1) where 𝑒(𝑑) is the controller output, 𝑒0 is the output bias value, 𝑒(𝑑) is the controller error input, π‘˜πΆ is the controller gain, 𝜏𝐼 is the integral time and 𝜏𝐷 is the derivative time (Seborg et al., 2016). The controllers aim to reduce 𝑒(𝑑) 584 to 0 by manipulating 𝑒(𝑑). From equation 1, it can be seen that π‘˜πΆ regulates the magnitude of response for all three actions while 𝜏𝐼, 𝜏𝐷 regulate their respective actions only. As illustrated in Figure 1, three proportional-integral (PI) controllers are present: one regulates the condenser pressure by manipulating the mass flow rate of cooling water through the condenser; one regulates the turbine inlet temperature by manipulating the spray valve opening, which allows water from the preheater to mix with and cool the superheated steam entering the turbine; one regulates the liquid level in the evaporator to prevent flooding or drying out by manipulating the feedwater mass flow rate. Each of these controllers has a fixed set point value 𝑦𝑠𝑝 against which the error is defined as 𝑒(𝑑) = 𝑦𝑠𝑝 βˆ’ π‘¦π‘š for measured value π‘¦π‘š. Further, a PID controller also manipulates the mass flow rate of hot molten salt driving the steam Rankine loop to adjust the turbine’s work output to meet some externally imposed demand as the set point value that can vary during a simulation. As the heat exchangers are the main source of inertia for the system, a PID controller is chosen here over a PI to help stabilize oscillations in the system caused by the integral action and the inertia of the system. The PID parameters are the design variables for the optimization procedure described in the next section. 3. Optimization of a PID controller’s performance Optimization is performed using a nature-inspired plant propagation algorithm (Salhi and Fraga, 2011) as implemented in the Fresa package, written in the Julia language (Bezanson et al., 2017). Fresa is a population- based evolutionary algorithm, inspired by the propagation of strawberry plants. Fresa has previously been used for design problems using dynamic models (Fraga, 2019). It is well suited to the current application as it treats the objective function as a black box, requiring no derivative information of the objectives which would be impractical to calculate due to the system’s complexity, potentially changing structure and discontinuities in the fluid property models (Fraga, 2021). This enables the evaluation of the objective function using an external simulation system: OpenModelica in this case. Additionally, Fresa can be used for multi-objective optimization problems which will be necessary in future work when other factors such as economic costs need to be considered. The Modelica models are simulated within Julia using the OMJulia interface (OMJulia, 2022). For each objective function evaluation, a full simulation is performed by OpenModelica, and relevant quantities can be extracted from the solution to return to the optimizer. Julia’s support of multithreading also allows for faster evaluation of objectives, as each thread can have its own OpenModelica session to perform simulations. The combined use of dynamic simulations within an optimization problem has been seen in other fields; Brunet et al. (2014) presented the multi-objective optimization of the production process of Penicillin V that also integrated economic analysis and process topology decisions. The dynamic process is described by a set of differential algebraic equations, as in this work for thermofluid flows, which is solved using a process simulator. 3.1 Optimization problem The parameters of the PID controller monitoring the turbine power output are to be chosen to improve controller performance. For the objective function, the mean absolute deviation is used as a quantitative measure of controller performance, where the deviation is the difference between the power demand π‘ƒπ‘‘π‘šπ‘‘ [W] and the turbine power output 𝑃𝑑𝑏 [W]. The mean is taken over a time period of 𝑇𝑑𝑒𝑣 [s], starting at time 𝑑0 [s] when a perturbation is applied to the power demand. The perturbation is a 10% drop in the power demand from 100 MW to 90 MW over a period of 150 s and the mean is measured over a period of 𝑇𝑑𝑒𝑣 = 1000 s. The optimization problem is stated as: π‘šπ‘–π‘› π‘˜πΆ,𝜏𝐼,𝜏𝐷 ( 1 𝑇𝑑𝑒𝑣 ∫ |π‘ƒπ‘‘π‘šπ‘‘(𝑑) βˆ’ 𝑃𝑑𝑏(𝑑, π‘˜πΆ , 𝜏𝐼 , 𝜏𝐷)| βˆ™ 𝑑𝑑 𝑑0+𝑇𝑑𝑒𝑣 𝑑0 ) (2) The design variables are the controller gain π‘˜πΆ [kg s-1 W-1], the integral time 𝜏𝐼 [s] and the derivative time 𝜏𝐷 [s]. No infeasibility functions are included in the optimization as every controller design is valid, even if its performance is poor. The valid search domain of the decision variables is defined by an upper and lower bound for each. The upper bound of 𝜏𝐼 and the lower bounds of π‘˜πΆ , 𝜏𝐷 are chosen arbitrarily such that there is at least an order of magnitude difference to the initial design. The other bounds are more challenging as they generally lead to more extreme controller responses, which can lead to issues in the evaluation of process designs. This is discussed more in section 3.2. The integral is calculated by OpenModelica to an accuracy consistent with the process simulation itself. 585 Figure 2: The objective function value (mean absolute deviation) relative to the number of objective function evaluations. Each point is the best solution found by Fresa in each optimization generation. Running the optimization over 10 generations, with a total number of 229 objective function evaluations, a reduction of 97 % is seen in the mean absolute deviation of the turbine power output. Figure 2 shows the evolution of the best solution found by Fresa as a function of the number of evaluations. The rapid decrease in the objective function value seen in figure 2, from 7 function evaluations to 41 over two generations of the Fresa method’s evolutionary procedure, demonstrates the potential effectiveness of the method to find good solutions quickly for complex systems. Ten generations appear to be sufficient to give confidence that a good solution has been obtained, based on the plateauing of the objective function value in figure 2, while ensuring that the computational demands are not excessive. The initial and optimized designs are given in table 1. Table 1: Comparison of the initial and optimized PID controller designs. π‘˜πΆ (kg s-1 W-1) 𝜏𝐼 (s) 𝜏𝐷 (s) Mean absolute deviation (W) Initial design 0.00100 30.0 10.0 11100 Optimized design 0.00318 2.00 8.41 294 3.2 Comparison of optimized controller performance The power deviations of two simulations using the initial and optimized PID controller designs are shown in figure 3, along with the input perturbation to the power demand. Comparable to the drop in the mean absolute deviation, the maximum absolute deviation is reduced by 95 %. The optimized controller is also able to drive the system near to the setpoint within 100 s of the perturbation ending compared with 400 s required by the initial design. The optimized design introduces more oscillations in the response of the system. While the derivative action of a PID controller can be used to reduce oscillations, the presence of oscillations is not yet considered in the objective function. This is a consequence of the choice of the mean absolute deviation as the objective. A possible method to reduce oscillations in the optimized designs is to use an alternative objective function such as the root mean square deviation, the integral of the time multiplied by absolute deviation or a weighted sum of these quantities (Solihin et al., 2008). Proper selection against oscillations may allow for derivative action to be removed from the controller, reducing the number of design variables and the design space to be explored by the optimization. Multi-objective optimization could be used to assess the trade-offs between different objectives by comparing factors such as return to setpoint time and maximum deviation. Note from table 1 that 𝜏𝐼 = 2.00 s for the optimized design. The reason for this apparently precise value is that it is the lower bound for the search space for this variable. This suggests that greater integral action would lower the value of the objective function. However, it is likely that this would also result in more oscillations. This value is chosen for the lower bound as highly oscillatory behaviours pose challenges to the numerical methods in the simulation of the process design. Specifically, oscillatory behaviour leads to smaller time steps in the solution of the differential-algebraic equations, resulting in significant increases in the computation time. As oscillatory responses are not desired, the lower bound has been chosen to define a search space that represents designs with desirable properties, and which can be evaluated with reasonable computational effort. 586 Figure 3: On the left, the power differences between the demand and turbine output are shown for the initial and optimized controllers. The perturbation in the power demand is shown on the right, noting the scale difference. The case study presented has been restricted to a single perturbation in the evaluation of designs. It could be the case that a given design performs well for the chosen perturbation but poorly for another. This will be addressed in the future by simulating multiple scenarios for each design and choosing an objective function that combines a controller performance metric from each simulation. Alternatively, a single simulation that includes a variety of different perturbations could be used. In any case, the methodology presented here will be able to represent such cases. Due to the STEP programme being in the early concept stage, experimental validation is currently out of scope for this work. 4. Conclusion The optimization of a proportional-integral-derivative controller’s dynamic performance within a steam Rankine cycle coupled to a thermal energy storage system has been presented. Controller design is one key step in the generation and evaluation of feasible designs for the STEP fusion power plant being developed by the UK Atomic Energy Authority. The evaluation of the impact of controller design on the performance of a power generation cycle with integrated energy storage was assessed using a dynamic model of the system. The optimization problem has been solved with the Fresa plant propagation algorithm, implemented in the Julia language. Fresa is a population-based stochastic method well suited for black-box optimization problems where objective function evaluations require significant computational effort. In this problem, each function evaluation required a full simulation of the system using OpenModelica, with OMJulia used as an interface, during which a perturbation to the power demand was applied. The mean absolute deviation between the turbine power output and this power demand was then used as the objective function value. Comparison of the initial hand-tuned controller design with the optimized design found by Fresa after 229 objective function evaluations shows a 97 % reduction in the mean absolute deviation, a 95 % reduction in the maximum absolute deviation and a faster return to setpoint after the perturbation has completed. The optimized design however introduces more oscillations in the system than the initial design, despite the inclusion of derivative action in the controller. This is due to the objective function not including any measure of oscillatory behaviour and hence not evaluating this aspect of potential designs. Future work will be to address the issue of oscillations and to ensure designs are not over-fitted to one perturbation. The scope of the optimization will also be expanded to include more design variables. On the control system side, this would cover the parameters of other controllers and possibly the structure of the control system itself. On the process side, the design variables will likely include key component parameters such as molten salt tank sizes and heat exchanger areas. These will then require the inclusion of an economic objective function as part of a multi-objective optimization problem to allow for the assessment of tradeoffs between the cost and the performance of designs. 587 Nomenclature 𝑒 - controller error input, - π‘˜πΆ – controller gain, kg s-1 W-1 π‘ƒπ‘‘π‘šπ‘‘ – power demand, W 𝑃𝑑𝑏 – turbine power , W 𝜏𝐷 – derivative time, s 𝑇𝑑𝑒𝑣 – mean deviation measurement period , s 𝜏𝐼 – integral time, s 𝑑 – time, s π‘‘βˆ— – integration time variable, s 𝑑0 – perturbation start time, s π‘¦π‘š – measured value, - 𝑦𝑠𝑝 – set point value, - 𝑒 - controller output, - 𝑒0 - output bias value, - Acknowledgments This work is partially funded by, and in collaboration with, the UKAEA. References AltΓ©s-Buch Q., Dickies R., Desideri A., Lemort V., Quoilin S., 2015, Dynamic modeling of thermal systems using a semi-empirical approach and the ThermoCycle Modelica library, 28th International Conference on Efficiency, Cost, Optimization, Simulation and Environmental Impact of Energy Systems. Bezanson J., Edelman A., Karpinski S., Shah V. B., 2017, Julia: A Fresh Approach to Numerical Computing, Society for Industrial and Applied Mathematics Review, 59, 65-98. Brunet R., GuillΓ©n-GosΓ‘lbez G., JimΓ©nez L., 2014, Combined simulation-optimization methodology to reduce the environmental impact of pharmaceutical processes: application to the production of Penicillin V, Journal of Cleaner Production, 76, 55-63. Fraga E. S., 2021, Fresa: A Plant Propagation Algorithm for Black-Box Single and Multiple Objective Optimization, International Journal on Engineering Technologies and Informatics, 2, 110-111. Fraga E. S., 2019, An Example of Multi-Objective Optimization for Dynamic Processes, Chemical Engineering Transactions, 74, 601-606. Hefni B. E., Bouskela D., 2019, Modeling and Simulation of Thermal Power Plants with ThermoSysPro, Springer Cham, Cham, Switzerland. Kannaiyan S., Bhartiya S., Bhushan M., 2019, Dynamic Modeling and Simulation of a Hybrid Solar Thermal Power Plant, Industrial and Engineering Chemistry Research, 58, 7531-7550. Modelica Association, 2021, Modelica Language accessed 16.01.2023. OMJulia, 2022, OMJulia.jl accessed 17.01.2023. Open Source Modelica Consortium, 2023, OpenModelica accessed 16.01.2023. Salhi A., Fraga E. S., 2011, Nature-Inspired Optimisation Approaches and the New Plant Propagation Algorithm, Proceedings of ICeMATH 2011, The International Conference on Numerical Analysis and Optimization, K2:1β€”8. Seeborg D. E., Edgar T. F., Mellichamp D. A., Doyle III F. J., 2016, Process Dynamics and Control, 4th Edition, Wiley, Hoboken, USA. Solihin M. I., Wahyudi, Kamal M. A. S. Legowo A., 2008, Objective Function Selection of GA-Based PID Control Optimization for Automatic Gantry Crane, Proceedings of the International Conference on Computer and Communication Engineering, 883-887. UKAEA, 2023, Spherical Tokamak for Energy Production accessed 12.01.2023. 588 94ward.pdf Optimization of a PID Controller within a Dynamic Model of a Steam Rankine Cycle with Coupled Energy Storage