Torque Controller

class gem_controllers.torque_controller.TorqueController(env: (<class 'gym_electric_motor.core.ElectricMotorEnvironment'>, None) = None, env_id: (<class 'str'>, None) = None, current_controller: (<class 'gem_controllers.current_controller.CurrentController'>, None) = None, torque_to_current_stage: (<class 'gem_controllers.stages.operation_point_selection.operation_point_selection.OperationPointSelection'>, None) = None, clipping_stage: (<class 'gem_controllers.stages.clipping_stages.clipping_stage.ClippingStage'>, None) = None)[source]

This class forms the torque controller, for any motor.

Initilizes a torque control stage.

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.

  • current_controller (gc.CurrentController) – The underlying current control stage.

  • torque_to_current_stage (gc.stages.OperationPointSelection) – The operation point selection class of the torque contol stage.

  • clipping_stage (gc.stages.clipping_stages.ClippingStage) – Clipping stage of the torque control stage.

property clipping_stage: ClippingStage

Clipping stage of the torque controller stage

control(state, reference)[source]

Claculate the reference values for the input voltages.

Parameters
  • state (np.array) – state of the environment

  • reference (np.array) – torque references

Returns

voltage reference

Return type

np.ndarray

property current_controller: CurrentController

Subordinated current controller stage

property current_reference: ndarray

Reference values of the current controller stage

reset()[source]

Reset all components of the torque control stage and the underlying stages

property t_n

Time constant of the current controller stage

torque_control(state, reference)[source]

Calculate the current refrences.

Parameters
  • state (np.array) – actual state of the environment

  • reference (np.array) – actual torque references

Returns

current references(np.array)

property torque_to_current_stage: OperationPointSelection

Operation point selection stage

tune(env, env_id, current_safety_margin=0.2, tune_current_controller=True, **kwargs)[source]

Tune the components of the current control stage.

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.

  • current_safety_margin (float) – Percentage indicating the maximum value for the current reference.

  • tune_current_controller (bool) – Flag, if the underlying current control stage should be tuned.