FB_ALY_SankeyDiagram
The Sankey Diagram function block can be used to create a Sankey diagram for later use in the HMI Dashboard. A distinction is made between inflows and outflows. The number of inflows and outflows can be individually parameterized via the parameters Num Channels Inflow and Num Channels Outflow respectively.
Since the function of this function block is irrelevant for the analysis itself, it belongs to the Visualization Only category.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_StateHistogram_1Ch
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
fRest: LREAL;
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 |
fRest | LREAL | Residual value (Inflow - Outflow) in percent. |
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. |
ConfigureInflowChannel() | Local | Configuration of the inflow channels. |
ConfigureOutflowChannel() | Local | Configuration of the outflow channels. |
FB_Init | Local | Initialize the number of inflow and outflow channels. |
GetGetInflowChannelOutputValue() | Local | Getting the result value from the Inflow result array without adding new values. |
GetGetInflowOutputArray() | Local | Getting the Inflow result array without adding new values. |
GetGetOutflowChannelOutputValue() | Local | Getting the result value from the Outflow result array without adding new values. |
GetGetOutflowOutputArray () | Local | Getting the Outflow result array without adding new values. |
Reset() | Local | Resets all internal states or the calculations performed so far. |
SetInflowChannelValue() | Local | Method for passing Inflow values to the algorithm. |
SetOutflowChannelValue() | Local | Method for passing Outflow values to the algorithm. |
Sample
VAR
fbSankeyDiagram : FB_ALY_SankeyDiagram(nNumChannelsInflow := 2, nNumChannelsOutflow := 3);
aChannelNamesInflow : ARRAY [1..2] OF STRING(255) := ['Grid', 'PV'];
aChannelNamesOutflow : ARRAY [1..3] OF STRING(255) := ['HVAC', 'Server', 'Lights'];
sChannelNameRest : STRING(255) := 'Rest';
bConfigure : BOOL := TRUE;
fInflowGrid : LREAL;
fInflowPV: LREAL;
fOutflowHVAC: LREAL;
fOutflowServer: LREAL;
fOutflowLights: LREAL;
aInflow : ARRAY[1..2] OF LREAL;
aOutflow : ARRAY[1..3] OF LREAL;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbSankeyDiagram.ConfigureInflowChannel(1, aChannelNamesInflow[1]);
fbSankeyDiagram.ConfigureInflowChannel(2, aChannelNamesInflow[2]);
fbSankeyDiagram.ConfigureOutflowChannel(1, aChannelNamesOutflow[1]);
fbSankeyDiagram.ConfigureOutflowChannel(2, aChannelNamesOutflow[2]);
fbSankeyDiagram.ConfigureOutflowChannel(3, aChannelNamesOutflow[3]);
fbSankeyDiagram.Configure(sChannelNameRest);
END_IF
// Call algorithm
fbSankeyDiagram.SetInflowChannelValue(1, fInflowGrid);
fbSankeyDiagram.SetInflowChannelValue(2, fInflowPV);
fbSankeyDiagram.SetOutflowChannelValue(1, fOutflowHVAC);
fbSankeyDiagram.SetOutflowChannelValue(2, fOutflowServer);
fbSankeyDiagram.SetOutflowChannelValue(3, fOutflowLights);
fbSankeyDiagram.Call();
fbSankeyDiagram.GetInflowOutputArray(ADR(aInflow), SIZEOF(aInflow));
fbSankeyDiagram.GetOutflowOutputArray(ADR(aOutflow), SIZEOF(aOutflow));
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |