# H-Bridge

Model H-bridge motor driver

Drivers

## Description

The H-Bridge block represents an H-bridge motor driver. The block has the following two Simulation mode options:

• PWM — The H-Bridge output is a controlled voltage that depends on the input signal at the PWM port. If the input signal has a value greater than the Enable threshold voltage parameter value, the H-Bridge output is on and has a value equal to the value of the Output voltage amplitude parameter. If it has a value less than the Enable threshold voltage parameter value, the block maintains the load circuit using one of the following three Freewheeling mode options:

• Via one semiconductor switch and one freewheeling diode

• Via two freewheeling diodes

• Via two semiconductor switches and one freewheeling diode

The first and third options are sometimes referred to as synchronous operation.

The signal at the REV port determines the polarity of the output. If the value of the signal at the REV port is less than the value of the Reverse threshold voltage parameter, the output has positive polarity; otherwise, it has negative polarity.

• Averaged — This mode has two Load current characteristics options:

• Smoothed

• Unsmoothed or discontinuous

The Smoothed option assumes that the current is practically continuous due to load inductance. In this case, the H-Bridge output is:

$\frac{{V}_{O}{V}_{PWM}}{{A}_{PWM}}-{I}_{OUT}{R}_{ON}$

where:

• VO is the value of the Output voltage amplitude parameter.

• VPWM is the value of the voltage at the PWM port.

• APWM is the value of the PWM signal amplitude parameter.

• IOUT is the value of the output current.

• RON is the Bridge on resistance parameter.

The current will be smooth if the PWM frequency is large enough. Synchronous operation where freewheeling is via a bridge arm back to the supply also helps smooth the current. For cases where the current is not smooth, or possibly discontinuous (that is, it goes to zero between PWM cycles), use the Unsmoothed or discontinuous option. For this option, you must also provide values for the Total load series resistance, Total load series inductance and PWM frequency. During simulation, the block uses these values to calculate a more accurate value for H-bridge output voltage that achieves the same average current as would be present if simulating in PWM mode.

Set the Simulation mode parameter to Averaged to speed up simulations when driving the H-Bridge block with a Controlled PWM Voltage block. You must also set the Simulation mode parameter of the Controlled PWM Voltage block to Averaged mode. This applies the average of the demanded PWM voltage to the motor. The accuracy of the Averaged mode simulation results relies on the validity of your assumption about the load current. If you specify that the current is Unsmoothed or discontinuous, then the accuracy also depends on the values you provide for load resistance and inductance being representative. This mode also makes some simplifying assumptions about the underlying equations for the case when current is discontinuous. For typical motor and bridge parameters, accuracy should be within a few percent. To verify Averaged mode accuracy, run the simulation using the PWM mode and compare the results to those obtained from using the Averaged mode.

Braking mode is invoked when the voltage presented at the BRK port is larger than the Braking threshold voltage. Regardless of whether in PWM or Averaged mode, when in braking mode the H-bridge is modeled by a series combination of two resistances R1 and R2 where:

• R1 is the resistance of a single bridge arm, that is, half the value of the Total bridge on resistance parameter.

• R2 is the resistance of a single bridge arm in parallel with a diode resistance, that is, R1 · Rd / ( R1 + Rd ), where Rd is the diode resistance.

### Thermal Port

The block has an optional thermal port, hidden by default. To expose the thermal port, right-click the block in your model, and then from the context menu select Simscape > Block choices > Show thermal port. This action displays the thermal port H on the block icon, and adds the Temperature Dependence and Thermal Port tabs to the block dialog box. These tabs are described further on this reference page.

When the thermal port is visible:

• The heat generated by the bridge on-resistance and freewheeling diodes is added to the thermal port. The thermal port has an associated thermal mass and initial temperature that you can set from the Thermal Port tab.

• The bridge on-resistance and freewheeling diode resistance become functions of temperature. You can define the values for these resistances and the second measurement temperature from the Temperature Dependence tab. Resistance is assumed to vary linearly between the two measurement temperatures. Extrapolation is used for temperatures outside of this range, except for when simulating in averaged mode with discontinuous load current characteristics.

## Basic Assumptions and Limitations

The model has the following limitations:

• If you are linearizing your model, set the Simulation mode parameter to Averaged and ensure that you have specified the operating point correctly. You can only linearize the H-Bridge block for inputs that are greater than zero and less than the PWM signal amplitude.

• No forward voltage is modeled for the freewheeling diodes. They are approximated as ideal resistances when forward biased, with resistance equal to the Freewheeling diode on resistance parameter value.

• In Averaged mode, and with the Unsmoothed or discontinuous choice for Load current characteristics, you must provide representative values for load inductance and resistance. If driving a DC Motor, then the resistance is the armature resistance, and the inductance is the sum of the armature inductance plus series smoothing inductor (if present). For a Universal Motor, total resistance is the sum of the armature and field windings, and total inductance is the sum of armature and field inductances plus any series smoothing inductance. For a Shunt Motor, MathWorks recommends that you draw a Thévenin equivalent circuit to determine appropriate values.

## Dialog Box and Parameters

### Simulation Mode & Load Assumptions Tab

Simulation mode

Select one of the following options for the type of output voltage:

• PWM — The output voltage is a pulse-width modulated signal. This is the default option.

• Averaged — The output voltage is a constant whose value is equal to the average value of the PWM signal.

Freewheeling mode

Select one of the following options for the type of H-Bridge dissipation circuit:

