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.

Data Output to .csv File

0 votes
1,225 views
Dear plexim team

In the attached simulation ("buck-boost converter.plecs") I would like to vary the parameters "Rload" and "Lload". For each parameter set at the end of the simulation (t = 0.1s) the currentripple should be saved in a .csv file. When I start the simulation script, currently only the value of the last simulation is saved, all other values are overwritten. The .csv file should be formatted correctly at best, (e.g. column values: Lload and row values: Rload) means per row and column combination one value of the currentripple.

I would be very happy about a solution.
Kind regards,
Raphael Baumeler
asked Jan 13, 2023 by raphael.baumeler (45 points)
You did not attach a model.
You are right, thanks for the hint. I've attach it now.

1 Answer

0 votes

The "To File" block prints the simulation output to a file. Using the "To File" block generally isn't appropriate for parameter sweeps unless you want to store the results of each simulation (which also requires changing the name of the output file for each parameter set).

What's more appropriate here is to use the approach taken in the "Buck Converter with Parameter Sweep" demo model.  Specifically, the use of a Signal Outport at the top level schematic so that the plecs('simulate') command returns simulation data (see the help excerpt below). Then one would manage the results and any file IO in the simulation script.  That demo also illustrates how to run the simulation in parallel (if you have PLECS 4.6).

Attached is a modified version of your model.  I assume you'll want to restructure the output, add headers, etc. but all of that is basic Octave file IO for which there are plenty of resources available.

 

 

 

answered Jan 18, 2023 by Bryan Lieblick (2,065 points)
Thanks a lot this is exactly what i wanted.

Best regards,
Raphael
...