Build and Simulate Single-Phase Half-Bridge Inverter with Ideal Switches and Thermal Port
In this example, you build and analyze a single-phase, half-bridge inverter that you control by using sinusoidal pulse-width modulation (SPWM) and simulate the effects of generated heat and device temperature.
To see the completed version of the model you create in this example, at the MATLAB® command prompt, enter
SinglePhaseHalfBridgeInverterThermalModel
.
Build the Model
The single-phase, half-bridge inverter in this example consists of a power circuit and a control system. First, create both parts of the model by adding and connecting the blocks.
Build the Power Circuit
The power circuit comprises a DC link, two semiconductor switches with their anti-parallel diode, and an inductive load.
To build the power circuit:
Create a new model.
Add the blocks in this table. The Library Path column specifies the hierarchical path to each block.
Block
Purpose Library Path
Quantity
DC Voltage Source Provide a DC link Simscape > Foundation Library > Electrical > Electrical Sources 2
Half-Bridge (Ideal, Switching) Model two semiconductor switches with their anti-parallel diodes and build the half-bridge with thermal effects Simscape > Electrical > Semiconductor & Converters
1
Inductor Model an inductive load Simscape > Foundation Library > Electrical > Electrical Elements 1
Convective Heat Transfer Represent a heat transfer by convection from the half-bridge to the ambient Simscape > Foundation Library > Thermal > Thermal Elements 1
Temperature Source Define the ambient temperature Simscape > Foundation Library > Thermal > Thermal Sources 1
Electrical Reference Provide the ground connection for the electrical conserving ports Simscape > Foundation Library > Electrical > Electrical Elements 1
Voltage Sensor Measure the voltage across the load Simscape > Foundation Library > Electrical > Electrical Sensors 1
Current Sensor Measure the current that flows through the load Simscape > Foundation Library > Electrical > Electrical Sensors 1
Solver Configuration Define the solver settings that apply to all physical modeling blocks Simscape > Utilities 1
Simulink-PS Converter Convert an output physical signal to a Simulink signal Simscape > Utilities 2
PS-Simulink Converter Convert a Simulink input signal into physical signal Simscape > Utilities 2
Scope Display the load voltage and the current wave Simulink > Commonly Used Blocks 2
Note
You can use the Simscape™ function
sscnew
with a domain type ofelectrical
to create a Simscape model that contains these blocks:Simulink-PS Converter
PS-Simulink Converter
Scope
Solver Configuration
Electrical Reference
Rename and connect the blocks as shown in the diagram.
To build the power circuit, this example uses a Half-Bridge (Ideal, Switching) block instead of an IGBT (Ideal, Switching) block. Similarly to the Half-Bridge (Ideal, Switching) block, you can calculate and parameterize the conduction loss of the IGBT and its anti-parallel diode, and the switching-on and switching-off losses of the IGBT. However, you cannot calculate the reverse recovery loss of the diode by using the same lookup table approach. To account for the reverse recovery loss, you need to specify the parameters associated with the diode charging dynamics. If you include the diode charging dynamics, the simulation requires more computational effort, compromising its performance.
Build the Control
The control system generates two pulse-width modulated (PWM) gate signals that control the switching behavior of two IGBTs in the Half-Bridge (Ideal, Switching) block.
To build the control system:
Add the blocks in this table to the model. The Library Path column specifies the hierarchical path to each block.
Block
Purpose Library Path
Quantity
Sine Wave Generate a sinusoidal signal that represents a unit sinusoidal modulation wave Simulink > Sources 1 Constant Define the sinusoidal pulse-width modulation index Simulink > Sources 1 Product Obtain the sinusoidal modulation wave by multiplying the unit sinusoidal wave by the modulation index Simulink > Math Operations 1
Bias Perform calculation to obtain the duty cycle signal Simulink > Math Operations 1
Gain Simulink > Math Operations 1
PWM Generator Generate PWM gate signal for the upper IGBT of the Half-Bridge (Ideal, Switching) block Simscape > Electrical > Control > Pulse Width Modulation 1
Logical Operator Obtain the complementary PWM gate signal for the lower IGBT of the Half-Bridge (Ideal, Switching) block Simulink > Logic and Bit Operations 1
Data Type Conversion Convert the input Boolean signal to double signal Simulink > Signal Attributes 1
Goto Pass the input PWM gate signal to the corresponding From block Simulink > Signal Routing 2
From Receive a PWM gate signal from the corresponding Goto block and pass the signal as an output Simulink > Signal Routing 2
Mux Combine two PWM gate signals Simulink > Signal Routing 1
Rename and connect the blocks as shown in the diagram.
Specify Model Parameters
Specify these parameters to represent the behavior of the system components:
Model Setup Parameters
These blocks specify model information that is not specific to a particular block:
Solver Configuration
Electrical Reference
As with Simscape models, you must include a Solver Configuration block in each topologically distinct physical network. This example has a single physical network, so use one Solver Configuration block with the default parameter values.
You must include an Electrical Reference block in each Simscape Electrical™ network. This block does not have any parameters.
Power Circuit Parameters
Specify these parameters to represent the behavior of the power circuit components:
Set the Constant voltage parameter of the two DC Voltage Source blocks to
100
.In the Half-Bridge (Ideal, Switching) block, set the parameters as follows:
Main settings
Gate-control port —
PS
Switching device —
IGBT
Threshold voltage, Vth —
0.5
. With this value, the Half-Bridge (Ideal, Switching) switches on when the value at the input port is equal to1
and switches off when the value at the input port is equal to0
. If you set the threshold voltage to the actual threshold value, then you must change the value at the input gate ports accordingly.On-state behavior and losses —
Tabulate with temperature and current
Integral Diode settings
Integral protection diode —
Yes
Diode model —
Tabulated I-V curve
Table type —
Table in If(Tj,Vf) form
Thermal Port settings
Thermal network —
External
Junction thermal mass —
0.1
Variables settings
Select Override Junction temperature Target.
Priority —
High
Value —
25
In the Inductor block, set these parameters:
Inductance —
0.005
Series resistance —
1
Parallel conductance —
0
In the Convective Heat Transfer block, set these parameters:
Area —
1e-3
Heat transfer coefficient —
20
In the Temperature Source block, set the Temperature parameter to
298.15
.
For a semiconductor device, the generated heat, or thermal loss, includes:
Conduction loss of the switch and its anti-parallel diode
Switching-on and switching-off loss of the switch
Reverse recovery loss of the anti-parallel diode
In this model, the Half-Bridge (Ideal, Switching) block models the semiconductor. The example models the thermal loses based on the voltage, current, and temperature. When the Half-Bridge (Ideal, Switching) block conducts current, the conduction loss is calculated by multiplying the on-state voltage across the half-bridge and the current that flows through itself.
A 2-D lookup table determines the value of the on-state voltage. To define the 2-D lookup table, in the Main settings, specify the values of the On-state voltage Vce(Tj,Ice), Temperature vector Tj, and Collector-emitter current vector Ic parameters.
The conduction loss of the anti-parallel diode is calculated by using the Forward currents If(Tj,Vf), Junction temperatures, Tj, and Forward voltages, Vf parameters in the Integral Diode settings.
A 2-D lookup table determines the value of the switching-on loss of the IGBT and then proportionates it to the Off-state voltage for loss data parameter. To define the 2-D lookup table, in the Losses settings, specify the values of the Switch-on loss, Eon(Tj,Ice), Temperature vector for losse,s Tj, Collector-emitter current vector for losses, Ice parameters.
The switching-off loss of the IGBT is calculated by using the Switch-off loss, Eoff(Tj,Ice) parameter in the Losses settings and the reverse recovery loss of the diode is calculated by using the Diode reverse recovery loss, Erec(Tj,Ice) parameter.
The generated heat dissipates from the half-bridge to the ambient atmosphere. The Convective Heat Transfer and the Temperature Source blocks model this thermal behavior. For more options of thermal network modeling, see Simulating Thermal Effects in Semiconductors.
Control System Parameters
Specify the following parameters to get the PWM gate signals for the upper and lower IGBTs from a sinusoidal modulation wave:
In the Constant block, set the Constant value parameter to
0.8
.To generate a unit sinusoidal modulation wave, set the parameters of the Sine Wave block:
Amplitude —
1
Bias —
0
Frequency (rad/sec) —
2*pi*60
Phase (rad) —
0
Sample time —
0
In the Bias block, set the Bias parameter to
1
.In the Gain block, set the Gain parameter to
0.5
.Set the PWM Generator block parameters:
Carrier counter —
Up-Down
Timer period (s) —
1/2/2000
Phase delay (s) —
0
Sample time —
0
In the Logical Operator block, set the Operator parameter to
NOT
.
The sinusoidal modulation wave is equal to To change the modulation wave, modify the modulation index, frequency, and phase values.
The PWM Generator block cannot receive the modulation wave as an input, because it must be a duty cycle. To obtain the duty cycle from the modulation wave, this example uses this equation:
where D is the duty cycle and M is the modulation wave. The Bias and Gain blocks of the control system implement this calculation.
The output PWM gate signal from the PWM Generator block controls the upper IGBT.
The Logical Operator block implements the complementary PWM gate signal that
controls the lower IGBT. The value of the Timer period (s)
parameter of the PWM Generator block is equal to 1/2/2000
, which
means that the switching frequency is equal to 2
kHz
.
The Goto blocks and From blocks implement the connection between the generated PWM gate signals and the two IGBTs in the Half-Bridge (Ideal, Switching) block. Setting the Goto tag parameter in a Goto and From block to the same tag allows you to pass a signal from one block to another without connecting them.
Signal Display Parameters
Specify the parameters of the Scope block to display the output signals.
Double-click the Scope blocks and then click the View > Configuration Properties to open the Scope Configuration Properties dialog box. On the Logging tab, clear the Limit data points to last check box.
Configure the Solver Parameters
Configure the solver parameters to use a continuous-time solver. Simscape Electrical models only run with a continuous-time solver when you clear the Local Solver parameter of a Solver Configuration block. Use the Configuration Parameters dialog to change the simulation end time, tighten the relative tolerance for a more accurate simulation, and remove the limit on the number of simulation data points Simulink® saves.
In the model window, select Modeling > Model Settings to open the Configuration Parameters dialog box.
In the left pane, click Solver:
Set Stop time to
4/60
.Set Solver to
ode23t (Mod. stiff/Trapezoidal)
.Set Max step size to
1e-4
.Set Relative tolerance to
1e-4
.
Click OK.
For more information about configuring solver parameters, see Simulating an Electronic, Mechatronic, or Electrical Power System.
Simulate the Model and Analyze the Results
Run the simulation and plot the results. In the model window, select SimulationRun.
To view the load voltage and current, double-click the Scope blocks. You can do this before or after you run the simulation.
This figure shows the load current.
The next figure shows the load voltage.
The load voltage is a PWM wave varying between -100 V and 100 V.
To view other simulation results, such as the conduction loss of the Half-Bridge (Ideal, Switching) block, use the Simscape Results Explorer. To enable the Simscape Results Explorer, first log the simulation data for all variables:
In the model window, select Modeling > Model Settings to open the Configuration Parameters dialog box.
In the left pane, click Simscape:
Set Log simulation data to
All
.Select the Open viewer after simulation check box.
Clear the Limit data points check box.
Click OK.
In the model window, select Simulation > Run to run the simulation. This figure shows the Simscape Results Explorer window that opens automatically.
When you click a node in the left pane, the corresponding plots appear in the right pane. For example, if you click the variable power_dissipated in Half-Bridge (Ideal, Switching) > S1, then the Simscape Results Explorer plots the conduction loss of the upper IGBT in the half-bridge.
To select several variables for side-by-side plot comparison, press Ctrl and click multiple variables. For example, check the switching-on and switching-off loss of the upper IGBT and the reverse recovery loss of the anti-parallel diode:
You can also check the total power loss and the junction temperature of the half-bridge by clicking the Qj and Tj variables in Half-Bridge (Ideal, Switching) > thermal_port.
For more information, see Simscape Results Explorer.
See Also
Half-Bridge (Ideal, Switching) | Inductor | Convective Heat Transfer | Temperature Source