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.

How to insert a phase delay value calculated during a running simulation to a delay or any other block?

+1 vote
2,622 views
Hi

How can I insert a variable calculated during a simulation to block. I know, we can write the initialization commands and the blocks pick up the variable value. But I want my circuit to sense the current and calculate the time values and provide that as a delay to the block.

Fig attached.

I want to provide a delay 't1' for my pulse2 i.e. pulse2 should start after pulse1. Either I should be able to provide delay t1 to the sawtooth waveform as shown or I use a delay block. But Plecs throws an error, as it does not pick the value from running simulation.

Can you please help?
asked Feb 13, 2019 by snehathakur (64 points)

1 Answer

+1 vote
 
Best answer
You cannot change block parameters at runtime.

To get the desired behavior, the turn-on block needs to be rewritten so that the delay is read from an input signal. This can be realized using a C-Script, please see the attached example.

Kind regards,

Oliver Schwartz
answered Feb 27, 2019 by Oliver Schwartz (618 points)
selected Mar 3, 2019 by snehathakur
Thank You Oliver.
In the attached example, the phase shift works fine but the duty of the phase-shifted pulse is reduced. Can you share an example where the duty of both the pulses remain the same but the phase shift varies?
Create Delay with C-script
...