1. Introduction
The rapid expansion of renewable energy (renewable energy (RE)) sources significantly increases volatility and unpredictability in the energy supply chain [
1], necessitating advanced control strategies to ensure grid stability and reliability [
2]. This emphasizes the crucial role of energy flexibility [
3], which is the ability of a resource to modulate its power generation or consumption [
4].
Green hydrogen, which can be produced through electrolysis, offers a viable solution for storing volatile RE [
5]. Hydrogen serves as a high-density energy carrier for production facilities and provides solutions for energy transportation and storage [
6]. Recent advancements in hydrogen storage materials, such as the development of advanced metal alloys [
7] and silica-confined nanostructures [
8], have shown promise in enhancing the efficiency and capacity of hydrogen storage systems. In parallel, ongoing research is also focused on improving the efficiency of hydrogen production [
9,
10,
11,
12]. However, leveraging the full potential of green hydrogen production presents challenges due to the inherent fluctuations of renewable energy sources [
13]. These fluctuations introduce uncertainties in the availability and predictability of an RE supply, complicating the integration and consistent utilization of green hydrogen [
13].
To fully capitalize on the benefits of green hydrogen and integrate it effectively into an energy system, advanced optimization strategies are crucial [
14]. The unpredictable nature of RE sources necessitates robust control mechanisms to handle these uncertainties [
15]. However, existing optimization approaches for control often disregard these uncertainties [
16,
17] and instead focus on economic optimization where coarse resolutions are sufficient [
18]. Yet, this static optimization is inherently vulnerable to uncertainties [
19], underscoring the need for finer resolutions to address both renewable integration and uncertainty management [
20]. Achieving such fine resolutions computationally, however, presents significant challenges regarding the timely generation of schedules [
18].
Therefore, a multi-layered optimization approach known for its scalability and adaptability, illustrated in
Figure 1, can be employed. Each layer within this hierarchical structure manages specific decision variables and monitors distinct parameters and variables from other layers. This hierarchical organization facilitates complexity abstraction and enables the provision of services to higher layers. For operational optimization purposes, these layers can be leveraged to achieve various optimization objectives [
21].
A key feature of the hierarchical optimization structure is the distinct temporal resolution of each layer, enabling effective responses to both dynamic changes and long-term trends. The
scheduling layer, which operates with the longest temporal resolution (from weeks to days) [
21], generates a
schedule. Meanwhile, the
site-wide optimization (site-wide optimization (SWO)) layer, which encompasses a system of flexible energy resources (e.g., multiple electrolyzers), defines a
plan. Long-term factors, such as market prices, can be integrated by these layers. A
plan is typically generated for a timespan from hours to days.
The
real-time optimization (real-time optimization (RTO)) layer operates at an intermediate resolution, typically ranging from hours to minutes, (Please note that the timescale of RTO differs from the shorter timescales seen in other real-time contexts, such as in the communication of controllers.) aligning operational execution with strategic directives [
21]. It defines a structured
set of setpoints (set of setpoints (SoS)), whereby the current setpoint is transferred to the resource via the control layer. The RTO layer replans resource operation within one SWO time step, taking into account new data such as short-term forecasts. Additionally, RTO, based on the concept of rolling planning or a receding horizon, offers a promising approach to mitigating uncertainties. While traditional strategic optimization methods may disregard this technique, RTO enhances adaptability and resilience under uncertainty, making it a powerful tool for economic optimization and improved operational planning [
22].
Forecasts, such as those for RE generation, are incorporated into these optimization processes. The uncertainty and therefore the accuracy of these forecasts correlates with the forecast horizon [
23]. Consequently, the
schedule has the most uncertainty, which decreases down to the RTO layer.
The bottom control layers have the shortest temporal resolution, responding to immediate changes within minutes or seconds [
21]. In these layers, the overall system is separated into resources, as each resource has its own controller. This layered approach to temporal resolution allows each layer to efficiently address specific tasks while ensuring a coordinated strategy which blends long-term planning with short-term reactions to changed contexts [
21].
The prevailing focus on static optimization [
20] often results in the isolated consideration of the depicted layers. Consequently, many publications disregard the interactions between RTO and SWO (gray layers in
Figure 1). Despite its potential for significant economic and energy-systemic benefits, the adoption of RTO in real-world applications has fallen short of expectations, leaving its potential largely untapped [
19,
22]. One possible reason for this is the high costs associated with the development and implementation of RTO solutions [
24].
To exploit the untapped potential and ensure more efficient and economical resource operation, this work investigates the transformation of an existing static optimization model (e.g., SWO) into a dynamic RTO model. As a result, a two-step optimization approach emerges which utilizes the same optimization model for both long-term and short-term optimization, thus addressing the isolated consideration of the individual layers (see
Figure 1). The adaptation of the automation pyramid by Skogestad [
21] (as shown in
Figure 1) is applied in this work. Consequently, this approach is capable of responding to uncertainties and short-term deviations, tackling the issue that different optimization models across layers may lead to inconsistencies [
22]. The objectives on the SWO and RTO layers are somehow similar, as both layers focus on maximizing benefit, such as by minimizing cost [
22]. Therefore, the main difference between the two layers is their temporal resolution [
22]. Recently, Reinpold et al. [
17] demonstrated that static optimization models can accurately represent the real behavior of a resource, making the models suitable for dual usage in both long-term planning and short-term optimization.
This work is based on previous work by the authors, which includes a reusable modular optimization model structure [
25] and a methodology for its parameterization [
26].
In summary, the contributions of this work are the following:
A method for adapting existing static optimization models for their dual use in SWO and RTO is developed;
An algorithm is formed for continually solving the two-stage optimization problem incorporating updated forecast information;
An evaluation and validation of the proposed method and algorithms through a case study are given;
An assessment of the dynamic RTO model’s effects on power system performance and efficiency, highlighting improvements over static optimization in terms of cost, stability, flexibility, and energy usage, is given.
This work is structured as follows.
Section 2 provides an analysis of related works and describes the research gap.
Section 3 describes the method for continually solving the two-stage optimization problem, including the approach for adapting existing static optimization models.
Section 4 evaluates the method via a case study. The method and its evaluation are discussed in
Section 5.
Section 6 concludes this work.
2. Related Work
This section reviews related works in optimizing flexible energy resources, focusing on their control and with emphasis on handling uncertainties.
Sun and Leto [
27] introduced a model for bidding in energy markets for the integration of renewable energy sources and the operation of flexible energy resources. This approach aims to maximize profits and mitigate risks associated with the uncertainties of renewable energy production. A work by Sun and Leto [
27] primarily addressed the upper layers of the control hierarchy shown in
Figure 1—
scheduling and SWO—by proposing a joint bidding strategy for various distributed energy resources based on a predictive model which considers the uncertainties of renewable energy production. However, the model does not address RTO, which is crucial for immediate response to short-term fluctuations.
Pazouki et al. [
28] described an optimization model for the operation of a system with energy generation from wind as well as the operation of flexible energy resources under uncertainty. Pazouki et al. [
28] focused on the economic, emission, reliability, and efficiency aspects of system operation in both certain and uncertain environments of wind, electricity demand, and real-time pricing markets. The authors utilized a stochastic optimization approach, incorporating Monte Carlo simulations to generate scenario trees based on predicted real-time pricing, wind, and electricity demand. This method allows for the modeling of uncertainties and the identification of optimal operational strategies. Although the generated scenarios address uncertainties, the responsiveness in terms of RTO is lacking. This optimization is performed on a sub-hourly resolution and cannot be considered RTO but rather SWO.
Vedullapalli et al. [
15] proposed a model and an algorithm for the operational planning of battery and heating, ventilation, and air conditioning resources in buildings using RTO to minimize the costs of electric energy. Vedullapalli et al. [
15] also presented a two-part forecasting model for short-term variations. This method only focuses on short-term management for the control of resources without higher planning functions like SWO. This approach underscores the necessity of real-time control but lacks the integration with long-term strategic planning to market system flexibility.
Tsay et al. [
29] proposed a framework for the energy-flexible operation of industrial air separation units using RTO. Their work highlights the need to account for process dynamics in production optimization due to the variable nature of electricity prices and addresses this with a dynamic optimization framework specifically designed for air separation units. Despite the mention of real-time electricity prices in their study, they were considered at an hourly resolution. Consequently, there was no reaction to short-term deviations, as the optimization primarily focused on the strategic, longer-term SWO of air separation units.
Flamm et al. [
14] presented a specialized optimization model for an electrolyzer. Through experimental analysis of an electrolyzer, detailed linearized models were created to capture the electrolyzer’s conversion efficiency and thermal dynamics [
14]. This model informs an RTO controller which aims to minimize hydrogen production costs by adapting to fluctuating electricity prices and photovoltaic inflow. However, a study by Flamm et al. [
14] used deterministic forecasts, which raises questions about the appropriateness of the method in dealing with forecast uncertainties. Furthermore, Flamm et al. [
14] described their approach as “model predictive control”, while Skogestad [
21] highlighted the limitations of single-layer optimization in dealing with uncertainty, as uncertainty must be quantified a priori.
Alabi et al. [
30] introduced an optimization approach for a multi-energy system. Initially, the approach focuses on data management via clustering and scenario reduction to mitigate uncertainties. Subsequently, it employs multi-objective optimization to balance investment and operating costs. Integration of the Markowitz portfolio risk theory allows for managing operational uncertainties. As the approach primarily emphasizes long-term planning and cost optimization, it lacks consideration for real-time resource control to effectively respond to fluctuations, a crucial aspect addressed by RTO. Moreover, the hourly resolution used for renewable energy sources has been proven inadequate in capturing their fluctuations, thus rendering a system not capable of reacting to short-term variations.
Similar to Alabi et al. [
30], Alirezazadeh et al. [
31] presented a method for the optimization of flexible generation within a smart grid. The method employs linear and nonlinear optimization models for solving unit commitment and smart grid scheduling problems, respectively. However, the method of Alirezazadeh et al. [
31] does not consider RTO, which would be required for adaptability to short-term variations, and is limited to static SWO.
Yang et al. [
32] focused on operational optimization for alkaline water electrolysis systems using a mixed-integer nonlinear programming approach. This optimization considers factors such as solar energy availability, electricity prices, and the resources’ operational characteristics for scheduling the electrolysis system. While the optimization effectively plans the operation of the electrolyzers based on the availability of solar energy and electricity prices to increase profitability, it is limited to long-term planning in terms of static SWO. This disregards the aspect of considering short-term fluctuations. As a result, this method cannot fully capture the dynamic nature of renewable energy sources, missing opportunities for further optimization and efficiency improvements in a real-time operational context.
Ireshika and Kepplinger [
33] investigated the management of electric vehicle charging under uncertainty using a two-stage optimization approach, thereby focusing on uncertainties such as non-elastic demand and electric vehicle usage behavior.
Dumas et al. [
34] introduced a hierarchical optimization approach for microgrids, focusing on the coordination between operational planning and RTO. At the operational planning level, decisions are made based on day-ahead forecasts to optimize energy costs over one or several days. The RTO level adjusts operations based on actual conditions and forecast errors within the current market period.
Whereas Ireshika and Kepplinger [
33] and Dumas et al. [
34] each emphasized the benefits of a two-stage optimization approach to managing flexible energy resources under uncertainty, instead of reusing existing approaches, both works specialized in applying dedicated optimization models for specific problems within their domains, using different models for the different levels of optimization. However, this can lead to conflicts between the planning and RTO layers, potentially resulting in inconsistencies [
22].
Analysis of related works revealed a gap in the integration of SWO and RTO into a unified framework, indicating a need for generalized methods to advance the field. This work contributes to this research area by proposing a novel two-stage optimization framework which seamlessly combines SWO and RTO, thereby addressing the limitations observed in previous studies. Unlike existing approaches, which often focus exclusively on either long-term planning or real-time control, the presented approach provides a cohesive solution which ensures consistent and efficient operation across both time scales. Existing approaches focus on either SWO or RTO, with strategies to address short-term deviations rarely discussed [
20]. This underlines the need to strive beyond the use of specific models for individual use cases and develop methods which provide a comprehensive and reusable solution for the dynamic adaptation of optimization strategies. By providing a comprehensive and adaptable method, this research advances the field by bridging the gap between long-term strategic planning and real-time adaptability, which is elemental for managing the inherent uncertainties of RE sources.
3. Method for Solving Two-Stage Optimization
This section introduces a method for continually solving SWO and RTO models for the subsequent control of systems of flexible energy resources. The concept for a two-stage optimization approach using existing optimization models is outlined in
Section 3.1. Necessary adjustments for transforming an existing optimization model into a model compatible with both SWO and RTO are explained in
Section 3.2. The approach for continually solving the two-stage optimization problem is elaborated upon in
Section 3.3.
3.1. Concept for Two-Stage Optimization
The concept, illustrated in
Figure 2, utilizes SWO to devise a
plan for the entire optimization horizon
(e.g., a full day), segmented into intervals
. Individual time steps are denoted by
. To accomplish this, long-term forecast data are incorporated, ensuring that the
plan reflects anticipated future conditions or demands. The results from this planning phase set starting points for RTO, such as defining starting conditions like the resource system states for each time step
. This approach is executed cyclically, with new, updated forecasts being taken into account for each optimization.
Following this initial phase, RTO refines the optimization at a higher resolution , such as on a per-minute basis, denoted by time steps over an optimization horizon T. The length of the RTO horizon is equivalent to one time step of SWO . This finer granularity allows for the accommodation of immediate fluctuations and guarantees that operations can quickly adjust to evolving scenarios. Any changes detected during the RTO phase, such as the failure of resources, are then fed back into the SWO, ensuring that the behavior of the real system is reflected in the subsequent planning periods of the SWO. This cyclical process creates a dynamic and responsive optimization framework which seamlessly integrates long-term strategic planning with immediate operational adjustments, significantly improving both efficiency and adaptability.
3.2. Dual Use of Optimization Models
To facilitate the transformation of static optimization models into dynamic RTO models, some preliminary steps must be performed. The basic prerequisite, however, is that a static, feasible optimization model of a system of flexible energy resources is available. The static optimization model requires modification to enable differentiation between its application in SWO and RTO. Specifically for RTO use, it is necessary to fix the historical values of variables, including the states of resources or initial setpoints for the RTO time steps. This is achieved by equating the respective decision variable to the respective value. These values are derived from the outcomes of the SWO or results of previous RTO time steps. Furthermore, the energy amount procured for any time step
must be set as a target for the corresponding RTO horizon starting at
. This is ensured by means of the constraint shown in Equation (
1), wherein the energy in one SWO time step
must be equal to the sum of the energy sourced from the grid in all corresponding RTO time steps
t:
This mechanism is particularly critical within the context of ancillary services, where the costs associated with these services are allocated to the entities responsible for any deviations from the planned energy use. Ensuring that the energy procurement targets are met precisely across each interval helps minimize financial penalties and operational disruptions, maintaining the stability and efficiency of the energy system.
Furthermore, the objective function could be modified to ensure the full integration of RE, such as maximizing the output of the system.
3.3. Solving the Two-Stage Optimization Model
The process for solving the two-stage optimization model is depicted in
Figure 3. First, the initial parameter settings are defined, such as the system state at the start of SWO (Step 1).
Subsequently, long-term forecast information, such as electricity data from spot markets or RE generation, is imported (Step 2) and utilized to solve the static optimization model for the time steps (Step 3). The results obtained from this operational planning for the time step are stored (Step 4) and subsequently adopted as initial values for the RTO model (, Step 5).
To enable appropriate responses, short-term forecasts with a high resolution, such as those from RE sources, are incorporated (Step 6). Subsequently, the RTO model is solved based on the specified RTO horizon T, allowing for suitable adjustments to short-term fluctuations (Step 7). Subsequently, the system verifies whether the end of the RTO horizon has been reached. If it has not, then the optimized setpoints are conveyed to the process (Step 8), and relevant measurement values are received (Step 9). These measured values can then be considered during RTO (Step 10). The current setpoints then act as the new starting values for the next RTO iteration (Step 10).
Upon reaching the end of the RTO horizon with , the system checks if the end of the planning interval has been reached as well. If it has, then the process terminates. However, this process is typically executed in a continual manner, meaning that in most cases, the end is never reached. Instead, new starting values for the subsequent planning time step are obtained from the static optimization, and the RTO process recommences (Step 5). Both stages are always solved for the entire length of the respective optimization horizon /T, incorporating newly available information, such as forecasts for future time steps, and historic values. Hence, each model is solved x times, with x corresponding to or for SWO and RTO, respectively.
Applying the method outlined in this section generates plans for the control of a system of electrolyzers. Upon the availability of new data, such as forecasts, an updated SoS or plan for the remaining time steps of the respective optimization horizon is generated.
5. Discussion
The method as well as the results of the evaluation are discussed in this section.
The presented research demonstrated the potential of transforming static optimization models into dynamic RTO models for managing flexible energy resources such as electrolyzers. Specifically, this work employed a two-stage optimization strategy which integrates both site-wide and real-time optimization techniques to improve operational flexibility. The method involves a hierarchical approach where long-term forecasts are used for SWO, and short-term adjustments are made through RTO. This allows the system to dynamically adapt to fluctuations in RE generation and accurately reflect the actual behavior of the resource as well as the actual availability of RE. The results from a case study of an electrolyzer system validate the effectiveness of this approach.
One of the main advantages of the proposed method is its ability to ensure a stable power grid by matching energy consumption with RE generation. This dynamic capability is crucial for handling the variability and unpredictability associated with RE sources, making the method highly adaptable to real-world conditions. The method demonstrates the practical benefits of integrating real-time adjustments into long-term planning, thus improving the overall operational flexibility.
The implications of this study are relevant to the future of energy management and the integration of RE sources. The two-stage optimization method developed in this work provides a robust framework for RTO of flexible energy resources, such as electrolyzers. By combining SWO and RTO, this method enhances the alignment of energy consumption with RE generation, which is fundamental for the effective utilization and significant expansion of RE sources. This alignment is important for sustainable energy practices, as it allows for more efficient use of RE resources and minimizes waste and mismatching. This method makes it possible to not assume perfect foresight during the determination of an SoS for subsequent control and rather continually use reliable values in RTO in a short time gap to realization. This, however, leads to some drawbacks, including potential deviations from the plan initially generated by SWO.
Such deviations are not initially problematic and are expected given the forecast uncertainties. In fact, one of the drawbacks is that if RTO did not account for these deviations and instead strictly adhered to the SWO plan generated under the assumption of perfect foresight, unplanned adjustments would eventually become necessary. This is because either not all available RE would be integrated or the grid supply would have to be adjusted in an unplanned and ad hoc manner. Therefore, the ability of RTO to adapt to real-time data ensures more efficient and reliable integration of RE, preventing the need for reactive measures and supporting overall grid stability.
Despite the promising outcomes, this work recognizes some limitations. One notable limitation is the dependency on the accuracy of RE generation forecasts. While the optimization models perform well with accurate forecasts, deviations from predicted values can influence the optimality of the SoS. Additionally, the initial set-up and computational requirements, although manageable, might present some challenges for large-scale implementation. The necessity for high-resolution data and computational resources could potentially impact the scalability of this approach. Future work should focus on the transfer of the method to decentralized optimization approaches employing multi-agent systems, as they are inherently suited for the representation of resources under uncertainty and the handling thereof. Additionally, research should aim to enhance forecast accuracy, streamline computational processes, and explore decentralized optimization approaches to further improve the method’s practicality and scalability.
Even though the case study showed the applicability of the method to a system of electrolyzers, SWO and RTO of other types of flexible energy resources are also possible, as the underlying optimization model structure is generically applicable [
17,
25].
6. Conclusions
In this work, a novel two-stage optimization method was developed which bridges the gap between SWO and RTO, allowing for dynamic adjustments in response to the unpredictable nature of RE sources. By leveraging existing static optimization models and transforming them for use in RTO, a seamless integration of RE into a system of electrolyzers was achieved, enhancing both grid reliability and operational efficiency. This method stands out for its adaptability, ensuring optimal resource utilization in near real time and reducing the energy procurement costs from the intra-day market.
The case study on a system of electrolyzers, utilizing a hybrid energy supply from both the grid and a wind farm, validated the effectiveness of the method. The results demonstrated not only more sustainable operation through the optimized use of renewable resources but also highlighted the potential for economic benefits, as updated forecasts can be included in the operational planning.
However, the proposed method has certain dependencies. The effectiveness of the method relies on the accuracy of RE generation forecasts. While the method was designed to handle forecast deviations, significant inaccuracies could impact the optimal schedule, potentially affecting the full realization of the benefits. Additionally, the approach involves a certain level of computational complexity and requires high-resolution data, which could pose challenges for extremely large-scale implementations.
In conclusion, the developed two-stage optimization strategy offers a robust and flexible framework for energy management, paving the way for more sustainable and economically viable energy control of flexible energy resources in the face of growing RE integration.