Electronic – Convert Single OPAMP PID to Software implementation

operational-amplifierpid controller

I have a number of analog PID implementations that I need to convert to software. In an typical example (given below), the summing junction is used to get setpoint-measured error. In decoding the P and I coefficients for software implementation, I am confused as to what input resistance should I consider, R1+R2 or R1 parallel with R2.

All help is welcome 🙂

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

I take it the resistor values (especially R5/R6? 200 ohms is an awfully heavy load on an op-amp) and maybe the op-amp number are just for illustration.

The 'P' gain is 0.1

The output slews at a rate of Vfb/(100K * 470nF) volts/second for the integral gain so the I time constant is 47ms.

There is no 'D' term.

The diodes and R5/R6 are to clamp the output asymmetrically (mainly to prevent integral windup). Presumably the output 0-100% requires an asymmetric swing like 0.5 to -7.5V or something like that. It's important in analog circuits to prevent integration from continuing once the output is saturated. It's infinitely more important in firmware implementations since there's almost no limit to how high the integration term could get (especially if you're using floating point). It's also important to limit it or at least initialize it. The controller might otherwise take longer than the age of the universe to recover if the integral term got set to something weird, which many customers might find unacceptable.