**3.3. Configuration of SimPowerSystems blocks**

Simulation of any SimPower circuit involves parameter configuration within model blocks after circuit is constructed. This is achieved by double-clicking on the circuit block to reveal block parameters. Table 5 shows the possible block configuration parameters for common SimPower power electronic devices. A user may also elect to use typical values provided by default.


**Table 5.** SimPowerSystems Block Configuration Parameters

The parameters of Table 5 can be classified according to the following: Ron, Lon, Vf are applicable during forward conduction of current, current 10% fall time and current tail time are applicable during shut-off, and snubber resistance and snubber capacitance affect the circuit during the OFF condition.

The definitions of Ron, Lon, and Vf are evident by inspection of the typical power electronic device circuit diagram shown in Fig. 8.

**Figure 8.** Example SimPower Power Electronic Device Equivalent Circuit

Initial current is the amount of current in amperes flowing through device at the start of simulation. Snubber resistance and capacitance (Rs and Cs) are self-evident for snubber circuits. Latching current (Il) is defined as the amount of current required for thyristor to become self-commutated. Turn-off time (Tq) is defined as the minimum amount of time required for the voltage across anode and cathode to be zero or less to avoid the device automatically turning on again when a forward voltage is seen. Current fall-time and tail time are explained in waveform shown in Fig. 9 (from Matlab help file).

**Figure 9.** SimPower GTO and IGBT Fall-Time and Tail-Time Waveform, Respectively Internal diode resistance of the MOSFET (Rd) is explained in Fig. 10.

**Figure 10.** SimPower MOSFET Equivalent Circuit

**Figure 8.** Example SimPower Power Electronic Device Equivalent Circuit

time are explained in waveform shown in Fig. 9 (from Matlab help file).

**Figure 9.** SimPower GTO and IGBT Fall-Time and Tail-Time Waveform, Respectively

Internal diode resistance of the MOSFET (Rd) is explained in Fig. 10.

circuit during the OFF condition.

device circuit diagram shown in Fig. 8.

The parameters of Table 5 can be classified according to the following: Ron, Lon, Vf are applicable during forward conduction of current, current 10% fall time and current tail time are applicable during shut-off, and snubber resistance and snubber capacitance affect the

The definitions of Ron, Lon, and Vf are evident by inspection of the typical power electronic

Initial current is the amount of current in amperes flowing through device at the start of simulation. Snubber resistance and capacitance (Rs and Cs) are self-evident for snubber circuits. Latching current (Il) is defined as the amount of current required for thyristor to become self-commutated. Turn-off time (Tq) is defined as the minimum amount of time required for the voltage across anode and cathode to be zero or less to avoid the device automatically turning on again when a forward voltage is seen. Current fall-time and tail

#### **4. Simulation, analysis, and design**

A Matlab script file can accompany simulations performed in the Simulink environment. Script files provide ease in defining and computing variables from a single location which allows the model to be general and applicable to many different cases as well as maintain uniformity in plotting and results presentation. If modification of parameters is desired, the changes are easily accomplished by changing the numbers in the workspace and repeating the simulation. This general-modeling functionality is a distinct advantage of Matlab over Multisim.

Simulink offers a simple and versatile platform for equation modeling. Practically any equation can be implemented in Simulink following an easy and direct method. Consider Eq. (1), the inductor voltage as a function of inductor current – these are the input and output variables of what can be implemented as a small subsystem in Simulink. The first modeling step can be to introduce variable routing tags for each input and output variable as shown in Fig. 11 (a). Next, consider the intermediate mathematics of the function. It is observed that the equation involves multiplication by a constant and a derivative – therefore drag these function blocks into the Simulink workspace and connect appropriately, Fig. 11 (b). For example Eq. (1) is simulated as in Fig. 11 (b). Following the signal step-by-step as shown in Fig. 11 (c) reveals that the subsystem output is the voltage of the inductor based on the input current to the inductor. The equation is therefore successfully modeled. It is well to mention that the model shown in Fig. 11 is an analytical exercise only; physically implementing the model shown is not recommended as the differentiator will amplify noise in a real system.

