How to solve the following

> 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).

BMS TRY TO FILE csv_timestamp.plecs (29.4 KB)