# Runtime Parameter Modifications with Scripting for Changing Thermal Parameters During Simulation

**URL:** <https://forum.plexim.com/t/runtime-parameter-modifications-with-scripting-for-changing-thermal-parameters-during-simulation/2445>\
**Category:** Support Solutions\
**Tags:** script, simulation-script, thermal-model, thermal-description\
**Created:** [August 12, 2025, 7:48am UTC](https://forum.plexim.com/t/runtime-parameter-modifications-with-scripting-for-changing-thermal-parameters-during-simulation/2445 "2025-08-12T07:48:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RetoChristen](https://dub1.discourse-cdn.com/flex006/user_avatar/forum.plexim.com/retochristen/32/1225_2.png) [@RetoChristen](https://forum.plexim.com/u/RetoChristen)\
**Post date:** [August 12, 2025, 7:48am UTC](https://forum.plexim.com/t/runtime-parameter-modifications-with-scripting-for-changing-thermal-parameters-during-simulation/2445/1 "2025-08-12T07:48:19Z")

</div>

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.

[rg\_change\_example.zip](https://forum.plexim.com/uploads/short-url/7dGZEPmpzCoJC1MUgXqq5ys2lWi.zip)

**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.

[thermal\_chain\_example.zip](https://forum.plexim.com/uploads/short-url/bccpZPAAhuk8snMEYzYRZYsMFn.zip)

**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.

[xml\_values\_example.zip](https://forum.plexim.com/uploads/short-url/1E0jVGujC5ewUXmfZmXt2zyIeiJ.zip)

**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](https://forum.plexim.com/uploads/short-url/7dGZEPmpzCoJC1MUgXqq5ys2lWi.zip) | Change Rgon and Rgoff values in component mask at specified current threshold. |
| [thermal\_chain\_example.zip](https://forum.plexim.com/uploads/short-url/bccpZPAAhuk8snMEYzYRZYsMFn.zip) | Change component values in externally defined thermal circuit (case-to-ambient) at specified simulation time. |
| [xml\_values\_example.zip](https://forum.plexim.com/uploads/short-url/1E0jVGujC5ewUXmfZmXt2zyIeiJ.zip) | Change junction-to-case parameters from thermald description (xml) at specified simulation time. |