As an exercise to bring together the concepts discussed of blocks performing functions based on embedded subsystems and equation modeling, consider the non-linear signal created with the Matlab program shown in Fig. 12.

**Figure 11.** Equation Modeling: Inductor Voltage as a Function of Current

**Figure 12.** Sinusoidal Signal Generation with Harmonic Content

The signal shown in Fig. 12 can be imported into the Simulink model with the "From Workspace" block and evaluated for total harmonic distortion (21) as shown in Fig. 13.

**Figure 13.** Total Harmonic Distortion Analysis of Signal with Harmonic Content

Compare the top three forward paths of the block diagram in Fig. 13 to Eq. (21). It can be seen that the signal has been successfully evaluated for Total Harmonic Distortion (THD) of the given signal (neglecting harmonic content beyond the 3rd). Now consider the fourth forward path of the block diagram and compare the THD measurement blocks at the right – the results are identical illustrating the embedded mathematical functionality contained in Simulink blocks. To explore further, right-click on the Simulink THD block, choose "Look Under Mask", and compare mathematical functionality.

Applying the same modeling techniques shown in the THD example in an effort to aid in optimization of power electronic converters and to exemplify the block modeling concepts discussed, the loss equations introduced in section 2.4 have been modeled in Simulink (Fig. 14) for the buck-boost converter and combined into a Simulink model block (Fig. 15). The Buck-Boost Converter Power & Efficiency block is used in section 4.3 for converter optimization.

**Figure 14.** Buck-Boost Power & Efficiency Block Embedded Calculations

## **4.1. Light dimmer**

152 MATLAB – A Fundamental Tool for Scientific Computing and Engineering Applications – Volume 1

current (A)



0

5

10

The signal shown in Fig. 12 can be imported into the Simulink model with the "From Workspace" block and evaluated for total harmonic distortion (21) as shown in Fig. 13.

1 1

*RMS Harmonic I I <sup>I</sup> THD I I*

*RMS RMS*

2 2 1

*RMS*

(21)

<sup>0</sup> 0.005 0.01 0.015 -15

time (s)

sqrt Math Function Divide

0.3607

0.3607 THD

THD.

**Figure 12.** Sinusoidal Signal Generation with Harmonic Content

Fourier Mag Phase n=3

1/(sqrt(2))

1/(sqrt(2))

1/(sqrt(2))

Gain2

Gain1

Gain

THD

Total Harmonic Distorsion

Fourier Mag Phase n=2

Fourier Mag Phase n=1

%% non-linear current signal clear; close; %intialize

t=0:0.0001:0.016; %Defines time array for one period i=10\*sin(377\*t)+3\*sin(754\*t) +2\*cos(1131\*t); %defines array for current signal

vv=[t' i'] %defines 2-column array containing both t and i values for one period

workspace

plot(t,i); grid; xlabel('time (s)'); ylabel('current (A)');

%plots signal

**Figure 13.** Total Harmonic Distortion Analysis of Signal with Harmonic Content

Compare the top three forward paths of the block diagram in Fig. 13 to Eq. (21). It can be seen that the signal has been successfully evaluated for Total Harmonic Distortion (THD) of the given signal (neglecting harmonic content beyond the 3rd). Now consider the fourth

Product2

Product1

vv From Workspace

> Consider the light dimmer circuit introduced in section 2.1. A good first step in simulation of this circuit is to understand the range of available output voltage and power as controlled by varying the potentiometer R2. As R2 is adjusted between its minimum and maximum resistance values, Matlab can be used to plot the waveforms to illustrate the output characteristics of the circuit. The light dimmer TRIAC is self-commutating as introduced in

section 2.1. This behavior in general is plotted as shown in Fig. 16, where alpha represents the firing angle of the TRIAC in the supplied waveform.

To find the output power of the light dimmer circuit, the light dimmer voltage waveform shown in Fig. 16 can be evaluated for RMS current over one-half period (as negative portion of waveform is symmetrical) giving,

