Dear all,
the delay time I needed is from PI controller and I reviewed the topics about this part but still couldn’t get how to create delay time by using C-script, if there are any suggestion or example I would be very grateful, thank you!!
Is the PI controller / C-Script discrete or continuous?
An example of a script with a variable delay is included in the PLECS documentation. See the attached model. The code is described in the “Multiple Sample Times - Turn-on Delay” part of the C-Script chapter in the PLECS User Manual.
The delay time is defined as a parameter, but it could just as well be an input into the block.
cscript_example_turnon_delay.plecs (9.5 KB)
The concepts are also described in the “Efficient PWM Generation using the C-Script Block” tutorial.
I think the delay time from PI controller should be continuous or I might get something wrong, I want turn on delay to be the same as turn off delay so that the duty cycle of secondary side correspond to the primary side, cause the limitation of pulse signals I created, the output of PI controller between 30 and -30 otherwise the five level output voltage wouldn’t be symmetrical, Is there any possibility that C-Script can complete this?
DAB.plecs (436.0 KB)
I have tried to complete this goal but the pulse signals didn’t work as expected even nothing showed up any suggestion with my code? I would be very grateful !!
DABwithphaseshift.plecs (464.6 KB)
Looking at your logic, it seems like the Turn-on Delay block in the PLECS library would achieve the same effect. The Turn-on Delay can be configured with a variable turn-on time.
If you want to proceed using a C-Script, then you will have to debug your script yourself, as there is likely a problem in your logic. I would suggest using additional output signals to better understand the intermediate calculation results and determine if they make sense.