SCADA Gas Flow Totalizer: Configuring 100 ms Scripts

Jason IP2 min read
Other ManufacturerSCADA ConfigurationTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Separate Flow Rate from Accumulated Volume

Do not overwrite the live flow-rate variable with the per-sample result. Keep the measured flow in CaudalDeGas and store the running total in a separate variable, ConsumoGas. The calculation assumes CaudalDeGas is a volumetric rate per hour and the script executes once every 0.1 seconds.

ConsumoGas = ConsumoGas + (CaudalDeGas * 0.1 / 3600)

Each execution converts the current hourly flow rate into the volume represented by one 0.1-second sample, then adds that increment to the existing total.

Verify the Time-Base Calculation

Quantity Expression Meaning
Sample interval 0.1 s Script update period
Hourly conversion 0.1 / 3600 Fraction of one hour per sample
Volume increment CaudalDeGas * 0.1 / 3600 Volume accumulated during the sample
Running total ConsumoGas + increment Previous total plus the latest volume

If the flow is 1000 volume units per hour, one sample adds 1000 × 0.1 / 3600 = 0.027777... volume units. At 900 units per hour, it adds 900 × 0.1 / 3600 = 0.025 units.

Configure and Verify the Script

  1. Initialize ConsumoGas to the required starting total before accumulation begins.
  2. Execute the accumulation statement once per 0.1-second update.
  3. Display ConsumoGas, not the individual sample increment.
  4. Hold the flow at 1000 units per hour and confirm that each execution increases the total by approximately 0.027777 units.
  5. Change the flow to 900 units per hour and confirm that each execution adds 0.025 units without discarding the previous total.

The formula is valid only if 0.1 seconds is the actual interval represented by every addition. If the execution interval changes, replace 0.1 with the corresponding elapsed time in seconds.

Distinguish Total Consumption from Average Flow

The running sum calculates accumulated consumption. It does not calculate an average. An average over sampled operation would require dividing an appropriate accumulated quantity by the corresponding accumulated time; keep that calculation separate from the totalizer.

FAQ

How do I accumulate gas flow in a SCADA script every 100 ms?

Execute ConsumoGas = ConsumoGas + (CaudalDeGas * 0.1 / 3600) once every 0.1 seconds, assuming the input is a flow rate per hour.

Why does my SCADA flow value not accumulate?

Assign the converted sample to a separate running-total variable. Writing caudal_gas = caudal_gas * 0.1 / 3600 replaces the measured flow instead of preserving and increasing a total.

How much should a 1000-unit-per-hour flow add every 0.1 seconds?

It should add 1000 × 0.1 / 3600 = 0.027777... volume units per execution. Confirm that the displayed total increases by this amount instead of displaying only the latest increment.

Back to blog