Frequently Asked Question

How to feed data from a .csv/.txt file to a simulation
Last Updated 3 years ago

There are two ways to feed data to a simulation:

  1. By importing data to HIL SCADA.
  2. By importing data to Schematic Editor.

Importing data to HIL Scada
The most simple way of reading .csv (or .txt) files would be to use the SCADA Input and write a macro in SCADA that uses the read_csv Python function. The following link provides an installation example where windspeed is read from a .txt file and sent as an input to the model: \examples\models\microgrid\wind_farm_microgrid

During the HIL SCADA panel initialization, the variable file_data is defined through the read_csv function. The file_data is then used in the "Wind Speed Profile" macro widget to feed the "wind_speed" input for each of the wind plants:


image




Importing data to Schematic Editor
You can feed data to the simulation from Schematic Editor using a Dynamic table or you can read the .csv file in Model Initialization.

When it comes from the Dynamic table, for voltage and current sources specifically, you can define an arbitrary signal. This signal can be converted to .isg format using the source file generator in the Waveform Generator tool.

Check data logging options here for your simulation output.


When it comes from Model Initialization you can read the.csv file with pandas.read_csv function. To make list from a data frame you should use df.values.tolist() function.

image



Please Wait!

Please wait... it will take a second!