Skip to content

Controller Modes


The brake/clutch controller offers a user selectable closed loop current controller and open loop voltage control and direct PWM ducty cycle control.

Controller modes

Set the controller mode by writing an enum to controller_0_mode or controller_1_mode:

Control mode Description
current Closed loop current controller.
voltage Direct open loop voltage control.
duty Direct open loop duty cycle control.
test_l Inductance test controller.
test_r Resistance test controller.

Controller mode: current

The current controller performs closed loop control of the load winding current.

The controller structure is:

Current Control

In this case:

  • \(i_{cmd}\) is taken fron the JCS signal cmd_ch_0 or cmd_ch_1.
  • \(v_{cmd}\) is the voltage command output from the PI controller.
  • \(duty\) is generated by normalising \(v_{cmd}\) to the measured DC bus voltage as \(duty = {v_{cmd} \over v_{dc}}\).

Note: The switching mechanism employed is unipolar, in that it is implemented using a single high side MOSFET. However the PI controller may produce negative going voltage commands or commands clamped to zero. Some controller performance degradation should be expected when commands around this region are generated. Typical behaviour might manifest as a mechanism being faster to turn on than it is to turn off.

Configuration parameters

PI Current controller
Commands Type Required Description
controller_X_current_kp float32 Required Channel X current controller proportional gain (A).
X is channel 0 or 1.
controller_X_current_ki float32 Required Channel X current controller integral gain (A.s).
X is channel 0 or 1.
controller_X_limit_out_h float32 Required Channel X current controller output and integrator upper limit (V).
X is channel 0 or 1.
controller_X_limit_out_l float32 Required Channel X current controller output and integrator lower limit (V).
X is channel 0 or 1.

To start the controller, set controller_X_mode to current to select the channel 0 or 1 current controller, then start the controller with a write to controller_X_start.

X is channel 0 or 1.


Controller mode: voltage

The voltage controller performs open loop control of the load winding voltage by transforming the incoming voltage command to a duty cycle.

The controller structure is:

Voltage Control

In this case:

  • \(v_{cmd}\) is the voltage command taken fron the JCS signal cmd_ch_0 or cmd_ch_1.
  • \(duty\) is generated by normalising \(v_{cmd}\) to the measured DC bus voltage as \(duty = {v_{cmd} \over v_{dc}}\).
Voltage command
Commands Type Required Description
controller_X_limit_out_h float32 Required Channel X voltage command output upper limit (V).
X is channel 0 or 1.
controller_X_limit_out_l float32 Required Channel X voltage command output lower limit (V).
X is channel 0 or 1.

To start the controller, set controller_X_mode to voltage to select the channel 0 or 1 duty cycle controller, then start the controller with a write to controller_X_start.

X is channel 0 or 1.


Controller mode: duty

The duty cylce controller performs open loop control of the load winding voltage by directly setting the duty cycle.

The controller structure is:

Direct Duty Control

In this case:

  • \(duty_{cmd}\) is the voltage command taken fron the JCS signal cmd_ch_0 or cmd_ch_1.
  • An output duty cycle \(duty\) is generated by applying a scale and offset to the incoming JCS signal command as \(duty = duty_{cmd} * scale - offset\).

Note: The duty cycle output to the load is hard clamped to [1.0, 0.0].

Configuration parameters

Duty cycle command
Commands Type Required Description
controller_X_duty_scale float32 Optional Channel X duty cycle controller command scale value.
X is channel 0 or 1.
controller_X_duty_offset float32 Optional Channel X duty cycle controller command offset value.
X is channel 0 or 1.

To start the controller, set controller_X_mode to duty to select the channel 0 or 1 duty cycle controller, then start the controller with a write to controller_X_start.

X is channel 0 or 1.


Controller mode: test_l

This controller mode attempts to determine load inductance (H) via frequency injection.

Test Inductance Waveform

Parameters:

Command Type Required Description
controller_X_test_l_v_bias float32 Required Channel X bias voltage (V).
X is channel 0 or 1.
controller_X_test_l_v_amplitude float32 Required Channel X test square wave amplitude (V), centered around the bias voltage.
X is channel 0 or 1.
controller_X_test_l_freq_hz float32 Required Channel X test square wave frequency (Hz).
X is channel 0 or 1.
controller_X_test_l_time_ms uint16 Required Channel X test duration (ms).
X is channel 0 or 1.

Once the parameters are written, set controller_X_mode to test_l to select the inductance test, then start the test with a write to controller_X_start. Poll the status of the test with a boolean read to command controller_X_is_running. The boolean value will be true if the controller is running (ie, the test is still running) and false if the controller is in any other state. Exit the test early with a write to command controller_X_stop.

Upon test completion read float32 from command controller_X_L. The test failed if the return value is 0.0f.

X is channel 0 or 1.


Controller mode: test_r

This controller mode attempts to determine the load resistance (Ohms) via Ohms law.

Parameters:

Command Type Required Description
controller_0_test_r_v_amplitude float32 Required Channel X test voltage (V).
X is channel 0 or 1.
controller_0_test_r_time_ms uint16 Required Channel X test duration (ms).
X is channel 0 or 1.

Once the parameters are written, set controller_X mode to test_r to select the resistance test, then start the test with a write to controller_X_start. Poll the status of the test with a boolean read to command controller_X_is_running. The boolean value will be true if the controller is running (ie, the test is still running) and false if the controller is in any other state. Exit the test early with a write to command controller_X_stop.

Upon test completion read float32 from command controller_X_R. The test failed if the return values is 0.0f.

X is channel 0 or 1.