ThermalSystemsControlLibrary: A Modelica Library for Developing Control Strategies of Industrial Energy Systems

The transformation of energy-intensive industries towards greenhouse gas neutrality leads to increasing complexity of industrial energy supply systems. This affects particularly thermal energy systems due to waste heat utilization measures as well as the integration of renewable energy sources and further storage capacities. This complexity is also reflected in the control strategies of such systems, which makes the development of dynamic simulation models for testing them a research field of growing interest. The ThermalSystemsControlLibrary is a novel Modelica library, which aims at standardized modeling of industrial energy supply systems for control strategy development. Based on a generic data model, all components cover physical as well as control modeling and are particularly suitable for testing supervisory control strategies within external frameworks using the FMI standard. The library is validated for an exemplary use case of an industrial energy supply system comparing two different supervisory control strategies.


Introduction
Global aspirations towards greenhouse gas neutrality as well as consequences of geopolitical developments force industrial companies to increasingly consider energy related aspects.In addition to sustainability, also affordability as well as resilience must be addressed from an industrial perspective.Therefore, measures like diversification, redundancy as well as de-centrality will be prevalent in future energy supply systems (Fridgen, Keller, Körner, & Schöpf, 2020;Lund et al., 2021).Apart from the positive effects of these measures, they tend to increase the complexity of the underlying system.To master this complexity throughout the operation of the system, control strategies must be developed and implemented.Here, not only local control functions (e.g., temperature control loop) but also supervisory control functions (e.g., converter sequencing control) must be considered (Wang & Ma, 2008).In research, many different approaches exist for the latter.Those can be differentiated for example by the nature of the underlying model (e.g., reinforcement-learning) as well as the degree of centralisation (e.g., multi-agent system) (Yao, Hu, & Varga, 2023).Here, detailed simulation models can still be beneficial for validation of the developed control strategies.
For that, we present a Modelica library which enables developers and users to model the physical systems' behavior as well as the corresponding control strategy.We primarily focus on fluid-bound thermal energy supply systems, due to the relevance of heating and cooling supply in industry.

State of research
The following section focuses on existing Modelica libraries and modeling approaches, as the multi-domain capabilities of Modelica are particularly suitable for the described application.The research field can be separated in two major fields: modeling of physical system behavior and control functions.Regarding the physical system behavior, a profound research base already exists.Here, Modelica-libraries such as AixLib, Buildings and BuildingSystems are stateof-the-art and can be applied depending on the users' needs (Müller, Remmen, Constantin, Lauster, & Fuchs;Nytsch-Geusen, Huber, Ljubijankic, & Rädler, 2013;Wetter, Zuo, Nouidui, & Pang, 2014).However, these Modelica-libraries inherit only basic functionalities for system control.An approach which focuses on the development of automation and control programs is presented in (Wetter et al., 2022).Here, a workflow is presented for the design, verification, and deployment of control sequences.An exemplary implementation is included in the Modelica Buildings Library 7.0.0.Modelica-aspects are more intensively addressed in (Schneider, Pessler, & Steiger, 2017).Here, the BuildingControlLib is presented, which allows the modeling and simulation of standardized control functions.(Wüllhorst et al., 2022).Furthermore, Modelon Impact provides a web-based tool for modeling and virtual testing of industrial energy systems (Modelon, 2023).

Research gap and requirements
The approaches described beforehand outline, that the modeling of physical systems as well as control functions are often addressed separately within the research community.However, Modelica already offers standard models for the development of rule-based operating strategies, which are still necessary as a fallback strategy in combination with intelligent approaches when applied to real-world systems.By the integration of an additional interface, which allows for switching between the fallback strategy in Modelica and an intelligent strategy within an external framework (e.g., reinforcement learning in Python), a Modelica library would represent the automation architecture of such a system in more accurate way and accounts for the simulation of operation permissions of the external strategy.
In addition, the modeling of local-control loops in Modelica is often regarded only on a small scale.
Requirements caused by more complex system, such as cascading of multiple local control-loops as well as sequencing of multiple components, are not addressed in detail so far.
The requirements for a Modelica library in the given research field can be summarized as follows: • Standardized development of physical and control models through provision of base classes • Provision of base methods for more complex control tasks • Hierarchical package structure for development and testing of (system) models • Consistent variable declaration and data model representing the automation architecture of realworld systems

