Implementing Proportional Controllers


Analog Implementation:

       Proportional control in an analog system is often implemented with operational amplifier circuits.  The circuit below produces an output voltage given by:

Vout = (Rf /R1)V1 - (Rf /R2)V2

        Clearly, this circuit can generate an output voltage that is proportional to an error signal, V1 - V2, and can be used as a proportional controller when resistance values are chosen so that:

R1 = R2



Digital Implementation:

        Proportional control in a digital system is often implemented in code in some programming language like C.

       Here's a pseudo-code segment that could implement a proportional controller.
 

/Measure the output/
MeasuredOutput = MeasureVolts(instrument);

/Compute Error/
Error = DesiredOutput - MeasuredOutput;

/Compute output voltage/
VoltsOut = ProportionalGain*Error;

/Output the control signal/
OutputVoltage(VoltsOut);

        This code assumes that you have a function - MeasureOutput - that will measure voltage using an instrument connected to the comuter, and can output voltage with a function - OutputVoltage - that uses another instrument connected to the computer.  It also assumes the somewhere earlier in the program the desired output and the proportional gain have been assigned values.