FB_WG_Weighing
The function block FB_WG_Weighing is used to determine a measured weight.
The configuration structure is transferred with ST_WG_Weighing.
Syntax
Declaration:
fbWeighing := FB_WG_Weighing(stConfig := ...)
Definition:
FUNCTION_BLOCK FB_WG_Weighing
VAR_INPUT
stConfig := ST_WG_Weighing; (*The input parameters of this function block represent initialization parameters and must already be assigned in the declaration of the FB instance! (Alternative: Configure() method)*)
END_VAR
VAR_OUTPUT
bValidMeasurement : BOOL := FALSE; // TRUE if ST_WG_Weighing_Validation-conditions are valid (only if nWindowLength is full).
bNewResult : BOOL := FALSE; // TRUE if a new result has been occured (at the end of the Validation measurement).
tLastResult : ULINT := 0; // Timestamp of new occured result.
fLastWeight : LREAL := 0.0; // Last weighing result.
fLastStd : LREAL := 0.0; // Last standard deviation result.
fWeight : LREAL := 0.0; // Moving average of nWindowLength input values.
fStd : LREAL := 0.0; // Moving standard deviation of nWindowLength input values.
fMin : LREAL := 0.0; // Minimum value of moving nWindowLength input values.
fMax : LREAL := 0.0; // Maximum value of moving nWindowLength input values.
fAutoTareOffset : LREAL := 0.0; // Last auto tare offset result.
bNewAutoTareResult : BOOL := FALSE; // TRUE if a new result has been occured (at the end of the AutoTare measurement).
END_VAR
VAR
Outputs
Name | Type | Description |
---|---|---|
bError | BOOL | TRUE, if an error occurs. |
bConfigured | BOOL | TRUE if the configuration was successful. |
ipResultMessage | Interface that provides properties and methods for message handling | |
bValidMeasurement | BOOL | TRUE if the ST_WG_Weighing_Validation conditions are met. |
bNewResult | BOOL | TRUE, if a new result was calculated. |
tLastResult | ULINT | The timestamp of the last calculated result. |
fLastWeight | LREAL | The weight (moving average) of the last result. |
fLastHour | LREAL | The standard deviation of the last result. |
fWeight | LREAL | The current weight (moving average) of the last result. |
fStd | LREAL | The current moving standard deviation. |
fMin | LREAL | Minimum fWeight weight in the sliding window. |
fMax | LREAL | Maximum fWeight weight in the sliding window. |
fAutoTareOffset | LREAL | The tare weight of the last result. |
bNewAutoTareResult | BOOL | TRUE if a new tare weight has been calculated. |
Methods
Name | Definition location | Description |
---|---|---|
Configure() | Local | Loads a new (or initial) configuration structure. |
Call() | Local | Calculates the output signal for a given input signal and configuration of the function block. |
Reset() | Local | Resets internal states. |
Properties
Name | Type | Access | Definition location | Initial value | Description |
---|---|---|---|---|---|
bTraceLevelDefault | BOOL | Get, Set | Local | TRUE | TRUE, if eTraceLevel = Warning. |
eTraceLevel | Get, Set | Local | Warning | Severity of an event | |
nTimeStamp | ULINT | Get, Set | Local | 0 | Timestamp of the oldest input value of the next Call(). |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.4024.50 | PC or CX (x64, x86) | Tc3_Weighing |