Automation data model for industrial energy systems
To develop a Modelica library that meets the above mentioned requirements, we use our previously published automation data model for the energy-flexible cyberphysical production systems (Fuhrländer-Völker, Borst, Theisinger, Ranzau, & Weigold, 2022).The properties and methods of this model form the basis for the developed model library and are briefly summarized in the following.The model consists of three base classes to abstract the control functions of single actuators and systems of multiple actuators: • Actuator2Point: Actuator with discrete behavior (e.g., uncontrolled pump) • ActuatorContinuous: Actuator with continuous behavior (e.g., speed-controlled pump) • SystemContinuous: System consisting of several actuators and sensors with continuous behavior (e.g., boiler with distribution pump and mixing valve).
These base classes implement two essential key methods, which will be reused within the Modelica libary: • SelectControlMode: Enables switching between the automatic control (e.g., fallback strategy) and algorithm mode (e.g., reinforcement learning) • SystemFlowControl: Sequential component control of the actuators within a system.
Furthermore, we propose standard data structures to ensure a high comprehensibility of the data model.Therefore, we define the following structures holding the related variables.
• control: access and discrete control variables • systemState: current system state.

Library concept
In the following, the structure of the developed ThermalSystemsControlLibrary (TSCL) and the underlying base classes for component as well as system modeling are explained.After introducing the main structure as well as the base classes, we describe the general procedure for system modeling.All components are based on the Modelica Standard Library (MSL, version 3.2.3).

Overall structure
The library follows in its basic structure existing Modelica libraries (Modelica Association, 2020).Therefore, we introduce the packages User's Guide, BaseClasses, Components and Applications (see Figure 1).While the User's Guide contains basic license and usage information, the BaseClasses package consists of the subpackages AutomationBaseClasses, FluidBaseClasses, Utilities, Media and Icons.AutomationBaseClasses holds all classes, functions and interfaces of the underlying data model, which must be used for component and system modeling with the TSCL.A component model represents an individual system, whereas a system model consists of multiple component models.The physical model part uses Modelica.Fluid connectors, whose basic properties are defined within the package FluidBaseClasses.Their use is also mandatory for TSCL-based models.The other base class packages hold utility functions, media declaration and icon models.The Components package contains subpackages for each technology.These always contain a control method package, a package for physical models and the component itself, consisting of the control and physical model.The Applications package holds exemplary use cases, which demonstrate possible applications of the TSCL.Here, a package structure consisting of records holding use case specific parameters, system models, thermal networks, operating strategies, and the main model may be used.

Base classes
One of the main features of the TSCL lies in the implementation of the AutomationBaseClasses package for standardized component and system control.The package is structured in the base classes and packages for interfaces, methods, and tests.The implementation follows largely the introduced data model, but is extended for the implementation of local control functions (Fuhrländer-Völker et al., 2022).The ActuatorContinuousLocalControlMode class enables the standardized implementation of multiple control modes for one actuator.This feature is also applied to the SystemContinuousLocalControlMode, which considers the implementation of control modes concerning multiple components within a system (e.g., thermal storage with loading and unloading pump).Figure 2 shows the overall architecture of the AutomationBaseClasses.Within the Interfaces package, several connectors implement the hierarchical data structure introduced in (Fuhrländer-Völker et al., 2022).In addition, we provide FMI connectors, giving the user reading and writing permission on sub-level variables within Functional Mock-Up Units (FMU) based on the underlying data model (Fuhrländer-Völker et al., 2022).Usually, input variables of a FMU can only be set when propagated to the top level of the model, which would be not in accordance with our data model.Using the FMI connectors results in a fully compatible implementation of the hierarchical data model.Following this, name strings for accessing the variables of the FMU are fully compatible to the Open Platform Communications Unified Architecture (OPC UA) identifiers from a Programmable Logic Controller (PLC).Thus, OPC UA nodes for controlling the real-world device can be accessed the same way like for the FMU, which makes time-consuming variable mapping obsolete.In summary, this enables the virtual commissioning of the implemented systems.Regarding the key methods of the data model, the sequence control enabling method SystemFlowControl, is the only method, which is extensively revised against (Fuhrländer-Völker et al., 2022).The application of the data model to numerous systems has shown that the machine states defined in (ISO, 2017) are suitable for the implementation of machine tools, but not for the implementation of energy supply systems due to the limited number of states.Therefore, this limitation of system states is removed, resulting in the basic sequence control, which is shown in Figure 3

