원시데이터 수집 시스템
선정목록으로

Safe reinforcement learning for multi-energy management systems with known constraint functions

관련 필름·전자재료 · (18) VENT(방수통기 부품)

기본 정보

저자
  1. Glenn Ceusters — ABB, Hoge Wei 27, 1930 Zaventem, Belgium|||Vrije Universiteit Brussel (VUB), AI-lab, Pleinlaan 2, 1050 Brussels, Belgium|||Vrije Universiteit Brussel (VUB), ETEC-MOBI, Pleinlaan 2, 1050 Brussels, Belgium
  2. Luis Ramirez Camargo — Copernicus Institute of Sustainable Development - Utrecht University, Princetonlaan 8a, 3584, CB Utrecht, Netherlands|||Vrije Universiteit Brussel (VUB), ETEC-MOBI, Pleinlaan 2, 1050 Brussels, Belgium
  3. Rüdiger Franke — ABB, Hoge Wei 27, 1930 Zaventem, Belgium
  4. Ann Nowé — Vrije Universiteit Brussel (VUB), AI-lab, Pleinlaan 2, 1050 Brussels, Belgium
  5. Maarten Messagie — Vrije Universiteit Brussel (VUB), ETEC-MOBI, Pleinlaan 2, 1050 Brussels, Belgium
DOI
10.1016/j.egyai.2022.100227
저널
Energy and AI
발행년도
2022
발행기관
Elsevier BV
피인용수
25
라이선스
cc-by-nc-nd
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1016/j.egyai.2022.100227
토픽
Fuel Cells and Related Materials
OpenAlex ID
W4312221761

평가 내용

관련도
관련
사업분야
필름·전자재료 · (18) VENT(방수통기 부품)
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
임베딩 유사도 기반 평가로 '필름·전자재료 > VENT(방수통기 부품)' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Reinforcement learning (RL) is a promising optimal control technique for multi-energy management systems. It does not require a model a priori - reducing the upfront and ongoing project-specific engineering effort and is capable of learning better representations of the underlying system dynamics. However, vanilla RL does not provide constraint satisfaction guarantees — resulting in various potentially unsafe interactions within its environment. In this paper, we present two novel online model-free safe RL methods, namely SafeFallback and GiveSafe, where the safety constraint formulation is decoupled from the RL formulation. These provide hard-constraint satisfaction guarantees both during training and deployment of the (near) optimal policy. This is without the need of solving a mathematical program, resulting in less computational power requirements and more flexible constraint function formulations. In a simulated multi-energy systems case study we have shown that both methods start with a significantly higher utility compared to a vanilla RL benchmark and Optlayer benchmark (94,6% and 82,8% compared to 35,5% and 77,8%) and that the proposed SafeFallback method even can outperform the vanilla RL benchmark (102,9% to 100%). We conclude that both methods are viably safety constraint handling techniques applicable beyond RL, as demonstrated with random policies while still providing hard-constraint guarantees.

본문 38,752자

