Tutorial 07
Tutorial 07
To design and simulate an PID control system To use simulation as a diagnostic tool to improve control system performance and select control gains
Learning Outcomes Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method PID Control Algorithms Design and Simulation with LabVIEW The PID control law is:
u = K p e + K i edt + K d
0
t de 1 de or u = K p e + edt + Td dt Ti 0 dt
Kp 100 ; Ki = ; K d = K p Td Kp Ti Transfer function: K U 1 U = K p + i + K d s or = Kp 1 + + T s d Ts E s E i Block diagram algorithm for PID controller with Auto/Man mode
PB =
PID Controller Comparator Subtract Kp Integral uin KI uin Derivative KD D Multiply I Multiply Auto (Control signal) 4 To Actuator Sum (Compound Arithmetic) P Auto/Man Select
SP PV
Multiply
OP
Figure 1 Block diagram algorithm for PID control with Auto/Man switch mode
Notes: In LabVIEW PID Control Toolkit (Control Design and Simulation Module) there are some PID control functions you can use. The following shows the level control system with all components: pc Liquid supply 20-100 kPa Pneumatic I/P supply 140 kPa 4-20mA hm
LC
qi
Cross-sectional A
LT
Tank h qo
PC 4-20mA PID
Resistance R
We need to match units for each component as shown in block diagram in Fig. 3. Ps [kPa] [mm] Hsp Km [V] [V] +_ E [V] > [mA] C PID [V] < [mA] Hm Km U A/M KIP [kPa] Pc Kv [kPa] Qin G [mm] H
H sp
[V]
Figure 3 Block diagram of the level control system PID Control Algorithm 1: Use Point by Point Integral and Derivative functions
Figure 4 PID control algorithm 1 using PtByPt Integral and Derivative functions (Signal Processing)
2
Figure 5 PID control algorithm 2 using Simulation Module PID Control Algorithm 3: Use one of PID functions (PID Control Toolkit)
Figure 8 Application of the NI PID VI PID Control Algorithm 4 (*): Use Formula Node and 4th-order RK Method Step 1: Error e = SP PV Step 2: Integral: k1 = dt*e; k2 = dt*(e+0.5k1); k3 = dt*(e+0.5k2); k4 = dt*(e+0.5k3); ei = ei + (1/6)*(k1+2k2+2k3+k4); Step 3: Derivative ed = [e(k)-e(k-1)]/dt; (e must be stored in memory using Shift Resister) Step 4: PID Control Signal: uPID = Kp*e + Ki*ei + Kd*ed;
Hands-on Exercise 4 PID control algorithm using Formula Node and RK method
Open the On-Off Level Control > Save as PIDLevelControlSysSim04.vi (we can start from an earlier version of level system simulator) Modify in a way that the Simulation Loop is replaced with a While Loop. Refer to PID Control Algorithm 4: Save the VI frequently Run and test the VI functionality Select some values of control gains such that the system response has small overshoot and zero offset. (Estimated time: 1 hour)
Conclusions
At this point the following LOs have been met: Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions 5
Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method
Follow-up Exercises
Make a LabVIEW simulation for the temperature control system (case study) [pp2.46-2.47].
Aim
To design and simulate an PID control system To use simulation as a diagnostic tool to improve control system performance and select control gains
Learning Outcomes Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method PID Control Algorithms Design and Simulation with LabVIEW
The PID control law is:
u = K p e + K i edt + K d
0
t de 1 de or u = K p e + edt + Td dt Ti 0 dt
Kp 100 ; Ki = ; K d = K p Td Kp Ti Transfer function: K U 1 U = K p + i + K d s or = Kp 1 + + T s d Ts E s E i Block diagram algorithm for PID controller with Auto/Man mode
PB =
PID Controller Comparator Subtract Kp Integral uin KI uin Derivative KD D Multiply I Multiply Auto (Control signal) 4 To Actuator Sum (Compound Arithmetic) P Auto/Man Select
SP PV
Multiply
OP
Figure 1 Block diagram algorithm for PID control with Auto/Man switch mode
Notes: In LabVIEW PID Control Toolkit (Control Design and Simulation Module) there are some PID control functions you can use. The following shows the level control system with all components: pc Liquid supply 20-100 kPa Pneumatic I/P supply 140 kPa 4-20mA hm
LC
qi
Cross-sectional A
LT
Tank h qo
PC 4-20mA PID
Resistance R
We need to match units for each component as shown in block diagram in Fig. 3. Ps [kPa] [mm] Hsp Km [V] [V] +_ E [V] > [mA] C PID [V] < [mA] Hm Km U A/M KIP [kPa] Pc Kv [kPa] Qin G [mm] H
H sp
[V]
Figure 3 Block diagram of the level control system PID Control Algorithm 1: Use Point by Point Integral and Derivative functions
Figure 4 PID control algorithm 1 using PtByPt Integral and Derivative functions (Signal Processing)
2
Figure 5 PID control algorithm 2 using Simulation Module PID Control Algorithm 3: Use one of PID functions (PID Control Toolkit)
Figure 8 Application of the NI PID VI PID Control Algorithm 4 (*): Use Formula Node and 4th-order RK Method Step 1: Error e = SP PV Step 2: Integral: k1 = dt*e; k2 = dt*(e+0.5k1); k3 = dt*(e+0.5k2); k4 = dt*(e+0.5k3); ei = ei + (1/6)*(k1+2k2+2k3+k4); Step 3: Derivative ed = [e(k)-e(k-1)]/dt; (e must be stored in memory using Shift Resister) Step 4: PID Control Signal: uPID = Kp*e + Ki*ei + Kd*ed;
Hands-on Exercise 4 PID control algorithm using Formula Node and RK method
Open the On-Off Level Control > Save as PIDLevelControlSysSim04.vi (we can start from an earlier version of level system simulator) Modify in a way that the Simulation Loop is replaced with a While Loop. Refer to PID Control Algorithm 4: Save the VI frequently Run and test the VI functionality Select some values of control gains such that the system response has small overshoot and zero offset. (Estimated time: 1 hour)
Conclusions
At this point the following LOs have been met: Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions 5
Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method
Follow-up Exercises
Make a LabVIEW simulation for the temperature control system (case study) [pp2.46-2.47].
Aim
To design and simulate an PID control system To use simulation as a diagnostic tool to improve control system performance and select control gains
Learning Outcomes Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method PID Control Algorithms Design and Simulation with LabVIEW
The PID control law is:
u = K p e + K i edt + K d
0
t de 1 de or u = K p e + edt + Td dt Ti 0 dt
Kp 100 ; Ki = ; K d = K p Td Kp Ti Transfer function: K U 1 U = K p + i + K d s or = Kp 1 + + T s d Ts E s E i Block diagram algorithm for PID controller with Auto/Man mode
PB =
PID Controller Comparator Subtract Kp Integral uin KI uin Derivative KD D Multiply I Multiply Auto (Control signal) 4 To Actuator Sum (Compound Arithmetic) P Auto/Man Select
SP PV
Multiply
OP
Figure 1 Block diagram algorithm for PID control with Auto/Man switch mode
Notes: In LabVIEW PID Control Toolkit (Control Design and Simulation Module) there are some PID control functions you can use. The following shows the level control system with all components: pc Liquid supply 20-100 kPa Pneumatic I/P supply 140 kPa 4-20mA hm
LC
qi
Cross-sectional A
LT
Tank h qo
PC 4-20mA PID
Resistance R
We need to match units for each component as shown in block diagram in Fig. 3. Ps [kPa] [mm] Hsp Km [V] [V] +_ E [V] > [mA] C PID [V] < [mA] Hm Km U A/M KIP [kPa] Pc Kv [kPa] Qin G [mm] H
H sp
[V]
Figure 3 Block diagram of the level control system PID Control Algorithm 1: Use Point by Point Integral and Derivative functions
Figure 4 PID control algorithm 1 using PtByPt Integral and Derivative functions (Signal Processing)
2
Figure 5 PID control algorithm 2 using Simulation Module PID Control Algorithm 3: Use one of PID functions (PID Control Toolkit)
Figure 8 Application of the NI PID VI PID Control Algorithm 4 (*): Use Formula Node and 4th-order RK Method Step 1: Error e = SP PV Step 2: Integral: k1 = dt*e; k2 = dt*(e+0.5k1); k3 = dt*(e+0.5k2); k4 = dt*(e+0.5k3); ei = ei + (1/6)*(k1+2k2+2k3+k4); Step 3: Derivative ed = [e(k)-e(k-1)]/dt; (e must be stored in memory using Shift Resister) Step 4: PID Control Signal: uPID = Kp*e + Ki*ei + Kd*ed;
Hands-on Exercise 4 PID control algorithm using Formula Node and RK method
Open the On-Off Level Control > Save as PIDLevelControlSysSim04.vi (we can start from an earlier version of level system simulator) Modify in a way that the Simulation Loop is replaced with a While Loop. Refer to PID Control Algorithm 4: Save the VI frequently Run and test the VI functionality Select some values of control gains such that the system response has small overshoot and zero offset. (Estimated time: 1 hour)
Conclusions
At this point the following LOs have been met: Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions 5
Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method
Follow-up Exercises
Make a LabVIEW simulation for the temperature control system (case study) [pp2.46-2.47].
Aim
To design and simulate an PID control system To use simulation as a diagnostic tool to improve control system performance and select control gains
Learning Outcomes Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method PID Control Algorithms Design and Simulation with LabVIEW
The PID control law is:
u = K p e + K i edt + K d
0
t de 1 de or u = K p e + edt + Td dt Ti 0 dt
Kp 100 ; Ki = ; K d = K p Td Kp Ti Transfer function: K U 1 U = K p + i + K d s or = Kp 1 + + T s d Ts E s E i Block diagram algorithm for PID controller with Auto/Man mode
PB =
PID Controller Comparator Subtract Kp Integral uin KI uin Derivative KD D Multiply I Multiply Auto (Control signal) 4 To Actuator Sum (Compound Arithmetic) P Auto/Man Select
SP PV
Multiply
OP
Figure 1 Block diagram algorithm for PID control with Auto/Man switch mode
Notes: In LabVIEW PID Control Toolkit (Control Design and Simulation Module) there are some PID control functions you can use. The following shows the level control system with all components: pc Liquid supply 20-100 kPa Pneumatic I/P supply 140 kPa 4-20mA hm
LC
qi
Cross-sectional A
LT
Tank h qo
PC 4-20mA PID
Resistance R
We need to match units for each component as shown in block diagram in Fig. 3. Ps [kPa] [mm] Hsp Km [V] [V] +_ E [V] > [mA] C PID [V] < [mA] Hm Km U A/M KIP [kPa] Pc Kv [kPa] Qin G [mm] H
H sp
[V]
Figure 3 Block diagram of the level control system PID Control Algorithm 1: Use Point by Point Integral and Derivative functions
Figure 4 PID control algorithm 1 using PtByPt Integral and Derivative functions (Signal Processing)
2
Figure 5 PID control algorithm 2 using Simulation Module PID Control Algorithm 3: Use one of PID functions (PID Control Toolkit)
Figure 8 Application of the NI PID VI PID Control Algorithm 4 (*): Use Formula Node and 4th-order RK Method Step 1: Error e = SP PV Step 2: Integral: k1 = dt*e; k2 = dt*(e+0.5k1); k3 = dt*(e+0.5k2); k4 = dt*(e+0.5k3); ei = ei + (1/6)*(k1+2k2+2k3+k4); Step 3: Derivative ed = [e(k)-e(k-1)]/dt; (e must be stored in memory using Shift Resister) Step 4: PID Control Signal: uPID = Kp*e + Ki*ei + Kd*ed;
Hands-on Exercise 4 PID control algorithm using Formula Node and RK method
Open the On-Off Level Control > Save as PIDLevelControlSysSim04.vi (we can start from an earlier version of level system simulator) Modify in a way that the Simulation Loop is replaced with a While Loop. Refer to PID Control Algorithm 4: Save the VI frequently Run and test the VI functionality Select some values of control gains such that the system response has small overshoot and zero offset. (Estimated time: 1 hour)
Conclusions
At this point the following LOs have been met: Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions 5
Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method
Follow-up Exercises
Make a LabVIEW simulation for the temperature control system (case study) [pp2.46-2.47].
Aim
To design and simulate an PID control system To use simulation as a diagnostic tool to improve control system performance and select control gains
Learning Outcomes Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method PID Control Algorithms Design and Simulation with LabVIEW
The PID control law is:
u = K p e + K i edt + K d
0
t de 1 de or u = K p e + edt + Td dt Ti 0 dt
Kp 100 ; Ki = ; K d = K p Td Kp Ti Transfer function: K U 1 U = K p + i + K d s or = Kp 1 + + T s d Ts E s E i Block diagram algorithm for PID controller with Auto/Man mode
PB =
PID Controller Comparator Subtract Kp Integral uin KI uin Derivative KD D Multiply I Multiply Auto (Control signal) 4 To Actuator Sum (Compound Arithmetic) P Auto/Man Select
SP PV
Multiply
OP
Figure 1 Block diagram algorithm for PID control with Auto/Man switch mode
Notes: In LabVIEW PID Control Toolkit (Control Design and Simulation Module) there are some PID control functions you can use. The following shows the level control system with all components: pc Liquid supply 20-100 kPa Pneumatic I/P supply 140 kPa 4-20mA hm
LC
qi
Cross-sectional A
LT
Tank h qo
PC 4-20mA PID
Resistance R
We need to match units for each component as shown in block diagram in Fig. 3. Ps [kPa] [mm] Hsp Km [V] [V] +_ E [V] > [mA] C PID [V] < [mA] Hm Km U A/M KIP [kPa] Pc Kv [kPa] Qin G [mm] H
H sp
[V]
Figure 3 Block diagram of the level control system PID Control Algorithm 1: Use Point by Point Integral and Derivative functions
Figure 4 PID control algorithm 1 using PtByPt Integral and Derivative functions (Signal Processing)
2
Figure 5 PID control algorithm 2 using Simulation Module PID Control Algorithm 3: Use one of PID functions (PID Control Toolkit)
Figure 8 Application of the NI PID VI PID Control Algorithm 4 (*): Use Formula Node and 4th-order RK Method Step 1: Error e = SP PV Step 2: Integral: k1 = dt*e; k2 = dt*(e+0.5k1); k3 = dt*(e+0.5k2); k4 = dt*(e+0.5k3); ei = ei + (1/6)*(k1+2k2+2k3+k4); Step 3: Derivative ed = [e(k)-e(k-1)]/dt; (e must be stored in memory using Shift Resister) Step 4: PID Control Signal: uPID = Kp*e + Ki*ei + Kd*ed;
Hands-on Exercise 4 PID control algorithm using Formula Node and RK method
Open the On-Off Level Control > Save as PIDLevelControlSysSim04.vi (we can start from an earlier version of level system simulator) Modify in a way that the Simulation Loop is replaced with a While Loop. Refer to PID Control Algorithm 4: Save the VI frequently Run and test the VI functionality Select some values of control gains such that the system response has small overshoot and zero offset. (Estimated time: 1 hour)
Conclusions
At this point the following LOs have been met: Design PID controllers with LabVIEW Implement PID control algorithms for level control Simulate PID control systems with Auto/Man switch mode Use PtByPt Integral and Derivative functions 5
Use PID Control functions of the PID Control Toolkit Use Formula Node and 4th-order RK Method
Follow-up Exercises
Make a LabVIEW simulation for the temperature control system (case study) [pp2.46-2.47].