Part 7 of 11
Programming PID Loops. Productivity3000
Be More Productive.
Up until now, most of what we have covered was preliminary information and tasks to get us to this point. Next I’ll cover the Productivity 3000’s PID Loop Instruction, the main focus of this video series. Once I have my analog signals scaled to usable and understandable values, I can now create my PID Loop Instruction that will perform the calculations. I click and drag the PID Loop instruction, located toward the bottom of the Instructions List under the PID heading, and drop it on the next available END rung in my Ladder Editor Window as shown here. The PID Loop Configuration window will open with the Major Setup tab ready for the various Tagnames and parameters to be entered. I enter a name for the PID Loop in the ‘Loop Name’ text box. I have chosen ‘Water Volume Control’. Continuing with the PID Loop configuration using fill-in-the-blank parameters, I enter the Tagname ‘Tank underscore Volume underscore SP’ into the ‘Set Point’ parameter, and select the Tagname ‘Tank underscore Volume’ from the drop down list, that was defined earlier, for the ‘Process Variable’. For the ‘Input Range Max’ parameter, I select the Tagname ‘Maximum underscore Volume’ that I calculated earlier, and likewise, the Tagname ‘Minimum underscore Volume’ that was also calculated is entered for the ‘Input Range Min’. I continue adding parameters to the fill-in-the-blank boxes. The ‘Pump underscore Speed’ Tagname I setup in channel one of our analog output module is used for the ‘Process Output’ parameter. The ‘Output Range Max’ parameter is set to ’65,535’, and the ‘Output Range Min’ parameter is set to zero. I use the same values for the ‘Output Upper Limit’ and ‘Output Lower Limit’ parameters in my application. In the next area I will set up the Tagnames for our ‘Proportional (Gain)’, ‘Integral (Reset) Time’ and ‘Derivative (Rate) Time’ parameters. To keep the naming simple for our example application, I have used the name of the parameter as the Tagname. So I can enter ‘Proportional’ for the ‘Proportional Gain’, ‘Integral’ for the ‘Integral Reset Time’, selecting seconds for my time range, and ‘Derivative’ for the ‘Derivative Rate Time’ with a default time in seconds. Before I press the ‘OK’ button to accept our PID Loop; let me mention the other Tabs available within the instruction window that will be covered in future LEARN videos. These include the Major Advanced tab, which for our example application we have used the default sample rate of 500 milliseconds, a ‘Forward’ Process Action, Freeze Bias is checked, and although we will discover that our application does not require any Derivative, the default for ‘Base the Derivative on the Process Variable’ is checked. The Major Alarms tab can be used to alarm values and bits for various conditions that occur doing the PID Loop operation. The Minor Setup, Minor Advanced, and Minor Alarms tabs are used if we had chosen a ‘Cascade Mode’ of operation found under the Major Advanced tab. Cascade Mode is typically used in applications where a secondary process can directly affect the primary process, though either the effects of disturbances from the secondary process or when the process gain or output actuator is non-linear. Once all the Tagnames and parameters have been entered into the PID Loop Instruction, we can press the ‘OK’ button. The next window that pops up will be the Define Tags dialog window, giving us the opportunity to select the Data Type for each of our new Tagnames. The default data type for all of the new Tagnames is ‘Integer, 32 Bit’. I will leave the default for the ‘Proportional’, ‘Integral’, and ‘Derivative’ Tagnames, but select ‘Float, 32 Bit’ for the ‘Set underscore Point’ Tagname. Next I transfer the changes to the Productivity 3000 CPU, save the project, and then enable the ‘Monitor Mode’ so I can see my results up to this point. Taking a quick look at our Tag Database, and using the check boxes to select the various data types, we see 32 Bit Floating Point and 32 Bit Integer Data Types were assigned to the Tagnames used in the PID Loop Instruction. 32 Bit Floating Point data types were chosen for the Process Tank’s Volume, Set Point, and Minimum to Maximum Volume range to allow for measurements read to the hundredth of a gallon. A 32 Bit Integer data type was chosen for the Proportional, Integral and Derivative terms. The 32 Bit Integer has plenty of resolution for the values that are typically used for final tuning of the PID loop. As seen in our final commented PID Loop rung, the PID instruction box requires two lines of control. The first is for enabling the PID execution, and the second for setting the PID to automatic mode or manual mode. Discrete bits controlled from push buttons located on the C-more Touch Panel are used to ‘Enable’ the PID loop and also for placing the loop in ‘Auto’ mode. When the PID loop is not in ‘Auto’ mode, it is in ‘Manual’ mode. We will see how ‘Manual’ mode is used for our initial startup, manually tune our PID loop, and then Auto-tuning the PID loop with the software’s built-in PID Tuning feature. In the next video, Part 8, we will cover some of the miscellaneous ladder logic that was created to add some extra monitoring features to our project.