$$I\_{RMS} = \sqrt{\frac{1}{\pi} \int\_{\alpha}^{2} \frac{V\_m^2}{R^2} \sin^2 \left(\theta\right) d\theta} = \frac{V\_m}{R} \sqrt{1 - \frac{\alpha}{\pi} + \frac{1}{2\pi} \sin \left(2\alpha\right)}\tag{22}$$

It follows that,

$$\mathrm{P}\left(\alpha\right) = \mathrm{I}\_{RMS}^{2}\mathrm{R} = \frac{\mathrm{V}\mathrm{m}^{2}}{2\mathrm{R}} \left[1\mathrm{-}\frac{\alpha}{\pi} + \frac{1}{2\pi}\sin\left(2\alpha\right)\right] \tag{23}$$

**Figure 15.** Developed DC/DC Converter Power & Efficiency Blocks – Buck, Boost, Buck-Boost

**Figure 16.** Self-Commutation at Firing Angle Alpha

and,

$$\mathbf{V}(\alpha) = \sqrt{\mathbf{P}(\alpha) \mathbf{\bar{j}}(\mathbf{R})} \tag{24}$$

where α = firing angle of TRIAC

The relationships shown in 23 and 24 can be plotted in the Matlab workspace as shown in Fig. 17, assuming a supply of 120VRMS, 60 Hz, and light bulb impedance of 576Ω (purely resistive – inductive effects negligible).

**Figure 17.** Power and Voltage as a Function of Firing Angle Alpha

2

iSS VSS iLS VLS iload

*V V I d*

2

2

Output Power

Losses

Ef f iciency

Asynchronous Buck/Boost Converter Power & Efficiency

*m m*

*R R*

**Figure 15.** Developed DC/DC Converter Power & Efficiency Blocks – Buck, Boost, Buck-Boost

The relationships shown in 23 and 24 can be plotted in the Matlab workspace as shown in Fig. 17, assuming a supply of 120VRMS, 60 Hz, and light bulb impedance of 576Ω (purely

 

the firing angle of the TRIAC in the supplied waveform.

of waveform is symmetrical) giving,

Output Power

Losses

Ef f iciency

Synchronous Buck/Boost Converter Power & Efficiency

It follows that,

iSS VSS iLS VLS iload

and,

*RMS*

**Figure 16.** Self-Commutation at Firing Angle Alpha

where α = firing angle of TRIAC

resistive – inductive effects negligible).

section 2.1. This behavior in general is plotted as shown in Fig. 16, where alpha represents

