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.

Control Simulation Events From a File

+2 votes
Hello all,

Is it possible to have a .csv file to control events on my simulation in PLECS standalone?

For example, I would like to have two columns in my file, one for Time and one for Power values.

What I would like to achieve is to change the variable that corresponds to Power when the simulation time equals the time in column 1.

The csv file can look something like this:

Time | Power
  0.1  |   10
   1    |   20
   3    |   15

Thank you very much for your response.
asked May 9 by Vasileios_tso (19 points)

2 Answers

+3 votes
Best answer

The answer to your question has been addressed here --


answered May 10 by Manu Parimi (34 points)
selected May 10 by Vasileios_tso
Thank you Manu,

I guess I wasn't looking at the right place. That is exactly what I wanted to do.

Best regards,
+4 votes

Hello Vasileios, 

I would suggest to use the Initialization tab in the Simulation Parameters. Convert your values into two Octave arrays in a way the 1D Look-Up Table block  can use it:

Time  | Power
 0.0  |  10
 0.1  |  10
 0.1  |  20
   1  |  20
   1  |  15
   3  |  15

With this method you can output arbitrary waveforms using the modulo function.

See attached minimum example.

answered May 9 by Falk Kyburz (151 points)
Hello Falk,

Thank you very much for your suggestion and for providing me with an example model. I think I can make it work as you suggest.

Let me think about it and try to implement it. The reason I am hesitant is that ideally, I would like to implement this on a ramp (change its Starting time and its Final output accordingly).

I will let you know as soon as I implement your example. Thank you once again.
Hi this is nearly what i search so i maybe get the right answer here.

I want to Use diffent DutyCyle Vallues in one Curve maybe the first second from 0-1sec with 0.5 and from 1-2 sec with with 0.4 can i maybe realise that as well?

This is my first Projekt with Plecs so probebly there is an easy way for it but i didn t finde it right now.

Yes, the material provided in this question is certainly an appropriate way for you to do what you mentioned.



My Problem is that i don t know how to get the value in my PulsGenerator Block so that the value is given to the Variable "DutyCycle".

I have a "graph" that is like the one from the example that Falk Kyburz postet.

But i don t know how the step into my PulsGenerator works.

You would need to build up your pulse generator logic from other components. I attached a simple PLECS Standalone example where a step function changes the modulation index (duty cycle) for our prebuilt Symmetrical PWM block and the resulting pulse train can be seen in a Scope. You can see the implementation of the PWM block under its mask and can replace the step function with a table of duty cycle values as in the examples above.
Thank you, that was exactly what i needed :)