# Interpreted Petri Nets Applied to Autonomous Components within Electric Power Systems
## 4 Case Study
### Informal Specification  
The power stabilization algorithm is initiated when the permissible (limit) power fluctuations at the connection point are exceeded \(\Delta P_{RES/LOAD}>P_{Lim}\)[30]. The change in power in the grid may be caused by the variability of energy production from RES or the variability of the load. RES are characterized by the variability of the produced energy resulting from changing weather conditions, e.g., the solar or wind power plant. On the other hand, loads that significantly change their value in a short time are, for example, the starting of high-power drives, induction welders, or welding machines. The operation of the algorithm is shown in Figure 5. In the case of the implementation of this algorithm, it is necessary to maintain the level of charge (SoC) of the energy storage system allowing both charging and discharging. Before starting the process of stabilizing power fluctuations, the charge level SoC of the energy storage system is checked. Taking into account the operating conditions of the energy storage system (minimum and maximum SoC level), it was assumed that the required SoC level for the implementation of the power stabilization algorithm should be 60-65% SoC\({}_{\text{max}}\) (So\({}_{\text{max}}\)0.6 \(<\) SoC \(<\) 0.65 SoC\({}_{\text{max}}\)). Such a SoC level enables both the transfer of energy to the power grid (discharge of the energy storage) and the consumption of energy by a storage system (charging an energy storage system). If the SoC level is higher than 0.65 SoC\({}_{\text{max}}\), the energy storage system is discharged with the assumed power \(P_{ES}=P_{DCH}\) (discharge power) until the required level of SoC. When the SoC level is lower than 0.6 SoC\({}_{\text{max}}\), the energy storage system is charged with \(P_{ES}=P_{CH}\) (charging power). When the required SoC level is achieved, the power stabilization procedure can be started. The power stabilization algorithm is a follow-up control system in which the set value (the power to be maintained at the PCC connection point) changes in a manner unknown in advance. The purpose of the control system is to follow the changes of the set value. The algorithm assumes maintaining a constant power (\(P_{\textit{ref}}\)) at the PCC for \(1\)-minute periods (time \(t_{1}\)). The value of the power that should be maintained \(P_{\textit{ref}}\) in the next minute is determined on the basis of the average RES/LOAD power that was recorded in the previous period (1). At time \(t_{1}\), the difference between the line power, measured at the PCC point (\(P_{RES/LOAD}\)), and the power \(P_{\textit{ref}}\), is determined. The difference between \(P_{\textit{ref}}\) and \(P_{RES/LOAD}\) is covered from the energy storage system. After the time \(t_{1}\) has elapsed, the power \(P_{\textit{ref}}\) is determined again for the next period. \[P_{ref(n)}=\overline{P}_{RES/LOAD\_1 min(n-1)} \tag{1}\]  
Figure 5: General algorithm for power stabilization of RES and loads. The algorithm also takes into account the maximum allowable power change \(\Delta P_{ref}\) (2) so as not to adversely affect the flicker \(P_{st}\) coefficient (3). This means that a step change in voltage occurring within one minute must not have an effect on the power grid in the form of a relative voltage change of more than 3% (\(\Delta U/U_{N}\) < 3%). \[\Delta P_{ref}=P_{ref(n-1)}-P_{ref(n)} \tag{2}\]  
\[\frac{\Delta P_{ref}}{S_{kQ}}<0.03 \tag{3}\]  
where \(S_{kQ}\) is a short-circuit power at the PCC. If \(\Delta P_{ref}\geq P_{Lim}\) then the algorithm will limit the charging/discharging power of the energy storage system to \(P_{ES}=P_{Lim}\). If \(\Delta P_{ref}\) < \(P_{Lim}\) then the charging/discharging power of the energy storage system will result from the power difference \(P_{RES/LOAD}\) measured at the PCC point and the power \(P_{ref(n)}\) (\(P_{ES}=P_{ref(n)}-P_{RES/LOAD}\)).