Constant Reference Generator

class gym_electric_motor.reference_generators.ConstReferenceGenerator(reference_state='omega', reference_value=0.5, **kwargs)[source]

Reference Generator that generates a constant reference for a single state variable.

Parameters:
  • reference_value (float) – Normalized Value for the const reference.

  • reference_state (string) – Name of the state to reference

  • kwargs (dict) – Arguments passed to the superclass ReferenceGenerator.

close()

Called by the environment, when the environment is deleted to close files, store logs, etc.

get_reference(*_, **__)[source]

Returns the reference array of the current time step.

The reference array needs to be in the same shape as the state variables. For referenced states the reference value is passed. For unreferenced states a default value (e.g. Zero) can be set in the reference array.

Parameters:

state (ndarray(float)) – Current state array of the environment.

Returns:

Current reference array.

Return type:

ndarray(float))

get_reference_observation(*_, **__)[source]

Returns the reference observation for the next time step. This observation needs to fit in the reference space.

Parameters:

state (ndarray(float)) – Current state array of the environment.

Returns:

Observation for the next reference time step.

Return type:

value in reference_space

property reference_names

Returns: reference_names(list(str)): A list containing all names of the referenced states in the reference observation.

property referenced_states

Returns: ndarray(bool): Boolean-Array with the length of the state_variables indicating which states are referenced.

reset(initial_state=None, initial_reference=None)

Reset of references for a new episode.

Parameters:
  • initial_state (ndarray(float)) – The initial state array of the environment.

  • initial_reference (ndarray(float)) – If not None: A desired initial reference array.

Returns:

The reference array at time step 0.

reference_observation(value in reference_space): The reference observation for the next time step.

trajectories(dict(list(float)): If available, generated trajectories for the Visualization can be passed here. Otherwise return None.

Return type:

reference_array(ndarray(float))

set_modules(physical_system)[source]

Announcement of the PhysicalSystem to the ReferenceGenerator.

In subclasses, store all important information from the physical system to the ReferenceGenerator here. The environment announces the physical system to the ReferenceGenerator during its initialization.

Parameters:

physical_system (PhysicalSystem) – The physical system of the environment.