Modeling Techniques for Simscape Components for FPGA HIL Deployment
R2026bThe Simscape™ Hardware-in-the-Loop (HIL) workflow supports modeling Simscape components such as converters and machines by using Simscape switches, averaged switches, and dynamic switches. Choose one of these modeling methods based on your network complexity and the number of switching elements in your design.
Using Simscape Switches
Model switches controlled by an external physical signal by using Simscape switch blocks such as Switch (Simscape), Ideal Semiconductor Switch (Simscape Electrical), Diode (Simscape Electrical), Diode (Simscape), IGBT (Ideal, Switching) (Simscape Electrical), GTO (Simscape Electrical), and MOSFET (Ideal, Switching) (Simscape Electrical). These switches, in conjunction with diode pairs, are controlled by firing pulses produced by a PWM generator. These blocks are available in the Simscape > Electrical > Semiconductors & Converters and Simscape > Foundation Library > Electrical > Electrical Elements libraries.
Modeling the Simscape components using Simscape switches is suitable for simple network topologies with a small number of switches. However, for complex topologies containing larger number of switches it can become difficult to capture all valid configurations that are possible. The number of possible configurations increases exponentially as
2n, where n is the number of switches.To reduce the model fidelity, you can use the
Averaged Switchoption for modeling the converters. When you set the Switching device parameter toAveraged Switch, the block models the switching device as a semiconductor switch with an antiparallel diode. The control signal port G accepts values in the interval [0,1]:When G is equal to
0or1, the averaged switch is fully opened or fully closed, respectively. The switch behaves similar to the Ideal Semiconductor Switch (Simscape Electrical) block with an antiparallel diode.When G is between
0and1, the averaged switch is partly opened.
You can average the PWM signal over a specified period and use modulation waveforms instead of PWM signals, which makes this option well-suited for applications with high switching frequencies (for example, 480 kHz). For the system to be HDL-compatible, the averaged switches use a piecewise constant approximation method for the gate input. For more information, see Linearize Models with Converters Using Averaged Switching (Simscape Electrical).
Using Dynamic Switches
Dynamic switch blocks such as Switch, Diode, MOSFET and IGBT are controlled by firing pulses produced by a PWM generator. These blocks are available in SimscapeFPGAHIL_lib > Dynamic Switch Models library. You can open the library from the MATLAB® Command Window.
The dynamic switch approximation method supports all local solvers. This method provides an improved FPGA sample rate and dead time stability, and prevents validation errors because this approximation uses only one configuration to solve the network. For more information, see Troubleshoot Validation Errors in Simscape Hardware-in-the-Loop Workflow.
You can use the dynamic switch approximation method to convert a Simscape model to an equivalent optimized model for FPGA deployment. To generate an optimized model, use the
sschdl.generateOptimizedModelfunction. This function replaces Simscape switches, converters, and machine blocks with their optimized equivalents. You can automatically tune the parameter values for the dynamic switches in the optimized model by using thesschdl.tuneOptimizedModelfunction. If you have a license for the Simulink® Design Optimization™ toolbox, you can further fine-tune the parameter values. For more information, see Generate HDL Code for Simscape Models by Using Dynamic Switch Approximation.
For more information on how to model a converter by using Simscape switches and dynamic switches, see Synchronous Buck Converter for Real-Time FPGA Deployment.
See Also
sschdl.generateOptimizedModel | sschdl.tuneOptimizedModel
Topics
- Generate HDL Code for Simscape Models by Using Dynamic Switch Approximation
- Resonant LLC Converter for Real-Time FPGA Deployment
- Modeling Best Practices for FPGA HIL Deployment
- Tune Parameter Values for Dynamic Switches in Half-Wave Rectifier Model
- Generate Optimized Simscape Three-Phase PMSM Drive Model for Real-Time FPGA HIL Deployment