Stochastic Control of Battery Energy Storage System with Hybrid Dynamics

: This paper addresses the control of load demand and power in a battery energy storage system (BESS) with Boolean-type constraints. It employs model predictive control (MPC) tailored for such systems. However, conventional MPC encounters computational challenges in practical applications, including battery storage control, and requires dedicated, mostly licensed solvers. To mitigate this, a solver-free yet efficient, suboptimal method is proposed. This approach involves generating randomized control sequences and assessing their feasibility to ensure adherence to constraints. The sequence with the best performance index is then selected, prioritizing feasibility and safety over optimality. Although this chosen sequence may not match the exact MPC solution in terms of optimality, it guarantees safe operation. The optimal control problem for the BESS is outlined, encompassing constraints on the state of charge, power limits, and charge/discharge modes. Three distinct scenarios evaluate the proposed method. The first prioritizes minimizing computational time, yielding a feasible solution significantly faster than the optimal approach. The second scenario strikes a balance between computational efficiency and suboptimality. The third scenario aims to minimize suboptimality while accepting longer computation times. This method’s adaptability to the user’s requirements in various scenarios and solver-free evaluation underscores its potential advantages in environments marked by stringent computational demands, a characteristic often found in BESS control applications.


Introduction
The upsurge of renewable energy sources and the escalating need for sustainable, reliable energy systems have spurred a profound interest in battery storage technologies [1].Batteries stand as a potent solution to the challenges posed by the integration of renewables like solar and wind power into the grid [2].Furthermore, they play a pivotal role in critical facets of energy management, including demand response, peak shaving, and grid stabilization [3].
In this context, the effective control of battery energy storage systems (BESSs) emerges as a primary factor in enhancing the overall performance and dependability of energy systems.Advanced methods that optimize the operation of battery storage systems within energy management systems (EMSs) hold the potential to significantly enhance grid efficiency and reliability [4].Efficient and reliable battery storage management holds paramount importance for several compelling reasons, given its pivotal role in mitigating various challenges in modern power systems and facilitating the integration of renewable energy resources [5].
Optimization-based control of BESSs can bolster grid stability by furnishing services like frequency regulation [6], voltage support, and spinning reserve [7].This aids in maintaining operational parameters within acceptable bounds and diminishes the likelihood of power outages and equipment failures.BESSs can adeptly handle the variability of renewable sources like wind and solar power by storing surplus energy during periods of high generation and releasing it during low generation periods [2,8].Efficient battery storage management proves instrumental in optimizing the benefits of such systems and facilitating the increased penetration of renewables in the energy mix.
The effective control of BESSs contributes to the reduction in peak demand by storing energy during off-peak times and discharging it during peak periods [3].This peak shaving capability alleviates stress on grid infrastructure, defers investments in new generation capacity, and lowers overall electricity costs for consumers.Efficient battery storage management amplifies the demand response programs by offering additional grid flexibility [9].This allows for better alignment of electricity consumption with available generation capacity, potentially leading to reduced greenhouse gas emissions and lower system costs.
The application of MPC for BESS control can also help reduce the variability of wind power and forecast errors, which pose challenges and security issues in power systems.The authors of [10] proposed a method to size a BESS for improved wind farm integration, incorporating operational constraints into MPC.By analyzing the average fluctuation rate with different BESS capacities and defining a dispatch fluctuation rate, the most economical BESS size was determined and demonstrated on a wind farm in Fujian, China.
In terms of optimal control, Model predictive control (MPC) has gained popularity in recent years.MPC is a versatile control strategy extensively used across engineering applications, as documented in [11].MPC continuously solves optimization problems, making it suitable for the control of systems with complex dynamics, input and output constraints, and unpredictable disturbances.
Despite numerous adaptations of model predictive control (MPC), significant limitations prevent its widespread application, particularly in controlling multivariable systems with fast dynamics, such as BESSs.These systems present substantial demands on computational and memory resources, creating challenges for hardware implementation.Another disadvantage of MPC would be the inability to consider time-varying system parameters [12].Consequently, there remains a substantial demand for the development and deployment of an MPC-like control approach that ensures nearly optimal performance on inexpensive, low-power embedded hardware [13].
Various techniques have been proposed to decrease the computational burden of conventional MPC.One approach involves solving the optimal control problem offline, wherein the optimal control law is precomputed for all feasible initial conditions, a methodology known as explicit MPC [14].Explicit MPC preserves optimality while eliminating the need for real-time optimization.Practical challenges associated with hardware synthesis of explicit MPC controllers were investigated in [15], while [16] offers an overview of alternative approaches aiming to maintain MPC controller optimality without online optimization.For instance, [17] explores the use of neural networks to design an explicit linear feedback law.Nonetheless, such methods typically sacrifice optimality and lack stability guarantees.Additionally, generating sufficient data for neural network training still necessitates the evaluation of a large set of optimal control problems.
In [18], a novel MPC strategy is introduced, especially tailored for BESSs, with a specific emphasis on grid operator objectives.The primary aim is to minimize the equivalent cost.Simulation results affirm the strategy's effectiveness in smoothing power fluctuations, ensuring optimal BESS operation for extended longevity.The authors of [19] introduced a state-of-charge (SoC) feedback-based battery control approach.This strategy allocates real-time power and energy for individual battery units, accounting for constraints on power fluctuation rates and the maximum allowable charge/discharge power for each unit.
In [20], a dynamic SoC recovery reference-based control approach for BESSs participating in secondary frequency regulation was introduced.The MPC method is employed to determine the optimal frequency regulation and SoC maintenance simultaneously.Additionally, fuzzy control is integrated to establish the SoC recovery reference value, ensuring that the SoC remains within an optimal range.The drawbacks of the MPC design framework are the substantial computational and memory demands.This paper considers the control of load demand and power from a BESS.The formulation of BESS control involves Boolean-type constraints.To tackle this challenge, a specialized MPC framework for systems with such constraints is employed.However, this type of optimization problem is classified as a mixed-integer problem and requires dedicated mathematical solvers that are typically inaccessible or licensed for commercial use, making MPC impractical for computationally restricted industrial hardware.
To overcome this challenge, we introduce a stochastic, nearly optimal approximation of MPC with Boolean-type constraints.This approach depends on the random generation of control inputs known as random shoots (RSs).The RS-based methods center on the random generation of control sequences, followed by assessments for feasibility to ensure constraint adherence and performance evaluation.Upon runtime completion, the feasible random sequence with the best performance index is chosen.If the optimization problem is convex, runtime and solution suboptimality can be estimated beforehand [21].Moreover, RS also solves problems with discontinuous prediction models, cost functions, or nonconvex constraints.
Over the past two decades, stochastic methods like the the random shooting-based (RS) approach have garnered attention in controller design [21][22][23].The RS method introduces randomized algorithms for a broad range of controller design problems.Details on these algorithms for controller synthesis using statistical learning theory are available in [23].Additionally, a generalized approach to solving convex optimization problems through randomized algorithms was proposed in [21], offering close-to-optimal solutions within a limited number of iterations.
Similar to neural-network-based MPC, RS offers a suboptimal solution without stability guarantees.However, unlike neural-network-based MPC, it does not require solving of optimal control problems to extract the training data, making it suitable for implementation on embedded platforms used in industrial applications and Industrial Internet of Things (IIoT) services.
This work proposes a lightweight implementation of close-to-optimal RS-based control, aiming to combine the benefits of MPC's optimal control evaluation with RS-based approximation's library-free, easy-to-implement algorithm.This approach promises straightforward and fast control implementation.The proposed method is verified for BESS control, including distinct scenarios that highlight the possibility of balancing between suboptimality and computational efficiency, showcasing the versatility of the random shooting-based approach.This solver-free methodology proves particularly valuable in settings with strict computational constraints, offering potential for innovative control strategies.In essence, it allows for new ways of effective energy storage system management.
The paper is structured as follows.After the Introduction, exploring the problem domain, this paper outlines the methodology used to address the research objectives in Section 2. This section outlines the principles of MPC, including its application to systems with Boolean-type constraints and stochastic approximation, i.e., the random-shootingbased method.The results of the case study are presented in Section 3, including system configuration, optimization of battery energy storage control, and various simulation scenarios.Subsequently, Section 4 provides an analysis of the results, comparing them with those obtained by existing methods and identifying both strengths and limitations.Finally, in Section 5, we summarize the paper, highlighting key insights and the application range of the proposed methods.