• Via one semiconductor switch and one freewheeling diode — In this mode, the block controls the load by maintaining one high-side bridge arm permanently on and using the PWM signal to modulate the corresponding low-side bridge arm. This means that the block uses only one of the freewheeling diodes in completing the dissipation circuit when the bridge turns off. This option is the default.

• Via two freewheeling diodes — In this mode, all bridge arms are off during the bridge off-state. This means that the block dissipates the load current across the power supply by two freewheeling diodes.

• Via two semiconductor switches and one freewheeling diode — In this mode, the block controls the load by maintaining one high-side bridge arm permanently on and using the PWM signal to toggle between enabling the corresponding low-side bridge arm and the opposite high-side bridge arm. This means that the block uses a freewheeling diode in parallel with a bridge arm, plus another series bridge arm, to complete the dissipation circuit when the bridge turns off.

This parameter is only visible when you select PWM for the Simulation mode parameter, or when you select Averaged for the Simulation mode parameter and Unsmoothed or discontinuous for the Load current characteristics parameter.

Select one of the following options for the type of load current:

• Smoothed — Assumes that the current is practically continuous due to load inductance. This option is the default.

• Unsmoothed or discontinuous — Use this option for cases where the current is not smooth, or possibly discontinuous (that is, it goes to zero between PWM cycles). For this option, you must also provide values for the Total load series resistance, Total load series inductance, and PWM frequency parameters. During simulation, the block uses these values to calculate a more accurate value for H-bridge output voltage that achieves the same average current as would be present if simulating in PWM mode.

This parameter is only visible when you select Averaged for the Simulation mode parameter.

The total load series resistance seen by the H-bridge. The default value is 10 Ω.

This parameter is only visible when you select Averaged for the Simulation mode parameter and Unsmoothed or discontinuous for the Load current characteristics parameter.

The total load series inductance seen by the H-bridge. As well as motor inductance, you should include any series inductance added external to the motor to smooth current. The default value is 1e-5 H.

This parameter is only visible when you select Averaged for the Simulation mode parameter and Unsmoothed or discontinuous for the Load current characteristics parameter.

PWM frequency

The PWM frequency at which the H-bridge is driven. For consistency, this should be the same value as the PWM frequency specified by the Controlled PWM Voltage block driving the H-Bridge. The default value is 10 kHz.

This parameter is only visible when you select Averaged for the Simulation mode parameter and Unsmoothed or discontinuous for the Load current characteristics parameter.

### Input Thresholds Tab

Enable threshold voltage

Threshold above which the voltage at the PWM port must rise to enable the H-Bridge output. This parameter is used only when the Simulation mode parameter on the Simulation Mode & Load Assumptions tab is set to PWM. The default value is 2.5 V.

PWM signal amplitude

The amplitude of the signal at the PWM input. The H-Bridge block uses this parameter only when the Simulation mode parameter on the Simulation Mode & Load Assumptions tab is set to Averaged. The default value is 5 V.

Reverse threshold voltage

When the voltage at the REV port is greater than this threshold, the output polarity becomes negative. The default value is 2.5 V.

Braking threshold voltage

When the voltage at the BRK port is greater than this threshold, the H-Bridge output terminals are short-circuited via the following series of devices:

• One bridge arm

• One bridge arm in parallel with a conducting freewheeling diode

The default value is 2.5 V.

### Bridge Parameters Tab

Output voltage amplitude

The amplitude of the voltage across the H-Bridge output ports when the output is on. The default value is 12 V.

Total bridge on resistance

The total effective resistance of the two semiconductor switches that connect the load to the two power rails when the voltage at the PWM port is greater than the value of the Enable threshold voltage parameter on the Input Thresholds tab. The default value is 0.1 Ω.

Freewheeling diode on resistance

The total resistance in the freewheeling diodes that dissipate the current that flows through the motor when the voltage at the PWM port is less than the value of the Enable threshold voltage parameter on the Input Thresholds tab. The default value is 0.05 Ω.

Measurement temperature

The temperature for which for which the resistance values on the Bridge Parameters tab are specified. This parameter appears only for blocks with exposed thermal port. For more information, see Thermal Port. The default value is 298.15 K.

### Temperature Dependence Tab

This tab appears only for blocks with exposed thermal port. For more information, see Thermal Port.

Total bridge on resistance at second measurement temperature

The total effective resistance of the two semiconductor switches that connect the load to the two power rails (as described in the Total bridge on resistance parameter definition), quoted at the Second measurement temperature. The default value is 0.1 Ω.

Freewheeling diode on resistance at second measurement temperature

The total resistance in the freewheeling diodes that dissipate the current that flows through the motor (as described in the Total bridge on resistance parameter definition), quoted at the Second measurement temperature. The default value is 0.05 Ω.

Second measurement temperature

The temperature for which for which the resistance values on the Temperature Dependence tab are specified. The default value is 398.15 K.

### Thermal Port Tab

This tab appears only for blocks with exposed thermal port. For more information, see Thermal Port.

Thermal mass

Thermal mass associated with the thermal port H. It represents the energy required to raise the temperature of of the thermal port by one degree. The default value is 100 J/K.

Initial temperature

The temperature of the thermal port at the start of simulation. The default value is 298.15 K.

## Ports

The block has the following ports:

+ref

Positive electrical output voltage.

-ref

Negative electrical output voltage.

PWM

Pulse-width modulated signal. The voltage is defined relative to the REF port.

REF

Floating zero volt reference.

REV

Voltage that controls when to reverse the polarity of the H-Bridge output. The voltage is defined relative to the REF port.

BRK

Voltage that controls when to short circuit the H-Bridge output. The voltage is defined relative to the REF port.

H