Control Simulation Events From a File

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.

2 Likes

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.

arbgen.plecs (5.49 KB)

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.

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

Thank you Manu,

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

Best regards,
Vasileios

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.

variable_duty_cycle.plecs (5.22 KB)

Thank you, that was exactly what i needed :slight_smile:

UPDATE: As of PLECS 4.4, the PLECS library now has a “From File” component that can be used for this purpose.