Methods
This paper introduces an approach, free from solvers, to evaluate model predictive control (MPC) in systems with Boolean-type constraints.This method arises from the recognition that solving MPC with Boolean-type constraints necessitates a mixed-integer solver, which can be a bottleneck in practical applications including BESSs.Moreover, there is a common need for rapid and efficient evaluation a suboptimal yet feasible control sequences even on computationally restricted hardware, which is often considered with BESSs.The random shooting-based methodology for systems with Boolean-type constraints mirrors the conventional MPC-based approach.It involves generating random control sequences and subsequently checking their feasibility to ensure they satisfy the constraints.

Model Predictive Control
Model predictive control (MPC) is a sophisticated control strategy widely employed in various engineering applications, as detailed in [11].MPC operates by solving an optimization problem at each time step.This allows MPC to effectively handle systems with complex dynamics, constraints on inputs and outputs, and uncertain disturbances.This strategy is centered around optimizing control inputs while adhering to specified constraints.The goal of solving the optimization problem is to generate a series of optimal control inputs at each control step.This determination of optimal control inputs relies on a prediction of the system's future behavior.This control methodology allows for the incorporation of constraints on output, state, and input variables.The optimization problem addressed by the model predictive controller discussed in this study is formally described as follows: min The system's states are denoted as x(k) ∈ R n x , and and control inputs are represented by the manipulated variable (u(k) ∈ R n u , where n x and n u are the number of system states and inputs, respectively).The system states and control inputs are constrained within intervals defined by their respective minimal and maximal values, denoted as u min , u max , x min , and x max .In a broader sense, these constraints can also take the form of any convex sets.The decision variables are composed of vectors X = [x(1) ⊤ , . . ., x(N) ⊤ ] ⊤ and U = [u(0) ⊤ , . . ., u(N − 1) ⊤ ] ⊤ , consisting of individual predictions of states and optimal control inputs.The MPC exclusively employs the first optimized control input (u(0) ⊤ ), subject to the receding horizon implementation based on a prediction horizon (N) and the current measured state (x(0)).In Equation (1), quadratic penalties are frequently considered.In general, the state update Equation (1b) can be either linear in the case of a linear model or nonlinear in the case of a nonlinear model.This choice enables the formulation of the MPC problem as a quadratic programming (QP) problem.However, similar outcomes can be achieved by employing 1-norm and ∞-norm-based penalizations in Equation ( 1), resulting in a linear programming (LP) problem (refer to [24] for further details).

