lm_counter_statcounter

Statistic Meter

The Statistic Meter reads the numeric value received on the Input connector and calculates accumulated totals for different time periods.
The node provides values for the current and previous day, week, month and year.

The calculated values are persistent and are therefore preserved when the server reboots.

The Start Date output provides the date and time of the most recent reset.
The outputs can be refreshed manually using the Data Request input or automatically when the Auto refresh property is enabled.

Connector Type Description
Input Input Numeric value used by the Statistic Meter to calculate the accumulated statistics.
Reset Input Resets all accumulated statistics when set to 1.
Data Request Input When set to 1, forces the node to refresh the output values.
Gate Input Optional input available when the Gate property is enabled. It can be used to activate the node and is also valid for its first initialization.
Curr. Day Output Total value for the current day.
Curr. Week Output Total value for the current week.
Curr. Month Output Total value for the current month.
Curr. Year Output Total value for the current year.
Prev. Day Output Total value for the previous day.
Prev. Week Output Total value for the previous week.
Prev. Month Output Total value for the previous month.
Prev. Year Output Total value for the previous year.
Start Date Output Date and time of the most recent reset operation.
Property Description
Auto refresh Enables automatic refreshing of the Statistic Meter outputs.
Label Defines the label used to identify the node.
Await all inputs When enabled, the node waits for the required input values before performing its processing.
Refresh rate Defines the interval between two automatic output refreshes when Auto refresh is enabled.
Gate Enables or disables the optional Gate input connector.

The Statistic Meter calculates the following values:

  • Curr. Day — total for the current day;
  • Curr. Week — total for the current week;
  • Curr. Month — total for the current month;
  • Curr. Year — total for the current year;
  • Prev. Day — total for the previous day;
  • Prev. Week — total for the previous week;
  • Prev. Month — total for the previous month;
  • Prev. Year — total for the previous year.

This allows the same input value to be analyzed automatically over several calendar periods.

The node receives a numeric value through the Input connector and uses it to update the statistics associated with the current calendar periods.

For example, while the current day is active, the accumulated value is available on:

Curr. Day

When the day changes, the completed value becomes available on:

Prev. Day

and the current-day calculation starts again for the new day.

The same principle is applied independently to:

  • weeks;
  • months;
  • years.

The node therefore maintains both the currently accumulating value and the completed value of the previous corresponding period.

The values calculated by the Statistic Meter are persistent.

This means that:

  • the accumulated statistics are stored by the server;
  • a server reboot does not delete the calculated totals;
  • after restart, the node continues using the previously stored statistical data.

Persistence is particularly useful for long-term statistics because a server restart does not interrupt the historical accumulation of the meter.

The Reset input clears all the values currently stored by the Statistic Meter.

When:

Reset = 1

the node performs the following operations:

  • all current-period outputs are reset to 0;
  • all previous-period outputs are reset to 0;
  • Start Date is updated with the current date and time;
  • normal counting remains stopped while Reset stays equal to 1.

The Statistic Meter can start counting again only after:

Reset = 0

The Reset signal must return to 0 after the reset operation.
While Reset remains equal to 1, the node does not resume normal counting.

The Start Date output contains the date and time of the most recent reset.

Each time the Statistic Meter is reset, this value is updated.

It can therefore be used to identify when the current statistical collection period started.

For example:

Event Start Date
Statistic Meter reset 21/09/2026 10:00
Normal operation 21/09/2026 10:00
New reset Updated with the new reset date and time

The Data Request input can be used to manually refresh the output values.

When:

Data Request = 1

the Statistic Meter updates the values available on its output connectors.

This is useful when the current statistics must be requested at a specific moment without waiting for the next automatic refresh.

When Auto refresh is enabled, the Statistic Meter automatically refreshes its output values at the interval configured in Refresh rate.

For example:

Property Value
Auto refresh True
Refresh rate 00:02:00

the outputs are automatically refreshed every:

2 minutes

This makes it unnecessary to trigger Data Request periodically from another part of the logic.

Data Request can still be useful when an immediate refresh is required, independently from the automatic refresh interval.

The Await all inputs property controls whether the node waits for all the required input values before beginning its processing.

When enabled, it can be useful in logic schemes where the node should not perform calculations until the required inputs have been initialized.

The Gate property enables an optional input connector that can be used to control the activation of the Statistic Meter.

When the property is disabled, the Gate connector is not used.

When enabled, the Gate input can also be used for the first initialization of the node.

To make the Statistic Meter operational the first time it is loaded into the server, the node must receive 1 on the Reset input or on the Gate input, if Gate is enabled.

Suppose the Input is used to provide a value that must be accumulated over time.

During the current day, the node calculates:

Curr. Day

At the end of the day:

  • the completed daily value is moved to Prev. Day;
  • Curr. Day starts the calculation for the new day.

At the same time, the value continues contributing to:

  • Curr. Week;
  • Curr. Month;
  • Curr. Year.

When the corresponding calendar period ends, its completed value becomes available on the appropriate previous-period output.

The Statistic Meter is useful whenever numeric values must be accumulated and organized automatically by calendar period.

Typical applications include:

  • energy consumption statistics;
  • water or gas consumption statistics;
  • production counters;
  • operating or usage statistics;
  • daily, weekly, monthly and yearly consumption comparison;
  • displaying current-period and previous-period totals;
  • long-term monitoring of cumulative numeric data.

The Statistic Meter can be tested using the Logic Module simulation tools.

A typical test procedure is the following:

  • connect a numeric value to the Input connector;
  • configure Auto refresh according to the required behaviour;
  • configure the Refresh rate;
  • configure Await all inputs if required;
  • enable Gate if the optional Gate input is needed;
  • activate Reset once when initializing the node;
  • return Reset to 0;
  • provide values to the Input connector;
  • activate Data Request and verify that the outputs are refreshed;
  • if Auto refresh is enabled, verify that the outputs are updated according to the configured Refresh rate;
  • verify the values available on the current-period outputs;
  • activate Reset and verify that all outputs return to 0 and Start Date is updated.
  • The Statistic Meter works with a numeric Input value.
  • The calculated statistics are persistent across server reboots.
  • Use Data Request when an immediate manual output refresh is required.
  • Enable Auto refresh when the output values must be refreshed periodically.
  • Configure Refresh rate according to the required update frequency.
  • Use Await all inputs when the node should wait for input initialization before processing.
  • Enable Gate only when the optional gate control is required.
  • On first server loading, send 1 to Reset or to Gate, if enabled, to initialize the Statistic Meter.
  • After a Reset command, return Reset to 0 to allow normal counting to resume.
  • Start Date identifies the beginning of the current statistical collection period.
  • lm_counter_statcounter.txt
  • Last modified: 2026/09/21 15:38
  • by francesco