API Utils - Krystian-L-Lis/Stage GitHub Wiki
#API #Utils
Type: Alias
Description:
DWORD alias that represents a colour as a 32-bit value.
Type: Interface
Extends: I_Debug
Description:
Provides methods and properties for working with RGBA colour values.
Type: Property
Accessors: Get, Set
Description: Gets or sets the alpha (transparency) channel.
Signature: PROPERTY Alpha: BYTE
Type: Property
Accessors: Get, Set
Description: Gets or sets the blue channel.
Signature: PROPERTY Blue: BYTE
Type: Property
Accessors: Get, Set
Description: Gets or sets the green channel.
Signature: PROPERTY Green: BYTE
Type: Property
Accessors: Get, Set
Description: Gets or sets the red channel.
Signature: PROPERTY Red: BYTE
Type: Property
Accessors: Get, Set
Description: Gets or sets the raw combined RGBA DWORD.
Signature: PROPERTY Raw: DWORD
Type: Method
Description: Copies the RGBA values from another I_RGBA
instance.
Signature:
METHOD Clone
VAR_INPUT
iOther: I_RGBA;
END_VAR
Type: Method
Description: Sets the RGBA values.
Signature:
METHOD Set
VAR_INPUT
nRed: BYTE;
nGreen: BYTE;
nBlue: BYTE;
nAlpha: BYTE;
END_VAR
Type: Function Block
Implements: I_RGBA
Description:
Provides methods and properties for working with RGBA colour values.
Type: Method
Description: Initializes the function block with RGBA values.
Signature:
METHOD FB_init : BOOL
VAR_INPUT
nRed: BYTE;
nGreen: BYTE;
nBlue: BYTE;
nAlpha: BYTE;
END_VAR
Type: Property
Accessors: Get, Set
From: I_RGBA
Description: Gets or sets the alpha (transparency) channel.
Signature: PROPERTY Alpha: BYTE
Type: Property
Accessors: Get, Set
From: I_RGBA
Description: Gets or sets the blue channel.
Signature: PROPERTY Blue: BYTE
Type: Property
Accessors: Get, Set
From: I_RGBA
Description: Gets or sets the green channel.
Signature: PROPERTY Green: BYTE
Type: Property
Accessors: Get, Set
From: I_RGBA
Description: Gets or sets the red channel.
Signature: PROPERTY Red: BYTE
Type: Property
Accessors: Get, Set
From: I_RGBA
Description: Gets or sets the raw combined RGBA DWORD.
Signature: PROPERTY Raw: DWORD
Type: Method
From: I_RGBA
Description: Copies the RGBA values from another I_RGBA
instance.
Signature:
METHOD Clone
VAR_INPUT
iOther: I_RGBA;
END_VAR
Type: Method
From: I_RGBA
Description: Sets the RGBA values.
Signature:
METHOD Set
VAR_INPUT
nRed: BYTE;
nGreen: BYTE;
nBlue: BYTE;
nAlpha: BYTE;
END_VAR
Type: Function
Description:
Fetches the current system time in Unix timestamp format (100ns since January 1, 1970).
Signature:
FUNCTION GetUnixTime : ULINT
VAR_INPUT
nOffset: LINT := 0;
END_VAR
Type: Program
Description:
Aggregate of various mathematical methods.
Type: Method
Description:
Returns a random value in range 0.0 - 1.0. Uses different seed for each call.
Signature: METHOD Random : LREAL
Type: Method
Description:
Simple low pass filter.
Signature:
METHOD LowPassFilter : LREAL
VAR_INPUT
rX: LREAL; // Input value
rPrvY: LREAL; // Previous value
rCoefficient: LREAL; // Weight coefficient
END_VAR
Type: Method
Description:
Takes value and scales it according to provided parameters.
Signature:
METHOD LinearScale: LREAL
VAR_INPUT
rX: LREAL; // Input value.
rMinX: LREAL; // Min input value.
rMaxX: LREAL; // Max input value.
rMinY: LREAL := 0; // Min output value.
rMaxY: LREAL := 1; // Max output value.
END_VAR
Type: Method
Description:
Time-compensated smoothing coefficient. A = 1 - (1 - B)^dt
.
Signature:
METHOD ExptDecay : LREAL
VAR_INPUT
rBlendFactor: LREAL; // In [0, 1] — how fast to blend toward input
rDeltaTime: LREAL := 0.01; // In seconds
END_VAR
Type: Function
Description:
Get task cycle time in seconds.
Signature:
METHOD GetTaskCycleTime : LREAL
VAR_IN_OUT CONSTANT
taskInfo: ARRAY[*] OF PlcTaskSystemInfo; // Just assign _TaskInfo as _TaskInfo cannot be accessed from lib :(
END_VAR