FB_ALY_TimeClock_1Ch
Time Clock 1Ch executes a time switch which can be configured with switch-on time, switch-off time and the days of the week on which the time switch should be active. A timestamp is required as a reference value because the algorithm needs a time context in which to operate.
Syntax
Definition:
FUNCTION_BLOCK FB_ALY_TimeClock_1Ch
VAR_OUTPUT
ipResultMessage: Tc3_EventLogger.I_TcMessage;
bError: BOOL;
bNewResult: BOOL;
bConfigured: BOOL;
bIsOn: BOOL;
fbTimeUntilNextSwitch: FB_ALY_Timespan
END_VAR
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 |
bIsOn | BOOL |
|
fbTimeUntilNextSwitch | FB_ALY_Timespan | Timespan until the next switching. |
Methods
Name | Definition Location | Description |
---|---|---|
Call() | Local | method calculates the outputs for a given configuration. |
Configure() | Local | General configuration of the algorithm with its parameterized conditions. |
Reset() | Local | Resets all internal states or the calculations made so far. |
Sample
VAR
fbTimeClock : FB_ALY_TimeClock_1Ch;
fbSystemTime : FB_ALY_GetSystemTime;
tTimeOn : LTIME := LTIME#8H;
tTimeOff : LTIME := LTIME#16H;
nDayOfWeekMask : WORD := E_ALY_DayOfWeekMask.MondayToFriday;
bConfigure : BOOL := TRUE;
END_VAR
// Configure algorithm
IF bConfigure THEN
bConfigure := FALSE;
fbTimeClock.Configure(tTimeOn, tTimeOff, nDayOfWeekMask);
END_IF
// Get current system time
fbSystemTime.Call();
// Call algorithm
fbTimeClock.Call(fbSystemTime.tSystemTime);
Requirements
Development environment | Target platform | Plc libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x64, x86) | Tc3_Analytics |