본문 펼치기
Reinforcement learning (RL) is a promising optimal control technique for multi-energy management systems. It does not require a model a priori -reducing the upfront and ongoing project-specific engineering effort and is capable of learning better representations of the underlying system dynamics. However, vanilla RL does not provide constraint satisfaction guarantees -resulting in various potentially unsafe interactions within its safety-critical environment. In this paper, we present two novel safe RL methods, namely SafeFallback and GiveSafe, where the safety constraint formulation is decoupled from the RL formulation. These provide hard-constraint, rather than soft-and chance-constraint, satisfaction guarantees both during training a (near) optimal policy (which involves exploratory and exploitative, i.e. greedy, steps) as well as during deployment of any policy (e.g. random agents or offline trained RL agents). This without the need of solving a mathematical program, resulting in less computational power requirements and a more flexible constraint function formulation (no derivative information is required). In a simulated multi-energy systems case study we have shown that both methods start with a significantly higher utility (i.e. useful policy) compared to a vanilla RL benchmark and Optlayer benchmark (94,6% and 82,8% compared to 35,5% and 77,8%) and that the proposed SafeFallback method even can outperform the vanilla RL benchmark (102,9% to 100%). We conclude that both methods are viably safety constraint handling techniques applicable beyond RL, as demonstrated with random policies while still providing hard-constraint guarantees. • Better policies can be found starting with an initial safe fallback policy Introduction Energy systems continue to become increasingly interconnected with each other as the energy technologies that allow for this sector coupling are more mature and are being more widely implemented. This allows for an integrated control strategy that further can enhance the overall efficiency and performance of these so-called multi-energy, -carrier, -commodity or -utility systems. Furthermore, these multi-energy systems allow for the utilization of the flexibility (i.e. storage, controllable loads) within and across all energy carriers. This integrated control strategy then typically [1] has an economic or environmental oriented objective function or a combination thereof and therefor being multi-objective. Introduction To ensure the optimum or Pareto optimum level of operation of such multi-energy systems, specific set-points are required to establish and maintain the desired objective (e.g. minimization of the energy costs or CO 2 -equivalent emissions) while still fulfilling all system constraints [2]. As flexibility utilization exhibits dynamic behaviour and introduces a dependency between successive time steps, optimisation across (or considering) numerous time steps is necessary. Additionally, multiple uncertainties (i.e. variation in demands, pricing and weather) need to be managed so that the stability of the multi-energy system is preserved. Introduction Model-predictive control (MPC) and reinforcement learning (RL) have recently been benchmarked within such a multi-energy management system context [3]. Ceusters et al. showed that RL-based energy management systems do not require a model a priori and that they can outperform linear MPC-based energy management systems after training. However, vanilla RL (see Figure 1a) performs a large number of potentially unsafe interactions within its environment, which is unacceptable in many real-world applications. For example, in a multi-energy system, neglecting the crucial energy balance constraint could result in either under-or over-production. For most power systems this imbalance could result in exceeding the maximum power capacity to or from the grid -especially relevant with the expected large-scale integration of electric vehicles. Moreover, this imbalance is particularly problematic for energy systems that are not connected to a larger power distribution grid or a district heating system and therefore lack a higher level of control. In this case the imbalance could lead to loss of user comfort (e.g. power or heat outages). Introduction Therefore, our goals is to ensure that every interaction with the underlying environment (a multi-energy system in our case study) satisfies a given set of safety constraints, independently of the used (optimal) control technique (see Figure 1b). This compared to formulating a specific safe RL algorithm which allows that future -presumably better -optimization algorithms can easily be used instead. . block diagrams comparison: the feasibility of the RL agent's actions, being in a given state, are always checked against the a priori constraint functions acting as a safety layer -shielding the environment from unsafe (control) actions. Note that, we assume that the continuous unconstrained error handling (i.e. minimization of the difference between a desired set-point and a measured process variable) is performed by proportional-integral-derivative (PID) controllers. Contribution and outline Our contributions can, to the best of our knowledge, be listed as the following: Contribution and outline • Online model-free safe RL method which provides hard-constraint, rather than soft-and chance-constraint, satisfaction guarantees that has a significantly higher initial utility; • Decoupling architecture of safety constraint formulations from the RL formulation so that future -presumably better -optimization algorithms can easily be used instead; • Hard-constraint satisfaction without the need of solving a mathematical program, resulting in less computational power requirements and a more flexible constraint function formulation (no derivative information is required); • Demonstration of safe RL-based energy management on a detailed multi-energy system simulation environment. Contribution and outline In section 2 related work is discussed and our research question is formulated, section 3 introduces the proposed methodologies, while in section 4 the tool chain, the simulated multi-energy system environment, the safety layer, the RL agent and the evaluation procedure are presented. Furthermore, section 5 discusses the results and provides directions for future work while section 6 presents the conclusion. Finally, Appendix A shows time series visualizations of the different policies, Appendix B the pseudo-code of the specific RL agent (TD3) and Appendix C the run-time statistics. Related work In recent years, there have been numerous of works that proposed RL for various applications within energy systems as reviewed by e.g. [4], [5] and [6]. The majority of these applications can be classified under a broader energy management problem. RL based energy management systems have even been proposed and demonstrated within the more specific (and arguably more challenging) multi-energy systems context. For example, Rayati et al. [7] were some of the first to apply RL, specifically Q-learning [8], for the energy management of a simulated multi-energy residential building, which they later extended with demand-side management capabilities [9]. Posteriorly, Mbuwir et al. [10] successfully applied RL (Q-learning) for a battery energy management system within a simulated residential multi-energy system. They inlcuded a back-up policy to over-rule the actions of the RL agent in case of constraint violation. Furthermore, Wang et al. [11] used a path tracking interior point method and a RL algorithm (Q-learning) for a bi-level interactive decision-making model with multiple agents in a regional multi-energy system. A multi-agent RL (Q-learning) approach was also proposed by Ahrarinouri et al. [12] and this for the energy management of a simulated residential multi-energy system. Around the same time, Ye et al. [13] proposed the usage of a deep RL algorithm, specifically a deep deterministic policy gradient (DDPG) [14] with a prioritized experience replay strategy, again within a simulated residential multi-energy system. Moreover, Xu et al. [15] demonstrated an industrial multi-energy scheduling framework using a RL (Q-learning) based differential evolution approach that adaptively determines the optimal mutation strategy and its associated parameters. While Zhu et al. [16] demonstrated a multi-agent deep RL energy management system, using multi-agent counterfactual soft actor-critic (mCSAC) [17], for a simulated multi-energy industrial park. Furthermore, Ceusters et al. [3] presented an onand off-policy multi-objective model-free RL approach, using proximal policy optimisation (PPO [18]) and twin delayed deep deterministic policy gradient (TD3 [19]) and they did benchmark this against a linear MPC -both derived from the general optimal control problem. They showed, on two separate simulated multi-energy systems, that the RL agents offer the potential to match and outperform the MPC. While, Zhang et al. presented a series of works [20][21][22] for the (near-to) optimal scheduling of an integrated energy system (a.k.a. multi-energy system) using deep reinforcement learning both for a single-and multi-objective and Zhang et al. [23] lather extended this for distributed multi-energy systems using multi-agent deep reinforcement learning. Related work However, as RL inherently requires the interaction with its environment, adequate measures are required to avoid the violation of the environmental specific constraints both during online training as during pure policy execution (e.g. after training a policy offline). All the works above have, knowingly (and thus reported as such) or non-knowingly, either neglected these specific environmental constraints or greatly simplified them -limiting the real-world use cases. Related work In one of the first attempts to combine both hard-constraint satisfaction and RL in energy systems, Venayagamoorthy et al. [24] presented an intelligent dynamic energy management system for a smart microgrid using an action-dependent heuristic dynamic program, a type of adaptive critic design-based controller. They furthermore used an evolutionary algorithm to improve the dispatch solution over time and rejected candidate solutions that did not satisfy the critical load fulfillment constraint relying on power balancing rules and an initial decision-tree energy management system. Furthermore, Zhang et al. [25] proposed a bi-level power management system of networked microgrids in an electric distribution systems. At the first level, a cooperative agent employs an adaptive model-free RL algorithm, to find the optimal retail price signals for the microgrids. While on the second level, each model-based microgrid controller solves a constrained mixed integer nonlinear program, based on the received price signal from the RL agent. Also, Zhao et al. [26] proposes a knowledge-assisted RL framework by combining a low-fidelity analytical model with a RL agent for a cooperative wind farm control problem. When the RL agent selects a naive action, a constraint action is calculated by solving an optimization problem using that analytical model. However, in all these cases it remains a heavy reliance on a prior physical models that are used in a separate optimization problem. Such developments contain a presumed transition function, a separated objective function (separated from the reward signal, which can introduce bias) and constraint functions -and thus not only constraint functions. Related work Nevertheless, recently and independent from this work, Park et al. [27] devised a novel RL algorithm, inspired by OptLayer [28], namely distance-based incentive/penalty Q-learning (DIP-QL) which also does not assume an a prior transition function and only uses constraint functions to provide hard-constraint guarantees as they demonstrated on a microgrid control problem. Yet, it uses a deep Q-learning algorithm as the backbone for their proposed method -where we propose to decouple the constraint handling from the RL algorithm so that futurepresumably better -optimization algorithms (as our framework is not limited to RL) can easily be used instead. Related work Concerning safe RL beyond the energy systems management field, García and Fernández [29], in a comprehensive review, identified and classified two broader approaches: (1) modifying the optimality criteria with a safety factor; (2) modifying the exploration process by incorporating external knowledge or the guidance by a risk metric. More recently, Dulac-Arnold et al. [30] identified nine challenges that must be addressed to implement RL in real-world problems, including safety constraint violation. Furthermore, Brunke et al. [31] provided a broader safe learning review across both the control theory research space as well as the RL research space. More specifically, they showed (1) learning-based control approaches that start with an a priori model to safely improve the policy under the uncertain system dynamics, (2) safe RL approaches that do not need a model or even constraints in advance -but then also do not provide strict safety guarantees (yet encourages safety or robustness), and (3) approaches that provide safety certificates of any learned control policy. Related work The reviewed literature shows that RL is a promising and widely proposed approach for various applications in energy systems (and other domains, not discussed here), as well as for energy management systems specifically. It is also clear that the transition of RL towards real-world applications is not trivial and requires special attention concerning safety. Multiple safe (reinforcement) learning approaches exist, ranging in level of safety namely (from lower to higher level): (1) soft-constraint satisfaction, (2) chance-constraint satisfaction and (3) hard-constraint satisfaction. However, model-free safe RL where the safety constraint formulation is decoupled from the RL formulation and which provides hard-constraint, rather than softand chance-constraint, satisfaction guarantees both during training a (near) optimal policy (which involves exploratory and exploitative, i.e. greedy, steps) as well as during deployment of any policy (e.g. random agents or offline trained RL agents). This without the need of solving a mathematical program has -to the best of our knowledge -never been proposed and demonstrated for the energy management of multi-energy systems. Proposed methodology Following the standard RL formulation of the state-value function, yet extending this towards constraints subjection, the objective is to find a policy π, which is a mapping of states, s ∈ S, to actions, a ∈ A(s), that maximizes an expected sum of discounted rewards and is subject to constraint sets X and U: Proposed methodology where E π is the expected value, following the policy π, of the rewards R discounted with the discount factor γ over an infinite sum at any time step t. Note that Equation 1a is a discrete 1 time-invariant infinite-horizon stochastic optimal control problem, as also indicated in [3], yet differs from the standard formulation of RL due to the a priori constraint functions in the sets X and U. We acknowledge that methods without a priori constraint functions exists, yet this can -under the state-of-the-art -only reach safety level 2 at best (chance-constraint satisfaction) [31]. Rather than proposing a specific safe RL algorithm, we propose to decouple the a priori constraint function formulation from the (RL) agent so that any (new RL) algorithm can be used -while always guarantying the hard-constraint satisfaction. 1 as the continuous error handling is performed by PID-controllers, see Figure 1 Although the proposed algorithms are conceptually simple, we will later show its effectiveness on a multi-energy system (which includes a non-grid connected thermal system). SafeFallback method The first method we propose relies on an a priori safe fallback policy π sa f e , which typically can be derived through classic control theory in the form of a set of hard-coded rules such as a simple rule-based policy (e.g. a priority-based energy management strategy -which is commonly available or easily constructible -see subsection 4.4 for the safe fallback policy of the considered case study). As we furthermore assume that the constraint functions are given, we can simply check if the selected actions a while in state s satisfy the constraint conditions. When the constraints conditions are satisfied, the selected actions a are considered to be safe actions a sa f e and are then executed in the environment so that the next state s , the reward r and done signal d are observed -which is the regular experience tuple (s, a sa f e , r, s , d) for the RL agent. However, if the constraint conditions are violated, the selected action a is overruled by the safe action a sa f e using the a priori safe fallback policy π sa f e . Now not only the experience tuple (s, a sa f e , r, s , d) is formed, but also the experience tuple (s, a, r − c, s , d) containing the infeasible action and additional negative reward (i.e. cost, c). The pseudo-code is given in algorithm 1. Our second method does not require an a priori safe fallback policy, yet relies on the RL agent itself to pass safe actions a sa f e -which can again be checked by the given constraint conditions. If the selected actions a while in state s passes the constraint check, the safe actions a sa f e get executed in the environment and a regular experience tuple (s, a sa f e , r, s , d) is received. However, if the constraints get violated the RL agent receives the experience tuple (s, a, r − c, s, d). Hence, the transition towards the next state is not observed (as the infeasible action is not executed) and a cost c (i.e. negative reward) is given. The RL agent then selects a new action a and a new constraint check is done. This is repeated until the constraint check gets passed and the selected action is considered to be a safe action a sa f e . This safe action is then executed in the environment and a regular experience tuple is received. The pseudo-code is given in algorithm 2 and a graphical representation, in the form of a Markov Chain, in Figure 2. is not executed in the environment so no transition to the next state S t+1 is observed and a cost C t is given. When the selected action is feasible (satisfies the constraints), that safe actions A sa f e t is executed in the environment so a transition to the next state S t+1 is observed with probability p(s t+1 | s t , a t ) and a reward R t is given. Toolchain A multi-energy systems simulation model, that was developed in [3], was used as it allowed for the verification of the safety critical operation (e.g. if all energy demands are fulfilled) of the multi-energy system without consequences (i.e. without the risk of violating real-life constraints and its associated harm). It is a Modelica [32] model, as it allowed for the convenient construction of the real-life presumed system dynamics using multi-physical first-principle equations and due to the available highly specialized libraries, elementary components and its object-oriented nature. Toolchain This Modelica model is then exported as a co-simulation functional mock-up unit (FMU), similar to [33] , and wrapped into an OpenAI gym environment [34] in Python, similar to [3,35]. The architecture of the tool-chain is shown in Figure 3. Notice that the Differential Algebraic Equations solver is part of the co-simulation FMU and that the do_step() method in PyFMI [36] is used over simulate() -again as in [3] due to the significant run-time speed-up when initialized properly. Simulation model The considered multi-energy system is similar to the one from [3], yet without the gas turbine (back-up genset) 2 , and has the following structure: It includes (from left to right, from top to bottom): an electric transformer, a wind turbine, a photovoltaic (PV) installation, a natural gas boiler, a heat pump (HP), a combined heat and power (CHP) unit, a thermal energy storage system (TESS) and a battery energy storage system (BESS). The dimensions of the considered multi-energy system are also from [3] and are summarised in Table 1 Simulation model where Q t boil , Q t hp , Q t chp and Q t tess are the thermal powers of the natural gas boiler, the heat pump, the combined heat and power unit (CHP) and the thermal energy storage system (TESS) respectively while P t hp , P t chp and P t bess represent the electrical powers of the heat pump, CHP and battery energy storage system (BESS), all constraint by its associated minimal and maximal power (see Table 1). Furthermore, γ t boil , γ t hp and γ t chp are binary variables that turn on/off the given asset (i.e. as the minimal powers are not zero). Yet these constraints, i.e. Equation 2a till Equation 2e, are easily handled by the dimensions of the (control) action space itself, i.e. Equation 4b till Equation 4f, and therefor do not require a specific constraint check. Simulation model While the electrical energy balance is always fulfilled (given the assumption that the electrical grid connection is sufficiently large), the thermal energy balance (Equation 2f) does require special attention in order to achieve hard-constraint satisfaction. No additional constraints are considered in this case study (e.g. ramping rates, minimal run-and down-time) as energy balance equations are considered to be the most limiting constraints in energy management problems. Writing out the thermal energy balance in more detail and relaxing the equality constraint formulation (towards an inequality constraint) then becomes: Simulation model where A t are the (control) actions, η the energy efficiencies, COP the coefficient of performance, SOC the state of charge and T various specific temperatures (i.e. T t boil the return temperature to the boiler, T t evap the evaporator temperature of the heat pump, T t cond the condenser temperature of the heat pump, T t env the environmental air temperature and T t tess the average temperature in the stratified hot water storage tank). We set Q tol to be 15,0% of the total Q t demand in the evaluation period, which we acknowledge to be relatively high -yet is chosen to keep the computational complexity low (Appendix C). Note that the different functions f (·) from Equation 3c are typically not trivial to model accurately. Therefor we assume the availability of a historical dataset to supervisory learn (using a Random Forest Regression algorithm) the function between the thermal power and the action directly (i.e. Q t asset = f (A t asset , χ t asset )), with the possibility to include informative exogenous variables χ t asset . Safe fallback policy As presented in subsection 3.1, algorithm 1 relies on an a prior safe fallback policy π sa f e which can be any (non-optimal) policy that satisfies the constraints and can typically be provided by domain experts. In our case study this is a simple priority rule: Safe fallback policy Note that, for clarity concerns, the policy has been written out in terms of thermal power outputs yet is still converted to actions A t chp and A t boil as going from Equation 3a to Equation 3b. Energy managing RL agent The fully observable discrete-time Markov decision process (MDP) is formulated as the tuple S, A, P a , R a so that: Energy managing RL agent where E t th is the thermal demand, E t el the electrical demand, P t wind the electrical wind in-feed, P t solar the electrical solar in-feed, X t el the electrical price signal (i.e. day-ahead spot price), SOC t tess the state-of-charge (SOC) of the TESS, SOC t bess the SOC of the BESS, h t the hour of the day and d t the day of the week all at the t-th step, which consitute the state-space S. The action-space A includes the control set-points from, A t boil the natural gas boiler, A t hp the heat pump, A t chp the CHP unit, A t tess the TESS and A t bess the BESS all between a minimum and maximum power rate as shown in Table 1. Energy managing RL agent The objective of the energy managing agent is given by the reward function R a (i.e. where we try to maximize a negative function, and thus minimize the positive version of that function, in accordance with Equation 1a) and is the negative loss in energy costs L t cost and loss in comfort L t com f ort both at the t-th time-step with multi-objective scaling constants a and b and with an additional cost c when the constraint are expected to be violated 3 . The loss in comfort is defined as |E t th − Q t |, where Q t is the thermal energy production. The electrical demand and natural gas consumption can always be fulfilled by (buying from) their respective infinitely large main grid connection, i.e. within the Modelica simulation model, it is assumed that the grid connections are sufficiently large. Note that the loss in comfort L t com f ort is bound by the tolerance of the constraints. This term, in the reward function, therefore serves as a fine-tuning mechanism to further minimize the loss in comfort within those bound and to mitigate the modelling error of the constraints itself (see Table 2 for the quality of the constraint functions). Energy managing RL agent The energy costs L t cost is in EUR with scaling factor a = 1/10, the loss in comfort L t com f ort is in Watt with scaling factor b = 1/5e5 and cost c = 1 in algorithm 1 and c = −50 + (10 if A t chp > 0.5 else 0) in algorithm 2. The state-space S is normalized and all actions in the action-space A are scaled between [+1, −1]. Energy managing RL agent Finally, we use a twin delayed deep deterministic policy gradient (TD3) agent, as it is considered one of the state-of-the-art RL algorithms, from the stable baseline [37] implementations and this with the following hyper-parameters (found after an hyper-parameter optimization study, similar to [3], for algorithm 1 and algorithm 2). The pseudo-code of the TD3 algorithm is given in Appendix B. batch_size 16 16 100 16 buffer_size 1e6 1e5 1e5 1e6 train_freq 1e0 1e1 2e3 1e0 gradient_steps 1e0 1e1 2e3 1e0 noise_type normal normal normal normal noise_std 0.183 0.791 0.329 0.183 Table 3. TD3 hyper-parameters Evaluation The performance, in terms of energy cost minimization subject to the (thermal comfort) constraint fulfillment, of the proposed methods algorithm 1 and algorithm 2 is compared against an unconstrained (and therefore possibly unsafe) RL agent, the OptLayer RL agent proposed by Pham et al. [28] (identified as related work), as well as against safe and unsafe random agents -serving as minimal performance benchmarks. We use a year-long training environment, a 15-minutes control horizon (i.e. the energy managing RL agent can select new actions every simulated 15 minutes) and a week-long evaluation environment while participating 3 as these unsafe actions are not executed in the environment -see algorithm 1 and algorithm 2 in a day-ahead electricity market. Any uncertainty (from e.g. demands, prices or wind and solar power generation) is inherently handled by the RL agent, as it is formulated as a discrete time-invariant infinite-horizon stochastic optimal control problem (see [3] for the derivation from a continuous time-varying stochastic system). The model-predictive controller from [3] is here not considered, as constraints can be formulated directly in the method. Results and discussion The simulation results of the objective values (i.e. rewards) are shown, in Table 4, both in absolute values as relative to the unconstrained RL benchmark. The inequality constraint tolerance, Equation 3c, is shown relative to the total demand (0% would mean equality constraint satisfaction, i.e. all thermal demand is being fulfilled including any thermal energy storage charging actions). These results (Table 4) show that algorithm 1 (SafeFallback -102,9%) outperforms algorithm 2 (GiveSafe -98,2%) and the vanilla unsafe TD3 benchmark (100%), yet is slightly worse then OptLayer (104,0%). This as the a prior safe fallback policy has the highest utility before training (94,6% compared to 82,8%, 35,5% and 77,8%), indicating the additionally given expert knowledge. The additional expert knowledge (of the safe fallback policy of algorithm 1 itself) is reflected in the initially higher constraint tolerance as well (7,0%), yet reaches an acceptable 10,1% (below the maximum tolerance of 15%, as set in Equation 3c). algorithm 2 and OptLayer have initially a higher constraint tolerance (15, 0% and 15,6%), yet reaching approximately the same tolerances (10,0% and 10,4%). Both of the proposed methods are therefore, as intended, significantly safer than the vanilla TD3 benchmark -which has an initial constraint tolerance of 146,0% and reaching only 21,0%. The constraint tolerances converge towards a limit as defined by the multi-objective reward function, Equation 4g, and its associated scaling factors a and b (i.e. energy cost minimization and energy demand fulfillment are conflicting objectives). Note that, OptLayer, initially violates the maximum tolerance of 15%, as set in Equation 3c. This happens because OptLayer involves solving a mixed-integer quadratic problem to compute the nearest feasible actions. Moreover, in OptLayer linear analytical approximations are used instead of surrogate functions f (·) from Equation 3c with the metrics provided in Table 2, since there is no derivative information present. The learning curves of the TD3 agents (using algorithm 1, algorithm 2 and OptLayer, as well as without any safety layer -indicated as UnSafe) are presented in Figure 5, where the initial (at time step 0) and final (at time step 525.150) results are the figures reported in Table 4. We observe a steep initial learning rate, low variance, and a stable (slightly increasing) performance with increasing number of interactions with its environment. We also observe that algorithm 1 (SafeFallback), algorithm 2 (GiveSafe) and OptLayer have a significantly higher initial performance (before any training has occurred, i.e. at time step 0) compared to its vanilla unsafe TD3 counterpart. This, again, due to the a priori expert knowledge in the form of a known safe fallback policy and in the form of safety constraint equations. The unsafe RL agent only reaches the initial performance (-6.481) of OptLayer after ∼ 35.000 time steps (1 year) and of algorithm 2 (-6.089) after ∼ 50.000 time steps (1 year and 5 months) and of algorithm 1 (-5.331) after ∼ 85.000 time steps (2 years and 5 months). Furthermore, the initial performance of Optlayer is lower then algorithm 1 and algorithm 2, surpassing algorithm 2 after ∼ 18.575 time steps (6 months) and algorithm 1 after ∼ 30.000 time steps (10 months) and that the performance gap remains significant with algorithm 2 (5,8 %) while algorithm 1 reaches a similar performance (1,1%). Optimal controller Objective value Constraint tolerance The cost curves (constraint tolerance) of the TD3 agents are presented in Figure 6. We observe a steep initial decrease of the constraint tolerance of the vanilla TD3 agent, yet never converging to the safety threshold of 15% as defined by Equation 3c -while algorithm 1 and algorithm 2 never exceed this threshold (i.e. proving the hard-constraint satisfaction during training) and OptLayer slightly exceeds this threshold as noted here before. The constraint tolerance convergence of all safe methods is less steep and reaches a stable performance (∼ 10%) after approximately 3 years (∼ 1e 5 time steps). Optimal controller Objective value Constraint tolerance However, the performance in terms of both the utility (objective value) and cost (constraint tolerance) of algorithm 1 (SafeFallback), algorithm 2 (GiveSafe) and OptLayer relies on an accurate formulation of the actual constraints, i.e. the accurate formulation of Equation 3c in this case study. As presented in subsection 4.3, this is not always trivial -especially for the TESS and the HP. When we replace the pre-trained TESS and HP functions from the safety layer, by simpler (linear) analytical equations we observe a reduction in performance (i.e. the equations also used in OptLayer). For example, for algorithm 1 by its initial objective value of -5.331 to -5.431 and its initial constraint tolerance of 7,0% to 7,6%. This problem can be mitigated however, by artificially lowering Q tol from Equation 3c. Optimal controller Objective value Constraint tolerance Nevertheless, training a RL agent on a real safety-critical environment would only be possible with a sufficiently accurate safety layer (i.e. constraints) and using adequate a priori unknown hyper-parameters. Therefore, we propose the following directions for future work: Optimal controller Objective value Constraint tolerance • Providing chance-constraint satisfaction guarantees for when no constraint functions are available a priori (but only limited, known to be safe, operational data) and to safely improve the a prior constraint functions as more data becomes available. Exploratory and exploitative steps will then never leave the safe region with high probability, by updating a statistical model (e.g. a Gaussian Process model). • Further reducing the training budget (i.e. improving sample efficiency, e.g. by combining SafeFallback with OptLayer) and rolling out a fixed sequence of (robust 4 ) control actions (e.g. using model-based RL agents) for day-ahead market planning. Optimal controller Objective value Constraint tolerance • Robustness of the RL-based energy management systems under faulty and noisy measurements / observations and utilizing online hyper-parameter optimization methods (i.e. that the hyper-parameters are tuned during online training). Conclusion This paper presented two novel model-free safe RL methods, where the safety constraint formulation is decoupled from the RL (MDP) formulation. These provide hard-constraint, rather than soft-and chance-constraint, satisfaction guarantees both during training a (near) optimal policy (which involves exploratory and exploitative, i.e. greedy, steps) as well as during deployment of any policy (e.g. random agents or offline trained RL agents). These methods are demonstrated in a multi-energy management systems context, where detailed simulation results are provided. Conclusion Both of the proposed methods are viable safety constraint handling techniques applicable beyond state-of-the-art RL, as demonstrated by random agents while still providing strict safety guarantees. Preferably, however, algorithm 1 (SafeFallback) is used as it showed good performance, does not requires to solve a mathematical program (e.g. a mixed-integer quadratic program in the case of OptLayer), and as the availability of a simple safe fallback policy is common or relatively easily constructible (i.e. in the form of a simple rule-based policy, e.g. a priority-based control strategy). Acknowledgement This work has been supported in part by ABB n.v. and Flemish Agency for Innovation and Entrepreneurship (VLAIO) grant HBC.2019.2613. Appendix A Simulations visualization In this section, we show a time series visualisation sample (a week) of the found control policies. The first observation that can be made (in Figure A1) is the violently unsafe behavior (146,0% of constraint tolerance, Table 4) of the TD3 agent before training, which at this stage acts as an unconstrained random agent. Specifically at this stage, a large thermal overproduction is the cause of the thermal discomfort and thus the constraint violation (as the total thermal 4 The transition probability matrix can then also be used to generate a robust planning rather than a pure most-likelihood planning installed capacity, given in Table 1, is significantly higher then the thermal demand, e.g. due to the back-up boiler capacity -and given the random behaviour before training, the sum of the total thermal output is expected to be significantly high). The overproduction is avoided after training the TD3 agent ( Figure A2). The policy itself has a high utility, yet now a significant thermal underproduction is observed (21,0% of constraint tolerance, Table 4). In practice, the natural gas boiler could be forced on to satisfy the thermal underproduction (yet this by itself would be an a prior "fallback" policy). When analysing the SafeFallback (algorithm 1) policies, and comparing them against the vanilla unsafe TD3 policies, we observe safe behavior. Before training, the constraint check mostly fails -using the safe fallback policy. Initially ( Figure A3), when the constraint check passes, safe random actions are observed (e.g. thermal "overproduction" is properly stored in the TESS). After safely training the TD3 agent, a policy with a high utility and a low constraint tolerance is observed ( Figure A4). Thermal underproduction is still present, yet within the set bound Q tol from Equation 3c. When analysing the GiveSafe (algorithm 2) policies, and comparing them against the vanilla unsafe TD3 policies, we again observe safe behavior. Before training, all actions are random but safe (e.g. thermal demand is matched by the thermal production or any thermal "overproduction" is stored in the TESS) -resulting in both a lower initial utility and higher constraint tolerance as Figure A3. After safely training the TD3 agent, a policy with a high utility and a low constraint tolerance is observed ( Figure A6) -yet with a lower utility as Figure A4. Thermal underproduction is again still present, yet within the set bound Q tol from Equation 3c. Finally, when analysing the OptLayer policies, we again observe safe behavior (even though the maximum tolerance of 15% is slightly violated, i.e. 15,6% as discussed before). Before training ( Figure A7), all the actions proposed by the TD3 agents are random and are therefore corrected towards the closed feasible actions (see [28] for the details of this algorithm). Even though this resembles the policy from algorithm 2, these actions are then no longer completely random and almost always result in a distribution among actions (every continuous action all have some part in the feasible solution) and this resulting in a worse initial utility. After safely training the TD3 agent ( Figure A8), a policy with a high utility and a low constraint tolerance is observed, yet again with some thermal underproduction (within the inequality bounds) as expected due to the conflicting objectives (the first term in Equation 4g minimizes the energy costs and therefor the production).

