pymgrid.modules.GensetModule#

class pymgrid.modules.GensetModule(running_min_production, running_max_production, genset_cost, co2_per_unit=0.0, cost_per_unit_co2=0.0, start_up_time=0, wind_down_time=0, allow_abortion=True, init_start_up=True, initial_step=0, normalized_action_bounds=(0, 1), raise_errors=False, provided_energy_name='genset_production')[source]#

A genset/generator module.

This module is a controllable source module; when used as a module in a microgrid, you must pass it an energy production request.

Parameters#

running_min_productionfloat

Minimum production of the genset when it is running.

running_max_productionfloat

Maximum production of the genset when it is running.

genset_costfloat or callable
  • If float, the marginal cost of running the genset: total_cost = genset_cost * production.

  • If callable, a function that takes the genset production as an argument and returns the genset cost.

co2_per_unitfloat, default 0.0

Carbon dioxide production per unit energy production.

cost_per_unit_co2float, default 0.0

Carbon dioxide cost per unit carbon dioxide production.

start_up_timeint, default 0

Number of steps it takes to turn on the genset.

wind_down_timeint, default 0

Number of steps it takes to turn off the genset.

allow_abortionbool, default True

Whether the genset is able to remain shut down while in the process of starting up and vice versa.

init_start_upbool, default True

Whether the genset is running upon reset.

normalized_action_boundstuple of int or float, default (0, 1).

Bounds of normalized actions. Change to (-1, 1) for e.g. an RL policy with a Tanh output activation.

raise_errorsbool, default False

Whether to raise errors if bounds are exceeded in an action. If False, actions are clipped to the limit possible.

provided_energy_namestr, default “genset_production”

Name of the energy provided by this module, to be used in logging.

Methods

as_sink(energy_excess)

Act as an energy sink to the microgrid.

as_source(energy_demand)

Act as an energy source to the microgrid.

dump([stream])

Save a module to a YAML buffer.

dynamic_action_space()

An action space bounded by the current step's maximum consumption and production.

from_normalized(value[, act, obs])

Un-normalize an action or observation.

get_co2(production)

Carbon dioxide emissions of energy production.

get_co2_cost(production)

Carbon dioxide production cost.

get_cost(production)

Total cost of energy production.

load(stream)

Load a module from yaml representation.

log_dict()

Module's log as a dict.

log_frame()

Module's log as a DataFrame.

next_max_production(goal_status)

Maximum production given a goal status.

next_min_production(goal_status)

Minimum production given a goal status.

next_status(goal_status)

Predict the next status of the genset given a goal status.

reset()

Reset the module to step zero and flush the log.

sample_action([strict_bound])

Sample an action from the module's action space.

serializable_state_attributes()

Return the attributes of the module that represent the module's current state for serialization.

state_dict([normalized])

Current state of the module as a dictionary.

step(action[, normalized])

Take one step in the module, attempting to draw a certain amount of energy from the genset.

to_normalized(value[, act, obs])

Normalize an action or observation.

update(external_energy_change[, as_source, ...])

Update the state of the module given an energy request.

update_status(goal_status)

Update the status of the microgrid.

verbose_eq(other[, indent])

Attributes

absorption_marginal_cost

Expected marginal cost of energy absorption.

action_space

Action spaces of the module.

current_status

Status of the genset.

current_step

Current step of the module.

goal_status

Goal of the genset.

is_sink

Whether the module is a sink.

is_source

Whether the module is a source.

log

Module's log as a DataFrame.

logger

The module's logger.

logger_last

The most recent entry in the log.

marginal_cost

Average marginal cost of producing with the module.

max_act

Maximum action that the module allows.

max_consumption

Maximum amount of consumption at the current time step.

max_obs

Maximum observation that the module gives.

max_production

Maximum amount of production at the current time step.

min_act

Minimum action that the module allows.

min_obs

Minimum observation that the module gives.

min_production

Minimum amount of production at the current time step.

module_type

Type of the module.

observation_space

Observation space of the module.

production_marginal_cost

Expected marginal cost of energy production.

state

Current state of the module as a vector.

yaml_tag

Tag used for yaml serialization.