eelib.data.csv_reader.csv_reader_model

eElib csv-reader model for reading-in .csv-files to imitate different model types (e.g. PV, household or heatpump).

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

Module Contents

Classes

CSVReader

Parent class for reading-in .csv-files.

GenericCSV

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

RatedCSV

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

PowerCSV

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

HouseholdCSV

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

PvCSV

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

HeatpumpCSV

CSV-Data-Reader for heatpump load profiles.

ChargingStationCSV

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

HouseholdThermalCSV

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

MarketIntradayContinuousCSV

CSV-Data-Reader for intraday continuous market data. Inherits from class CSVReader.

class CSVReader(ename: 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)

Parent class for reading-in .csv-files.

Raises:
  • FileNotFoundError – when .csv-file cannot be opened (e.g. path or data corrupted)

  • ValueError – when start date is not in .csv-file

  • IndexError – when end of .csv-file is reached before simulation end

_VALID_PARAMETERS
classmethod get_valid_parameters()

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() None
step(time) None

Performs simulation step of eELib csv_reader model, which is returning the averaged read values in the .csv-file.

Parameters:

time (int) – Current simulation time in seconds.

class GenericCSV(ename: 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)

Bases: CSVReader

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

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(time) None

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

Parameters:

time (int) – Current simulation time in seconds.

class RatedCSV(ename: 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, p_rated: int = 4500, p_rated_profile: int = 4500)

Bases: CSVReader

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

classmethod get_valid_parameters()

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 PowerCSV(ename: 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, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0)

Bases: RatedCSV

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
classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

_set_reactive_power() None

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

step(time)

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

Parameters:

time (int) – Current simulation time in seconds.

class HouseholdCSV(ename: 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, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0)

Bases: PowerCSV

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

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

class PvCSV(ename: 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, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0)

Bases: PowerCSV

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

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(time)

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

Parameters:

time (int) – Current simulation time in seconds.

class HeatpumpCSV(ename: 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, p_rated: int = 4000, p_rated_profile: int = 4000, cos_phi: float = 0.95)

Bases: PowerCSV

CSV-Data-Reader for heatpump load profiles.

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(time)

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

Parameters:

time (int) – Current simulation time in seconds.

class ChargingStationCSV(ename: 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, p_rated: int = 4500, p_rated_profile: int = 4500, cos_phi: float = 1.0)

Bases: PowerCSV

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

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

class HouseholdThermalCSV(ename: 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, p_rated: int = 20000, p_rated_profile: int = 20000)

Bases: RatedCSV

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

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(time)

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

Parameters:

time (int) – Current simulation time in seconds.

class MarketIntradayContinuousCSV(ename: 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)

Bases: CSVReader

CSV-Data-Reader for intraday continuous market data. Inherits from class CSVReader.

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

classmethod get_valid_parameters()

Returns dictionary containing valid parameter types and values.

Returns:

valid parameters for this model

Return type:

dict

step(time)

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

Parameters:

time (int) – Current simulation time in seconds.