### Author Topic: PID FMD 88-10  (Read 5101 times)

#### acxysty ##### PID FMD 88-10
« on: January 25, 2014, 11:17:44 AM »
Hi,

My system is as follows, I have two gas lines with on each line a proportional valve and a pressure sensor.

At first I opened my first proportional valve with setPWM function.

I'd like to do a pressure regulator to compensate the pressure that I have on the first line of gas by opening my second line to have a delta of zero pressure.

For this I use the PID function with the FMD 88-10 and a PWM to manage the opening and closing of each of my proportional valves.

My problem is that I don't know how the PID on FMD works including the PIDcompute function.

Can you help me?

Thanks

#### support

• Global Moderator
• Hero Member
•     • • Posts: 3119 ##### Re:PID FMD 88-10
« Reply #1 on: January 26, 2014, 11:16:11 PM »

X will be in the range of 0 to 10000 representing 0.00% to 100.00% of full scale ADC. This is your process variable.

Now suppose you have a set point pressure S that you want the control system to reach. Whatever unit your pressure is measured you should convert it into the same unit as X using TBASIC. E.g  if your ADC returns 0 to 100% of full scale for pressure of 0 to 50.0 psi,  and say if you want the set point to be 30 psi, => S = 30*10000/50 = 6000 (60% of fullscale ADC).

The ERROR signal is E = S – X.

The control output Y is controlled by the PWM duty cycle (0 to 10000 representing 0 to 100% duty cycle). The purpose of PID control is to determine the value of  Y from E, which is obtained by the following:

1)   Use PIDDEF to set the P, I and D term (only do this once during initialization)
2)   Use  Y = PIDCompute(E)   to compute the output Y.
3)   SETPWM 1, Y, f    ‘ where f is the frequency recommended by your valve supplier.

Note: Fx1616-BA, Fx2424, SmartTILE-Fx and EZWire1616 all support floating point math so P, I and D could be floating point numbers or variables.

However, Since Nano-10 and FMD PLCs do not support floating point,  you can get fractional P, I and D term by representing each unit of these term as 0.1.  So for a proportional term of 4.0 you will use P =40 and for integral term of 0.3  you will use I = 3.  You will need to divide the result from PIDcompute() function by 10 in order to obtain the actual output Y

i.e. Y = PIDcompute(E)/10     ‘ For P, I, and D that are 0.1 per unit

As for the value of P, I and D, this is usually done by experimentation. A starting point may be P = 4 (40 if you use 0.1 per unit). In order to have zero steady state error you must have an Integral term (i.e. non zero I term). You can start with I = 0.1 and D = 0. You can gradually increase/decrease these values to alter the response time of your control system in order to reach the Set Point pressure where E = 0.

Some references regarding how to determine starting P term (proportional gain) can be found here: