Illuminator Data Models

class illuminator.models.CSV_reader_v3.CSV(**kwargs)

A model for reading time series data from CSV files.

This model reads data from a CSV file line by line, synchronizing with simulation time. The CSV file should contain a header row with column names and a timestamp column.

Parameters:
  • date_format (str) – Format of the date/time column in the CSV file

  • delimiter (str) – Column delimiter character in the CSV file (default ‘,’)

  • datafile (str / list) – [list of] Path to the CSV file to read from

  • send_row (bool) – If True, sends the entire row as a dictionary under the key ‘row’. If False, sends individual columns as separate states.

Inputs:

file_index (int (optional)) – If multiple files are provided, this input selects which file to read from.

Outputs:

None

States:
  • next_row (dict (optional, if send_row is True)) – The next row of data read from the CSV file.

  • <column_name> (float (for each column in the CSV file, if send_row is False)) – The value of each column in the current row.

change_file(file_index) None

Change the CSV file being read based on the ‘file_index’ input.

finalize() None

Closes the file object within self.datafile.

go_to_expected_date() None
go_to_start_date() None
init(sid, time_resolution=1, **sim_params)
Initialize the simulator with the ID sid and pass the

time_resolution and additional parameters (sim_params) sent by mosaik. Return the meta data meta.

If your simulator has no sim_params, you don’t need to override this method.

skip_header()
step(time, inputs, max_advance=900) None

Perform one step of the simulation.

Parameters:

timeint

The current time of the simulation.

inputsdict

Input values for the simulation step.

max_advanceint

Maximum time the simulator can advance (default is 900 seconds).

Returns:

int

The next simulation time.