Wiener Process Reference Generator

class gym_electric_motor.reference_generators.WienerProcessReferenceGenerator(sigma_range=(0.001, 0.1), initial_range=None, **kwargs)[source]

Reference Generator that generates a reference for one state by a Wiener Process with the changing parameter sigma and mean = 0.

Parameters:
  • sigma_range (Tuple(float,float)) – Lower and Upper limit for the sigma-parameter of the WienerProcess.

  • initial_range (Tuple(float,float)) – Minimal and maximal normalized value of the initial reference point of a new episode. Default: Equal to the limit margin inherited from the SubepisodedReferenceGenerator

  • kwargs – Further arguments to pass to SubepisodedReferenceGenerator

close()

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

get_reference(*_, **__)

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(*_, **__)

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

next_generator()

Sets a new reference generator for a new episode.

property random_generator

The random generator that has to be used to draw the random numbers.

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)[source]

The references are reset. If an initial reference is passed, this value will be the first reference value of the next episode. Otherwise it will be 0.

Parameters:
  • initial_state (ndarray(float)) – The initial state of the physical system.

  • initial_reference (ndarray(float)) – (Optional) The first reference value.

Returns:

initial reference array. initial_reference_observation(element of reference_space): An initial observation of the next reference. trajectory(None): No initial trajectory is passed.

Return type:

initial_reference(ndarray(float))

seed(seed=None)

The function to set the seed.

This function is called by within the global seed call of the environment. The environment passes the sub-seed to this component that is generated based on the source-seed of the env.

Parameters:

seed ((np.random.SeedSequence, None)) – Seed sequence to derive new seeds and reference generators at every episode start. Default: None (a new SeedSequence is generated).

Returns:

A list containing all seeds within this RandomComponent. In general, this list has length 1. If the RandomComponent holds further RandomComponent instances, the list has to contain also these entropies. The entropy of this instance has to be placed always at first place.

Return type:

List(int)

property seed_sequence

The base seed sequence that generates the sub generators and sub seeds at every environment reset.

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.