To find the output power of the light dimmer circuit, the light dimmer voltage waveform shown in Fig. 16 can be evaluated for RMS current over one-half period (as negative portion

> 2 <sup>2</sup> Vm <sup>α</sup> <sup>1</sup> <sup>P</sup> <sup>α</sup> =I 1- + sin 2<sup>α</sup> 2R <sup>π</sup> <sup>2</sup><sup>π</sup> *RMS<sup>R</sup>*

> > iSS VSS iD VD iload

1 1 sin 1 sin 2

 (22)

2

Output Power

Losses

Ef f iciency

Buck Converter Power & Efficiency (23)

iGTO VGTO iLS VLS iload

Output Power

Losses

Ef f iciency

Boost Converter Power & Efficiency

<sup>V</sup> <sup>α</sup> = P <sup>α</sup> <sup>R</sup> (24)

Fig. 17 reveals power and voltage characteristics that can be expected from the light dimmer circuit. As expected, the power output is non-linear, i.e. proportional changes in potentiometer dial rotation do not result in proportional changes in lamp brightness. The graph also confirms the maximum voltage and power the lamp will experience for proper lamp sizing.

To examine light dimmer circuit behavior in more detail and observe waveforms, the circuit can be implemented in Simulink. The model can be constructed as shown in Fig. 18. Simulink blocks are added to the model simply by dragging-and-dropping from the Simulink Library Browser, while connections between blocks are accomplished by singleclicking and dragging to appropriate nodes. The blocks shown are color coded by type of block as organized within Simulink as follows: orange – SimPower sources, red – SimPower power electronic devices, magenta – SimPower elements, light blue – SimPower measurements devices, dark blue – standard Simulink blocks.

Some devices shown in Fig. 18 are identical to those introduced in Fig. 1, such as resistors and capacitors. The DIAC is represented by two diodes placed to conduct current in opposite directions (for AC) as diodes exhibit the same self-commutating behavior. The TRIAC is implemented using two thyristors to pass AC current in much the same way as the DIAC, the difference being the active control input at the gate. Thyristors are chosen in SimPower for their self-commutating behavior and representation of TRIAC characteristics. Double-click model blocks to set parameters according to those shown.

Note the block in Fig. 18 labeled "powergui" near the AC voltage source. This block automatically appears upon running a SimPower simulation, and is required. The powergui contains configuration functions such as initial states, machine initialization parameters, FFT analysis, and other useful tools, albeit none are utilized in this chapter.

The results of evaluating the light dimmer circuit in Simulink are shown in real time as the simulation progresses on the numerical readouts. After the simulation is completed, double-clicking on the "Vload" scope icon reveals a waveform similar to Fig. 19. The waveform of Fig. 19 shows the self-commutation behavior discussed earlier in that, once fired, the TRIAC passes current until the voltage across it drops to zero. Note the time that the gate voltage spikes to 1 is the exact time that the TRIAC fires and allows the source voltage waveform to pass until the current drops below the holding current IH which occurs in this ideal case at I=0. Also notice the waveform that fires at approximately 10ms is slightly distorted – this asymmetrical firing of the TRIAC's occurs for a brief period until the converter stabilizes.

**Figure 18.** Light Dimmer Circuit

**Figure 19.** SimPower Light Dimmer Output Voltage Waveform - α=87°

analysis, and other useful tools, albeit none are utilized in this chapter.

period until the converter stabilizes.

**Figure 18.** Light Dimmer Circuit

Note the block in Fig. 18 labeled "powergui" near the AC voltage source. This block automatically appears upon running a SimPower simulation, and is required. The powergui contains configuration functions such as initial states, machine initialization parameters, FFT

The results of evaluating the light dimmer circuit in Simulink are shown in real time as the simulation progresses on the numerical readouts. After the simulation is completed, double-clicking on the "Vload" scope icon reveals a waveform similar to Fig. 19. The waveform of Fig. 19 shows the self-commutation behavior discussed earlier in that, once fired, the TRIAC passes current until the voltage across it drops to zero. Note the time that the gate voltage spikes to 1 is the exact time that the TRIAC fires and allows the source voltage waveform to pass until the current drops below the holding current IH which occurs in this ideal case at I=0. Also notice the waveform that fires at approximately 10ms is slightly distorted – this asymmetrical firing of the TRIAC's occurs for a brief

The light dimmer circuit was also constructed using physical components and tested for validity. A 60 Watt light bulb was light controlled using the Littlefuse Q2015L5 TRIAC and the STMicroelectronics DB3 DIAC. The Fluke-41 Power Harmonics Analyzer was the primary waveform capturing device (Fig. 20).

Graphical comparison of simulated and experimental results shows very good agreement. Observe the symmetrical firing angle on both halves of the waveform as presented and discussed earlier – this provides confirmation of a successful design concerning firing angle symmetry. Simulated and experimental data were taken for firing angles ranging from 28° to 155° and recorded as presented in Table 6.

**Figure 20.** Experimental Light Dimmer Output Voltage Waveform - α=87°


**Table 6.** Light Dimmer Characteristics – Experimental vs. Simulated Results

There is good agreement between the simulated and experimental data given in Table 6. The values diverge particularly toward the upper firing angles. Divergence and inconsistencies are expected due to variations in the load resistance due to thermal effects. THD is expected to be lower for low firing angles as less harmonic components are present in undisturbed waveforms closely resembling the smooth curve of the input sine wave. The more the voltage waveform is modified by the TRIAC firing at higher angles the more high frequency components are produced, and therefore the more total harmonic distortion.
