Time Base Filter
The Time Base Filter node processes an analog value received from the Input connector by applying a configurable computation method to a set of samples before sending the result to the Output connector.
The node can operate on a fixed number of samples or, when the Running window property is enabled, on the samples received within a moving time window.
This makes it possible to smooth analog values, calculate minimum or maximum values over time, and reduce the influence of short fluctuations in the input signal.
Connectors
| Connector | Type | Description |
|---|---|---|
| Input | Input | Analog value acquired and processed by the filter. |
| Output | Output | Analog value resulting from the selected computation applied to the considered samples. |
Main properties
| Property | Description |
|---|---|
| Computation | Defines the computation method applied to the collected samples. Available methods are Average, Min and Max. |
| Number of Samples | Defines how many input values are considered for the computation when using the standard sampling mode. |
| Running window | Enables the moving time window mode. When enabled, the computation is performed on the samples received within the configured time interval. |
| Period UoM | Defines the unit of measure used for the running window period. Available values are Milliseconds, Seconds, Minutes and Hours. |
| Time factor | Defines the duration of the running window according to the selected Period UoM. |
Operation
The Time Base Filter collects analog values from the Input connector and processes them according to the selected Computation method.
The node can work in two different ways:
- with Running window disabled, the computation is based on the configured Number of Samples;
- with Running window enabled, the computation is performed on the samples received within the configured moving time window.
The result of the selected computation is then sent to the Output connector.
Computation methods
The Computation property defines how the selected input samples are processed.
The available methods are:
| Computation | Description |
|---|---|
| Average | Returns the arithmetic mean of the considered samples. |
| Min | Returns the minimum value among the considered samples. |
| Max | Returns the maximum value among the considered samples. |
Average
When Computation is set to Average, the node calculates the arithmetic mean of the considered samples.
For example, with:
Number of Samples = 4
and the following values:
| Sample | Value |
|---|---|
| 1 | 20 |
| 2 | 22 |
| 3 | 21 |
| 4 | 25 |
the resulting output is:
Output = (20 + 22 + 21 + 25) / 4 = 22
The Average method is useful when small fluctuations in the input signal should be reduced.
Min
When Computation is set to Min, the node returns the lowest value among the considered samples.
Using the same values:
| Sample | Value |
|---|---|
| 1 | 20 |
| 2 | 22 |
| 3 | 21 |
| 4 | 25 |
the resulting output is:
Output = 20
This method is useful when the lowest value reached during the considered interval is required.
Max
When Computation is set to Max, the node returns the highest value among the considered samples.
Using the same values:
| Sample | Value |
|---|---|
| 1 | 20 |
| 2 | 22 |
| 3 | 21 |
| 4 | 25 |
the resulting output is:
Output = 25
This method is useful when the highest value reached during the considered interval is required.
Number of Samples
When Running window is disabled, the Number of Samples property defines how many input values are used for the selected computation.
For example:
| Number of Samples | Behaviour |
|---|---|
| Low value | Faster response to input changes, but less filtering. |
| High value | More stable result, but reduced sensitivity to rapid changes. |
For the Average method, a larger number of samples generally produces a smoother output.
For Min and Max, the configured number of samples defines how many values are considered when searching for the minimum or maximum value.
Running window
The Running window property changes the way the node selects the samples used for the computation.
When Running window is disabled, the node processes the configured Number of Samples.
When Running window is enabled, the computation is performed on the samples received within a moving time window.
The duration of the window is defined using:
- Period UoM, which defines the time unit;
- Time factor, which defines the duration expressed in the selected unit.
The available units for Period UoM are:
- Milliseconds
- Seconds
- Minutes
- Hours
For example:
| Property | Value |
|---|---|
| Running window | Enabled |
| Period UoM | Minutes |
| Time factor | 1 |
the node processes the samples received during the last 1 minute.
If:
Computation = Average
the node returns the average of the samples received during the last minute.
If:
Computation = Min
the node returns the minimum value received during the last minute.
If:
Computation = Max
the node returns the maximum value received during the last minute.
The number of samples considered inside the running window is limited to:
100 samples
The running window moves continuously over time.
As new samples are received, older samples that fall outside the configured period are excluded from the computation.
When more than 100 samples are received inside the running window, the node can consider a maximum of 100 samples.
Example - Average
Consider a temperature sensor whose measured value changes slightly at every acquisition:
| Sample | Input |
|---|---|
| 1 | 21.8°C |
| 2 | 22.1°C |
| 3 | 21.9°C |
| 4 | 22.2°C |
| 5 | 22.0°C |
With:
| Property | Value |
|---|---|
| Computation | Average |
| Number of Samples | 5 |
| Running window | Disabled |
the resulting value is:
Output = 22.0°C
Instead of propagating every small variation directly to the following logic, the Time Base Filter provides a more stable value.
Example - Running window
Assume:
| Property | Value |
|---|---|
| Computation | Max |
| Running window | Enabled |
| Period UoM | Minutes |
| Time factor | 1 |
During the last minute the following values are received:
20, 22, 25, 21, 23
The resulting output is:
Output = 25
After enough time has passed for the value 25 to leave the one-minute running window, it is no longer considered in the computation.
The output is then recalculated using only the values still present inside the active time window.
Typical applications
The Time Base Filter is useful when analog data must be processed over multiple samples or over a time interval.
Typical applications include:
- smoothing temperature sensor values;
- reducing fluctuations in humidity or environmental measurements;
- calculating an average value over a set of samples;
- determining the minimum value reached during a time interval;
- determining the maximum value reached during a time interval;
- stabilizing analog values before comparisons or calculations;
- monitoring minimum or maximum process values over a moving time window.
Verification through simulation
The Time Base Filter can be tested using the Logic Module simulation tools.
A typical test procedure is the following:
- connect a variable analog value to the Input connector;
- select Average, Min or Max in the Computation property;
- configure the Number of Samples;
- enable Running window if required;
- configure Period UoM and Time factor when using the running window;
- start the simulation;
- provide different values to the Input connector;
- observe how the Output changes according to the selected computation;
- compare the behaviour using different numbers of samples;
- if Running window is enabled, verify that values outside the configured time window are no longer considered.
Configuration notes
- Select Average when a smoother representative value is required.
- Select Min when the lowest value among the considered samples is required.
- Select Max when the highest value among the considered samples is required.
- With Running window disabled, use Number of Samples to define how many values contribute to the computation.
- With Running window enabled, use Period UoM and Time factor to define the duration of the moving time window.
- Available Period UoM values are Milliseconds, Seconds, Minutes and Hours.
- The running window supports a maximum of 100 samples.
- A larger sample set generally makes Average filtering more stable but less responsive to rapid changes.
- Consider the dynamics of the measured value when configuring the filter.
- Avoid excessive filtering when rapid input variations must be detected immediately.
- The Output remains an analog value and can therefore be connected directly to other analog Logic Module nodes.
