zen_garden.model.time_steps

This file implements a helper class to deal with timesteps.

Classes

TimeStepsDicts([dict_all_sequence_time_steps])

Helper class to deal with time steps of the optimization setup.

class zen_garden.model.time_steps.TimeStepsDicts(dict_all_sequence_time_steps=None)

Helper class to deal with time steps of the optimization setup.

This class implements some simple helper functions that can deal with the time steps of the optimization setup. It is very similar to EnergySystem functions and is meant to avoid the import of packages that can cause conflicts.

__init__(dict_all_sequence_time_steps=None)

Sets all dicts of sequences of time steps.

Parameters:

dict_all_sequence_time_steps – dict of all dict_sequence_time_steps

calculate_time_step_duration(input_time_steps, base_time_steps)

Calculates (equidistant) time step durations for input time steps.

Parameters:
  • input_time_steps – input time steps

  • base_time_steps – manual list of base time steps

Returns:

time_step_duration_dict: dict with duration of each time step

convert_time_step_energy2power(time_step_energy)

Converts energy time steps to power time steps of storage technologies.

converts the time step of the energy quantities of a storage technology to the time step of the power quantities.

Parameters:

time_step_energy – time step of energy quantities

Returns:

time step of power quantities

convert_time_step_operation2year(time_step_operation)

Converts the operational time step to the invest time step.

Parameters:

time_step_operation – time step of operational time steps

Returns:

time step of invest time steps

decode_time_step(element_time_step: int, time_step_type: str = None)

Decodes timeStep to baseTimeStep of model.

Decodes timeStep, i.e., retrieves the baseTimeStep corresponding to the variableTimeStep of a element. timeStep of element –> baseTimeStep of model.

Parameters:
  • element_time_step – time step of element

  • time_step_type – invest or operation. Only relevant for technologies, None for carrier

Returns:

baseTimeStep of model

decode_yearly_time_steps(element_time_steps)

Decodes list of years to base time steps.

Parameters:

element_time_steps – time steps of year

Returns:

full_base_time_steps: full list of time steps

encode_time_step(base_time_steps: int, time_step_type: str = None)

Encodes baseTimeStep to timeStep of element.

Encodes baseTimeStep, i.e., retrieves the time step of an element corresponding to baseTimeStep of model. baseTimeStep of model –> timeStep of element.

Parameters:
  • base_time_steps – base time step of model for which the corresponding time index is extracted

  • time_step_type – invest or operation. Only relevant for technologies

Returns:

outputTimeStep: time step of element

get_previous_storage_time_step(time_step)

Gets the storage time step before in the sequence.

Parameters:

time_step – current time step

Returns:

previous_time_step: previous time step

get_sequence_time_steps(time_step_type='operation')

Get sequence ot time steps of element.

Parameters:

time_step_type – type of time step (operation, storage or yearly)

Returns:

sequence_time_steps: list of time steps corresponding to base time step

get_sequence_time_steps_dict()

Returns all dicts of sequence of time steps.

Returns:

dict_all_sequence_time_steps: dict of all dict_sequence_time_steps

get_time_steps_storage2year()

Gets conversion dict from storage time steps to invest time steps of techs.

Returns:

time_steps_storage2year of the specified element

get_time_steps_storage_startend(time_step)

Gets conversion dict from operation time steps to invest time steps of techs.

Parameters:

time_step – #TODO describe parameter/return

Returns:

#TODO describe parameter/return

get_time_steps_year2operation(year=None)

Gets conversion dict from invest time steps to operation time steps of techs.

Parameters:

year – year of interest

Returns:

time_steps_year2operation of the specified element (at specified year)

get_time_steps_year2storage(year=None)

Gets conversion dict from invest time steps to storage time steps of techs.

Parameters:

year – year of interest

Returns:

time_steps_year2storage of the specified element (at specified year)

set_aggregated_time_steps(tsa)

Sets the aggregated time steps types.

Parameters:

tsa – time series aggregation object

set_time_steps_operation2year_both_dir()

Converts operational time steps to investment/yearly time steps.

set_time_steps_storage2year_both_dir()

Converts storage time steps to investment/yearly time steps.

set_time_steps_storage_startend(system)

Matches last time step of the year to the first for storage level time steps.

sets the dict of matching the last time step of the year in the storage level domain to the first.

Parameters:

system – dictionary defining the system