Model Predictive Control for Systems with Boolean-Type Constraints
The purpose of this paper is to control BESS systems with boolean-type constraints.Systems with discrete constraints are a subclass of hybrid systems, which are dynamic systems characterized by the presence of continuous states, discrete states, and event variables.Essentially, these systems exhibit a combination of time-driven and eventdriven behaviors.The designed controller must affect both the time-driven and eventdriven aspects, potentially handling signals that are either continuous or discrete in nature.Hybrid systems offer an effective approach for representing complex, large-scale industrial processes.The general optimization problem for systems with Boolean-type physical constraints can be structured as follows: min x(0) = x 0 , (2f) Considering MPC for systems with Boolean-type constraints, the control inputs have the following structure: where u ⊤ b and u ⊤ d are the Boolean-type and discrete states, respectively.The system states are constrained within bounded intervals defined by x min and x max .The continuous and discrete control inputs are bounded by u b,min , u b,max , u d,min , and u d,max .Note that these types of optimization problems are classified as mixed-integer problems and require a dedicated solver.

Stochastic Approximation of MPC Problem
The MPC design framework, as discussed in Section 2.1, faces a significant challenge related to the demanding computational and memory requirements.Furthermore, the MPC framework relies on the existence and availability of mathematical solvers, which are almost never open-source for commercial use.This proves impractical for the commonly used embedded hardware in the industry.To address this issue, a stochastic, nearly optimal approximation of MPC control is introduced.This method is based on random generation of control inputs i.e., random shoots (RSs), hence its name: random shooting-based control.The RS-based methods rely on generating control sequences randomly.These sequences are assessed for feasibility, ensuring constraint satisfaction, and their performance is evaluated.At the end of the runtime, the feasible random sequence with the best performance index is selected, and its first element is applied in the system-receding horizon fashion similar to the MPC framework.While this chosen sequence may not be optimal, it remains feasible, ensuring safe operation.The degree of suboptimality diminishes as more control sequences are generated.For convex optimization problems, it is possible to estimate the runtime and suboptimality in advance (see [21]).In the case of nonlinear optimization, the evaluation of the suboptimality level is not straightforward and is highly case-dependent.This method's versatility extends to solving problems with nonlinear or discontinuous prediction models or cost functions, as well as non-convex constraints, as it allows for exploitation of the structure of the optimization problem.The fundamental principles of the RS-based control are summarized in Algorithm 1. Algorithm 1 is also visualized using a flow chart in Figure 1.
This approach generates a randomized sequence of feasible control inputs, selecting the one with the best performance index ( J).This performance index can be compared to the minimum cost function value in (1).It achieves this by considering a large number of randomly generated sequences of control inputs.Generally, the chosen control sequence ( U = u 0 , u 1 , . . ., u N−1 ) is suboptimal compared to the exact MPC solution in (1).
In Algorithm 1, i serves as a counter for random shoots, r represents feasible random shoots, binary γ indicates feasibility, and N F is the maximum number of feasible random shoots.The remaining variables in Algorithm 1 are consistent with those in the MPC problem in (1).
However, it is important to note that implementing Algorithm 1 comes with a drawback: it does not guarantee the existence of N F feasible random shoots within a given sampling time (t s ), meaning achieving the required level of suboptimality is not assured.In fact, in the worst case, a feasible control input ( u 0 ) may not be found.Moreover, in terms of recursive feasibility, Algorithm 1 does not guarantee the discovery of a feasible solution in the subsequent control step.Algorithm 1 Random shooting-based approximation of the MPC problem.
Require: system state measurement x 0 , number N F of feasible random shoots, maximal number of random shoots This paper introduces a solver-free, random shooting-based approach for evaluating model predictive control (MPC) in systems with Boolean-type constraints, as defined in (2).This approach stems from the recognition that solving the problem in (2) typically requires a mixed-integer solver, which can be a bottleneck in practical applications.Additionally, there is often a need for swiftly and efficiently evaluating a suboptimal yet feasible control sequence.
The random shooting-based method for systems with Boolean-type constraints follows a similar procedure to its conventional counterpart outlined in Algorithm 1.Control sequences are randomly generated and subsequently assessed for feasibility to ensure compliance with constraints.The sequence with the best performance index is selected.While this chosen sequence may not be optimal, it remains feasible, ensuring safe operation.
The fundamental principles of random shooting-based control are summarized in Algorithm 2. This approach generates a randomized sequence of feasible control inputs, distinguishing between discrete control inputs ( ûd ) and Boolean control inputs ( ûb ).It selects the combination with the best performance index ( J) over the prediction horizon.Although the chosen control sequence ( U = u 0 , u 1 , . . ., u N−1 ) is suboptimal compared to the exact MPC solution in (1), it provides a practical and efficient alternative.
In Algorithm 2, the parameters i, r, γ, and N F align with the variables in Algorithm 1 and in the optimal control problem (2).This method offers a valuable solution for systems with Boolean-type constraints, allowing for efficient evaluation without the need for specialized solvers, thus overcoming a significant practical limitation in MPC applications.