Components
Component models follow the structure shown in Figure 4 and consist of a physical model part based on Modelica.FluidPorts, the base class control part, and a local, component-specific control unit.Furthermore, each component has standardized control and state interfaces, which are implemented by the underlying automation base class.Based on this modeling structure, the TSCL provides the following component models: pipes, valves, buffer storages, heat exchangers, pumps, condensing boilers, combined heat power units (CHP), compression chillers, dry coolers, and generic heat consumers.All component models are parameterized by records.

Modeling procedure
Modeling with the TSCL follows a three-step procedure consisting of technology, system, and scenario modeling (see Figure 5).During the first step, the generic component records are extended by use case-specific parameters.After that, subsystems implementing the physical interactions of component models and especially their sequence control are modeled.Secondly, several subsystems may be combined in a supply system model.This is especially useful for complex structures, e.g.multiple networks of different supply temperatures.The control variables of the subsystems within a supply system should be defined by use case-specific connectors which allows using the same physical model with different control strategy models.Afterwards, the control strategy, which enables the toplevel system control, is implemented.Here, supply temperatures and prioritization of energy supply as well as storage systems are implemented.Thirdly, the developed strategy models are combined with the supply system model to set up different scenarios.Finally, the scenarios may be evaluated in simulation studies.

Use case -ETA Research Factory
According to the described modeling procedure, the heat supply system of the ETA Research Factory of the Technical University of Darmstadt is partly modelled as a validation use case.In the following section the overall system topology, the parameterization of network components and the basic operating strategy is described.

Overall system topology
The use case comprises of two connected heating networks, operating on a high and low temperature level.The high temperature heating network (HNHT) includes two combined heat and power units and a condensing boiler.For active heat storage, a vacuum super insulated (VSI) heat storage is integrated in the HNHT.For the decoupling of production and consumption, a buffer storage is used as a hydraulic separator.A static heating represents the consumer in the HNHT.Furthermore, a counterflow heat exchanger connects the HNHT to the heating network low temperature (HNLT) and acts as a heat producer in the HNLT.The consumer side comprises an underfloor heating, which is connected to the producer side through a buffer storage.

Supervisory control strategy
For the supervisory control strategy of the thermal supply systems, temperature limits for both networks are defined.The prioritization of the producers is tuned by defining di erent o sets or the produ ers' set points, which are controlled by hysteresis controllers.Following the nomenclature of the data model, the fSetPointAutomatic of the producers is defined by the target temperatures of the HNHT and the HNLT.The hysteresis controllers prioritize the condensing boiler against the CHP units and control the operation variable bSetStatusOn for all systems.The fSetPointAutomatic of the consumers, static heating in the HNHT and underfloor heating in the HNLT, is set according to the heating characteristic, determined by the outdoor temperature.

Application
In the following section, we validate the TSCL for the use case of the ETA Research Factory.We first demonstrate the system modeling procedure for an exemplary CHP system and then present the results from comparing two operating strategies using the TSCL.

