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

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

C_Script_Converter.plecs (169 KB)

> 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.

delayed_repeating_sequence.plecs (8.01 KB)