Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

Implementation of a 1D Look-up Table within a C-Script block

0 votes
292 views
Hello,
I am using a 1D Lookup table to generate a reference waveform for integration into a full-bridge converter. However, within this converter, there is going to be quite a bit of power electronics that I want to reach a steady state before passing this reference waveform into the PI controller.

I would therefore like to proceed with a C-Script block, my intention is for the C-script to implement an initial delay (which I have managed to do), following this delay I want it to pass on my reference waveform, repeating indefinitely at a given frequency (50 Hz) until the simulation time span is reached.

I'm sure this should be possible but I have no idea where to begin my experience with the C-script block is limited. I've managed to do the delay with the help of the manual but not sure where to start regarding the reference waveform and the repeat iterations.
Any help would be appreciated, I know is not much to go on but the attached schematic includes the circuit design with the desired reference signal within the lookup table. The idea is to replace the Test Waveforms Look-up table with the C-script block.

Please let me know if there is anything else I can support with.

Thanks
asked Mar 13, 2023 by Brian Strugnell (21 points)

1 Answer

0 votes
 
Best answer
> my intention is for the C-script to implement an initial delay (which I have managed to do), following this delay I want it to pass on my reference waveform, repeating indefinitely at a given frequency (50 Hz) until the simulation time span is reached.

You can use a C-Script for this purpose, but it might be unnecessarily complicated.  You can use regular PLECS library components such an integrator block with wrapping to implement your desired logic.

See the attached example.  You can use a Signal Switch if you want the initial reference to be something besides the initial value of the table output.

You can replace the Step component with logic to detect that your steady-state conditions have been reached.
answered Mar 14, 2023 by Bryan Lieblick (1,905 points)
selected Mar 14, 2023 by Brian Strugnell
...