**3. Simulation Schematics**

The isolated WHIM shown in Figure 1 was simulated using the *MATLAB-Simulink* framework [25]. All the parameters of the presented WHIM are shown in Appendix A. The WHIM Simulink schematic is shown in Figure 3. Some of the components described above, such as the 275 kW IG of the WTG, the 300 kVA SM and its voltage regulator, the consumer load, etc. are blocks which belong to the *SimPowerSystems* blockset for Simulink. The electrical part of the IG is represented by a fourth-order model, the SM electrical part is represented by a sixth-order model and its voltage regulator-exciter is an IEEE type 1 model.

**Figure 3.** Wind-hydro isolated microgrid *Simulink* schematics.

The Hydro Turbine block implements the HT, the gate, the penstock and the speed governor models. It receives as inputs the constant 1 p.u. speed reference and the current HTG speed *ω* and produces as an output the mechanical power *Ph*−*mec* needed to bring the HTG speed to its set point. Figure 4 shows the schematics of the non-linear hydraulic turbine model, which includes Equations (1) and (2) and penstock model Equation (3).

**Figure 4.** Hydraulic turbine *Simulink* schematics.

In the simulations below, the penstock friction losses term *hf* in Equation (3) and the damping torque coefficient *KD* in Equation (2) are considered negligible. As an effect, since these natural dampings are not implemented, the system stability of the simulated WHIM can be considered worse than in reality. The Pelton turbine efficiency has been implemented by means of a lookup table, which follows the efficiency curve depicted in Figure 2.

Figure 5 shows the HT speed governor schematic, which comprises a Proportional Integral Derivative (PID) speed controller and a servo actuator. The PID speed controller performs an isochronous speed control, so that in steady state, the HT speed will be the rated one, assuming the HT demanded power is in the range [0, *HTNOM*], being *HTNOM* the HT rated power. The PID pure derivative term has been replaced by a derivative filter. PID parameters *Kp*, *Ki* and *Kd*, are calculated as proposed in [20]:

$$K\_p \quad = \quad 1.6 \frac{H}{T\_w} \tag{7}$$

$$K\_i \quad = \quad 0.14 \frac{K\_p}{T\_w} \tag{8}$$

$$\mathcal{K}\_d \quad = \quad 0.54H \tag{9}$$

where *H* = 2 s is the HTG inertia constant previously justified and *Tw* is the previously defined water time constant. The penstock is assumed to be short, with *Tw* = 1 s. With these values, Equations (7)–(9) are used to calculate the PID speed controller parameters. The PID input is the sum of the HTG speed error and the *Kick Start* (KS) signal. As shown in Figure 5, the KS signal is produced by a second order system with a zero at the origin, which acts as a derivative. When the WHIM transitions from WO to WH mode, the WH/WO\* mode signal changes from 0 to 1 and the KS signal waveform is the impulse response of the second order system formed only by the denominator. As stated above, just before the WO to WH transition occurs, the flow rate is null and the aim of the KS signal is to speed up the increase in flow rate

*Energies* **2020**, *13*, 5937

from zero to *qnl*, reducing the dead time in which there is no production of mechanical power. In the simulations below, the benefits of using the KS signal are shown. In the figure, it can be seen how the servo converts the PID output into gate opening *y*, constrained to the range [0, 1]. The servo-motor speed limits are included to avoid in the penstock big pressure transients and water hammer [26]. This servo-motor speed limits are a strong constraint to any speed controller to be implemented here.

**Figure 5.** Hydraulic turbine speed governor *Simulink* schematics.

The WT block of Figure 3 is implemented with the WT power curves of Figure 6, which define the WT shaft mechanical power *Pt*−*mec* as a function of the wind speed and the wind turbine rotational speed. To calculate the torque *Tm* delivered to the WTG-IG, *Pt*−*mec* is divided by the WT speed.

**Figure 6.** Wind turbine mechanical torque calculation.

DL control in WO mode is performed by the PID depicted in Figure 7 with the objective of regulating the system frequency. The rated frequency 1 p.u. is subtracted from the system frequency in order to obtain the frequency error, which is the input to the DL PID. The DL PID outputs, when positive, the reference power *Pref* to be consumed by the DL. The proportional, derivative and integral constants of the DL PID have been tuned to speed up the frequency response, so it is much faster than the HT PID one, and to minimize frequency overshoots. A negative output produced by the DL PID implies that active power must be produced instead of consumed, to regulate the system frequency and therefore indicates active power deficit. Since the DL cannot produce any power, a DL PID negative output means that the HTG must produce power in order to achieve the proper active power balance, and therefore a transition from WO to WH mode is needed. An active power deficit situation leads to a frequency fall, which is detected by comparing the output of the integral component of the DL PID which integrates the frequency error with the constant −0.1, as shown in Figure 7. An active power deficit signal is activated when the output of the integrator is below the constant −0.1, which makes the mode flip-flop output toggle from 0 to 1, making in turn the system change to WH mode. The constant −0.1 has been adjusted taken into account the system dynamics in WO mode. In WH mode, the power reference for the DL is zero.

Finally it is worth noting that the HT PID is active in the three modes of operation. However, in WO mode, the DL PID controls the system frequency in a much faster way than the HT PID does, so the HT PID does not have any impact during WO mode.

**Figure 7.** Dump load control *Simulink* schematics.
