# Interpreted Petri Nets Applied to Autonomous Components within Electric Power Systems
## 4 Case Study
### Formal Specification  
In order to formally specify a detailed description of the algorithm's operation, an interpreted Petri net model was created (Figure 6), which takes into account additional dependencies related to the physical constraints of the system. This model defines the transition conditions between the respective operating states of the system. First, the storage system must provide the initial conditions for the provision of the power stabilization service--0.6 SoCMAX \(\leq\) SoC \(\leq\) 0.65 SoCMAX. After reaching the initial conditions, then the power stabilization algorithm is implemented, according to the relationships (1)-(3) and the diagram in Figure 5. Then, the operating points associated with discharging or charging the energy storage system, with a power \(P_{ES}\) lower than \(P_{Lim}\) or a power \(P_{ES}\) greater than \(P_{Lim}\), are defined. It is always possible to disable the provision of the power stabilization service. In the occurrence of full charge (SoC = SoCMAX) or full discharge (SoC = SoCMIN), for the algorithm to continue to work, the discharge process \(P_{ES}\) < 0 or the charging process \(P_{ES}\) > 0 must follow. If there is a state of full charge or discharge of the energy reservoir, the algorithm will not be able to fully compensate for power fluctuations during this time. The transition of the energy storage system into the operating state with power limitation to \(P_{Lim}\) occurs when the system is installed in a network with low short-circuit power, Equation (3). Then, the charge power or discharge power of the energy storage system could affect excessive high voltage fluctuations in the network. The transition to this operating state of the signal is associated with large power changes in the system with low short-circuit power (high short-circuit loop impedance). Following the proposed modeling methodology, the general steps of control algorithm realization have been identified and appropriate output signals have been defined that correspond to the system state (line 1 of Algorithm 1). They are used to indicate the current status of the system. The elements of set \(Y\) are listed in Table 1. Next, the conditions and input signals for the control algorithm have been defined (lines 2-5 of Algorithm 1) that directly influence the current system state. The input signals are _true_ if the corresponding conditions are fulfilled. Otherwise, they are _false_. The elements of set \(X\) are listed in Table 2.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Signal** & **Description** \\ \hline y1 & Idle state \\ y2 & Initialization of initial conditions of the algorithm \\ y3 & Battery pre-charging \\ y4 & Battery charging with \(\mid\!\!P_{ESmax}\!\mid\!\!\mid\!\mid\!\mid\!\mid\!\mid\!\mid\!\mid\!\mid\!\mid \!\mid\! Afterwards, the structure of the interpreted Petri net is created so that it properly describes the functionality (line 6 of Algorithm 1). The initial marking involves place \(p1\) and corresponds to the idle state (line 7 of Algorithm 1). Places are connected with each other via transitions, some of which are mutually sequential to each other. Next, output signals are assigned to appropriate places as system states (lines 9-11 of Algorithm 1), e.g., signal \(y1\) (indication of idle state) is assigned to place \(p1\), which means that it is active as long as place \(p1\) maintains a token. In turn, input signals are assigned to transitions as their guards (lines 12-16 of Algorithm 1), e.g., signal \(x9\) (request to start the algorithm) is assigned to transition \(t1\). A transition is fired (realized) if its incoming place has a token and the condition assigned to it is true, e.g., transition \(t1\) is fired if place \(p1\) contains a token and input signal \(x9\) is true, then a token is removed from place \(p1\) and added to place \(p2\). Otherwise, the net does not change its marking (i.e., it does not evolve).