In this lecture, we will show how we can use average circuit simulations to verify our average current mode control design. The converter example is again shown right here. It's a boost converter taking 170 V input to 400 V output at 2 kilowatt. It is operating at 100 kilohertz with a pulse width modulator that has VM equal to 4 volts. In the previous lecture, we have designed the current loop compensator as a lag or PI compensator with a transfer function shown right here, with a gain, zero and pole frequencies are shown right here. So we will now take that design and put it into a simulation model using averaged switch modeling approach. Here's the average circuit model of the average current model controlled boost converter example. Let's look carefully at how that model is constructed. So in the power stage we have the transistor and the diode replaced by the averaged switch model. In this case we chose CCM-DCM1 model because we wanted to allow for the possibility that the converter may operate in discontinuous conduction mode. For the parameter values that are given for the design at a power level of 2 kilowatts at the output, the load resistance with 400 V at the output is going to be 80 ohms. Under those conditions the converter will operate in continuous conduction mode. But you can certainly go ahead and make changes in the parameter values and make the converter operate in discontinuous conduction mode at light load. The CCM-DCM1 model has parameters. Those parameters are the value of the inductance, which matches the value of the inductance in the power stage of 250 microhenries. and a switching frequency of 100 kilohertz, which matches the value of the switching frequency in a switching circuit model or an actual circuit. The pulse width modulator is modeled simply as a controlled source. That control source has a value of 0.25 times the voltage at the output of the current compensator, with limits imposed on the minimum duty cycle of 1% and maximum duty of 99%. This particular line gives us the ability to set simply the gain of the pulse width modulator as well as practical limits for the minimum and the maximum duty cycle. Where is 0.25 coming from? It is coming from the fact that VM in the example considered is equal to 4 volts. So the gain of the pulse modulator is 1 over 4 or 0.25. In the bottom part of the diagram, you see an implementation of the current mode control compensator. That compensator follows the design we had done in the previous lecture with the values of R1, C2, R2 and C3 corresponding to the values that we have determined earlier. One detail to pay attention to is that we have placed exactly the same network with a subscript a in the circuit between the control input and the plus input of the op-amp. The reason we have done so is to have the actual implementation of the compensator done in a form that v sub m, the output voltage that we would have at the output of the current loop compensator is equal to Gci, that's the current loop compensator transfer function, G sub ci(s) times the control input v sub c minus the sensed current input v sub s. v sub s is the voltage right here, and notice how we have modeled the current sensing through a controlled source Hsense, which has a gain in front of the sensed current, in this case the inductor current, equal to 0.25, which is the assumed equivalent current sensing resistance for the current control loop. So placing the same network right here as the network we have around the op-amp feedback loop, gives us a differential amplifier configuration of the compensator which results in exactly this transfer function right here, where the difference between v sub c and v sub s is amplified by the transfer function Gci(s). Finally, let's look at the simulation commands right here. First of all notice that we’re using the average.lib library as we should, because we are relying on the average switch model in the circuit simulation used to verify the performance of the current control loop. We're sweeping the frequencies for small signal ac simulation with 300 points per decade from 10 hertz to 100 kilohertz, and we are also using a measurement line to find where the cross-over frequency is, as the frequency where the magnitude response of v(y) over v(x) = 1 or 0 dB. To find the loop gain, we employ the voltage injection method. We place a small signal AC voltage source between the output of the compensator and the input of the pulse width modulator, and we set, for convenience, the AC source value to 1, the normalized value of 1. That's the Vz voltage insertion source that we have for testing the loop gain. So the loop gain is going to be plotted as the negative v(y) over v(x). Here is the result for the loop gain. So the magnitude response of the loop gain is shown right here. And you can identify with a cursor or with that measurement line by inspection of the log output file from Spice simulation, the value of the cross-over frequency is equal to 9 kHz. It is very close to the desired value of 10 kilohertz that we have designed for. The phase margin comes out to be 48 degrees which exceeds the 45 degrees goal that we have set. Next, let's look at the closed-loop control to inductor current response. Why do we do that? Well, we would like to see how well in a small-signal sense our current control loop operates in closed loop. So to do so, we set our injection source to 0, and instead assign AC 1 to the control input v sub c. The output of interest is going to be the inductor current because that's the goal of the current control loop to control the inductor current. So the frequency response of the current control loop closed loop is shown right here. This is the response from the control input to the inductor current in the small-signal sense, and what Spice simulation shows are both the magnitude and phase responses. At low frequencies, the response is ideal. We have a lot of loop gain at low frequencies, which is why the low frequency gain of the closed loop control to inductor current response follows the ideal value of 1 over Rf, Rf being the equivalent current sensing resistance for the current. So computing that value gives us 12 dB over ohm value for the ideal response at low frequencies. And remember that we have designed our loop gain with a cross-over frequency target of 10 kilohertz, the actual value was 9 kilohertz, and you see that in the closed-loop response (phase margin is around 45 degrees), we have a little bit of peaking in the magnitude response, and that's okay. Typically that would be a very practical response. So we have a wide bandwidth control loop over the current available with a wide range of frequencies where the control to current response follows the ideal value set by the current sensing resistance R sub f. Next, now that we have designed the inner current loop we're going to take the same example to design the outer voltage loop and show how that outer voltage loop can be used to regulate the output voltage by designing appropriately the voltage loop compensator, G sub cv. That voltage loop compensator based on the error between the reference voltage and the sensed value of the voltage, is going to give the control input for the inner current control loop, as we have already discussed.