# Basic PLC Ladder Programming Examples 21

## Basic PLC Ladder Programming Examples 21

### Accurate Pipe Flow Measurement ·       Measuring the flow to an accuracy of 2 decimal places.
In this example, the diameter of the pipe is measured by mm, the flow rate is
measured by dm/s, and the flow is measured by cm3/s. The cross-sectional
area of the pipe = πr2 = π(d/2)2 and the flow =
cross-sectional area × flow rate

Number of PLC Inputs Required
X0 – Starting the measurement
Number of PLC Data Registers Required
D0 -Diameter of the pipe (unit: mm; set value: 10mm)
D6 -Operation result of the cross-sectional area
(unit: mm2)
D10 -Flow rate (unit: dm/s; set value: 25dm/s)
D20 -Operation result of the flow (unit: mm3
/s)
D30 -Operation result of the flow (unit: cm3
/s) Description:
·
The floating
point operation is usually applied to perform decimal calculation. However, it
needs to be converted and is more complicated. Therefore, we use elementary
arithmetic operation instructions to perform decimal calculation in this
example.
·
The units of mm,
cm and dm are used in the program. For calculation requirement, the program
sets these units into mm3 and then converts them into cm3.
·
π (π≈3.14) is
required when calculating the cross-sectional area of the pipe. In order to get
the calculation accuracy of 2 decimal places, the program increases π 100 times
to be K314 instead of increasing the unit dm/s 100 times to be mm/s.
·
In the end, the
program divides the value in D20 (unit: mm3 /s) with 1000 so as to
convert the unit into cm3 /s. (1 cm3 = 1 ml, 1l = 1000 ml = 1000 cm3
= 1 dm3 )
·
.Assume the pipe
diameter D0 is 10 mm and the flow rate D10 is 25 dm/s, the operation result of
the total flow will be 196 cm3 /s.
Note: Example is only for training
purposes. No practical implementation is done.

See More PLC Ladder Programming Examples