섹션 본문 42문단 · 37,798자

(제목 없음)

1Reinforcement learning (RL) is a promising optimal control technique for multi-energy management systems. It does not require a model a priori -reducing the upfront and ongoing project-specific engineering effort and is capable of learning better representations of the underlying system dynamics. However, vanilla RL does not provide constraint satisfaction guarantees -resulting in various potentially unsafe interactions within its safety-critical environment. In this paper, we present two novel safe RL methods, namely SafeFallback and GiveSafe, where the safety constraint formulation is decoupled from the RL formulation. These provide hard-constraint, rather than soft-and chance-constraint, satisfaction guarantees both during training a (near) optimal policy (which involves exploratory and exploitative, i.e. greedy, steps) as well as during deployment of any policy (e.g. random agents or offline trained RL agents). This without the need of solving a mathematical program, resulting in less computational power requirements and a more flexible constraint function formulation (no derivative information is required). In a simulated multi-energy systems case study we have shown that both methods start with a significantly higher utility (i.e. useful policy) compared to a vanilla RL benchmark and Optlayer benchmark (94,6% and 82,8% compared to 35,5% and 77,8%) and that the proposed SafeFallback method even can outperform the vanilla RL benchmark (102,9% to 100%). We conclude that both methods are viably safety constraint handling techniques applicable beyond RL, as demonstrated with random policies while still providing hard-constraint guarantees.