Algorithm 2 Random shooting-based approximation of the MPC problem for systems with
Boolean-type constraints.
Require: system state measurement x 0 , number N F of feasible random shoots, maximal number of random shoots N max , MPC problem f (x k , u k ), N, U , x min , x max , u b,min , u b,max , u b,min , u b,max , ℓ(x k , u k ) Ensure: sequence of control inputs: U = { u 0 , u 1 , . . ., u N−1 } 1: J ← ∞; U ← ∅; r ← 0, i ← 0 // Initialize random shooting 2: while r < N F and i < N max do J ← Ĵr // Update reference penalty

Results
The presented case study involves the control of load demand and power from a BESS.The optimal control problem for the BESS is detailed in Section 3.2.This formulation also includes Boolean-type constraints.To address this type of problem, we must utilize an MPC framework tailored for systems with such constraints, as discussed in Section 2.2.Additionally, we propose a computationally efficient, solver-free alternative called random shooting-based approximation of MPC for systems with Boolean-type constraints, as outlined in Section 2.4.
Random shooting-based approaches are known for their stochastic nature and remarkable adaptability in addressing diverse control challenges by allowing the user to exploit the structure of the optimization problem.In this case study, we explore this adaptability by analyzing the proposed approach described in Section 2.4 in three distinct control scenarios and comparing them subject to the optimal approach in Section 2.2.These scenarios not only demonstrate its ability to establish a balance between computational complexity and suboptimality level but also showcase the advantages of this lightweight, solver-free alternative to traditional MPC.

