Base DC Motor
Code Documentation
- class gym_electric_motor.physical_systems.electric_motors.DcMotor(motor_parameter=None, nominal_values=None, limit_values=None, motor_initializer=None)[source]
Bases:
ElectricMotor
The DcMotor and its subclasses implement the technical system of a dc motor.
This includes the system equations, the motor parameters of the equivalent circuit diagram, as well as limits.
Motor Parameter
Unit
Default Value
Description
r_a
Ohm
16e-3
Armature circuit resistance
r_e
Ohm
16e-2
Exciting circuit resistance
l_a
H
19e-6
Armature circuit inductance
l_e
H
5.4e-3
Exciting circuit inductance
l_e_prime
H
1.7e-3
Effective excitation inductance
j_rotor
kg/m^2
0.025
Moment of inertia of the rotor
- ..note ::
The motor parameter are based on the following DC Motor (slightly adapted): https://www.heinzmann-electric-motors.com/en/products/dc-motors/pmg-132-dc-motor
Motor Currents
Unit
Description
i_a
A
Armature circuit current
i_e
A
Exciting circuit current
Motor Voltages
Unit
Description
u_a
V
Armature circuit voltage
u_e
v
Exciting circuit voltage
Limits /
Nominal Value Dictionary Entries:
Entry
Description
i_a
Armature current
i_e
Exciting current
omega
Angular Velocity
torque
Motor generated torque
u_a
Armature Voltage
u_e
Exciting Voltage
- Parameters:
motor_parameter – Motor parameter dictionary. Contents specified for each motor.
nominal_values – Nominal values for the motor quantities.
limit_values – Limits for the motor quantities.
motor_initializer –
Initial motor states (currents) (‘constant’, ‘uniform’, ‘gaussian’ sampled from
given interval or out of nominal motor values)
initial_limits – limits for of the initial state-value
- electrical_jacobian(state, u_in, omega, *_)
Calculation of the jacobian of each motor ODE for the given inputs / The motors ODE-System.
Overriding this method is optional for each subclass. If it is overridden, the parameter HAS_JACOBIAN must also be set to True. Otherwise, the jacobian will not be called.
- Parameters:
- Returns:
[0]: Derivatives of all electrical motor states over all electrical motor states shape:(states x states) [1]: Derivatives of all electrical motor states over omega shape:(states,) [2]: Derivative of Torque over all motor states shape:(states,)
- Return type:
Tuple(ndarray, ndarray, ndarray)
- electrical_ode(state, u_in, omega, *_)[source]
Calculation of the derivatives of each motor state variable for the given inputs / The motors ODE-System.
- get_state_space(input_currents, input_voltages)[source]
Calculate the possible normalized state space for the motor as a tuple of dictionaries “low” and “high”.
- initialize(state_space, state_positions, **__)
Initializes given state values. Values can be given as a constant or sampled random out of a statistical distribution. Initial value is in range of the nominal values or a given interval. Values are written in initial_states attribute
- Parameters:
state_space (gymnasium.Box) – normalized state space boundaries (given by physical system)
state_positions (dict) – indices of system states (given by physical system)
- next_generator()
Sets a new reference generator for a new episode.
- reset(state_space, state_positions, **__)
Reset the motors state to a new initial state. (Default 0)
- 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)
- HAS_JACOBIAN = False
Parameter indicating if the class is implementing the optional jacobian function
- I_A_IDX = 0
- I_E_IDX = 1
- property initial_limits
Returns: dict: nominal motor limits for choosing initial values
- property initializer
Returns: dict: Motor initial state and additional initializer parameter
- property limits
Readonly motors limit state array. Entries are set to the maximum physical possible values in case of unspecified limits.
- property motor_parameter
Returns: dict(float): The motors parameter dictionary
- property nominal_values
Readonly motors nominal values.
- property random_generator
The random generator that has to be used to draw the random numbers.
- property seed_sequence
The base seed sequence that generates the sub generators and sub seeds at every environment reset.