FB_ALY_MinMaxAvgInterval_1Ch
The Min Max Avg Interval 1Ch calculates the minimum, maximum and the average of the input values for the time period of the configured Interval. Furthermore the time values of minimum and maximum are shown. Note that all values are from the relative last interval and that they will only be updated when the interval is over. The calculation restarts when the time of the interval has elapsed.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_MinMaxAvgInterval_1Ch
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
fMin: LREAL;
fMax: LREAL;
fAvg: LREAL;
fbTimeMin: FB_ALY_DateTime;
fbTimeMax: FB_ALY_DateTime;
fbTimeCurrentInterval: FB_ALY_Timespan;
END_VAR
Outputs
Name | Type | Description |
---|---|---|
ipResultMessage | Contains more detailed information on the current return value. This special interface pointer is internally secured so that it is always valid/assigned. | |
bError | BOOL | This output is |
bNewResult | BOOL | When a new result has been calculated, the output is |
bConfigured | BOOL | Displays |
fMin | LREAL | Minimum of the input values in the current time interval. |
fMax | LREAL | Maximum of the input values in the current time interval. |
fAvg | LREAL | Average of the input values in the current time interval. |
fbTimeMin | FB_ALY_DateTime | Timestamp of |
fbTimeMax | FB_ALY_DateTime | Timestamp of |
fbTimeCurrentInterval | FB_ALY_Timespan | Elapsed time of the current interval. |
Methods
Name | Definition location | Description |
---|---|---|
Call() | Local | Method for calculating the outputs for a specific configuration. |
Configure() | Local | General configuration of the algorithm with its parameterized conditions. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
SetChannelValue() | Local | Method for passing values to the algorithm. |
Pause() | Local | Method to pause the execution including the internal time intervals. |
Sample
VAR
fbMinMaxAvgInterval : FB_ALY_MinMaxAvgInterval_1Ch;
fbSystemTime : FB_ALY_GetSystemTime;
tInterval : LTIME := LTIME#20S;
bConfigure : BOOL := TRUE;
nInput : INT;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbMinMaxAvgInterval.Configure(tInterval);
END_IF
// Get current system time
fbSystemTime.Call();
// Call algorithm
fbMinMaxAvgInterval.SetChannelValue(nInput);
fbMinMaxAvgInterval.Call(fbSystemTime.tSystemTime);
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |