eelib.data.csv_reader.csv_bulk_reader_model

eElib csv-bulk-reader model for reading-in .csv-files for different purposes. Reads a values for a certain horizon.

Author: elenia@TUBS
Copyright 2025 elenia
This file is part of eELib, which is free software under the terms of the GNU GPL Version 3.

Module Contents

Classes

CSVBulkReader

Parent class for bulk-reading-in .csv-files.

GenericBulkCSV

CSV-Data-Reader for profiles. Inherits from class csv_reader.

RatedBulkCSV

CSV-Data-Reader for profiles. Inherits from class csv_reader.

PowerBulkCSV

CSV-Data-Reader for power profiles. Inherits from class csv_reader.

HouseholdBulkCSV

CSV-Data-Reader for household load profiles. Inherits from class csv_reader.

PvBulkCSV

CSV-Data-Reader for pv-generation profiles. Inherits from class CSVReader.

HeatpumpBulkCSV

CSV-Data-Reader for heatpump load profiles.

ChargingStationBulkCSV

CSV-Data-Reader for charging_station profiles. Inherits from class CSVReader.

HouseholdThermalBulkCSV

CSV-Data-Reader for thermal demand profiles. Inherits from class RatedCSV.

MarketBulkCSV

CSV-Data-Reader for day-ahead or intraday auction market data. Inherits from CSVBulkReader.

class CSVBulkReader(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False)

Parent class for bulk-reading-in .csv-files.

_VALID_PARAMETERS
eid
datafile
date_format = "'YYYY-MM-DD HH:mm:ss'"
start_date
delimiter = "','"
header_rows
step_size = '900'
send_period
send_period_sim_steps
bulk_resolution
bulk_horizon
cyclic = 'False'
data = 'None'
time = 'None'
attrs = '[]'
values
index = '0'
last_update_step = 'None'
classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

_open_csv() None

Opens the .csv-file and loads data set.

Raises:

FileNotFoundError – when .csv-file cannot be read

_check_data() None

Checks if row in opened .csv-file contains the simulation start date.

Raises:

ValueError – Start date is not in .csv-file

_resample_data()

Resamples the data to the target resolution specified in self.bulk_resolution.

_ready(timestep: int) bool

Checks if the data is ready to be sent.

Parameters:

timestep (int) – Current simulation step.

Returns:

True if the data is ready to be sent.

Return type:

bool

step(timestep: int) None

Performs simulation step of eELib csv_bulk_reader model, which is returning the averaged read values in the .csv-file. The bulked csv reader sets the values to a list of values for the predefined bulk horizon, starting from the current time slot (request_time).

Parameters:

timestep (int) – Current simulation step.

Raises:

IndexError – Raises an error if the index of the data is out of bound, most likely due to differences between start date in scenario and in ‘model_data’.

class GenericBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False)

Bases: CSVBulkReader

CSV-Data-Reader for profiles. Inherits from class csv_reader. Sets each column of the csv file as attribute.

classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(timestep: int) None

Performs simulation step of generic csv reader model, which is setting the attr according to the columns in csv file.

Parameters:

timestep (int) – Current simulation step.

class RatedBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 4500, p_rated_profile: int = 4500)

Bases: CSVBulkReader

CSV-Data-Reader for profiles. Inherits from class csv_reader. Adds support for scaling to p_rated.

p_rated = '4500'
p_rated_profile = '4500'
scaling_factor
classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

_apply_p_rated() None

Apply scaling factor (p_rated/p_rated_profile).

class PowerBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0, calc_e_demand_annual: bool = False)

Bases: RatedBulkCSV

CSV-Data-Reader for power profiles. Inherits from class csv_reader.

Adds support for calculating reactive power.
Assumptions:
- first column is p
- second column is q, if csv has more than one column
p = 'None'
q = 'None'
voltage_control
e_annual = 'None'
classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

_calc_e_demand_annual()

Calculate the annual energy from the sum of power values, scaling up/down to 1 year.

_set_reactive_power() None

Calculate reactive power if not given in csv file and if cos_phi is set.

step(timestep: int)

Performs simulation step of eELib load model, which is returning the read active/reactive power value of the .csv-file.

Parameters:

timestep (int) – Current simulation step.

class HouseholdBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0, calc_e_demand_annual: bool = False)

Bases: PowerBulkCSV

CSV-Data-Reader for household load profiles. Inherits from class csv_reader.

classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

class PvBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0, calc_e_demand_annual: bool = False)

Bases: PowerBulkCSV

CSV-Data-Reader for pv-generation profiles. Inherits from class CSVReader.

classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(timestep: int)

Performs simulation step of eELib load model, which is returning the read active/reactive power value of the .csv-file.

Parameters:

timestep (int) – Current simulation step.

class HeatpumpBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0, calc_e_demand_annual: bool = False)

Bases: PowerBulkCSV

CSV-Data-Reader for heatpump load profiles. Expected input data is the electrical power. No thermal power is calculated and exposed.

class ChargingStationBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0, calc_e_demand_annual: bool = False)

Bases: PowerBulkCSV

CSV-Data-Reader for charging_station profiles. Inherits from class CSVReader.

classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

class HouseholdThermalBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, send_period: str = '00:15:00', bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, p_rated: int = 20000, p_rated_profile: int = 20000)

Bases: RatedBulkCSV

CSV-Data-Reader for thermal demand profiles. Inherits from class RatedCSV.

p_th_room = 'None'
p_th_water = 'None'
classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(timestep: int)

Performs simulation step of eELib charging_station model, which is returning the read active power value of the .csv-file.

Parameters:

timestep (int) – Current simulation step.

class MarketBulkCSV(eid: str, datafile: str, header_rows: int, start_time: str, date_format: str = 'YYYY-MM-DD HH:mm:ss', delimiter: str = ',', step_size: int = 60 * 15, bulk_resolution: str = '00:15:00', bulk_horizon: str = '24:00:00', cyclic: bool = False, send_time: str = '12:00:00')

Bases: CSVBulkReader

CSV-Data-Reader for day-ahead or intraday auction market data. Inherits from CSVBulkReader.

Implementation as a price-taking market: The participants have no influence or impact on the market price and participants have to accept the prevailing market price. As decentralized power systems are investigated, this assumption is fine as the whole intraday market includes many sellers (with the identical product ‘electricity’). See e.g. https://www.economicsonline.co.uk/definitions/price-taker.html/ for more information.

The prices are given in the unit ‘EUR/MWh’.

send_time
send_time_sim_steps
market_data = 'None'
classmethod get_valid_parameters() dict

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

_ready(timestep: int) bool

Checks if the data is ready to be sent. TODO: Not working for simulations not starting at 00:00:00.

Parameters:

timestep (int) – Current simulation step.

Returns:

True if the data is ready to be sent.

Return type:

bool

step(timestep: int)

Performs simulation step of model, which is returning the read value of the .csv-file. If the request time is reached, the market data is set to the values of the .csv-file for the next day. The start time of the market data is the start time of the next day in seconds.

Parameters:

timestep (int) – Current simulation step.