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
2,830 views
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, 2018 by Vasileios_tso (20 points)

3 Answers

0 votes
 
Best answer
UPDATE: As of PLECS 4.4, the PLECS library now has a "From File" component that can be used for this purpose.
answered Jun 10, 2020 by Kris Eberle (1,623 points)
+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, 2018 by Falk Kyburz (253 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.
Hello,

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

Thanks,

Kris

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 :)
+3 votes
Hello,

The answer to your question has been addressed here -- https://forum.plexim.com/11/is-it-possible-to-import-waveform-data-into-plecs?show=12.

Regards,

Manu
answered May 10, 2018 by Manu Parimi (363 points)
Thank you Manu,

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

Best regards,
Vasileios
...