FB_ALY_ParetoAnalysis
The Pareto Analysis module allows you to combine different input data to display a Pareto chart. This is used in the following applications, among others:
Error analysis: Identifying the most common sources of errors
Quality management: Determining the main causes of quality problems
Time management: Diagnosis of which tasks take up most of the time
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_ParetoAnalysis
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
END_VAR
Outputs
Name | Type | Description |
---|---|---|
ipResultMessage | Contains more detailed information on the current return value. For this special interface pointer, it is ensured internally that it is always valid/assigned. | |
bError | BOOL | The output is |
bNewResult | BOOL | When a new result has been calculated, the output is |
bConfigured | BOOL | Displays |
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. |
FB_init | Local | Initializes the number of input channels. |
GetOutputArray() | Local | Getting the result array without adding new values. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
SetChannelValue() | Local | Method for passing values to the algorithm. |
SetInitial() | Local | Method for setting start values. |
Properties
Name | Type | Access | Definition location | Initial value | Description |
---|---|---|---|---|---|
fTolerance | LREAL | Get, Set | Local | 0.0 | Tolerance value for the Equal / NotEqual comparisons |
Sample with several input channels
VAR
fbParetoAnalysis : FB_ALY_ParetoAnalysis(nNumChannels := 3);
fbSystemTime : FB_ALY_GetSystemTime;
stConfig : ST_ALY_Threshold :=(eComparisonOperator := E_ALY_ComparisonOperator.Equals, fThreshold := 1.0);
aChannelNames : ARRAY[1..3] OF STRING(255) := ['First Channel', 'Second Channel', 'Third Channel'];
bConfigure : BOOL := TRUE;
fInput1 : LREAL;
bInput2 : BOOL;
nInput3 : INT;
aResult : ARRAY[1..3] OF ULINT;
aRelResult : ARRAY[1..3] OF LREAL;
aChannelNamesResult : ARRAY[1..3] OF STRING(255);
END_VAR
// Get current system time
fbSystemTime.Call();
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbParetoAnalysis.ConfigureChannel(1, stConfig, aChannelNames[1]);
fbParetoAnalysis.ConfigureChannel(2, stConfig, aChannelNames[2]);
fbParetoAnalysis.ConfigureChannel(3, stConfig, aChannelNames[3]);
fbParetoAnalysis.Configure(E_ALY_ParetoMode.Timespan);
END_IF
// Call algorithm
fbParetoAnalysis.SetChannelValue(1, fInput1);
fbParetoAnalysis.SetChannelValue(2, bInput2);
fbParetoAnalysis.SetChannelValue(3, nInput3);
fbParetoAnalysis.Call(fbSystemTime.tSystemTime);
fbParetoAnalysis.GetOutputArray(1, ADR(aResult), SIZEOF(aResult));
fbParetoAnalysis.GetOutputArray(2, ADR(aRelResult), SIZEOF(aRelResult));
fbParetoAnalysis.GetOutputArray(3, ADR(aChannelNamesResult), SIZEOF(aChannelNamesResult));
Sample with one input channel
VAR
fbParetoAnalysis : FB_ALY_ParetoAnalysis(bSingleInput := TRUE, nNumChannels := 3);
fbSystemTime : FB_ALY_GetSystemTime;
stConfig : ST_ALY_Threshold :=(eComparisonOperator := E_ALY_ComparisonOperator.Equals, fThreshold := 1.0);
aChannelNames : ARRAY[1..3] OF STRING(255) := ['Idle', 'Run', 'Error'];
bConfigure : BOOL := TRUE;
nState : INT;
aResult : ARRAY[1..3] OF ULINT;
aRelResult : ARRAY[1..3] OF LREAL;
aChannelNamesResult : ARRAY[1..3] OF STRING(255);
END_VAR
// Get current system time
fbSystemTime.Call();
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
stConfig.fThreshold := 0;
fbParetoAnalysis.ConfigureChannel(1, stConfig, aChannelNames[1]);
stConfig.fThreshold := 10;
fbParetoAnalysis.ConfigureChannel(2, stConfig, aChannelNames[2]);
stConfig.fThreshold := 99;
fbParetoAnalysis.ConfigureChannel(3, stConfig, aChannelNames[3]);
fbParetoAnalysis.Configure(E_ALY_ParetoMode.Timespan);
END_IF
// Call algorithm
fbParetoAnalysis.SetChannelValue(1, nState);
fbParetoAnalysis.Call(fbSystemTime.tSystemTime);
fbParetoAnalysis.GetOutputArray(1, ADR(aResult), SIZEOF(aResult));
fbParetoAnalysis.GetOutputArray(2, ADR(aRelResult), SIZEOF(aRelResult));
fbParetoAnalysis.GetOutputArray(3, ADR(aChannelNamesResult), SIZEOF(aChannelNamesResult));
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |