I am modelling a half-bridge LLC resonant converter in PLECS, and I want to design a model-based digital controller for TI C2000 code generation. The power electronics of the converter are implemented as a PLECS Circuit inside a MATLAB/Simulink model.
Because the converter is frequency-controlled, I am using the PLECS Variable Frequency PWM block. This block receives a control signal that sets the desired switching frequency.
When I run the system in continuous time (Simulink variable-step, e.g. ode23tb), the simulation works correctly for both fixed and variable switching frequency.
However, when I introduce a time-discrete control algorithm, the simulation fails:
-
The digital controller runs at a fixed sampling period (T_ctrl = 10 µs)
-
The controller output is fed into the PLECS Variable Frequency PWM through a ZOH block
-
The PLECS plant remains simulated with a variable-step solver
-
The simulation then terminates due to too many detected zero crossings
My intended model structure is:
PLECS Plant → ZOH → Fixed-step Simulink Control (C2000 code-gen) → ZOH → PLECS Plant
I looked at the demo model “LLC Resonant Converter with embedded code generation for TI C2000 MCUs”, but in that example the PWM for the C2000 is generated either for an RT Box or the control algorithm is implemented directly inside PLECS.
I want a different architecture: PLECS handles only the power stage, while Simulink (fixed-step) implements the digital controller, and the PLECS plant should continue to run with a variable-step solver.
My questions:
-
What is the recommended and clean way to make a variable-step PLECS plant and a fixed-step Simulink controller work together, especially when using the Variable Frequency PWM block, which seems to trigger excessive zero-crossing events when driven by a sampled (ZOH) signal?
-
Are there established modelling patterns or interface strategies to avoid the zero-crossing explosion in this mixed-step architecture?
-
Which solver is best suited for this type of model?
-
The issue appears mainly when the frequency control signal changes rapidly, how should this be handled to avoid too many zero crossings?
-
I get a warning of algebraic loops, is this causing some issues?