System Configuration
In this case study, the performance of simulations carried out was largely influenced by both the software and hardware configurations used.For the software setup, we utilized MATLAB R2023a on a Windows 11 Home operating system.For optimization tasks, the GLPK-GLPKMEX-CC solver from YALMIP was employed.The computational efficiency was ensured by the hardware setup, which featured a 12th Gen Intel(R) Core(TM) i7-12700H processor at 2.30 GHz and 32.0 GB RAM.

Optimal Control Problem of the Battery Energy Storage System
In this case study, we consider a microgrid consisting of a battery energy storage system.The created microgrid is connected to the power grid, using which it can the exchange energy depending on the amount of produced or required power.The aim is to cover the desired load by using the power delivered from the power grid and BESS.The optimal solution is found by solving the optimization problem defined in general form as min where P buy,k denotes the power bought from the grid.Notations P load,k and P batt,k represent load demand and power from the BESS, respectively.The parameter c buy,k denotes prices for buying from the power grid, and P charge and P discharge represent the charge and discharge power, respectively.The values SoC min and SoC max specify the boundaries for the battery's state of charge, marking the lowest and highest levels, respectively.

Control Setup and Simulation Scenarios
In the simulations, we defined several key parameters to guide our control strategies.The state of charge (SoC) was set between specific limits: SoC max = 90% and SoC min = 30%.The initial value was SoC(1) = 60%.The power output from the battery, denoted as P batt , was constrained within the range of P discharge = −250 kW and P charge = 250 kW.For the battery itself, we established a fixed capacity of C batt = 2300 kWh and a predetermined efficiency of ϵ batt = 0.9.The prediction horizon, represented by N, was set for 24 h, while the control horizon extended over 48 h.The power demand, labeled as P load , quantified the power consumption in kW for a small county from 1 January 2021 to 3 January 2021.In parallel, the c buy vector, detailing electricity prices, matched the timeline of P load .

