# Combining average and transient/Spice simulation in a same plant

**URL:** <https://forum.plexim.com/t/combining-average-and-transient-spice-simulation-in-a-same-plant/3048>\
**Category:** PLECS\
**Created:** [May 6, 2026, 10:08am UTC](https://forum.plexim.com/t/combining-average-and-transient-spice-simulation-in-a-same-plant/3048 "2026-05-06T10:08:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ernesto\_Incerti](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@Ernesto\_Incerti](https://forum.plexim.com/u/Ernesto_Incerti)\
**Post date:** [May 6, 2026, 10:08am UTC](https://forum.plexim.com/t/combining-average-and-transient-spice-simulation-in-a-same-plant/3048/1 "2026-05-06T10:08:56Z")

</div>

It would be interesting if it would be the possibility to switch from an average model to a Spice model for a small time, to have a full view and a fast simulation, by changing the simulation parameters during the simulation when switching from a model to another, and enabling the right model only when switched to itself. in this way whe can have in a single simulation a full wiev of the behaviour of the system. see an example of what i mean

[plecs\_pspice\_test.plecs](https://forum.plexim.com/uploads/short-url/8ycZ8rDhK1aVvPRAhTyUZAbj5I5.plecs) (79.7 KB)

---

<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:** [May 7, 2026, 6:18am UTC](https://forum.plexim.com/t/combining-average-and-transient-spice-simulation-in-a-same-plant/3048/2 "2026-05-07T06:18:18Z")

</div>

I understand your motivation for first using an averaged model and then switching to SPICE. However, even switching from an averaged model to a switched model is not straightforward, since the initial states are not the same. Therefore, the switched model cannot directly inherit an already simulated state from the averaged model.

I would also like to mention that averaged models are mainly intended for real-time simulations, as in PLECS, and possibly for long mission profiles. For this reason, I would suggest running a switched model first and then switching to SPICE.

I have created two scripts that I hope will be helpful:

**Run Switched/Averaged**  
This script runs the model once in _switched_ mode and once in _average_ mode. This should help you verify the average mode and compare the differences. Please note that I made a few changes to your initial model:

- I replaced your T-Type implementation with the library component block _[3-Level Half Bridge (T-Type)](https://docs.plexim.com/plecs/latest/components-by-category/halfbridge_3level_ttype/#component-halfbridge_3level_ttype)_. This power module already provides the option to switch between _switched_ and _sub-cycle average_ configurations.
- I replaced the PWM blocks with library blocks for the switched case and placed everything into a configurable subsystem. Depending on the selected configuration, the correct PWM signal or modulation index is generated.
- The model now runs two separate simulations, in contrast to your initial model, where both models were solved in parallel. This allows the simulation to benefit from the much faster execution when average mode is selected.

**Switch PLECS/SPICE**  
This script uses the switched mode and changes to a SPICE implementation at a specified time. To do this, I modified the model described above as follows:

- I broke the library link to the T-Type model and added a third configuration, _Switched SPICE_.
- In this configuration, I included the MOSFET model from [ProofOfConceptSwitchPlecsToSpice.plecs](https://forum.plexim.com/uploads/short-url/mllK7csOiOdHIhSyDqTtwtUeVa.plecs) as discussed here: [Using Ideal and SPICE Models in the Same PLECS Simulation - #5 by RetoChristen](https://forum.plexim.com/t/using-ideal-and-spice-models-in-the-same-plecs-simulation/2916/5)
- I replaced the netlist with a switch model that is able to block the voltage and conduct the current: [C3M0021120K](https://www.wolfspeed.com/products/power/sic-mosfets/1200v-silicon-carbide-mosfets/c3m0021120k/). I also adapted the gate circuit so that `Rg = 2.5 Ω` and `Vgs = -4 V/+15 V` , as suggested in the data sheet.
- I fixed the MOSFETs to _SPICE_ mode. _PLECS_ mode can still be helpful for debugging, for example to check whether the switches are placed in the correct direction.
- When you run the model, it starts with ideal switched semiconductors and adds one cycle of SPICE simulation at the end of the simulation run.

I am attaching the model [switched\_average\_test.plecs](https://forum.plexim.com/uploads/short-url/puNOY29qulpXb3JtKB3AhbGKTUz.plecs) (66.9 KB), which runs the first script. The second model, [switched\_spice\_average\_test.plecs](https://forum.plexim.com/uploads/short-url/a0d0xxArFuqe6pe7FRaJ1xlxbBt.plecs) (233.5 KB), runs both scripts.

Please note that the library link is broken in the second model, so this part will not be affected by any future PLECS updates.

I hope this helps.
