Totalize an Analog Value


Thread Starter


Disclaimer, This is for a personal home project and not work related.

I have a ML1100 and a rain gauge. The rain gauge specs are 0-5v equals 0-50mm of water. I'm converting the signal to 4-20mA with a conditioner going in to an analog card and currently have an SCP setup... All good.

I would like to totalize precipitation in a 24 hour period, store the value, then reset and totalize again.

I work for an automation company in an executive position where I give the 30,000 feet view of an entire process and the programmers make it happen, But I'm too embarrassed to ask them for help on this--- Don't tell them.

Can anyone help? Thx in advance
Totalization is a process where a finite quantity of a product is to be accumulated (totalized) over a period of time.

There are two methods of totalization:

1. Add a number of pulses generated by a device such as a turbine meter whose output pulses equated to a quantity of product directly with no integration required.

2. Integrate a rate of product flow, such as gallons/minute, barrels/day, and so forth, to produce a quantity, for example, gallons, barrels.

Since your value to be totalized comes from analog input with scaling 0-5 V = 0-50 mm, the second method should be applied, but since mm is distance unit, not a flow rate unit, may be your unit should be mm/day or mm/year.

Process measurements having an analog value corresponding to the quantity/time (for example, gallons/minute or in your case mm/day) can be applied to an analog input card channel and then converted to a quantity (gallons) by integrating the rate value over time.
For example, if an analog value is received by an input module which corresponds to a rate of 200 gallons/minute and a sample of this rate is totalized for 30 seconds....100 gallons of product has been accumulated.

These analog values would need to be interfaced to totalization programming in ladder with execution period of 1 sec. For your case, assumed 50 mm/ day, so with sample of 1 second, there is 50/86400 = 0.000578703703704 mm/sec to be accumulated each second and if the flow rate is constant and totalized for 24 Hrs, the totalized value should be exactly match to 50 mm.

Using the STI feature will ensure an accurate Sampling Period and Number of Samples.

It is NOT recommended to use Timer (TON) Instructions since the Scan Time can cause an inaccurate Sampling Period. 

At the beginning of the time period (Day, Hour, etc.)
- Take a reading / for example 8mA
- Convert to desired engineering units / 8mA = 12.5 mm
- Store in variable 1

At the end of the time period
- take a reading / 12ma
- Convert / 12 mA = 25 mm
- Store in variable 2
- Period total = Variable 2 - Variable 1

Of course this does not handle emptying the rain gauge and restart.

If the rain gauge can be automatically emptied at the start of the period, then variable 1 will be 0.

I would set up an array and store the reading at the end of each hour and total at the end of 24 hours for a more fine grained analysis.

I actually set up a system at a remote pumping station for a wastewater district about 20 years ago. It gave them hourly rainfall accumulations and a snapshot of temperature and wind speed.
A rain gauge is an integrating function: the rain accumulates in the instrument as a 'level'.

So your 'program' does not need to totalize, the rain gauge (inherently) does totalization by reporting level, not instantaneous rainfall.

So RalphM's approach is correct - report the total as often as needed, which if needs a real time clock to tell when to sample and store.

If the rain gauge does not empty automatically, then the program needs to subtract the previous day's total from the current total.