Interface
- class RoboPid
- setGains(Kp, Ki, Kd)
sets the gains:
Kp - proportional gainKi - integral gainKd - derivative gain- Param
Kp - proportional gain
- Param
Ki - integral gain
- Param
Kd - derivative gain
- Returns
None
- getGains()
get the currently set gains
Kp - proprotional gainKi - integral gainKd - derivative gain- Returns
(Kp, Ki, Kd)
- Return type
- setKp(Kp)
sets the proportional gain Kp
- Param
Kp - the proportional gain
- setKi(Ki)
sets the integral gain Ki
- Param
Ki - the integral gain
- setKd(Kd):
sets the derivative gain Kd
- Param
Kd - the derivative gain
- setIntegrateModeOn()
Turns integrative mode on
In integrative mode, the timestep integrations are calculated inside the controller and the output from the PID controller for the current timestep is used directly or with modifications and sent to the device or process plant as the current input signal. The integrations are cumulative across all timesteps until the PID controller is restarted with reset() or resetAll()
- Param
None
- Returns
None
- setIterateModeOn()
Turns iteration mode on
In iterative mode, the PID timestep integrations are manually calculated and updated outside the controller in the algorithm that calls the PID controller for the output of the PID at the current timestep. The output of the PID is localized to this timestep and not cumulative across all calls for the PID output since the start or restart of the controller by calling reset() or resetAll(). The accumulative effect of the PID is handled by the functional algorithm that is using the PID controller and then sent to the device or process plant as an input signal.
- Param
None
- Returns
None
- inIntegrateMode()
check if using integrative mode for PID evaluation
- Returns
True if in integrative mode and False if not
- Return type
Bool
- inIterateMode()
check if using iterative mode for PID evaluation
- Returns
True if in iterative mode and False if not
- Return type
Bool
- setTimeinc(time_inc)
Sets the discrete timestep increment value used in integrative calculations. time_inc can be any positive value. Set the time_inc unit of measurement to be the same unit as the sample rate of current signal. This value can be changed dynamically while the controller is running to adjust to changes in the frequency of the input signal if necessary.
- Param
time_inc
- Returns
None
- getTimeinc()
returns the current discrete timestep increment value
- Param
None
- Returns
time_inc
- getPid(signal_ref, signal)
Returns the results of the PID equation evaluation since the last call to this function. It is usually called at each timestep interval that is synced to the measured signal that samples at the same timestep interval frequency. Calculation, accumulative and persistent values depend on the mode setting.
- Param
signal_ref - reference signal value
- Param
signal - current measured signal value returned by process
- Returns
result of PID equation eval
- Return type
- getPidTuple(signal_ref, signal)
Returns tuple form of the components of the PID equation since last evaluation that was initiated by calling getPid(…) or an equivalent.
- param
signal_ref - reference signal value
- param
signal - current measured signal value returned by process
- return
components of PID equation evaluation (Kp P, Ki, I, Kd, D)
Kp - proprotional gainP - result of proportional term evaluationKi - integral gainI - result of integral term evaluationKd - derivative gainD - result of derivative term evaluation
- Return type
- pid(signal_ref, signal)
short form for getPid(…)
- get(signal_ref, signal)
short form for getPid(…)
- reset()
Resets the controller for a new run. Clears out integration results but keeps the currently set gains and mode parameters intact.
- Param
None
- Returns
None
- resetAll()
Resets all runtime variables to the the object instance initialization state. Gains and timestep increment values are also set to default values. Previous integration results are cleared.
- Param
None
- Returns
None