Subsystem modeling for a CHP system
Figure 6 shows the implementation of an exemplary CHP system.For this, the base class SystemContinuous is extended to provide basic control functions.The system consists of a discrete valve, a rotational pump, a mixing valve, a heat meter and the CHP unit.For the physical part of the model, all components are connected by Modelica.FluidPorts.All components have identical control interfaces due to the use of the same base classes (see Figure 2).The system control enables the state dependent start and stop process of the components.In this case, discrete and mixing valve, pump and CHP are started in sequence.The time delay is thereby modeled by component-internal PT1-elements.The component control (nControlMode) implements a flow temperature control for the CHP, a differential temperature control of 15 K for the mixing valve and constant speed control for the pump.All other systems described in section 3 follow this modeling approach and are instantiated in two supply system models for HNHT and HNLT.Both supply systems are completed by specific control connectors forwarding the control signals from the supervisory control.The supervisory control strategy models consist of several sub-models for the implementation of supply system-specific prioritization of the subsystems.The complete modeling example is located within the Applications package of the TSCL repository.

Results
Figure 7 shows the simulation results of the supply system model of the ETA Research Factory considering two different supervisory control strategy models.In the baseline scenario, it is assumed that the temporal decoupling of heat production and consumption is exclusively enabled by a buffer storage.To reduce the number of operation cycles of heat producers, the VSI heat storage is used as an additional, controllable heat storage.The simulation duration for both scenarios is set to 24 hours.For the baseline scenario, the strongly fluctuating demand within the HNLT leads to many operation switching cycles of the condensing boiler and CHP (see Figure 7a).
In addition, the allowed temperature range in the HNHT is very small (see Figure 7b).By considering the VSI heat storage in the supervisory control strategy, the operating cycle of the heat producers can be significantly reduced (see Figure 7c).The additional storage is used after switching on the CHP and enables a longer operation time of the condensing boiler and the CHP.From 6:30 a.m. to 5 p.m., the heat demand is exclusively covered from the previously loaded VSI heat storage.This leads to a continuously decreasing storage temperature while the buffer storage temperature remains within the allowable range.As soon as the temperature of the VSI heat storage is too low to meet the supply requirements, the condensing boiler and the CHP are started to heat up the buffer storage and then the additional storage.Finally, the simulation study validates that the integration of an additional heat storage including an optimized supervisory control strategy, leads to a reduction of switching cycles from 14 to 2 within 24 hours.

Conclusion
The ThermalSystemsControlLibrary is the consistent implementation of our previous published data model for the energy-optimized control of industrial energy supply systems.Because of its flexible base classes, which already implement lots of control functions that are necessary for using the model in combination with intelligent control strategies within external frameworks, it allows the rapid modeling of complex infrastructure and enables virtual testing of supervisory control strategies.Moreover, all models implement a data model conform FMI interface, so they can be easily used to validate control strategies operating in external frameworks.
Up to now the TSCL has only been validated for the heat supply systems of the ETA Research Factory.Future work should therefore address modeling other use cases, especially cooling supply systems consisting of more complex supply technologies (e.g.absorption chillers).Furthermore, it should be noted that the library is limited to the modeling of fluid systems.In the future, additional base classes to model sector coupling technologies could be also addressed.approaches should be investigated.This may also include the real-time capability of the modeling approach to enable the implementation of digital twins.
ThermalSystemsControlLibrary: A Modelica Library for Developing Control Strategies of Industrial Energy Systems 210 Proceedings of the Modelica Conference 2023 October 9-11, 2023, Aachen, Germany DOI 10.3384/ecp204209

Figure 4 .
Figure 4. Component and system model structure.

Figure 6 .
Figure 6.Modelica model of exemplary combined heat power system.

Figure 7 .
Figure 7. Simulation results for the control strategy without (a-b) and with an active storage (c-d).
Finally, the performance of cosimulations in combination with different optimization (Blum et al., 2021) a framework for simulation-based testing of control-strategies in buildings(Blum et al., 2021).Therefore, Modelica blocks are developed, which enable overwriting local control-functions.By that, different control approaches can be tested and compared in a robust manner.Wüllhorst et al. also present with BESMod a library for the development of supervisory control functions for building energy systems .