MOSFET (Ideal, Switching)
R2026bIdeal N-channel MOSFET for switching applications
Libraries:
Simscape /
Electrical /
Semiconductors & Converters
Description
The MOSFET (Ideal, Switching) block models the ideal switching behavior of an n-channel metal-oxide-semiconductor field-effect transistor (MOSFET).
The switching characteristic of an n-channel MOSFET is such that if the gate-source voltage exceeds the specified threshold voltage, the MOSFET is in the on state. Otherwise, the device is in the off state. This figure shows a typical i-v characteristic:

To define the I-V characteristic of the MOSFET, set the On-state behavior and
switching losses parameter to either Specify constant
values or Tabulate. The
Tabulate option is available only if you expose the thermal port
of the block.
In the on state, the drain-source path behaves like a linear resistor with resistance, Rds_on. However, if you expose the thermal port of the block and parameterize the device using tabulated I-V data, the tabulated resistance is a function of the temperature and current.
In the off state, the drain-source path behaves like a linear resistor with low off-state conductance, Goff.
Then, the defining Simscape™ equations for the block are:
if G > Vth v == i*Rds_on; else v == i/Goff; end
where:
G depends on the value of the Gate-control port parameter.
If you set the Gate-control port parameter to
PS, you control the gate terminal through a physical signal. G is the value at the input port G.If you set the Gate-control port parameter to
Electrical, you control the gate terminal through an electrical signal. G is equal to:if v >= 0 G = G.v - S.v; else G = G.v - D.v; end
where G.v is the gate voltage, S.v is the source voltage, and D.v is the drain voltage.
Vth is the threshold voltage.
v is the drain-source voltage.
i is the drain-source current.
Rds_on is the on-state resistance.
Goff is the off-state conductance.
Using the Integral Diode settings, you can include the body diode or an integral protection diode. The integral diode provides a conduction path for reverse current and allows for an increased numerical stability in your model. For example, to provide a path for a high reverse-voltage spike that is generated when a semiconductor device suddenly switches off the voltage supply to an inductive load.
Model Gate Port and Thermal Effects
You can choose between physical or electrical ports to control the gate terminal and expose
the thermal port to model the heat that switching events and conduction losses
generate. To choose the gate-control port, set the Gate-control
port parameter to PS or
Electrical. To expose the thermal port, set the
Modeling option parameter to No thermal
port or Show thermal port.
You can also expose the thermal port HDiode of the integral protection diode by selecting the Separate thermal port for integral diode parameter. If you do not expose the diode thermal port, both the device and the diode share the common thermal port, H. (since R2024b)
For more information about using thermal ports, see Simulating Thermal Effects in Semiconductors.
Thermal Losses
The MOSFET (Ideal, Switching) block models three types of thermal losses: conduction losses, switching losses, and reverse recovery losses of the integral diode.
The block calculates conduction losses as the instantaneous electrical power
dissipated by the device, P = iv,
using either a fixed on‑state resistance or a temperature‑dependent on‑state voltage
characteristic. The block draws the requisite electrical power from the supply in through
the ports and converts it to thermal power. If you set the Modeling
option parameter to No thermal port, the block
dissipates this thermal power to the external system. If you set the Modeling
option parameter to Show thermal port, the block
continuously injects this power into the thermal network as heat.
The power_dissipated variable in the logged simulation data reports
ohmic on-state losses. This variable does not include switching losses or reverse recovery
losses because the block models these losses as instantaneous events.
Switching losses are major sources of thermal loss in semiconductors. During each
on-off switching transition, the MOSFET parasitics store and then dissipate energy. To
model switching losses, set the Modeling option parameter to
Show thermal port. The MOSFET (Ideal, Switching) block uses an abstract
model that simulates fast and does not model charge dynamics. The model treats switching
losses as discrete energy packets that occur at switching events, instead of continuous
power.
The figure shows an idealized representation of the output voltage Vout and current Iout of the semiconductor device. The interval includes the nth switching cycle, during which the device turns on and then off.
![]()
When a switching device turns on, the loss depends on the off-state voltage across the device just prior to turn on and the on-state current when the device reaches its fully on state. Similarly, when a switching device turns off, the loss depends on the on-state current through the device just prior turn off and the off-state voltage across it when it reaches its fully off state.
To compute the switching losses, you specify the energy dissipated during a single switch-on and switch-off event. You also specify the corresponding reference values of off-state voltage and on-state current at which you quote the losses. Choose how to parameterize the losses depending on the data you have.
To specify a scalar value for the switching losses, set the On-state behavior and switching losses parameter to
Specify constant values. The Switch-on loss and Switch-off loss parameter values set the sizes of the switching losses. The block scales the losses by the measured off-state voltage and the on-state current.To specify the losses as a function of the junction temperature and on-state current at a fixed off-state voltage, set the On-state behavior and switching losses parameter to
Tabulateand clear the Include switching loss tabulation with off-state Vds voltage parameter. The Switch-on loss, Eon(Tj,Ids) and Switch-off, Eoff(Tj,Ids) parameters set the size of the losses. The block scales the losses measured by the off-state voltage.To specify the losses as a function of the junction temperature, on-state current, and off-state voltage, set the On-state behavior and switching losses parameter to
Tabulateand select the Include switching loss tabulation with off-state Vds voltage parameter.
You can choose when to take some of the measurements that the block uses to calculate switching losses. Some circuits deviate from the idealized case shown in the figure. For example, there can be transient peaks in current during turn on due to output capacitance or transient peaks in voltage during turn off due to parasitic inductance. Manufacturers quote losses at the voltage and current values after any transients due to parasitics, hereafter referred to as steady-state values.
The off-state voltage at turn on is always steady so to calculate Eon the block measures the voltage at turn on VTurnOn. You can choose when to measure the on-state current:
If the current is not steady immediately after turn on and the final on-state value does not vary between consecutive cycles, use the final on-state value from the previous cycle ITurnOff(n-1). (since R2023b)
If the current is steady immediately after turn on, use the initial on-state current from the present cycle ITurnOn(n).
If the current is not steady immediately after turn on and the on-state value varies between consecutive cycles, specify a delay following turn on before the block measures the current ITurnOn(n) < Iout(n) < ITurnOff(n). (since R2026b)
Similarly, to calculate Eoff the block measures the on-state current at turn off ITurnOff(n). You can choose when to measure the off-state voltage to avoid transients:
At the end of the last off period VTurnOn(n)
At the start of the present cycle VTurnOff(n)
Following turn off after a short delay VTurnOff(n) < Vout (n)< VTurnOn(n+1)
For conventional switched-mode power supplies, using measurements from the previous cycle is the most robust option because switching transients do not affect the measured values. To take measurements from the previous cycle, select the Use last on-state current from previous cycle for turn-on loss and Use last off-state voltage from previous cycle for turn-off loss parameters. You also need to take one of the current or voltage measurements from the previous cycle if:
You are modeling a capacitance across the switching device, for example, if the protection diode has capacitance or you are using the Lauritzen charge model. The capacitance causes a current overshoot at turn-on, so ITurnOn(n) does not represent the steady-state value. The best practice is not to model capacitance across the switching device, because this mixes an abstracted model for the switching device with a detailed physics model for the diode. If you must model capacitance across the switching device, you can use the current measurement at the end of the last on-period ITurnOff(n-1) to calculate Eon. To enable this option, select the Use last on-state current from previous cycle for turn-on loss parameter.
You are modeling switching device lead inductance. The inductance causes a voltage overshoot at turn off, so VTurnOff(n) does not represent the steady-state value. The best practice is not to model switching device lead inductance, because the time constant associated with lead inductance is typically much smaller than the pulse-width modulation (PWM) period. This smaller time constant means that the simulation requires smaller simulation time steps, slowing down the simulation. If you must model switching device lead inductance, select the Use last off-state voltage from previous cycle for turn-off loss parameter to use the voltage measurement at the end of the last off period, VTurnOn(n) to calculate Eoff.
Resonant converters switch when there are no losses using zero-current or zero-voltage
switching (ZCS or ZVS). A converter design might achieve ZCS and ZVS only at particular
operating points, or achieve only one of ZCS and ZVS. Because the operating point, for
example device current, can vary so much between turn on and turn off, you sometimes need
to make the measurements of current or voltage at the switching event. To calculate
turn-on loss using the initial on-state current measurement immediately after turn on,
clear the Use last on-state current from previous cycle for turn-on
loss parameter and set the On-state current measurement
delay parameter to 0. To calculate turn-off loss using the
initial off-state voltage measurement immediately after turn off, clear the Use
last off-state voltage from previous cycle for turn-off loss parameter and
set the Off-state voltage measurement delay parameter to
0.
When making measurements at the switching event, transient dynamics in the off-state voltage or on-state current can result in an incorrect measurement value. Wait for any transients to settle down before taking the measurement. If your circuit has a current overshoot before the on-state current reaches a steady state, then set the On-state current measurement delay parameter to a value that is slightly longer than the current overshoot time. If your circuit has a voltage transient before the off-state voltage reaches a steady state, then set the Off-state voltage measurement delay parameter to a value that is slightly longer than the transient.
Examine the simulation results to check that the current and voltage behave as you
expect. The ziOff variable in the logged simulation data represents the
current at turn off and ziOn represents the current measured after
turn‑on including any delay. Similarly, zvOn represents the voltage at
turn on and zvOff represents the voltage measured after turn on
including any delay. Use these variables to verify that the sampled current and voltage
values are at steady state and representative of the intended operating point. To learn
how to log and plot simulation data, see the Log and Plot Simulation Data
example.
This table summarizes when to measure the on-state current to accurately calculate Eon for common power electronics applications. The block measures the voltage at turn on VTurnOn(n).
Currents Measurements for Calculating Turn-on Losses
| Applications | Current Measurement | Parameter Values | Variable in Logged Simulation Data |
|---|---|---|---|
| The final value of the on‑state current at the end of the last on period, measured at turn off ITurnOff(n-1) |
| ziOff |
| The initial on-state current from the present cycle, measured just after turn on ITurnOn(n) |
| ziOn |
| The on-state current during the present cycle, measured a short delay after turn on ITurnOn(n) < Iout(n) < ITurnOff(n) |
| ziOn |
This table summarizes when to measure the off-state voltage to accurately calculate Eoff for common power electronics applications. The block measures the current at turn on ITurnOff(n).
Voltage Measurements for Calculating Turn-off Losses
| Applications | Voltage Measurement | Parameter Values | Variable in Logged Simulation Data |
|---|---|---|---|
| The final value of the off‑state voltage at the end of the last off period, measured at turn on VTurnOn(n) |
| zvOn |
| The initial off-state voltage from the present cycle, measured just after turn off VTurnOff(n) |
| zvOff |
| The off-state voltage during the present cycle, measured a short delay after turn off VTurnOff(n) < Vout (n) < VTurnOn(n+1) |
| zvOff |
The MOSFET (Ideal, Switching) block applies switching losses to the thermal port by stepping up the junction temperature, at switching events, with a value equal to the switching loss divided by the total thermal mass at the junction. However, the blocks does not draw an equivalent amount of energy from the power supply. The block is unable to draw this electrical energy from the electrical ports because drawing the energy requires a power source that is always connected to the switching device. In a switching converter, the switching device only sees the power source for a subset of the switching cycle so it is not possible to draw this electrical energy from the supply instantaneously at each switching event. The block effectively draws this electrical energy in from outside the electrical and thermal networks, in order to have the correct thermal energy balance. If your circuit has a half-bridge structure, you can use Half-Bridge (Ideal, Switching) block, which can draw equivalent energy from the supply, instead. If you need to use the MOSFET (Ideal, Switching) block, you can draw equivalent energy from the supply using a Probe block. For more information, see the Apply IGBT Switching Losses to Electrical Supply example.
Reverse recovery loss can be a significant source of thermal loss in diodes. The diode dissipates energy every time it turns off, from its conducting state to the open-circuit state. To model reverse recovery loss:
Set Modeling option to
Show thermal port.Set Integral protection diode to
Diode with no dynamics.
If you set the Reverse recovery loss model parameter to
Tabulate loss with Tj and If, the value of the
Reverse recovery loss table, Erec(Tj, If) parameter specifies the
dissipated energy as a function of the junction temperature and the forward current just
before the switching event. The off-state voltage linearly scales the losses relative to the
Turn-off voltage when measuring recovery loss, Vrec parameter
value. The table uses delayed values for the current and voltage. To use a value in the
lookup table that is close to the instantaneous value, set the Filter
time constant for voltage and current values parameter to a value that is
lower than the fastest switching period.
If you set the Reverse recovery loss
model parameter to Tabulate loss with Tj, If, and
Vrec, the value of the Reverse recovery loss table, Erec(Tj, If,
Vrec) parameter specifies the dissipated energy as a function of the junction
temperature, forward current just before the switching event, and off-state voltage after
the reverse recovery event. The table uses delayed values for the current and voltage. To
use a value in the lookup table that is close to the instantaneous value, set the
Filter time constant for voltage and current values parameter to a
value that is lower than the fastest switching period. (since R2026a)
If you set the Reverse recovery loss model parameter to
Fixed loss, the value of the Reverse recovery
loss parameter specifies the energy dissipated during each turn-off event. If
you select the Scale reverse recovery loss with current and voltage
parameter, then the block scales this loss value linearly by the on-state current and the
off-state voltage. To use scaling values that are close to the instantaneous values, set
Filter time constant for voltage and current values to
a value that is lower than the fastest switching period.
Parameterization
The MOSFET (Ideal, Switching) block supports multiple predefined parameterizations.
Use this parameterization data to represent components by specific suppliers. The parameterizations of these MOSFETs match the manufacturer data sheets. To load a predefined parameterization, double-click the MOSFET (Ideal, Switching) block, click the <click to select> hyperlink of the Selected part parameter, and, in the Block Parameterization Manager window, select the part you want to use from the list of available components.
Note
The predefined parameterizations of Simscape components use available data sources for the parameter values. Engineering judgment and simplifying assumptions are used to fill in for missing data. As a result, expect deviations between simulated and actual physical behavior. To ensure accuracy, validate the simulated behavior against experimental data and refine component models as necessary.
For more information about predefined parameterization and a list of the available components, see Simscape Electrical Part Collection.
You can also use the ee_importDeviceParameters function to extract the device parameters from an
XML file and import them into the block. The XML file must be on the MATLAB® path and must use a parameterization format supported by Hitachi.
Variables
To set the priority and initial target values for the block variables before simulation, use the Initial Targets section in the block dialog box or Property Inspector. For more information, see Set Priority and Initial Target for Block Variables.
Use nominal values to specify the expected magnitude of a variable in a model. Using system scaling based on nominal values increases the simulation robustness. Nominal values can come from different sources. One of these sources is the Nominal Values section in the block dialog box or Property Inspector. For more information, see System Scaling by Nominal Values.
Generate Derived Data Sheet
Since R2026a
You can generate a derived data sheet for the MOSFET (Ideal, Switching) block that contains summary tables and characteristic plots similar to those that device manufacturers provide in their data sheets. A built-in MATLAB script calculates the block-level characteristics based on the parameter values in your model. Use derived data sheets to explore the effect of your parameter choices on device characteristics, help you select manufactured parts, or share your component-level design with others.
The derived data sheet for the MOSFET (Ideal, Switching) block includes these plots:
Drain current versus drain-source voltage at different temperatures
Switch-on loss and switch-off loss versus drain current at different temperatures
Surface plots of switching losses, with respect to the on-state current and off-state voltage, at different temperatures
Surface plot of switching losses, with respect to on-state current and junction temperature, at maximum off-state voltage
Forward voltage versus current of the body diode at different temperatures
Reverse recovery loss versus diode current (since R2026b)
Surface plots of the reverse recovery loss, as a function of the on-state current and off-state voltage, at different temperatures (since R2026b)
Surface plot of the reverse recovery loss, as a function of the on-state current and junction temperature, at the maximum off-state voltage (since R2026b)
Off-state drain current voltage versus off-state drain-source voltage
Off-state forward voltage versus current of the body diode
To generate a derived data sheet:
Open the MATLAB script by clicking the Open live script button next to the Derived data sheet parameter in the Utilities section of the block dialog box.
Click the Generate Data Sheet button in the script.
For more information about derived data sheets, see Generate Derived Data Sheets.
Plot Basic I-V Characteristics
Since R2023b
You can plot the basic I-V characteristics of the MOSFET (Ideal, Switching) block without building a complete model. Use the plots to explore the impact of your parameter choices on device characteristics. If you parameterize the block from a data sheet, you can compare your plots to the data sheet to check that you parameterized the block correctly. If you have a complete working model but do not know which manufactured part to use, you can compare your plots to data sheets to help you decide.
To plot the basic characteristics, click the Plot button next to the Basic characteristics parameter. (since R2026a)
The Basic characteristics parameter generates different plots depending on the values you specify for the Modeling option, On-state behavior and switching losses, and Integral protection diode parameters of the MOSFET (Ideal, Switching) block. If you model the switching device with an integral protection diode, the Basic characteristics parameter plots the I-V characteristics for both the switching device and the diode. If you enable the thermal port of the block, the Basic characteristics parameter also generates surface plots of the turn-on energy loss and turn-off energy loss as functions of the on-state current and off-state voltage. For more information about this parameter, see Plot Basic I-V Characteristics of Semiconductor Blocks.
Examples
Assumptions and Limitations
The logged simulation data reports the thermal losses as
lastTurnOffLoss,lastTurnOnLoss, andlastReverseRecoveryLoss. These variables record losses as a pulse with an amplitude equal to the energy loss. If you use a script to sum the total losses over a defined simulation period, you must sum the pulse values at each pulse rising edge. You can also access the total accumulated switching losses from theaccumulatedSwitchingLossesvariable in the logged simulation data. This variable sums all switching losses to date, including reverse recovery losses for the diode. Alternatively, you can extract conduction and switching losses from logged data using theee_getPowerLossSummaryandee_getPowerLossTimeSeriesfunctions.If you are using a fixed-step solver, the shortest pulse on or pulse off that captures both the turn-on and turn-off losses is three time steps long. A turn-on pulse with length equal to the fixed step only reports turn-off losses. A turn-off pulse with length equal to the fixed step only reports turn-on losses.
If you operate the MOSFET in the reverse region (negative drain-source currents), the logged simulation data does not report any switch-on or switch-off losses because the parallel diode provides continuous parallel conduction. In the logged simulation data,
ziOnreports zero current to implement the zero losses even if the current steps to a negative value.If you select the On-state current measurement delay or the Off-state voltage measurement delay parameters in a fixed-step simulation, the step size must be small enough to give the requisite time resolution to make the measurement.
If you use tabulated data to model switching losses or reverse recovery losses, check that the temperature, current, and voltage are in the range you specify. If you do not define a realistic thermal model, for example, if the junction mass or the conductance from the junction to the case is too small, the temperature can exceed the range you specify, causing the block to extrapolate the losses to nonphysical values.
The MOSFET (Ideal, Switching) block does not support energy accounting. If you try to get energy information for this block using the
getEnergyInfofunction, the function generates an error message.
Ports
The figure shows the block port names.

Conserving
Parameters
Extended Capabilities
Version History
Introduced in R2013bSee Also
Simscape Blocks
- Diode | Half-Bridge (Ideal, Switching) | Ideal Semiconductor Switch | IGBT (Ideal, Switching) | Thyristor (Piecewise Linear) | GTO | N-Channel MOSFET | P-Channel MOSFET




