P Controller

class gem_controllers.stages.base_controllers.p_controller.PController(control_task, p_gain=array([0.]), action_range=(array([0.]), array([0.])))[source]

This class represents an proportional controller, which can be combined e.g. with a integration controller to a PI controller.

Parameters
  • control_task (str) – Control task of the P controller.

  • p_gain (np.array) – Array of p gains of the P controller.

  • action_range (np.array) – Action range of the stage.

__call__(state, reference)[source]

Calculate the reference for the underlying stage

Parameters
  • state (np.ndarray) – The state of the environment.

  • reference (np.ndarray) – The reference of the state.

Returns

reference values of the next stage

Return type

np.array

_tune_current_controller(env, env_id, a)[source]

Tune the P controller for the current control by the symmetrical optimum.

Parameters
  • env (ElectricMotorEnvironment) – The GEM-Environment that the controller shall be created for.

  • env_id (str) – The corresponding environment-id to specify the concrete environment.

  • a (float) – Design parameter of the symmetrical optimum.

_tune_speed_controller(env, env_id, a=4, t_n=None)[source]

Tune the P controller for the speed control by the symmetrical optimum.

Parameters
  • env (ElectricMotorEnvironment) – The GEM-Environment that the controller shall be created for.

  • env_id (str) – The corresponding environment-id to specify the concrete environment.

  • a (float) – Design parameter of the symmetrical optimum.

  • t_n (float) – Time constant of the underlying torque controller.

property action_range

Action range of the base controller

control(state, reference)[source]

Calculate the reference for the underlying stage

Parameters
  • state (np.ndarray) – The state of the environment.

  • reference (np.ndarray) – The reference of the state.

Returns

reference values of the next stage

Return type

np.array

property p_gain

P gain of the P controller

property state_indices

Indices of the controlled states

tune(env, env_id, a=4)[source]

Tune the controller for the desired control task.

Parameters
  • env (ElectricMotorEnvironment) – The GEM-Environment that the controller shall be created for.

  • env_id (str) – The corresponding environment-id to specify the concrete environment.

  • a (float) – Design parameter of the symmetrical optimum.