Skip to content

Controller Modes


The two channel simple thermal manager features modes for performing closed loop control of two independent computer style fans or pumps.

Peripheral support

The manager support 2, 3 and 4 pin computer style fans and pumps.

Depending on the peripheral command and feedback signals available, not all control modes may be possible.

For example:

  • Where 2 pin peripherals are used, no speed feedback or speed setting of the peripheral is supported.
  • 3 pin peripherals support modes are dependent on whether the third pin provides speed feedback or a speed command input.
  • Where 4 pin peripherals are used, reading the peripheral speed and setting the peripheral speed is supported.

High level and low level controller structure

Controller structure

The two channel thermal manager implements optional high level controllers that may perform some mapping or control action, then pass the output to a lower level controller.

If a high level controller is active, its output overrides a low level controllers input.


High level controller types

Set the high level controller type by writing an enum to high_controller_0_type or high_controller_1_type:

Control type Description
disabled The high level controller is disabled for this channel. If disabled the low level controller will take input from JCS input signal r_X.
linear_map An open loop linear map that maps the four high level controller JCS signal inputs to a single output for consumption by the low level controller.

High level controller type: disabled

The high level controller for this channel is disabled. Connecting and writing data to JCS signals channel_X_in_0...3 has no effect.

Usage of the low level controllers is still available.


High level controller type: linear_map

An open loop linear map that takes up to four inputs, via JCS signals channel_X_in_0...3 and maps them to a single output.

Linear Map

The linear map takes up to four JCS signal inputs, passes each through a linear mapping, then passes the maximum of the configured maps to the output.

A usage example is taking in temperature sources, mapping them and outputting the maximum to a fan speed.

Map output coefficients

The map output coefficients define the output range, and since only one output is available, only one set of output coefficients are required. Configure the map output coefficients by writing an array of 4 values:

Commands Type Required Description
high_controller_X_linear_map_output_coeffs float32 array Optional An array of 4 coefficients for channel X high level linear map output.
Required if linear map is enabled.
X is channel 0 or 1.

Map input coefficients

The map input coefficients define the input range for each input signal. Configure each input map by writing an array of 4 coefficients.

Commands Type Required Description
high_controller_X_linear_map_input_0_coeffs float32 array Optional An array of 4 coefficients for channel X linear map input number 0.
X is channel 0 or 1.
high_controller_X_linear_map_input_1_coeffs float32 array Optional An array of 4 coefficients for channel X linear map input number 1.
X is channel 0 or 1.
high_controller_X_linear_map_input_2_coeffs float32 array Optional An array of 4 coefficients for channel X linear map input number 2.
X is channel 0 or 1.
high_controller_X_linear_map_input_3_coeffs float32 array Optional An array of 4 coefficients for channel X linear map input number 3.
X is channel 0 or 1.

Notes:

  • Not all inputs are required.
  • If an input is connected as a JCS signal, its input map must be configured.

Low level controller types

Set the low level controller type by writing an enum to low_controller_0_type or low_controller_1_type:

Control type Description
internal_speed Closed loop PID speed control, taking speed feedback from the fan or pump peripheral itself.
external_feedback Closed loop PID control (not limited to speed) taking feedback from an external JCS signal.
current Closed loop PID current control, taking feedback from the channel current sensor.
direct Direct PWM duty cycle control (command valid between [0.0-1.0]).

Configuration parameters

The following parameters are available for configuration:

Commands Type Required Description
low_controller_X_kp float32 Optional Controller proportional gain term.
X is channel 0 or 1.
low_controller_X_ki float32 Optional Controller integral gain term.
X is channel 0 or 1.
low_controller_X_kd float32 Optional Controller derivative gain term.
X is channel 0 or 1.

Low level controller type: internal_speed

Low level internal speed control

Control mode internal_speed utilises a 4-pin peripherals speed sense and speed command functionality to perform closed loop speed control of the peripheral.

Thermal manager internally computes and filters the peripheral speed from the input signal at the Control loop frequency as defined in the electrical specifications. The sensed speed is then passed as a feedback signal to the low level PID controller. The PID controller output is clamped to the range [0.0, 1.0] before being converted to a PWM duty cycle and output to the peripheral.


Controller mode: external_feedback

Low level external feedback control

Control mode external_feedback performs closed loop control via feedback from the external JCS signals channel_X_feedback (where X is channel 0 or 1) and a set point from JCS signals channel_X_setpoint.

An example use of this control mode is performing closed loop pressure control of a computer style pump.

