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.

How to solve the following

0 votes
135 views
Hi Bryan,

Thank you for your help. I have attached the portion of my PLECS simulation in the file below for your reference.

For 1, how would Octave capture the readings while I am running my PLECS simulation? Both applications must run at the same time?

For 2, How do I change pref2,pref3,pref4 to Ppv, Pwind, Ptotal? I have used constants in the file and have renamed the constants to their respective names but I am still unable to get the desired description in the CSV file header.

 

For 3, I would like to include timestamps in the first column of the CSV file to mimic the real time data collection like what we normally see in other applications, my goal is to auto generate many csv files with data and the data can then hopefully be used in machine learning applications to predict the energy yield or load usage for my microgrid
asked Mar 8 by Edmund (14 points)
Hi Edmund.  It seems you did not attach your model.  Can you please try again?
Hi Bryan, Sorry I have attached my files in the post for your reference. Cheers

1 Answer

0 votes

> For 1, how would Octave capture the readings while I am running my PLECS simulation? Both applications must run at the same time?

PLECS uses Octave/MATLAB as a scripting engine. You do not need to run it separately. See the attached sample implementing what I suggested earlier.

> For 2, How do I change pref2,pref3,pref4 to Ppv, Pwind, Ptotal? I have used constants in the file and have renamed the constants to their respective names but I am still unable to get the desired description in the CSV file header.

The name in the CSV doesn't come from the "Signal From" and "Signal To" blocks, but rather the input blocks to the labeled signals.  In your case it is the name of the "Formula" blocks you're using.  You can see the name of the block by right clicking and selecting Format + Show Name.  From there you can edit the name.  Here you want to change "Pref3" to "Pw".

 

> For 3, I would like to include timestamps in the first column of the CSV file to mimic the real time data collection like what we normally see in other applications, my goal is to auto generate many csv files with data and the data can then hopefully be used in machine learning applications to predict the energy yield or load usage for my microgrid

Getting the clock time of your computer doesn't make sense in this application, as it is not correlated to the time in your model. One second in your model may be more or less than one second according to your watch.  The data you're exporting already includes a time column. 

If you want to convert that value to a date-like value like "YY:MM:DD:ss" then I recommend post-processing your results and adding the simulation time as a time offset to the desired start time.  You can also convert the simulation time to a UTC time stamp by adding the requires seconds offset (e.g. +1710115200 for 12am March 11th, 2024 GMT).

answered Mar 11 by Bryan Lieblick (1,937 points)
Hi Bryan, I would adopt your suggestion for the csv file output, and thanks for your amazing help in answering my other questions too! Cheers
...