Dead Time Processor
- class gym_electric_motor.physical_system_wrappers.DeadTimeProcessor(steps=1, reset_action=None, physical_system=None)[source]
The DeadTimeProcessor delays the actions to the physical system for a parameterizable amount of steps.
- Reset Actions:
When the environment is reset, no valid previous actions are available. Per default, constant reset actions are used. Also, custom reset actions parameterized. Therefore, a method can be passed during initialization of a DeadTimeProcessor. This method needs to return a list of valid actions of the action space whose length equals the number of dead time steps.
The default reset actions are zeros. The concrete shape is derived by the concrete action spaces:
Discrete, MultiDiscrete, Box
.
Args: steps(int): Number of steps to delay the actions. reset_action(callable): A callable that returns a list of length steps to initialize the dead-actions
after a reset. Default: See above in the class description
physical_system(PhysicalSystem (optional)): The inner physical system of this PhysicalSystemWrapper.
- property action_space
The processed action space.
If it is unset, the action space of the inner physical system is returned.
- close()
Called, when the environment is closed. Close the System and all of its submodules by closing files, saving logs etc.
- property dead_time
The number of delayed steps.
- Type:
int
- property k
Returns: int: The current systems time step k.
- property limits
The processed physical system limits.
If it is unset, the inner limits are returned.
- next_generator()
Sets a new reference generator for a new episode.
- property nominal_state
The processed physical system nominal state.
If it is unset, the inner nominal state is returned.
- property physical_system
The next inner physical_system or the next inner physical_system_wrapper.
- property random_generator
The random generator that has to be used to draw the random numbers.
- reset()[source]
Resets the processor and the inner physical system for a new episode.
- Returns:
The initial state of the system.
- Return type:
numpy.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_physical_system(physical_system)[source]
Sets the inner PhysicalSystem of the DeadTimeProcessor.
- Parameters:
physical_system (PhysicalSystem) – The physical system to be set.
- simulate(action)[source]
Saves the action, applies the dead-time action and simulates the system for one time step.
- Args:
action(element of the action_space): The next action for the system.
- Returns:
The next state of the system.
- Return type:
numpy.ndarray[float]
- property state_names
The processed physical system state names.
If it is unset, the state names of the inner physical system are returned.
- property state_positions
Returns: dict(int): Dictionary mapping the state names to its positions in the state arrays
- property state_space
The processed state space.
If it is unset, the state space of the inner physical system is returned.
- property unwrapped
The innermost physical system within all Physical System Wrappers.