Examples
- Last UpdatedMar 03, 2025
- 1 minute read
The following examples show expressions that use arithmetic operators. The tag names used in these examples are:
-
FlowRate.Pump1 measures the flow rate of a pump in liters per second (L/s)
-
FlowRate.Pump2 measures the flow rate of a pump in liters per minute (L/min)
-
TankCapacity measures the available capacity of a tank in kiloliters (kL)
-
TimeElapsed measures elapsed time in seconds (s)
Example 1
The following expression returns the sum of flow rates for two pumps, and assigns the alias TotalFlow to the expression.
Pump1.FlowRate + Pump2.FlowRate
Because the tags use different units, and there is no explicit unit conversion specified, the units of Pump2.FlowRate are implicitly converted to liters/second to match the units of Pump1.FlowRate before the values are added together.
Example 2
The following expression returns a value per minute representing the total volume flowing through both pumps during that minute.
TOTAL(Pump1.FlowRate + Pump2.FlowRate, 1 minute)
Example 3
The following expression calculates a pump's efficiency as a percentage. This example uses water at 50 degrees Celsius, which has a density of 992.24 kg/m3 and head of 3.5m, the gravitational constant of 9.81 m/s2, and "Pump1.Power" represents the power used by the pump in Watts.
Pump1.FlowRate * 3.5 * 992.24 * 9.81 / 100.0 / Pump1.Power
Example 4
The following expression returns the travel time in seconds for material in a pipe. The pipe has a diameter of 0.15m, and a length of 100m.
3.1415 * 0.15 ^ 2.0 * 100 / UOM(Pump1.FlowRate, m3/sec)