pymgrid.envs.DiscreteMicrogridEnv#

class pymgrid.envs.DiscreteMicrogridEnv(modules, add_unbalanced_module=True, loss_load_cost=10, overgeneration_cost=2, reward_shaping_func=None, trajectory_func=None, flat_spaces=True, observation_keys=None, remove_redundant_gensets=True, step_callback=None, reset_callback=None)[source]#

A discrete env that implements priority lists as actions on a microgrid.

The environment deploys fixed controllable modules to the extent necessary to zero out the net load (load minus renewable generation).

Methods

close()

Override close in your subclass to perform any necessary cleanup.

compute_net_load([normalized])

Compute the net load at the current step.

convert_action(action)

Convert a reinforcement learning action to a microgrid control.

deserialize(mapping)

dump([stream])

Save a microgrid to a YAML buffer.

flatten_obs(observation_space, obs)

from_microgrid(microgrid, **kwargs)

Construct an RL environment from a microgrid.

from_nonmodular(nonmodular, **kwargs)

Convert to Microgrid from old-style NonModularMicrogrid.

from_normalized(data_dict[, act, obs])

De-normalize an action or observation.

from_scenario([microgrid_number])

Load one of the pymgrid25 benchmark microgrids.

get_cost_info()

get_empty_action([sample_flex_modules])

Get an action for the microgrid with no values set.

get_forecast_horizon()

Get the forecast horizon of timeseries modules contained in the microgrid.

get_log([as_frame, drop_singleton_key, ...])

Collect a log of controls and responses of the microgrid.

get_priority_lists(remove_redundant_gensets)

Get all of the priority lists for the microgrid.

load(stream)

Load a microgrid from a yaml buffer.

potential_observation_keys()

remove_action(action_number)

Remove an action from the action space.

reset()

Reset the microgrid and flush the log.

run(control[, normalized])

sample_action([strict_bound, ...])

Get a random action within the microgrid's action space.

set_forecaster(forecaster[, ...])

Set the forecaster for timeseries modules in the microgrid.

set_module_attrs([attr_dict])

Set the value of an attribute in all modules containing that attribute.

state_dict([normalized, as_run_output, _initial])

State of the microgrid as a dict.

state_series([normalized])

State of the microgrid as a pandas Series.

step(action)

Run one timestep of the environment's dynamics.

to_nonmodular()

Convert Microgrid to old-style NonModularMicrogrid.

to_normalized(data_dict[, act, obs])

Normalize an action or observation.

verbose_eq(other[, indent])

Attributes

action_space

Space object corresponding to valid actions.

controllable

Container of all controllable modules in the microgrid.

current_step

Current step of underlying modules.

final_step

Final step of underlying timeseries data.

fixed

Container of all fixed modules in the microgrid.

flat_spaces

Whether the environment's spaces are flat.

flex

Container of all flex modules in the microgrid.

initial_step

Initial step at which to start underlying timeseries data.

log

Microgrid's log as a DataFrame.

module_list

List of all modules in the microgrid.

modules

View of the module container.

n_modules

Number of modules in the microgrid.

np_random

Returns the environment's internal _np_random that if not set will initialise with a random seed.

observation_space

Space object corresponding to valid observations.

yaml_tag

Tag used for yaml serialization.

actions_list

List of priority lists.