Squared Clipping Stage

class gem_controllers.stages.clipping_stages.squared_clipping_stage.SquaredClippingStage(control_task='CC')[source]

This class clips multiple references together, by clipping the vector length of the references to a scalar limit.

Parameters

control_task (str) – Control task of the controller stage.

__call__(state, reference)[source]

Clips a reference to the limits.

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

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

Returns

The reference of a controller stage clipped to the limit.

Return type

clipped_reference(np.ndarray)

property clipping_difference: ndarray

Difference between the reference and the clipped reference

property limits

Limits of the controlled states

property margin

Margin of the controlled states

reset()[source]

Reset the squared clipping stage

tune(env, env_id, margin=0.0, **kwargs)[source]

Set the limits for the clipped states.

Parameters
  • env (gym_electric_motor.ElectricMotorEnvironment) – The environment to be controlled.

  • env_id (str) – The id of the environment.

  • margin (float) – Percentage, how far the value should be clipped below the limit.