This thread presents three example models that use scripted simulation in PLECS to modify thermal or electrical parameters during runtime. All examples demonstrate similar scripting concepts but target different applications.
Note: Although these examples focus on thermal simulations, the workflow can be applied to many other use cases. Each model includes both internal Octave scripts and equivalent Python scripts.
rg_change
The simulation runs until a specified current threshold is reached. At that point, the simulation is paused, all states are saved, and the IGBT parameters Rgon and Rgoff are updated. The run then continues until a second (adjusted) current threshold is reached, where it stops again.
thermal_chain
Instead of using a current threshold, the thermal chain parameters are overwritten after a fixed simulation time. Here the thermal chain is the case-to-ambient chain that is not associated directly with the thermal description of the switching devices.
xml_values
Uses an IGBT subsystem with an additional Thermal Chain tab.
-
If left empty, values are taken from the associated XML file.
-
If specified, they override the XML values in the mask initialization (
Ctrl+M→ Initialization).
A script simulates for a given time, then overwrites the thermal chain and continues the run.
Tip
For easier access to XML files, place them in a subfolder in the same location as the .plecs file, and name the subfolder <MODEL_NAME>_plecs (e.g. thermal_domain_tutorial_plecs).
Downloads
| File | Description |
|---|---|
| rg_change_example.zip | Change Rgon and Rgoff values in component mask at specified current threshold. |
| thermal_chain_example.zip | Change component values in externally defined thermal circuit (case-to-ambient) at specified simulation time. |
| xml_values_example.zip | Change junction-to-case parameters from thermald description (xml) at specified simulation time. |