2• Better policies can be found starting with an initial safe fallback policy

Introduction

3Energy systems continue to become increasingly interconnected with each other as the energy technologies that allow for this sector coupling are more mature and are being more widely implemented. This allows for an integrated control strategy that further can enhance the overall efficiency and performance of these so-called multi-energy, -carrier, -commodity or -utility systems. Furthermore, these multi-energy systems allow for the utilization of the flexibility (i.e. storage, controllable loads) within and across all energy carriers. This integrated control strategy then typically [1] has an economic or environmental oriented objective function or a combination thereof and therefor being multi-objective.

4To ensure the optimum or Pareto optimum level of operation of such multi-energy systems, specific set-points are required to establish and maintain the desired objective (e.g. minimization of the energy costs or CO 2 -equivalent emissions) while still fulfilling all system constraints [2]. As flexibility utilization exhibits dynamic behaviour and introduces a dependency between successive time steps, optimisation across (or considering) numerous time steps is necessary. Additionally, multiple uncertainties (i.e. variation in demands, pricing and weather) need to be managed so that the stability of the multi-energy system is preserved.

5Model-predictive control (MPC) and reinforcement learning (RL) have recently been benchmarked within such a multi-energy management system context [3]. Ceusters et al. showed that RL-based energy management systems do not require a model a priori and that they can outperform linear MPC-based energy management systems after training. However, vanilla RL (see Figure 1a) performs a large number of potentially unsafe interactions within its environment, which is unacceptable in many real-world applications. For example, in a multi-energy system, neglecting the crucial energy balance constraint could result in either under-or over-production. For most power systems this imbalance could result in exceeding the maximum power capacity to or from the grid -especially relevant with the expected large-scale integration of electric vehicles. Moreover, this imbalance is particularly problematic for energy systems that are not connected to a larger power distribution grid or a district heating system and therefore lack a higher level of control. In this case the imbalance could lead to loss of user comfort (e.g. power or heat outages).