Scenario 1-Fast
In this scenario, the objective was to tune the proposed Algorithm 2 to minimize the average computational time required to evaluate the sequence of control inputs.This objective is achieved by restricting the Algorithm 2 to identify just five feasible solutions, i.e., N F = 5.Consequently, the algorithm operates at a significantly higher speed, a benefit accompanied by a trade-off in solution suboptimality.This trade-off entails an expected increase in suboptimality compared to the optimal solution, as the algorithm's focus shifts toward computational efficiency over optimal control performance.Note that the provided solution is still a feasible one, subject to the constraints defined in (3).
Figure 2 shows the results of Algorithm 2, where N F = 5.The initial graph portrays the c buy vector.Following this, the second graph shows the optimal trajectory of P load , P batt , and P buy as computed by the approach outlined in Section 2.2.In the third graph, the results of Algorithm 2, where N F=5 , are shown.

Scenario 2-Balanced
In the "Balanced" scenario, Algorithm 2 is configured to explore a finite number of control input combinations, offering a trade-off between computational efficiency and solution quality.To achieve this balance, we set the total number of tested input combinations to N max = 5000.This design decision introduces an element of variability in the number of feasible solutions found, as the algorithm adapts to the problem's complexity.The number of feasible solutions varies across each sampling period in which Algorithm 2 is employed.On average, 1572 were found to be feasible.
As a result, there is a significant probability of identifying a sufficient number of feasible combinations, ensuring a relatively short computation time.This scenario strikes a balance between computational time and suboptimality.A lower suboptimality rate compared to the first scenario is expected but with a slightly increased average computational time.By carefully tuning Algorithm 2, a balance between control performance and computational efficiency is established.Figure 4 presents the simulation results in an analogous manner to the previous scenario.

Scenario 3-Reliable
In the "Reliable" scenario, Algorithm 2 is tailored to ensure the computation of a predefined number of feasible solutions (N F ).This holds the promise of reducing suboptimality rates when compared to Scenario 1, where only five feasible solutions were explored.However, it comes at a computational cost, as the algorithm must diligently search for these feasible solutions.The number of required feasible solutions is set to N F = 5000, which differentiates it from the "Balanced" scenario, where N max = 5000 represented the overall number of examined input combinations with 1572 feasible solutions.Despite the increased computational time, this factor is of lesser concern, since the sampling time interval is set at one hour.The extended computational time is inconsequential in this case.Compared to Figure 5, the Figure 6 illustrates the simulation results in a manner consistent with the previous scenarios.Figure 7 illustrates the battery's (SoC) trajectory over the simulation duration, underscoring the notable congruence in performance between the conventional MPC and random shooting techniques.Table 1 provides a comprehensive overview of quantified results, offering performance metrics for the proposed method (Section 2.4) in different setups and the optimal method (Section 2.2).The parameter t eval presents the average computational time required for the computation of the control inputs.The value of J cl represents the closed-loop cost function in (2a) summed over the control span of 48 h.In the N F column, we observe the number of feasible solutions found, while in the case of Scenario 2, we present an average number of feasible solutions, as it varies across each sampling period.Suboptimality provides an essential measure of how closely each method approaches the optimal solution.The symbol " †" denotes the inapplicability of the criterion.

