Skip to content

PD controller

A proportional/derivative controller where both the proportional and derivative actions are taken from input signals.


JCS Network Configuration

structure.yaml Configuration

type proc_pd

Signals - From Process

Signal name Type Required Description
u float32 required Controller output
Signal name can be renamed by the user

Signals - To Process

Signal name Type Required Description
p_setpoint float32 required Proportional term command input
p_feedback float32 required Proportional term feedback input
d_setpoint float32 optional Derivative term command input
d_feedback float32 optional Derivative term feedback input
feedforward float32 optional Feed forward input
kp float32 optional Proportional term gain
If not connected, then must be set by parameter proc_pd_kp
kd float32 optional Derivative term gain
If not connected, then must be set by parameter proc_pd_kd
output_limit float32 optional Output and integrator limit
Defines both output limit high and low

Note: The PD controller breaks out the gains as optional signals. If they are not connected as signals the gains can be set via parameter.

Configuration Parameters

Parameter name Type Required Description
proc_pd_kp float32 optional Proportional gain term
Ignored if signal kp is connected
proc_pd_kd float32 optional Derivative gain term
Ignored if signal kd is connected
proc_pd_kff float32 optional Feedforward gain term
proc_pd_limit_out_h float32 optional Controller output limit - high (output_units)
proc_pd_limit_out_l float32 optional Controller output limit - low (output_units)
proc_pd_rate_limit_rising float32 optional Controller output rising rate limiter (output_units/s)
proc_pd_rate_limit_falling float32 optional Controller output falling rate limiter (output_units/s)
proc_pd_startup_rate_limit float32 optional Startup output limits rate limiter (output_units/s/s)
proc_pd_p_is_rotational_error boolean optional True: wraps the computed proportional error term \(e[k]\) to the interval \([-\pi, \pi]\)
Default value: false
proc_pd_d_is_rotational_error boolean optional True: wraps the computed derivative error term \(e[k]\) to the interval \([-\pi, \pi]\)
Default value: false

Operation

The PD controller is implemented in parallel form as the following difference equations:

If the parameter option proc_pd_p_is_rotational_error is set to false, then the proportional term is computed as:

\[ p[k] = k_p (r_{p}[k] - y_{p}[k]) \]

If the parameter option proc_pd_p_is_rotational_error is set to true, then the proportional term is computed as:

\[ p[k] = k_p wrap(r_{p}[k] - y_{p}[k], -\pi, \pi) \]

Here, \(r_{p}\) is the p_setpoint signal and \(y_{p}\) is the p_feedback signal.

If the parameter option proc_pd_d_is_rotational_error is set to false, then the derivative term is computed as:

\[ d[k] = k_d (r_{d}[k] - y_{d}[k]) \]

If the parameter option proc_pd_d_is_rotational_error is set to true, then the derivative term is computed as:

\[ d[k] = k_d wrap(r_{d}[k] - y_{d}[k], -\pi, \pi) \]

Here, \(r_{d}\) is the d_setpoint signal and \(y_{d}\) is the d_feedback signal.

The final PD is computed with the added feedforward term \(k_{ff} * ff[k]\):

\[ y[k] = p[k] + d[k] + k_{ff} * ff[k] \]

Limits configured in proc_pd_limit_out_h and proc_pd_limit_out_l are applied to the output:

\[ y[k] = \begin{cases} limit_h,& \text{if } y[k]\geq limit_h\\ y[k], & limit_l \lt y[k] \lt limit_h \\ limit_l,& \text{if } y[k]\leq limit_l\\ \end{cases} \]

Following the limits, a rate limit may be applied to the output by parameters proc_pd_rate_limit_rising and proc_pd_rate_limit_falling. If these parameters are set as \(0\) or left unconfigured the rate limiter is disabled.

\[ y[k] = y[k-1] + \begin{cases} dt \times rate_{rising} ,& \text{if } y[k] - y[k-1] \geq dt \times rate_{rising}\\ 0, & dt \times rate_{falling} \lt y[k] - y[k-1] \lt dt \times rate_{rising} \\ dt \times rate_{falling} ,& \text{if } y[k] - y[k-1] \leq dt \times rate_{falling}\\ \end{cases} \]

Startup

During controller startup an aggressive rate limit may be applied via parameter proc_pd_startup_rate_limit. This parameter rate limits the controller limits, starting from \(0\) until the limits reach the value defined by parameters proc_pd_limit_out_h and proc_pd_limit_out_l or the value defined by signal output_limit (whichever is configured). Once the rate limited limits equal the pre-defined limits, the startup rate limiter is disabled.

The effect of this limiter is to provide a 'soft' startup, in case of any large controller error present as the system starts.

Set parameter proc_pd_startup_rate_limit to \(0\), or leave unconfigured to disable the startup rate limiter.