6Therefore, our goals is to ensure that every interaction with the underlying environment (a multi-energy system in our case study) satisfies a given set of safety constraints, independently of the used (optimal) control technique (see Figure 1b). This compared to formulating a specific safe RL algorithm which allows that future -presumably better -optimization algorithms can easily be used instead. . block diagrams comparison: the feasibility of the RL agent's actions, being in a given state, are always checked against the a priori constraint functions acting as a safety layer -shielding the environment from unsafe (control) actions. Note that, we assume that the continuous unconstrained error handling (i.e. minimization of the difference between a desired set-point and a measured process variable) is performed by proportional-integral-derivative (PID) controllers.

Contribution and outline

7Our contributions can, to the best of our knowledge, be listed as the following:

8• Online model-free safe RL method which provides hard-constraint, rather than soft-and chance-constraint, satisfaction guarantees that has a significantly higher initial utility; • Decoupling architecture of safety constraint formulations from the RL formulation so that future -presumably better -optimization algorithms can easily be used instead; • Hard-constraint satisfaction without the need of solving a mathematical program, resulting in less computational power requirements and a more flexible constraint function formulation (no derivative information is required); • Demonstration of safe RL-based energy management on a detailed multi-energy system simulation environment.

9In section 2 related work is discussed and our research question is formulated, section 3 introduces the proposed methodologies, while in section 4 the tool chain, the simulated multi-energy system environment, the safety layer, the RL agent and the evaluation procedure are presented. Furthermore, section 5 discusses the results and provides directions for future work while section 6 presents the conclusion. Finally, Appendix A shows time series visualizations of the different policies, Appendix B the pseudo-code of the specific RL agent (TD3) and Appendix C the run-time statistics.

Related work

10In recent years, there have been numerous of works that proposed RL for various applications within energy systems as reviewed by e.g. [4], [5] and [6]. The majority of these applications can be classified under a broader energy management problem. RL based energy management systems have even been proposed and demonstrated within the more specific (and arguably more challenging) multi-energy systems context. For example, Rayati et al. [7] were some of the first to apply RL, specifically Q-learning [8], for the energy management of a simulated multi-energy residential building, which they later extended with demand-side management capabilities [9]. Posteriorly, Mbuwir et al. [10] successfully applied RL (Q-learning) for a battery energy management system within a simulated residential multi-energy system. They inlcuded a back-up policy to over-rule the actions of the RL agent in case of constraint violation. Furthermore, Wang et al. [11] used a path tracking interior point method and a RL algorithm (Q-learning) for a bi-level interactive decision-making model with multiple agents in a regional multi-energy system. A multi-agent RL (Q-learning) approach was also proposed by Ahrarinouri et al. [12] and this for the energy management of a simulated residential multi-energy system. Around the same time, Ye et al. [13] proposed the usage of a deep RL algorithm, specifically a deep deterministic policy gradient (DDPG) [14] with a prioritized experience replay strategy, again within a simulated residential multi-energy system. Moreover, Xu et al. [15] demonstrated an industrial multi-energy scheduling framework using a RL (Q-learning) based differential evolution approach that adaptively determines the optimal mutation strategy and its associated parameters. While Zhu et al. [16] demonstrated a multi-agent deep RL energy management system, using multi-agent counterfactual soft actor-critic (mCSAC) [17], for a simulated multi-energy industrial park. Furthermore, Ceusters et al. [3] presented an onand off-policy multi-objective model-free RL approach, using proximal policy optimisation (PPO [18]) and twin delayed deep deterministic policy gradient (TD3 [19]) and they did benchmark this against a linear MPC -both derived from the general optimal control problem. They showed, on two separate simulated multi-energy systems, that the RL agents offer the potential to match and outperform the MPC. While, Zhang et al. presented a series of works [20][21][22] for the (near-to) optimal scheduling of an integrated energy system (a.k.a. multi-energy system) using deep reinforcement learning both for a single-and multi-objective and Zhang et al. [23] lather extended this for distributed multi-energy systems using multi-agent deep reinforcement learning.

11However, as RL inherently requires the interaction with its environment, adequate measures are required to avoid the violation of the environmental specific constraints both during online training as during pure policy execution (e.g. after training a policy offline). All the works above have, knowingly (and thus reported as such) or non-knowingly, either neglected these specific environmental constraints or greatly simplified them -limiting the real-world use cases.

12In one of the first attempts to combine both hard-constraint satisfaction and RL in energy systems, Venayagamoorthy et al. [24] presented an intelligent dynamic energy management system for a smart microgrid using an action-dependent heuristic dynamic program, a type of adaptive critic design-based controller. They furthermore used an evolutionary algorithm to improve the dispatch solution over time and rejected candidate solutions that did not satisfy the critical load fulfillment constraint relying on power balancing rules and an initial decision-tree energy management system. Furthermore, Zhang et al. [25] proposed a bi-level power management system of networked microgrids in an electric distribution systems. At the first level, a cooperative agent employs an adaptive model-free RL algorithm, to find the optimal retail price signals for the microgrids. While on the second level, each model-based microgrid controller solves a constrained mixed integer nonlinear program, based on the received price signal from the RL agent. Also, Zhao et al. [26] proposes a knowledge-assisted RL framework by combining a low-fidelity analytical model with a RL agent for a cooperative wind farm control problem. When the RL agent selects a naive action, a constraint action is calculated by solving an optimization problem using that analytical model. However, in all these cases it remains a heavy reliance on a prior physical models that are used in a separate optimization problem. Such developments contain a presumed transition function, a separated objective function (separated from the reward signal, which can introduce bias) and constraint functions -and thus not only constraint functions.

13Nevertheless, recently and independent from this work, Park et al. [27] devised a novel RL algorithm, inspired by OptLayer [28], namely distance-based incentive/penalty Q-learning (DIP-QL) which also does not assume an a prior transition function and only uses constraint functions to provide hard-constraint guarantees as they demonstrated on a microgrid control problem. Yet, it uses a deep Q-learning algorithm as the backbone for their proposed method -where we propose to decouple the constraint handling from the RL algorithm so that futurepresumably better -optimization algorithms (as our framework is not limited to RL) can easily be used instead.

14Concerning safe RL beyond the energy systems management field, García and Fernández [29], in a comprehensive review, identified and classified two broader approaches: (1) modifying the optimality criteria with a safety factor; (2) modifying the exploration process by incorporating external knowledge or the guidance by a risk metric. More recently, Dulac-Arnold et al. [30] identified nine challenges that must be addressed to implement RL in real-world problems, including safety constraint violation. Furthermore, Brunke et al. [31] provided a broader safe learning review across both the control theory research space as well as the RL research space. More specifically, they showed (1) learning-based control approaches that start with an a priori model to safely improve the policy under the uncertain system dynamics, (2) safe RL approaches that do not need a model or even constraints in advance -but then also do not provide strict safety guarantees (yet encourages safety or robustness), and (3) approaches that provide safety certificates of any learned control policy.

