PI Control for a buck converter.
The buck converter from the previous tutorial is extended with a PI control. We will create a model where the mosfet is controlled from the block diagram where the PI controlled is modeled. Create a circuit as shown below:

The gate of the Mosfet is a block diagram node. This is indicated by the square node. We will control the gate of the Mosfet by using a SIGNAL block. The block SIGNAL is used to create wave forms like square waves, sinusoidal and triangular waveforms. Select the block TIME and SIGNAL from Components/Blocks/Source

Please note that in most cases the first input has to be connected to the block Time. The DC value of the source is set to 0 and the AC value is set to 1. The frequency of the square wave form is set to 200kHz with a phase-shift of 0 rad. In the previous tutorial the duty cycle, being the last input of the block SIGNAL was set to 0.5. In this control a PI control is used with the following parameters:
- P=10
- I=20
The gate of the Mosfet is connected to the output of the block SIGNAL. The simulation is shown below.