Discussion
In this case study, two distinct control methodologies were employed to calculate the load demand and battery power of the BESS, as described in (3).The resulting control trajectories were analyzed in terms of their performance and computational complexity.The first methodology implemented an optimal strategy: MPC with Boolean-type constraints (Section 2.2).This deterministic method accurately computes the solution to the optimization problem in (2).The second implemented strategy adopted the random shooting-based approximation of MPC with Boolean-type constraints (Section 2.4).Unlike the deterministic MPC-based approach, this method generates a sequence of random control inputs, subsequently evaluating their feasibility against the system constraints.The stochastic nature of this methodology inherently results in a suboptimal solution, a consequence of its probabilistic approach.
Table 1 provided an analysis of quantified results, offering a comparison of the performance and computational complexity of the proposed method (Section 2.4) in different setups and the optimal method (Section 2.2).The proposed method was tested with respect to three distinct scenarios.The adaptability of the method relies mainly on two parameters of the proposed Algorithm 2: N F and N max .By tuning these two criteria, the user can strike a balance between the desired level of suboptimality and the permissible level of computational complexity.An example of computationally efficient evaluation of Algorithm 2 would be Scenario 1, where the evaluation of a feasible solution was approximately five times faster than the evaluation of an optimal solution.This benefit came with the price of an increased suboptimality level, which was approximately 10%.Scenario 2 was more balanced, aiming to achieve a feasible solution with a reasonable level of suboptimality while expending a reasonable computational effort.The evaluation of a feasible solution is now slower than the optimal method, but the suboptimality of the solution is only 5%.In Scenario 3, the aim was to achieve a suboptimality level below 5%, but the price for this was an increased evaluation time of 145 ms.
The purpose of the different scenarios was to showcase the versatility and adaptability of this method by balancing performance, i.e., suboptimality and computational complexity.Arguably, the random shooting methodology, while inherently stochastic, offers several advantages.First and foremost, its non-reliance on traditional optimization solvers significantly streamlines the computational process, making it well-suited for environments with strict computational demands such as embedded hardware or where solver integration is complex.Additionally, the method allows for the exploitation of the optimization problem, potentially uncovering effective control strategies that deterministic approaches might overlook or might not be able to incorporate.

Conclusions
In conclusion, our study presents two distinct control methodologies for managing load demand and battery power in a battery energy storage system.The first method, MPC with Boolean-type constraints, provides an optimal deterministic solution, while the second method, a random shooting-based approximation of MPC, offers a stochastic yet computationally efficient alternative.Through various scenarios, we demonstrated the trade-off between suboptimality and computational complexity, showcasing the versatility of the random shooting approach.The shortcomings of the proposed method are its suboptimal solutions compared to the deterministic approach (MPC) and a lack of deterministic guarantees.On the other hand, this methodology, free from traditional optimization solvers, proves particularly advantageous in environments with stringent computational demands.Moreover, it offers adaptability and scalability, as it allows for complete exploitation of the structure of the optimization problem according to specific applications or user demands.Overall, it opens doors to potentially innovative control strategies that deterministic methods may not readily reveal.The developed algorithms show promise for various applications in power systems and microgrids.Efficient control of storage systems can enhance grid stability by taking into account frequency regulation, voltage support, and spinning reserve.Additionally, efficient control of BESSs enables peak demand reduction, lowering electricity costs.Such a strategy enables the integration of renewable energy sources by mitigating their variability.

Figure 2 .
Figure 2. Composite subplot of electricity price along the control horizon and battery dynamics: comparison between conventional MPC and the Random shooting method within Scenario 1.

Figure 3
Figure 3 depicts the state of charge (SoC) trajectory of the battery throughout the simulation.

Figure 3 .
Figure 3. Evolution of state of charge (SoC) over the simulation duration of Scenario 1.

Figure 4 .
Figure 4. Composite subplot of electricity price along the control horizon and battery dynamics: comparison between conventional MPC and the closely mirroring random shooting method.

Figure 5 .
Figure 5. Evolution of state of charge (SoC) over the simulation duration of Scenario 2.

Figure 6 .
Figure 6.Composite subplot of electricity price along the control horizon and battery dynamics: comparison between conventional MPC and the random shooting method of Scenario 3.

Figure 7 .
Figure 7. Evolution of State of charge (SoC) over the simulation duration of Scenario 3.
buy,k ,P batt,k ,SoC k

Table 1 .
Table presenting quantified performance results.