15The reviewed literature shows that RL is a promising and widely proposed approach for various applications in energy systems (and other domains, not discussed here), as well as for energy management systems specifically. It is also clear that the transition of RL towards real-world applications is not trivial and requires special attention concerning safety. Multiple safe (reinforcement) learning approaches exist, ranging in level of safety namely (from lower to higher level): (1) soft-constraint satisfaction, (2) chance-constraint satisfaction and (3) hard-constraint satisfaction. However, model-free safe RL where the safety constraint formulation is decoupled from the RL formulation and which provides hard-constraint, rather than softand chance-constraint, satisfaction guarantees both during training a (near) optimal policy (which involves exploratory and exploitative, i.e. greedy, steps) as well as during deployment of any policy (e.g. random agents or offline trained RL agents). This without the need of solving a mathematical program has -to the best of our knowledge -never been proposed and demonstrated for the energy management of multi-energy systems.

Proposed methodology

16Following the standard RL formulation of the state-value function, yet extending this towards constraints subjection, the objective is to find a policy π, which is a mapping of states, s ∈ S, to actions, a ∈ A(s), that maximizes an expected sum of discounted rewards and is subject to constraint sets X and U:

17where E π is the expected value, following the policy π, of the rewards R discounted with the discount factor γ over an infinite sum at any time step t. Note that Equation 1a is a discrete 1 time-invariant infinite-horizon stochastic optimal control problem, as also indicated in [3], yet differs from the standard formulation of RL due to the a priori constraint functions in the sets X and U. We acknowledge that methods without a priori constraint functions exists, yet this can -under the state-of-the-art -only reach safety level 2 at best (chance-constraint satisfaction) [31]. Rather than proposing a specific safe RL algorithm, we propose to decouple the a priori constraint function formulation from the (RL) agent so that any (new RL) algorithm can be used -while always guarantying the hard-constraint satisfaction. 1 as the continuous error handling is performed by PID-controllers, see Figure 1 Although the proposed algorithms are conceptually simple, we will later show its effectiveness on a multi-energy system (which includes a non-grid connected thermal system).

SafeFallback method

18The first method we propose relies on an a priori safe fallback policy π sa f e , which typically can be derived through classic control theory in the form of a set of hard-coded rules such as a simple rule-based policy (e.g. a priority-based energy management strategy -which is commonly available or easily constructible -see subsection 4.4 for the safe fallback policy of the considered case study). As we furthermore assume that the constraint functions are given, we can simply check if the selected actions a while in state s satisfy the constraint conditions. When the constraints conditions are satisfied, the selected actions a are considered to be safe actions a sa f e and are then executed in the environment so that the next state s , the reward r and done signal d are observed -which is the regular experience tuple (s, a sa f e , r, s , d) for the RL agent. However, if the constraint conditions are violated, the selected action a is overruled by the safe action a sa f e using the a priori safe fallback policy π sa f e . Now not only the experience tuple (s, a sa f e , r, s , d) is formed, but also the experience tuple (s, a, r − c, s , d) containing the infeasible action and additional negative reward (i.e. cost, c). The pseudo-code is given in algorithm 1. Our second method does not require an a priori safe fallback policy, yet relies on the RL agent itself to pass safe actions a sa f e -which can again be checked by the given constraint conditions. If the selected actions a while in state s passes the constraint check, the safe actions a sa f e get executed in the environment and a regular experience tuple (s, a sa f e , r, s , d) is received. However, if the constraints get violated the RL agent receives the experience tuple (s, a, r − c, s, d). Hence, the transition towards the next state is not observed (as the infeasible action is not executed) and a cost c (i.e. negative reward) is given. The RL agent then selects a new action a and a new constraint check is done. This is repeated until the constraint check gets passed and the selected action is considered to be a safe action a sa f e . This safe action is then executed in the environment and a regular experience tuple is received. The pseudo-code is given in algorithm 2 and a graphical representation, in the form of a Markov Chain, in Figure 2. is not executed in the environment so no transition to the next state S t+1 is observed and a cost C t is given. When the selected action is feasible (satisfies the constraints), that safe actions A sa f e t is executed in the environment so a transition to the next state S t+1 is observed with probability p(s t+1 | s t , a t ) and a reward R t is given.

Toolchain

19A multi-energy systems simulation model, that was developed in [3], was used as it allowed for the verification of the safety critical operation (e.g. if all energy demands are fulfilled) of the multi-energy system without consequences (i.e. without the risk of violating real-life constraints and its associated harm). It is a Modelica [32] model, as it allowed for the convenient construction of the real-life presumed system dynamics using multi-physical first-principle equations and due to the available highly specialized libraries, elementary components and its object-oriented nature.

20This Modelica model is then exported as a co-simulation functional mock-up unit (FMU), similar to [33] , and wrapped into an OpenAI gym environment [34] in Python, similar to [3,35]. The architecture of the tool-chain is shown in Figure 3. Notice that the Differential Algebraic Equations solver is part of the co-simulation FMU and that the do_step() method in PyFMI [36] is used over simulate() -again as in [3] due to the significant run-time speed-up when initialized properly.

Simulation model

21The considered multi-energy system is similar to the one from [3], yet without the gas turbine (back-up genset) 2 , and has the following structure: It includes (from left to right, from top to bottom): an electric transformer, a wind turbine, a photovoltaic (PV) installation, a natural gas boiler, a heat pump (HP), a combined heat and power (CHP) unit, a thermal energy storage system (TESS) and a battery energy storage system (BESS). The dimensions of the considered multi-energy system are also from [3] and are summarised in Table 1

22where Q t boil , Q t hp , Q t chp and Q t tess are the thermal powers of the natural gas boiler, the heat pump, the combined heat and power unit (CHP) and the thermal energy storage system (TESS) respectively while P t hp , P t chp and P t bess represent the electrical powers of the heat pump, CHP and battery energy storage system (BESS), all constraint by its associated minimal and maximal power (see Table 1). Furthermore, γ t boil , γ t hp and γ t chp are binary variables that turn on/off the given asset (i.e. as the minimal powers are not zero). Yet these constraints, i.e. Equation 2a till Equation 2e, are easily handled by the dimensions of the (control) action space itself, i.e. Equation 4b till Equation 4f, and therefor do not require a specific constraint check.

23While the electrical energy balance is always fulfilled (given the assumption that the electrical grid connection is sufficiently large), the thermal energy balance (Equation 2f) does require special attention in order to achieve hard-constraint satisfaction. No additional constraints are considered in this case study (e.g. ramping rates, minimal run-and down-time) as energy balance equations are considered to be the most limiting constraints in energy management problems. Writing out the thermal energy balance in more detail and relaxing the equality constraint formulation (towards an inequality constraint) then becomes:

24where A t are the (control) actions, η the energy efficiencies, COP the coefficient of performance, SOC the state of charge and T various specific temperatures (i.e. T t boil the return temperature to the boiler, T t evap the evaporator temperature of the heat pump, T t cond the condenser temperature of the heat pump, T t env the environmental air temperature and T t tess the average temperature in the stratified hot water storage tank). We set Q tol to be 15,0% of the total Q t demand in the evaluation period, which we acknowledge to be relatively high -yet is chosen to keep the computational complexity low (Appendix C). Note that the different functions f (·) from Equation 3c are typically not trivial to model accurately. Therefor we assume the availability of a historical dataset to supervisory learn (using a Random Forest Regression algorithm) the function between the thermal power and the action directly (i.e. Q t asset = f (A t asset , χ t asset )), with the possibility to include informative exogenous variables χ t asset .

Safe fallback policy

25As presented in subsection 3.1, algorithm 1 relies on an a prior safe fallback policy π sa f e which can be any (non-optimal) policy that satisfies the constraints and can typically be provided by domain experts. In our case study this is a simple priority rule:

26Note that, for clarity concerns, the policy has been written out in terms of thermal power outputs yet is still converted to actions A t chp and A t boil as going from Equation 3a to Equation 3b.

Energy managing RL agent

27The fully observable discrete-time Markov decision process (MDP) is formulated as the tuple S, A, P a , R a so that:

28where E t th is the thermal demand, E t el the electrical demand, P t wind the electrical wind in-feed, P t solar the electrical solar in-feed, X t el the electrical price signal (i.e. day-ahead spot price), SOC t tess the state-of-charge (SOC) of the TESS, SOC t bess the SOC of the BESS, h t the hour of the day and d t the day of the week all at the t-th step, which consitute the state-space S. The action-space A includes the control set-points from, A t boil the natural gas boiler, A t hp the heat pump, A t chp the CHP unit, A t tess the TESS and A t bess the BESS all between a minimum and maximum power rate as shown in Table 1.