The PID controller output is clamped to the range [0.0, 1.0] before being converted to a PWM duty cycle and output to the peripheral.


Controller mode: direct

Low level direct PWM

Control mode direct allows setting the peripheral PWM duty cycle directly.

Control input is presented at JCS signal channel_X_setpoint (where X is channel 0 or 1). The control input is clamped to the range [0.0, 1.0] before being converted to a PWM duty cycle and output to the peripheral.


Controller mode: current

Low level current control

Control mode current performs closed loop control by measuring the current of the peripherals 12V DC bus input. The PID controller output is clamped to the range [0.0, 1.0] before being converted to a PWM duty cycle and output to the peripheral.

Notes:

  • There will be some DC current quantity present on the current feedback. This is the quiescent current usage of the peripheral.
  • Some peripherals, particularly fans, will show pulses of current consumption rather than nice continuous current measurements. This is due to the internal operation of the peripheral. If an average or more continuous measurement is required, lower the current measurement filter cutoff by writing to i_dc_X_filter_fc_hz.

High level and low level controller worked example

From numerous sources, but in particular CUI Devices The Complete Guide to Thermal Management show that a required airflow \(Q\) in CFM can be related to the amount of power dissipated and a temperature difference to be maintained.

This is given by:

\[ CFM_{req} = {{q}\over{C_p \rho \delta{T}}} \]

where, \(q\) is the heat transferred, \(C_p\) is the specific heat of air at \(26^{\circ}C\) and \(\rho\) is the air density at the same temperature.

Manipulating and plugging in values gives the following relationship:

\[ CFM_{req} = {{1.76 q} \over \delta{T}} \]

The Delta Electronics AFB0712HHB fan datasheet shows the following properties:

Airflow at zero static pressure is \(37.54CFM\) at \(4300RPM\) reference speed at 12V. The thermal controller can supply a maximum of 12V to a fan, so this will be the maximum speed and airflow we can achieve with this fan.

We suppose we are attempting to keep a JCS 7250 motor controller cool, and we are operating it at 72V and a maximum of 50A, for a maximum power level of 3600W. A worst case power dissipation of \(5\% \times 1600W = 180W\) (for a worst case efficiency of \(95\%\)) is found.

We assume that we would like to limit the motor controller to a maximum of \(50\deg\C\).

Fan CFM to speed is a linear relationship:

\[ {CFM_{1}\over{CFM_{2}}} = {speed_{1}\over{speed_{2}}} \]

this can be rearranged to find a required speed from the maximum speed and CFM in the datasheet, and the required CFM from the previous calculations:

\[ speed_{req} = {speed_{max} CFM_{req}\over{CFM_{max}}} \]

Plugging all the numbers in, we find the following:

Max fan speed 4300 RPM (450Rad/S)
Max fan CFM 37.54 CFM
Max device temperature \(50^{\circ}C\)
Ambient temperature \(26^{\circ}C\)
Fan speed at max device temperature 1511 RPM (158Rad/S)

How can this be used?

We have defined a fan speed to maintain our maximum temperature, but we would like to allow the fan to spin up to its maximum speed, so that any unaccounted for temperature transients can be handled.

This is easily achievable with the high and low level controller approach used by the thermal controller.

Low level speed control

Low level speed control is straight forward: We choose internal_speed control and configure appropriate gains:

  # Channel 0 config - fan speed control
  low_controller_0_type: internal_speed
  low_controller_0_kp: 0.01
  low_controller_0_ki: 0.1

High level temperature to fan speed mapping

The high level controller linear_map can be used to achieve the characteristics defined above.

The output coefficients defined in high_controller_0_linear_map_output_coeffs defines the output speeds for given input temperatures, and the high_controller_0_linear_map_input_0_coeffs defines the input temperatures:

  high_controller_0_linear_map_output_coeffs:  [0, 158, 450, 500]
  high_controller_0_linear_map_input_0_coeffs: [0, 50,  90,  100]

Here, the first two coefficients in each table linearly map the temperature to the ideal fan speed. The third coefficients serve as backup; we define 90degC as the maximum temperature we will allow, and in turn the fan will run at maximum speed. The last coefficients should not be reached, however the linear map requires four coefficients to be defined.

Complete high level controller entry:

  # Channel 0 config - One temperature source to be mapped to a fan speed
  high_controller_0_type: linear_map
  # Linear map output sets the fan speed
  high_controller_0_linear_map_output_coeffs: [100, 200, 400, 600]
  # Linear map inputs are the incoming temperatures
  high_controller_0_linear_map_input_0_coeffs: [0, 40, 60, 80]