FB_ALY_LifecycleAnalysis_1Ch
The Lifecycle Analysis 1Ch calculates the elapsed and the estimated remaining cycles of a device. When the signal of the input channel passes the configured edge at a specific threshold, the elapsed cycles are increased and the remaining cycles are decreased.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_LifecycleAnalysis_1Ch
VAR_INPUT
bPersistent: BOOL;
END_VAR
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
nCyclesElapsed: ULINT;
nCyclesRemaining: LINT;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
bPersistent | BOOL | If the value is |
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 |
nCyclesElapsed | ULINT | Number of cycles elapsed. |
nCyclesRemaining | LINT | Remaining cycles. |
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. |
ConfigureChannel() | Local | Channel-specific configuration for the respective algorithm. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
SetChannelValue() | Local | Method for passing values to the algorithm. |
SetInital() | Local | Method for setting initial values for the algorithms, e.g. already expired lifetime. |
Properties
Name | Type | Access | Definition location | Initial value | Description |
---|---|---|---|---|---|
fTolerance | LREAL | Get, Set | Local | 0.0 | Tolerance value for the Equal / NotEqual comparisons |
Sample
VAR
fbLifecycleAnalysis : FB_ALY_LifecycleAnalysis_1Ch;
stThresholdEdge : ST_ALY_Threshold;
nCyclesEstimated : ULINT := 1_000_000;
bConfigure : BOOL := TRUE;
nInput : INT;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
stThresholdEdge.eComparisonOperator := E_ALY_ComparisonOperator.Equals;
stThresholdEdge.fThreshold := 1;
fbLifecycleAnalysis.ConfigureChannel(stThresholdEdge);
fbLifecycleAnalysis.Configure(nCyclesEstimated);
END_IF
// Call algorithm
fbLifecycleAnalysis.SetChannelValue(nInput);
fbLifecycleAnalysis.Call();
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |