Part 6 of 11
Be More Productive.
Next I use the Scale Linear Instruction to determine our Process Tanks volume based on the water level as seen by the Ultrasonic Sensor. I also use Scaling to create a variable that will allow us to display the Diaphragm Pumps output rate in gallons per minute on our C-more Touch Panel. Now that we have a better understanding of what is going on with the analog input module that is fed with the 0 to 10 volt DC analog signal from the Ultrasonic Sensor, we are ready to use the Scale (Linear) Instruction to provide our Tank Volume in engineering units of gallons of water. But first we need to assign a Tagname to the first channel, AIS32-0.1.3.1, on our P3-04ADS analog input module to which we have our Ultrasonic Sensor wired. We will rename this existing Tagname to Ultrasonic_600, which represents the sensors 0 to 10 volt DC analog signal with a maximum sense range of 600 mm, although in our application we have converted this maximum range value to 23.62 inches, because we are working in English measurements. As seen here, the Hardware Configuration tool is used to edit the existing Tagname that is automatically assigned to the analog input. Next drag and drop the Scale (Linear) Instruction into the next available END coil position on the ladder logic. In our case, this looks to be Rung number 4. The Scale (Linear) Instruction dialog window will open. Lets insert the new Tagname Ultrasonic underscore 600 into the Scale Instructions Input parameter. It will produce a count range of 0 to 65,535, so for the minimum input parameter called In Min, we can enter a zero. For the maximum input parameter called In Max, we can enter the value 65,535. The next two parameters, Out Min and Out Max, become a simple matter to insert the Tagnames we created earlier for our Maximum underscore Volume and Minimum underscore Volume, but again because our maximum volume is seen when the water is closest to the sensor, with the sensor reading zero, and vice a versa for our minimum volume, the Maximum underscore Volume Tagname should be used for the Out Min parameter, and the Minimum underscore Volume Tagname for the Out Max parameter. This is a little confusing, and there are different ways we could handle this condition, but being able to plug all of our parameters into one instruction to produce our final results makes programming a lot simpler. Next, we need to create another new Tagname for our result that goes into the Scale Instructions Output parameter. We will name this Tagname Tank underscore Volume. If you have followed along so far, the value in Tank underscore Volume will become our Process Variable used in our PID Loop calculations. The output of our PID Loop calculation, as we have discussed, will provide a 0 to 10 volt DC signal from the P3-04DA analog output module to a Dart 12 volt DC variable speed motor controller. The motor controller will provide power to the 12 volt DC Diaphragm Pump motor. The Diaphragm Pump is capable of producing a flow rate up to 1 gallon per minute. The analog output module uses a 32-bit integer value with a range of 0 to 65,535 to produce the 0 to 10 volt DC signal. As seen in the PID Loop Instruction that follows, we will use the PIDs Process Output directly to control the pump rate. This will give us the maximum resolution without the need to scale. We will actually create a Tagname called Pump underscore Speed? that is used as the PID Loops Process Output that directly controls the analog ouput modules channel 1, which is wired directly to the Dart DC motor controllers 0 to 10 volt DC analog input. Again, using the Hardware Configuration tool, create a Tagname for the P3-04DA analog output modules first channel, AOS32-0.1.4.1, and rename it as Pump underscore Speed. This Tagname will be used in our PID Loop Instruction, and represents the calculated rate the pump needs to operate to maintain the water level in the Process Tank. The rate will be somewhere between zero and one gallon per minute. Jumping a little ahead of ourselves in the program, it would be nice to have our C-more Touch Panel display the actual Diaphragm Pump rate in gallons per minute. This is another easy task that makes use of our Scale (Linear) Instruction. Our goal is to create a value of 0 to 1,000 based on the Pump_Speed value of 0 to 65,535 at any given instant. In the C-more Touch Panel we will display the result to show 0 to 1.000 gallons per minute by using a decimal point three places to the left. Drag and drop the Scale Instruction into the next End coil. Next select the Tagname Pump underscore Speed in the Scale Instructions Input parameter. For the In Min parameter, we will enter zero, and the In Max will be 65,535. To produce the 0 to 1,000 value to display on the C-more, enter zero for the Out Min parameter, and 1,000 for the Out Max. Enter Cmore underscore PID underscore Output in the Output parameter, then click OK. The Define Tags dialog box will come up in the programming software. I have assigned Cmore underscore PID underscore Output as an Integer, 16 Bit Data Type. Follow me to Part 7 as I get to the heart of this video series and explain the use of the Productivity 3000s PID Loop Instruction.