29The objective of the energy managing agent is given by the reward function R a (i.e. where we try to maximize a negative function, and thus minimize the positive version of that function, in accordance with Equation 1a) and is the negative loss in energy costs L t cost and loss in comfort L t com f ort both at the t-th time-step with multi-objective scaling constants a and b and with an additional cost c when the constraint are expected to be violated 3 . The loss in comfort is defined as |E t th − Q t |, where Q t is the thermal energy production. The electrical demand and natural gas consumption can always be fulfilled by (buying from) their respective infinitely large main grid connection, i.e. within the Modelica simulation model, it is assumed that the grid connections are sufficiently large. Note that the loss in comfort L t com f ort is bound by the tolerance of the constraints. This term, in the reward function, therefore serves as a fine-tuning mechanism to further minimize the loss in comfort within those bound and to mitigate the modelling error of the constraints itself (see Table 2 for the quality of the constraint functions).

30The energy costs L t cost is in EUR with scaling factor a = 1/10, the loss in comfort L t com f ort is in Watt with scaling factor b = 1/5e5 and cost c = 1 in algorithm 1 and c = −50 + (10 if A t chp > 0.5 else 0) in algorithm 2. The state-space S is normalized and all actions in the action-space A are scaled between [+1, −1].

31Finally, we use a twin delayed deep deterministic policy gradient (TD3) agent, as it is considered one of the state-of-the-art RL algorithms, from the stable baseline [37] implementations and this with the following hyper-parameters (found after an hyper-parameter optimization study, similar to [3], for algorithm 1 and algorithm 2). The pseudo-code of the TD3 algorithm is given in Appendix B. batch_size 16 16 100 16 buffer_size 1e6 1e5 1e5 1e6 train_freq 1e0 1e1 2e3 1e0 gradient_steps 1e0 1e1 2e3 1e0 noise_type normal normal normal normal noise_std 0.183 0.791 0.329 0.183 Table 3. TD3 hyper-parameters

Evaluation

32The performance, in terms of energy cost minimization subject to the (thermal comfort) constraint fulfillment, of the proposed methods algorithm 1 and algorithm 2 is compared against an unconstrained (and therefore possibly unsafe) RL agent, the OptLayer RL agent proposed by Pham et al. [28] (identified as related work), as well as against safe and unsafe random agents -serving as minimal performance benchmarks. We use a year-long training environment, a 15-minutes control horizon (i.e. the energy managing RL agent can select new actions every simulated 15 minutes) and a week-long evaluation environment while participating 3 as these unsafe actions are not executed in the environment -see algorithm 1 and algorithm 2 in a day-ahead electricity market. Any uncertainty (from e.g. demands, prices or wind and solar power generation) is inherently handled by the RL agent, as it is formulated as a discrete time-invariant infinite-horizon stochastic optimal control problem (see [3] for the derivation from a continuous time-varying stochastic system). The model-predictive controller from [3] is here not considered, as constraints can be formulated directly in the method.

Results and discussion

33The simulation results of the objective values (i.e. rewards) are shown, in Table 4, both in absolute values as relative to the unconstrained RL benchmark. The inequality constraint tolerance, Equation 3c, is shown relative to the total demand (0% would mean equality constraint satisfaction, i.e. all thermal demand is being fulfilled including any thermal energy storage charging actions). These results (Table 4) show that algorithm 1 (SafeFallback -102,9%) outperforms algorithm 2 (GiveSafe -98,2%) and the vanilla unsafe TD3 benchmark (100%), yet is slightly worse then OptLayer (104,0%). This as the a prior safe fallback policy has the highest utility before training (94,6% compared to 82,8%, 35,5% and 77,8%), indicating the additionally given expert knowledge. The additional expert knowledge (of the safe fallback policy of algorithm 1 itself) is reflected in the initially higher constraint tolerance as well (7,0%), yet reaches an acceptable 10,1% (below the maximum tolerance of 15%, as set in Equation 3c). algorithm 2 and OptLayer have initially a higher constraint tolerance (15, 0% and 15,6%), yet reaching approximately the same tolerances (10,0% and 10,4%). Both of the proposed methods are therefore, as intended, significantly safer than the vanilla TD3 benchmark -which has an initial constraint tolerance of 146,0% and reaching only 21,0%. The constraint tolerances converge towards a limit as defined by the multi-objective reward function, Equation 4g, and its associated scaling factors a and b (i.e. energy cost minimization and energy demand fulfillment are conflicting objectives). Note that, OptLayer, initially violates the maximum tolerance of 15%, as set in Equation 3c. This happens because OptLayer involves solving a mixed-integer quadratic problem to compute the nearest feasible actions. Moreover, in OptLayer linear analytical approximations are used instead of surrogate functions f (·) from Equation 3c with the metrics provided in Table 2, since there is no derivative information present. The learning curves of the TD3 agents (using algorithm 1, algorithm 2 and OptLayer, as well as without any safety layer -indicated as UnSafe) are presented in Figure 5, where the initial (at time step 0) and final (at time step 525.150) results are the figures reported in Table 4. We observe a steep initial learning rate, low variance, and a stable (slightly increasing) performance with increasing number of interactions with its environment. We also observe that algorithm 1 (SafeFallback), algorithm 2 (GiveSafe) and OptLayer have a significantly higher initial performance (before any training has occurred, i.e. at time step 0) compared to its vanilla unsafe TD3 counterpart. This, again, due to the a priori expert knowledge in the form of a known safe fallback policy and in the form of safety constraint equations. The unsafe RL agent only reaches the initial performance (-6.481) of OptLayer after ∼ 35.000 time steps (1 year) and of algorithm 2 (-6.089) after ∼ 50.000 time steps (1 year and 5 months) and of algorithm 1 (-5.331) after ∼ 85.000 time steps (2 years and 5 months). Furthermore, the initial performance of Optlayer is lower then algorithm 1 and algorithm 2, surpassing algorithm 2 after ∼ 18.575 time steps (6 months) and algorithm 1 after ∼ 30.000 time steps (10 months) and that the performance gap remains significant with algorithm 2 (5,8 %) while algorithm 1 reaches a similar performance (1,1%).

Optimal controller Objective value Constraint tolerance

34The cost curves (constraint tolerance) of the TD3 agents are presented in Figure 6. We observe a steep initial decrease of the constraint tolerance of the vanilla TD3 agent, yet never converging to the safety threshold of 15% as defined by Equation 3c -while algorithm 1 and algorithm 2 never exceed this threshold (i.e. proving the hard-constraint satisfaction during training) and OptLayer slightly exceeds this threshold as noted here before. The constraint tolerance convergence of all safe methods is less steep and reaches a stable performance (∼ 10%) after approximately 3 years (∼ 1e 5 time steps).

35However, the performance in terms of both the utility (objective value) and cost (constraint tolerance) of algorithm 1 (SafeFallback), algorithm 2 (GiveSafe) and OptLayer relies on an accurate formulation of the actual constraints, i.e. the accurate formulation of Equation 3c in this case study. As presented in subsection 4.3, this is not always trivial -especially for the TESS and the HP. When we replace the pre-trained TESS and HP functions from the safety layer, by simpler (linear) analytical equations we observe a reduction in performance (i.e. the equations also used in OptLayer). For example, for algorithm 1 by its initial objective value of -5.331 to -5.431 and its initial constraint tolerance of 7,0% to 7,6%. This problem can be mitigated however, by artificially lowering Q tol from Equation 3c.

36Nevertheless, training a RL agent on a real safety-critical environment would only be possible with a sufficiently accurate safety layer (i.e. constraints) and using adequate a priori unknown hyper-parameters. Therefore, we propose the following directions for future work:

37• Providing chance-constraint satisfaction guarantees for when no constraint functions are available a priori (but only limited, known to be safe, operational data) and to safely improve the a prior constraint functions as more data becomes available. Exploratory and exploitative steps will then never leave the safe region with high probability, by updating a statistical model (e.g. a Gaussian Process model). • Further reducing the training budget (i.e. improving sample efficiency, e.g. by combining SafeFallback with OptLayer) and rolling out a fixed sequence of (robust 4 ) control actions (e.g. using model-based RL agents) for day-ahead market planning.

38• Robustness of the RL-based energy management systems under faulty and noisy measurements / observations and utilizing online hyper-parameter optimization methods (i.e. that the hyper-parameters are tuned during online training).

Conclusion

39This paper presented two novel model-free safe RL methods, where the safety constraint formulation is decoupled from the RL (MDP) formulation. These provide hard-constraint, rather than soft-and chance-constraint, satisfaction guarantees both during training a (near) optimal policy (which involves exploratory and exploitative, i.e. greedy, steps) as well as during deployment of any policy (e.g. random agents or offline trained RL agents). These methods are demonstrated in a multi-energy management systems context, where detailed simulation results are provided.

40Both of the proposed methods are viable safety constraint handling techniques applicable beyond state-of-the-art RL, as demonstrated by random agents while still providing strict safety guarantees. Preferably, however, algorithm 1 (SafeFallback) is used as it showed good performance, does not requires to solve a mathematical program (e.g. a mixed-integer quadratic program in the case of OptLayer), and as the availability of a simple safe fallback policy is common or relatively easily constructible (i.e. in the form of a simple rule-based policy, e.g. a priority-based control strategy).

