# Transactive Energy to Thwart Load Altering Attacks on Power Distribution Systems
## 3 Automatic Generation Control
### Automatic Generation Control in the Time-Domain  
For deriving the time-domain representation of the block diagram in Figure 1, a time domain relation between input and output variables of each block should be obtained. Toward this end, we consider the specific block with input and output variables \(\Delta P_{g}\) and \(\Delta P_{t}\), respectively. This specific block establishes the following relation between the variables \(\Delta P_{g}\) and \(\Delta P_{t}\) in frequency domain:  
\[\Delta P_{t}(s)=\frac{K_{t}}{T_{t}s+1}\Delta P_{g}(s), \tag{1}\]  
where \(s\) is the complex-frequency variable. From (1), one can find the following time-domain relation between \(\Delta P_{g}(t)\) and \(\Delta P_{t}(t)\):  
\[\Delta P_{t}^{\prime}(t)=-\frac{\Delta P_{t}(t)}{T_{t}}+\frac{K_{t}}{T_{t}} \Delta P_{g}(t). \tag{2}\]  
Figure 1: The representation of automatic generation control in complex frequency domain [36; 37].  
In a similar way to the above approach, the frequency-domain relations between input and output variables of all the blocks in Figure 1 can be translated to time-domain relations:  
\[\begin{split}&\Delta\omega^{\prime}(t)=-\frac{D}{M}\Delta\omega(t)+ \frac{K_{p}}{M}\left(\Delta P_{t}(t)-\Delta P_{D}\right)\\ &\Delta P_{g}^{\prime}(t)=-\frac{\Delta P_{g}(t)}{T_{g}}+\frac{K _{g}}{T_{g}}x(t)\\ & x^{\prime}(t)=\big{(}\frac{D}{MR}-K_{i}\big{)}\Delta\omega- \frac{K_{p}}{MR}\Delta P_{t}(t)+\frac{K_{p}}{MR}\Delta P_{D},\end{split} \tag{3}\]  
where \(\Delta P_{D}\) denotes the change in power consumption of the power grid. The Equations (2) and (3) can be summarized in the following matrix form:  
\[\begin{bmatrix}\Delta\omega^{\prime}(t)\\ \Delta P_{t}^{\prime}(t)\\ \Delta P_{g}^{\prime}(t)\\ x^{\prime}(t)\end{bmatrix}\!\!=\!\!\!\begin{bmatrix}\frac{-D}{M}&\frac{K_{p}} {M}&0&0\\ 0&\frac{-1}{T_{t}}&\frac{K_{t}}{T_{t}}&0\\ 0&0&\frac{-1}{T_{g}}&\frac{K_{g}}{T_{g}}\\ \frac{D-MRK_{i}}{MR}&\frac{-K_{p}}{MR}&0&0\end{bmatrix}\!\!\!\begin{bmatrix} \Delta\omega(t)\\ \Delta P_{t}(t)\\ \Delta P_{g}(t)\\ x(t)\end{bmatrix}\!\!+\!\!\begin{bmatrix}\frac{-K_{p}}{M}\\ 0\\ 0\\ \frac{K_{p}}{MR}\end{bmatrix}\!\!\!\Delta P_{D}. \tag{4}\]  
The Equation (4) is the time-domain representation of the automatic generation control. This equation is also referred to as the state-space representation ([38], p. 24) of the block diagram of Figure 1.  
In this paper, the Equation (4) is used to simulate the response of a generator to a change in power consumption of the power grid \(\Delta P_{D}\). More precisely, the state of the variables \(\Delta\omega\), \(\Delta P_{t}\)\(\Delta P_{g}\), and \(x\) is updated in time intervals of length \(\tau=0.01\) seconds as follows:  
\[\begin{bmatrix}\Delta\omega(t+\tau)\\ \Delta P_{t}(t+\tau)\\ \Delta P_{g}(t+\tau)\\ x(t+\tau)\end{bmatrix}=\begin{bmatrix}\Delta\omega(t)\\ \Delta P_{t}(t)\\ \Delta P_{g}(t)\\ x(t)\end{bmatrix}+\begin{bmatrix}\Delta\omega^{\prime}\\ \Delta P_{t}^{\prime}(t)\\ \Delta P_{g}^{\prime}(t)\\ x^{\prime}(t)\end{bmatrix}\tau, \tag{5}\]  
where the derivatives of the variables \(\Delta\omega\), \(\Delta P_{t}\)\(\Delta P_{g}\), and \(x\) are calculated from the Equation (4).  
We note that \(\Delta\) and \(\omega\) in Equations (4) and (5) are the changes in angular frequency of the sinusoidal voltages. Accordingly, the change in frequency of sinusoidal voltages is obtained as follows:  
\[\Delta f=\Delta\omega/2\pi. \tag{6}\]  
Figure 2 shows the change in frequency of sinusoidal voltages \(\Delta f\) in an exemplary power grid, succeeding a surge in power consumption of the grid. From Figure 2, the frequency of sinusoidal voltages drops below the rated frequency of 60 Hz subsequent to the increase in power consumption of the power grid. The frequency is eventually reverted back to the rated frequency by means of the automatic generation control mechanism.