User Tools

Site Tools


en-us_commands:pid

This is an old revision of the document!


PID Control

Command Description
IpidSet(id, kp, ki, kd, sampleMs, outMin, outMax) Sets coefficients, calculation interval and output range.
IpidRun(id, pv, sv) Calculates output from the current value PV and setpoint SV.
IpidReset(id) Resets the integral value and internal state.
IpidReverse(id, reverse) Selects direct or reverse action.
IpidItermLimit(id, min, max) Limits the integral term range.
IpidOutput(id) Returns the last output value.
void setup() { IpidSet(0, 2.0, 0.5, 0.1, 100, 0, 100); }
void loop() {
  float output = IpidRun(0, ntcReadf(0), 50.0);
  IanalogWritef(0, 0.0, 100.0, output);
}

Command Prototypes

Return Type Command Prototype
bool IpidSet(uint8_t id, float kp, float ki, float kd, unsigned long sampleMs, float outMin, float outMax)
float IpidRun(uint8_t id, float pv, float sv)
void IpidReset(uint8_t id)
void IpidReverse(uint8_t id, bool reverse)
void IpidItermLimit(uint8_t id, float iMin, float iMax)
float IpidOutput(uint8_t id)

PID calculation is not a safety device. Handle sensor open circuits, overtemperature, stuck outputs and emergency stops with separate circuits and logic.

← Built-in Command List

en-us_commands/pid.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki