Output of C-Script to comand a switch

Hi everyone!

I’m having a problem with my simulation:

I’m using a C-script to make the discrete control of my converter, everyone works fine until now,

I’m trying to make the inicialization routine, (context: is an active rectifier with a LCL filter, i need make the precharge of the DC-Link, connecting a resistor in the beginning of the circuit (1 per line) when i make the precharge, then, when the capacitor is charged, i need to bypass this 3 resistor), but it does’n work as i want. Now, i’m getting the on-off signal of the switch to activate/desactivate the resistor to make the precharge, but some pulses in the output (should stay calm on 750V) cause problems in the modulation, i don’t know why this appears. i think can be because of the way what i make the on-off of the switch (just an IF in the c-script, if the value of the output is less than 520V, connect the resistor, else, disconnect). The sample of the C-script is 50khz.
Anyone have an idea of what happen? Or, another way to make the precharge?

Thanks!!

PD: attach the schematic and photo of results of the problem.

Hi Matias, this sounds more like a control design issue than something with PLECS.

If you’re seeing the pre-charge switch toggling, then you’re likely on the right track with your pre-charge logic being too simple.

Normally the converter controller would use a finite state-machine to distinguish between different modes. For example there are distinct startup, operating, faulted, and restoration states. The pre-charge resistors would carry current only during certain states, and with enough specificity to prevent toggling and equipment damage.

Hi Bryan.

This problem just appears when i make the precharge, if i don’t use the precharge-stage (initial condition in the capacitor), i haven’t problem with the controller, so, i agree with the problem is beacause the control stage of the precharge.

I agree too with using a finite state-machine, but, at this moment of the proyect, i just haven’t designed it yet.