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.

Create an arbitrary delay time using C-script

+1 vote
815 views

Hi everyone, I have several questions:

(1) Here is a code to create a delay with one sampling period from the PLECS manual:

         Output function code: OutputSignal(0, 0) = DiscState(0);

         Update function code: DiscState(0) = InputSignal(0, 0);

          Now, I want to create a delay with "n*Ts": Ts being the sampling period. How could I do that in PLECS               C- script?

(2) There is a block "Pulse Delay" in the Library. However, the delay time needs to be input manually.

In my controller, the delay time should be from a PI controller. Is there any way to put the delay time from a controller to the "Pulse Delay" block?

Thanks in advance!

 


 

 

asked Nov 28, 2020 by Alex Ng (15 points)
edited Nov 30, 2020 by Alex Ng
Hello,

The Pulse Delay block cannot accept a variable time delay input via its mask parameters or input ports, but if you look under the mask of its implementation you will see that it is based on a C-Script block. I would suggest you look at the Space Vector Modulator block to see how the C-Script block is used to calculate variable timing events internally. With the C-Script block, you _can_ use an external value, such as the output of your PI controller, as part of the algorithm. Good luck!

Kris

1 Answer

0 votes
even i have that doubt of creating the delay hope some one answers its
answered Dec 26, 2020 by AskBrillz (14 points)
Please see my comment above.
...