Acknowledgement

41This work has been supported in part by ABB n.v. and Flemish Agency for Innovation and Entrepreneurship (VLAIO) grant HBC.2019.2613.

Appendix A Simulations visualization

42In this section, we show a time series visualisation sample (a week) of the found control policies. The first observation that can be made (in Figure A1) is the violently unsafe behavior (146,0% of constraint tolerance, Table 4) of the TD3 agent before training, which at this stage acts as an unconstrained random agent. Specifically at this stage, a large thermal overproduction is the cause of the thermal discomfort and thus the constraint violation (as the total thermal 4 The transition probability matrix can then also be used to generate a robust planning rather than a pure most-likelihood planning installed capacity, given in Table 1, is significantly higher then the thermal demand, e.g. due to the back-up boiler capacity -and given the random behaviour before training, the sum of the total thermal output is expected to be significantly high). The overproduction is avoided after training the TD3 agent ( Figure A2). The policy itself has a high utility, yet now a significant thermal underproduction is observed (21,0% of constraint tolerance, Table 4). In practice, the natural gas boiler could be forced on to satisfy the thermal underproduction (yet this by itself would be an a prior "fallback" policy). When analysing the SafeFallback (algorithm 1) policies, and comparing them against the vanilla unsafe TD3 policies, we observe safe behavior. Before training, the constraint check mostly fails -using the safe fallback policy. Initially ( Figure A3), when the constraint check passes, safe random actions are observed (e.g. thermal "overproduction" is properly stored in the TESS). After safely training the TD3 agent, a policy with a high utility and a low constraint tolerance is observed ( Figure A4). Thermal underproduction is still present, yet within the set bound Q tol from Equation 3c. When analysing the GiveSafe (algorithm 2) policies, and comparing them against the vanilla unsafe TD3 policies, we again observe safe behavior. Before training, all actions are random but safe (e.g. thermal demand is matched by the thermal production or any thermal "overproduction" is stored in the TESS) -resulting in both a lower initial utility and higher constraint tolerance as Figure A3. After safely training the TD3 agent, a policy with a high utility and a low constraint tolerance is observed ( Figure A6) -yet with a lower utility as Figure A4. Thermal underproduction is again still present, yet within the set bound Q tol from Equation 3c. Finally, when analysing the OptLayer policies, we again observe safe behavior (even though the maximum tolerance of 15% is slightly violated, i.e. 15,6% as discussed before). Before training ( Figure A7), all the actions proposed by the TD3 agents are random and are therefore corrected towards the closed feasible actions (see [28] for the details of this algorithm). Even though this resembles the policy from algorithm 2, these actions are then no longer completely random and almost always result in a distribution among actions (every continuous action all have some part in the feasible solution) and this resulting in a worse initial utility. After safely training the TD3 agent ( Figure A8), a policy with a high utility and a low constraint tolerance is observed, yet again with some thermal underproduction (within the inequality bounds) as expected due to the conflicting objectives (the first term in Equation 4g minimizes the energy costs and therefor the production).

참고문헌 33건

  1. A comprehensive survey on safe reinforcement learning Journal of Machine Learning Research · The MIT Press · 2015
  2. Trade-off between environmental and economic objectives in the optimization of multi-energy systems Building Simulation · Springer Science+Business Media · 2009 10.1007/s12273-009-9202-4
  3. Feedback control for optimal process operation Journal of Process Control · Elsevier BV · 2007 10.1016/j.jprocont.2006.10.011
  4. Demand side management for a residential customer in multi-energy systems Sustainable Cities and Society · Elsevier BV · 2016 10.1016/j.scs.2016.01.010
  5. Dynamic Energy Management System for a Smart Microgrid IEEE Transactions on Neural Networks and Learning Systems · Institute of Electrical and Electronics Engineers · 2016 10.1109/tnnls.2016.2514358
  6. PyFMI: A Python Package for Simulation of Coupled Dynamic Models with the Functional Mock-up Interface 2016
  7. Proceedings. 1985 IEEE International Conference on Robotics and Automation 1985 10.1109/robot.1985
  8. From system model to optimal control - A tool chain for the efficient solution of optimal control problems Linköping electronic conference proceedings · Linköping University Electronic Press · 2017 10.3384/ecp17132249
  9. Diagnosing Non-Intermittent Anomalies in Reinforcement Learning Policy Executions (Short Paper) arXiv (Cornell University) · Cornell University · 2017 10.4230/oasics.dx.2024.16
  10. A Learning-Based Power Management Method for Networked Microgrids Under Incomplete Information IEEE Transactions on Smart Grid · Institute of Electrical and Electronics Engineers · 2019 10.1109/tsg.2019.2933502
  11. Deep reinforcement learning–based approach for optimizing energy conversion in integrated electrical and heating system with renewable energy Energy Conversion and Management · Elsevier BV · 2019 10.1016/j.enconman.2019.112199
  12. ACM International Conference Proceeding Series 2011
  13. Cooperative Wind Farm Control With Deep Reinforcement Learning and Knowledge-Assisted Learning IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2020 10.1109/tii.2020.2974037
  14. Model-Free Real-Time Autonomous Control for a Residential Multi-Energy System Using Deep Reinforcement Learning IEEE Transactions on Smart Grid · Institute of Electrical and Electronics Engineers · 2020 10.1109/tsg.2020.2976771
  15. Multiagent Reinforcement Learning for Energy Management in Residential Buildings IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2020 10.1109/tii.2020.2977104
  16. Learning from delayed rewards 1989
  17. Reinforcement learning in sustainable energy and electric systems: a survey Annual Reviews in Control · Elsevier BV · 2020 10.1016/j.arcontrol.2020.03.001
  18. Dynamic energy conversion and management strategy for an integrated electricity and natural gas system with renewable energy: Deep reinforcement learning approach Energy Conversion and Management · Elsevier BV · 2020 10.1016/j.enconman.2020.113063
  19. Reinforcement Learning and Its Applications in Modern Power and Energy Systems: A Review Journal of Modern Power Systems and Clean Energy · Springer Nature · 2020 10.35833/mpce.2020.000552
  20. Applications of reinforcement learning in energy systems Renewable and Sustainable Energy Reviews · Elsevier BV · 2020 10.1016/j.rser.2020.110618
  21. Challenges of real-world reinforcement learning: definitions, benchmarks and analysis Machine Learning · Springer Science+Business Media · 2021 10.1007/s10994-021-05961-4
  22. Multi-Energy Scheduling of an Industrial Integrated Energy System by Reinforcement Learning-Based Differential Evolution IEEE Transactions on Green Communications and Networking · Institute of Electrical and Electronics Engineers · 2021 10.1109/tgcn.2021.3061789
  23. Decomposed Soft Actor-Critic Method for Cooperative Multi-Agent Reinforcement Learning arXiv (Cornell University) · Cornell University · 2021 10.48550/arxiv.2104.06655
  24. Soft actor-critic –based multi-objective optimized energy conversion and management strategy for integrated energy systems with renewable energy Energy Conversion and Management · Elsevier BV · 2021 10.1016/j.enconman.2021.114381
  25. Safe Learning in Robotics: From Learning-Based Control to Safe Reinforcement Learning Annual Review of Control Robotics and Autonomous Systems · Annual Reviews · 2022 10.1146/annurev-control-042920-020211
  26. Model-predictive control and reinforcement learning in multi-energy system case studies Applied Energy · Elsevier BV · 2021 10.1016/j.apenergy.2021.117634
  27. Stable-Baselines3: Reliable Reinforcement Learning Implementations Journal of Machine Learning Research · The MIT Press · 2021
  28. A multi-agent deep reinforcement learning approach enabled distributed energy management schedule for the coordinate control of multi-energy hub with gas, electricity, and freshwater Energy Conversion and Management · Elsevier BV · 2022 10.1016/j.enconman.2022.115340
  29. Energy management based on multi-agent deep reinforcement learning for a multi-energy industrial park Applied Energy · Elsevier BV · 2022 10.1016/j.apenergy.2022.118636
  30. DIP-QL: A Novel Reinforcement Learning Method for Constrained Industrial Systems IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2022 10.1109/tii.2022.3159570
  31. Advances of machine learning in multi-energy district communities‒ mechanisms, applications and perspectives Energy and AI · Elsevier BV · 2022 10.1016/j.egyai.2022.100187
  32. Data-driven stochastic energy management of multi energy system using deep reinforcement learning Energy · Elsevier BV · 2022 10.1016/j.energy.2022.125187
  33. Real-world challenges for multi-agent reinforcement learning in grid-interactive buildings Energy and AI · Elsevier BV · 2022 10.1016/j.egyai.2022.100202