|AutomationDirect Live Chat|
Part 5 of 11
More Math Calculations. Productivity3000
Be More Productive.
It will be helpful to calculate both the maximum and minimum volumes that can be read by our Ultrasonic Sensor, based on the water level, and then use the results to scale the actual volume that is stored in the Process Tank at any given instant. Having an understanding of the sensors physical limitations in how close to the sensors face an object can be read, and the location of the sensor in the Process Tank will allow us to calculate the maximum volume. The closest distance the Ultrasonic Sensor can measure is 3.94 inches from its face, and the sensor is mounted through the Process Tanks lid a distance of 2 inches. This gives us a minimum distance of 5.94 inches we can sense into the tank. Subtracting from the tanks total height of 18.75 inches would equal 12.81 inches from the bottom of the tank. With each 1.88 inches of height in the tank representing one gallon of water, the highest volume that can be read by the sensor will be 12.81 divided by 1.88 inches height per gallon, which will equal 6.80 gallons. Using another Math Instruction, and creating another Tagname titled Maximum underscore Volume, entered into the Result parameter, we can calculate the maximum volume by using the tanks height of 18.75 inches, subtracting the sensor face at two inches into the tank, minus the minimum sensor distance of 3.94 inches, and dividing by our previously calculated Water_Height_per_Gallon Tagname, with a result of 6.8053 gallons, or just 6.80 gallons. Next we will calculate the minimum volume that the Ultrasonic Sensor can potentially detect, which would be the greatest distance that can be seen by the sensor. This calculation takes a little more thought in what is going on here. The Ultrasonic Sensor can measure out to a distance of 23.62 inches. Since the Process Tank has a height of 18.75 inches, the sensor could actually see past the bottom of the Process Tank if there were no obstructions, but we want to keep the final volume valve at zero when the tank is empty, and still use the total 0 to 65,535 count range of the analog input module to maintain our resolution. With another Math Instruction, create a new Tagname titled Minimum underscore Volume, entered into the Result parameter, and calculate the minimum volume by taking the tank height of 18.75 inches, subtracting the sensor face at 2 inches into tank, minus the maximum sensor distance of 23.62 inches, and divide by the Water_Height_per_Gallon Tagname. The result is a negative 3.65 gallons because we have the ability for the Ultrasonic Sensor to measure beyond the bottom of the Process Tank. Before we proceed to our Scaling Linear Instruction, I should point out that the previous calculations could be done manually, and the results entered as a numeric value in the next calculation. But, by using the Math Instruction, we have the ability to document and better understand our program later, and this also leaves us an easy way to make corrections to our program calculations if further conditions change. Join me in Part 6 of this video series when I show you how to use the Productivity 3000s Scale Instruction to get our final results in engineering units that will be easier to understand.