FB_ALY_ProductivityInterval_1Ch
The algorithm Productivity Interval 1Ch calculates the productivity of the process during a given interval. The interval can be defined by the inputs tTimeStart and tTimeStop. The pieces produced are taken into account during execution. A produced element is counted when an edge is applied to the input. The estimated productivity of the current interval and the productivity of the last complete interval are provided as output values. The algorithm can be configured with the target value of the produced pieces within a given interval.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_ProductivityInterval_1Ch
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
bWithinInterval: BOOL;
fbCurrentTimestamp: FB_ALY_DateTime;
fbIntervalLength: FB_ALY_Timespan;
fbElapsedTime: FB_ALY_Timespan;
fbRemainingTime: FB_ALY_Timespan;
nProducedInInterval: ULINT;
nRemainingInInterval: ULINT;
fCurrentProductivity: LREAL;
fExpectedProductivity: LREAL;
fLastFullPeriodProductivity: LREAL;
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 |
bWithinInterval | BOOL | Indicates whether the current time is within the interval. |
fbCurrentTimestamp | FB_ALY_DateTime | Current timestamp. |
fbIntervalLength | FB_ALY_Timespan | Length of the interval. |
fbElapsedTime | FB_ALY_Timespan | Elapsed time within the interval. |
fbRemainingTime | FB_ALY_Timespan | Time remaining within the interval. |
nProducedInInterval | ULINT | Produced parts within the interval. |
nRemainingInInterval | ULINT | Remaining pieces within the interval. |
fCurrentProductivity | LREAL | Current productivity of the interval in percent. Takes into account the length of the interval, the time already elapsed, the pieces to be produced and the pieces already produced. The output is in percent. |
fExpectedProductivity | LREAL | Expected productivity of the interval in percent. To determine the possible pieces that can be produced within the remaining time, the production time of the last part is used. |
fLastFullPeriodProductivity | LREAL | Productivity of the last complete interval in percent. This is only calculated if the interval was fully processed. |
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. |
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
fbProductivityInterval : FB_ALY_ProductivityInterval_1Ch;
fbSystemTime : FB_ALY_GetSystemTime;
stThreshold : ST_ALY_Threshold;
nExpectedPieces : ULINT := 40;
bConfigure : BOOL := TRUE;
bPieceProduced : BOOL;
tTimeStart : LTIME := LTIME#8H;
tTimeStop : LTIME := LTIME#16H;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
stThreshold.eComparisonOperator := E_ALY_ComparisonOperator.Equals;
stThreshold.fThreshold := 1;
fbProductivityInterval.ConfigureChannel(stThreshold);
fbProductivityInterval.Configure(nExpectedPieces);
END_IF
// Get current system time
fbSystemTime.Call();
// Call algorithm
fbProductivityInterval.SetChannelValue(bPieceProduced);
fbProductivityInterval.Call(tTimeStart, tTimeStop, fbSystemTime.tSystemTime);
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |