diff --git a/src/abstractions/ctrl/src/AxoLogger/IAxoLogger.st b/src/abstractions/ctrl/src/AxoLogger/IAxoLogger.st
index 17a5aa0ef..0a46f99fb 100644
--- a/src/abstractions/ctrl/src/AxoLogger/IAxoLogger.st
+++ b/src/abstractions/ctrl/src/AxoLogger/IAxoLogger.st
@@ -24,7 +24,7 @@ NAMESPACE AXOpen.Logging
///
/// _message is a string of maximum 80 characters that represents the log message
///
- _message : STRING[80];
+ _message : STRING[254];
///
/// _level is an instance of eLogLevel that represents the level of the log
@@ -47,7 +47,7 @@ NAMESPACE AXOpen.Logging
///
/// _message is a string of maximum 80 characters that represents the log message
///
- _message : STRING[80];
+ _message : STRING[254];
///
/// _level is an instance of eLogLevel that represents the level of the log
diff --git a/src/components.elements/ctrl/test/Mock.st b/src/components.elements/ctrl/test/Mock.st
index 555916dcf..952d4f7bb 100644
--- a/src/components.elements/ctrl/test/Mock.st
+++ b/src/components.elements/ctrl/test/Mock.st
@@ -34,7 +34,7 @@ NAMESPACE AxoIO.Tests
/// The object that sends the log.
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
_sender : IAxoObject;
END_VAR
@@ -49,7 +49,7 @@ NAMESPACE AxoIO.Tests
/// The severity level of the log.
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
END_VAR
diff --git a/src/core/ctrl/src/AxoAlert/AxoAlert.st b/src/core/ctrl/src/AxoAlert/AxoAlert.st
index c548a41b4..9e795caae 100644
--- a/src/core/ctrl/src/AxoAlert/AxoAlert.st
+++ b/src/core/ctrl/src/AxoAlert/AxoAlert.st
@@ -34,6 +34,8 @@ NAMESPACE AXOpen.Core
RETURN;
END_IF;
+ SUPER.SetSuspendCyclicExecuteIsNotCalledCheck(TRUE);
+
SUPER.Run(inParent);
IF NOT THIS.IsInitialized THEN // dialog is not observed/monitored by server
diff --git a/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st b/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st
index 9e480ba4b..4b8cb3e54 100644
--- a/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st
+++ b/src/core/ctrl/src/AxoCoordination/AxoStep/AxoStep.st
@@ -1,7 +1,7 @@
NAMESPACE AXOpen.Core
{#ix-prop: public string Description}
{S7.extern=ReadWrite}
- CLASS AxoStep EXTENDS AxoTask IMPLEMENTS IAxoStep
+ CLASS AxoStep EXTENDS AxoTaskLight IMPLEMENTS IAxoStep
VAR PUBLIC
{#ix-attr:[ReadOnly()]}
Order : ULINT;
diff --git a/src/core/ctrl/src/AxoDialog/AxoDialog.st b/src/core/ctrl/src/AxoDialog/AxoDialog.st
index b7152b138..f935c7c04 100644
--- a/src/core/ctrl/src/AxoDialog/AxoDialog.st
+++ b/src/core/ctrl/src/AxoDialog/AxoDialog.st
@@ -31,9 +31,8 @@ NAMESPACE AXOpen.Core
VAR_TEMP
callCounter : ULINT;
END_VAR
-
- // SUPER.SuspendExecuteAnalisis();
- SUPER.SetSuspendMultipleExecuteCallCheck(TRUE);
+
+ //SUPER.SetSuspendMultipleExecuteCallCheck(TRUE);
SUPER.SetSuspendCyclicExecuteIsNotCalledCheck(TRUE);
Show := THIS;
diff --git a/src/core/ctrl/src/AxoLogger/AxoLogEntry.st b/src/core/ctrl/src/AxoLogger/AxoLogEntry.st
index 0c58d7e90..547da9648 100644
--- a/src/core/ctrl/src/AxoLogger/AxoLogEntry.st
+++ b/src/core/ctrl/src/AxoLogger/AxoLogEntry.st
@@ -8,7 +8,7 @@ NAMESPACE AXOpen.Logging
///
/// The message of the log entry. The maximum length of the message is 80 characters.
///
- Message : STRING[80];
+ Message : STRING[254];
///
/// The severity level of the log entry.
diff --git a/src/core/ctrl/src/AxoLogger/AxoLogger.st b/src/core/ctrl/src/AxoLogger/AxoLogger.st
index 9b3e5a283..ff2fbb97f 100644
--- a/src/core/ctrl/src/AxoLogger/AxoLogger.st
+++ b/src/core/ctrl/src/AxoLogger/AxoLogger.st
@@ -33,7 +33,7 @@ NAMESPACE AXOpen.Logging
/// The object that sends the log.
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
_sender : IAxoObject;
END_VAR
@@ -62,7 +62,7 @@ NAMESPACE AXOpen.Logging
/// The severity level of the log.
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
END_VAR
diff --git a/src/core/ctrl/src/AxoRemoteTask/AxoRemoteTask.st b/src/core/ctrl/src/AxoRemoteTask/AxoRemoteTask.st
index 6c989ea17..a5664aa7f 100644
--- a/src/core/ctrl/src/AxoRemoteTask/AxoRemoteTask.st
+++ b/src/core/ctrl/src/AxoRemoteTask/AxoRemoteTask.st
@@ -24,15 +24,7 @@ NAMESPACE AXOpen.Core
HasRemoteException : BOOL;
IsBeingCalledCounter : INT;
- // {#ix-set:MessageText = "<#Remote task is not initialized by remote partner.#>"}
- // {#ix-set:Help = "<#Make sure the remote application that should handle this remote request is running and is available in the network.#>"}
- // TaskNotInitialized : AXOpen.Messaging.Static.AxoMessenger;
-
- // {#ix-set:MessageText = "<#During the execution or remote task an error occured.#> |[[1]RemoteExceptionDetails]|"}
- // {#ix-set:Help = "<#Check detail of this remote task for more information about the problem.#>"}
- // TaskHasRemoteException : AXOpen.Messaging.Static.AxoMessenger;
-
-
+
{#ix-set:AttributeName = "<#RemoteTaskMessenger#>"}
{#ix-set:PlcTextList = "[1]:'<#Remote task is not initialized by remote partner.#>':'<#Make sure the remote application that should handle this remote request is running and is available to the controller.#>'';
'[2]:'<#During the execution or remote task an error occured.#> |[[1]RemoteExceptionDetails]|':'<#Check detail of this remote task for more information about the problem.#>'"}
diff --git a/src/core/ctrl/src/AxoTask/AxoTask.st b/src/core/ctrl/src/AxoTask/AxoTask.st
index 2df4b8f07..4b299ef65 100644
--- a/src/core/ctrl/src/AxoTask/AxoTask.st
+++ b/src/core/ctrl/src/AxoTask/AxoTask.st
@@ -7,22 +7,10 @@ USING AXOpen.Messaging.Static;
NAMESPACE AXOpen.Core
{S7.extern=ReadWrite}
- CLASS PUBLIC AxoTask EXTENDS AxoObject IMPLEMENTS IAxoTask, IAxoTaskState
+ CLASS PUBLIC AxoTask EXTENDS AxoTaskLight IMPLEMENTS IAxoTask, IAxoTaskState
VAR PUBLIC
- ///
- /// Gets the state of this task.
- ///
- {#ix-set:AttributeName = "<#Command state#>"}
- {#ix-attr:[ReadOnly()]}
- Status : eAxoTaskState;
-
- ///
- /// Gets or sets whether this task is disabled for execution.
- ///
- IsDisabled : BOOL;
-
- ///
+ ///
/// Remote requests for invoke of this task.
/// When 'TRUE' this task will be invoked.
///
@@ -45,29 +33,6 @@ NAMESPACE AXOpen.Core
/// When 'TRUE' this task will be resumed.
///
RemoteResume : BOOL;
-
- ///
- /// Contains contex cycle number when this task started.
- ///
- StartSignature : ULINT;
-
- ///
- /// Gets elapsed time of last task execution.
- ///
- {#ix-attr:[ReadOnly()]}
- Duration : LTIME;
-
- ///
- /// Gets date and time when the task started.
- ///
- {#ix-attr:[ReadOnly()]}
- StartTimeStamp : LDATE_AND_TIME;
-
- ///
- /// Contains details about the error.
- ///
- ErrorDetails : STRING[254];
-
///
/// Provides some error messages.
///
@@ -77,172 +42,8 @@ NAMESPACE AXOpen.Core
[3]:'<#Invalid Rtm.#>':'<#Check the inicialization of the Rtm.#>'"}
_messenger : AXOpen.Messaging.Static.AxoMessenger;
END_VAR
-
- VAR PRIVATE
- _openCycleCountInvoke : ULINT;
- _openCycleCountExecute : ULINT;
- _taskTimer : AXOpen.Timers.OnDelayTimer;
- _isFirstExecutionCycle : BOOL;
-
- _suspendCyclicExecuteIsNotCalledCheck : BOOL := FALSE;
- _suspendMultipleExecuteCallCheck : BOOL := FALSE;
- _suspendRtmCheck : BOOL := FALSE;
- _RemoteRestoreEnabled : BOOL := TRUE;
- _RemoteAbortEnabled : BOOL := FALSE;
-
- _restoreCycleCount : ULINT;
- _doneCycleCount : ULINT;
- _startCycleCount : ULINT;
- _errorCycleCount : ULINT;
- _abortCycleCount : ULINT;
- _resumeCycleCount : ULINT;
-
- _context : IAxoContext;
- NULL_RTM : _NULL_RTM;
- END_VAR
-
- ///
- /// Gets the actual state of this task.
- ///
- METHOD PUBLIC GetState : eAxoTaskState
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- END_IF;
- END_IF;
-
- GetState := Status;
- END_METHOD
-
- METHOD PUBLIC GetErrorDetails : STRING[254]
- GetErrorDetails := ErrorDetails;
- END_METHOD
-
- ///
- /// Gets true when the task is ready.
- ///
- METHOD PUBLIC IsReady : BOOL
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- IsReady := false;
- RETURN;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- IsReady := TRUE;
- RETURN;
- END_IF;
- END_IF;
-
- IsReady := Status = eAxoTaskState#Ready;
- END_METHOD
-
- ///
- /// Gets true when the task is done.
- ///
- METHOD PUBLIC IsDone : BOOL
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- IsDone := false;
- RETURN;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- IsDone := false;
- RETURN;
- END_IF;
- END_IF;
-
- IsDone := Status = eAxoTaskState#Done ;
- END_METHOD
-
- ///
- /// Gets true when the task is busy/executing.
- ///
- METHOD PUBLIC IsBusy : BOOL
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- IsBusy := false;
- RETURN;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- IsBusy := false;
- RETURN;
- END_IF;
- END_IF;
-
- IsBusy := Status = eAxoTaskState#Busy;
- END_METHOD
-
- ///
- /// Gets true when the task is aborted.
- ///
- METHOD PUBLIC IsAborted : BOOL
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- IsAborted := false;
- RETURN;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- IsAborted := false;
- RETURN;
- END_IF;
- END_IF;
-
- IsAborted := Status = eAxoTaskState#Aborted;
- END_METHOD
-
- ///
- /// Gets true when the task has error.
- ///
- METHOD PUBLIC HasError : BOOL
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- HasError := FALSE;
- RETURN;
- ELSE
- HasError := TRUE;
- RETURN;
- END_IF;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- HasError := FALSE;
- RETURN;
- END_IF;
- END_IF;
-
- HasError := Status = eAxoTaskState#Error;
- END_METHOD
-
- ///
- /// Checks if the current execution cycle is the first cycle.
- ///
- ///A boolean value indicating whether the current execution cycle is the first cycle (TRUE) or not (FALSE).
- ///
- /// This method provides information about whether the current execution cycle is the initial cycle.
- /// It returns TRUE if the code is being executed for the first time in the cycle.
- /// It returns FALSE if the code is not in the first execution cycle.
- ///
- METHOD PUBLIC IsFirstExecutionCycle : BOOL
- IsFirstExecutionCycle := _isFirstExecutionCycle; // Returns the status of the first execution cycle flag.
- END_METHOD
+
///
/// Sets the flag to suspend or resume multiple execute check operations.
///
@@ -272,35 +73,6 @@ NAMESPACE AXOpen.Core
GetSuspendMultipleExecuteCallCheckState := _suspendMultipleExecuteCallCheck; // Returns the current state of the flag.
END_METHOD
- ///
- /// Sets the flag to suspend or resume Rtm check.
- ///
- ///A boolean value indicating whether Rtm check operations should be suspended (TRUE) or resumed (FALSE).
- ///
- /// This method allows dynamic control over the Rtm check operations.
- /// When suspended (TRUE), the system stops processing Rtm check operations.
- /// When resumed (FALSE), the system resumes processing Rtm check operations.
- ///
- METHOD PUBLIC SetSuspendRtmCheck
- VAR_INPUT
- Suspend : BOOL; // Input parameter to suspend or resume Rtm check operations.
- END_VAR
- _suspendRtmCheck := Suspend; // Assign the input value to the variable.
- END_METHOD
-
- ///
- /// Retrieves the current state of the flag indicating whether Rtm check operations are suspended or resumed.
- ///
- ///A boolean value indicating whether Rtm check operations are suspended (TRUE) or resumed (FALSE).
- ///
- /// This method provides the current state of the flag controlling Rtm check operations.
- /// It returns TRUE if Rtm check operations are suspended, indicating that processing is halted.
- /// It returns FALSE if Rtm check operations are resumed, allowing normal processing to occur.
- ///
- METHOD PUBLIC GetSuspendRtmCheckState : BOOL
- GetSuspendRtmCheckState := _suspendRtmCheck; // Returns the current state of the flag.
- END_METHOD
-
///
/// Enables or disables the suspension of cyclic execute check operations.
///
@@ -313,7 +85,7 @@ NAMESPACE AXOpen.Core
/// This method allows dynamic control over cyclic execution checks.
/// Setting the flag to TRUE halts execution, while setting it to FALSE resumes normal operation.
///
- METHOD PUBLIC SetSuspendCyclicExecuteIsNotCalledCheck
+ METHOD PUBLIC OVERRIDE SetSuspendCyclicExecuteIsNotCalledCheck
VAR_INPUT
Suspend : BOOL; // TRUE to suspend execution, FALSE to resume.
END_VAR
@@ -332,179 +104,50 @@ NAMESPACE AXOpen.Core
/// This method provides visibility into the current execution state.
/// It returns TRUE if execution is suspended and FALSE if execution is running normally.
///
- METHOD PUBLIC GetSuspendCyclicExecuteIsNotCalledCheckState : BOOL
+ METHOD PUBLIC OVERRIDE GetSuspendCyclicExecuteIsNotCalledCheckState : BOOL
GetSuspendCyclicExecuteIsNotCalledCheckState := _suspendCyclicExecuteIsNotCalledCheck; // Return the current flag state.
END_METHOD
- METHOD PRIVATE IsNewInvokeCall : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- IF _context <> NULL THEN
- IsNewInvokeCall := _openCycleCountInvoke < _context.OpenCycleCount() - ULINT#1;
- ELSE
- IsNewInvokeCall := FALSE;
- END_IF;
- END_METHOD
- METHOD PRIVATE IsNewExecuteCall : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- IF _context <> NULL THEN
- IsNewExecuteCall := _openCycleCountExecute < _context.OpenCycleCount() - ULINT#1;
- ELSE
- IsNewExecuteCall := FALSE;
- END_IF;
- END_METHOD
-
- METHOD PRIVATE IsExecuteCalledInThisPlcCycle : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- IF _context <> NULL THEN
- IsExecuteCalledInThisPlcCycle := _openCycleCountExecute = _context.OpenCycleCount();
- ELSE
- IsExecuteCalledInThisPlcCycle := FALSE;
- END_IF;
- END_METHOD
-
- METHOD PRIVATE WasExecuteCalledInPreviousPlcCycle : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- IF _context <> NULL THEN
- WasExecuteCalledInPreviousPlcCycle := _openCycleCountExecute + ULINT#1 = _context.OpenCycleCount();
- ELSE
- WasExecuteCalledInPreviousPlcCycle := FALSE;
- END_IF;
- END_METHOD
-
-
///
/// Invokes this task.
///
- METHOD PUBLIC Invoke : IAxoTaskState
+ METHOD PUBLIC OVERRIDE Invoke : IAxoTaskState
VAR_INPUT
inParent : IAxoObject;
END_VAR
VAR
_isNullContext : BOOL;
- _cyclicExecuteIsNotCalled : BOOL;
+ // _cyclicExecuteIsNotCalled : BOOL;
+ _context : IAxoContext;
END_VAR;
-
SUPER.Run(inParent);
-
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
-
- IF _context = NULL THEN
- Status := eAxoTaskState#Error;
- ErrorDetails := 'NULL CONTEXT';
- RETURN;
- END_IF;
-
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- END_IF;
- END_IF;
-
- _messenger.Serve(THIS);
-
- IF Status = eAxoTaskState#Done AND THIS.IsNewInvokeCall() THEN
- Status := eAxoTaskState#Ready;
- END_IF;
-
- _openCycleCountInvoke := _context.OpenCycleCount();
-
- // task should not be Invoked, if the execute method was not called in this or previous PLC cycle
- IF Status = eAxoTaskState#Ready THEN
- IF (THIS.IsExecuteCalledInThisPlcCycle() OR THIS.WasExecuteCalledInPreviousPlcCycle()) THEN
- Status := eAxoTaskState#Kicking;
- _context.GetLogger().Log('Task invoked', eLogLevel#Verbose, THIS);
- ELSE
- IF(NOT _suspendCyclicExecuteIsNotCalledCheck) THEN
- _cyclicExecuteIsNotCalled := TRUE;
- Status := eAxoTaskState#Error;
- ErrorDetails := 'CyclicExecuteIsNotCalled';
- END_IF;
- END_IF;
- END_IF;
+ _context := THIS.GetContext();
+ _cyclicExecuteIsNotCalled := FALSE;
+ Invoke := SUPER.Invoke();
+ _messenger.Serve(THIS);
_messenger.ActivateOnCondition(ULINT#1,_cyclicExecuteIsNotCalled,eAxoMessageCategory#ProgrammingError);
Invoke := THIS;
END_METHOD
- ///
- /// Restores this task.
- ///
- METHOD PUBLIC Restore : IAxoTaskState
- IF(Status <> eAxoTaskState#Ready AND Status <> eAxoTaskState#Disabled) THEN
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- _context.GetLogger().Log('Task restored', eLogLevel#Verbose, THIS);
- _restoreCycleCount := _context.OpenCycleCount();
- END_IF;
- Status := eAxoTaskState#Ready;
- ErrorDetails := '';
- _messenger.Restore(); //TODO check the behavior
-
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- END_IF;
- END_IF;
-
- Restore := THIS;
- THIS.OnRestore();
- END_METHOD
-
- ///
- /// Makes this task to transition in `Done` state
- /// when `Condition` argument is `TRUE`.
- ///
- METHOD PUBLIC DoneWhen
- VAR_INPUT
- Condition : BOOL;
- END_VAR
- IF Condition AND Status = eAxoTaskState#Busy THEN
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- _context.GetLogger().Log('Task done.', eLogLevel#Verbose, THIS);
- Status := eAxoTaskState#Done;
- THIS.OnDone();
- _doneCycleCount := _context.OpenCycleCount();
- END_IF;
- END_METHOD
-
+
///
/// Returns `TRUE` if the task is Busy, otherwise false.
/// This method needs to be called cyclically.
///
- METHOD PUBLIC Execute : BOOL
+ METHOD PUBLIC OVERRIDE Execute : BOOL
VAR_INPUT
inParent : IAxoObject;
END_VAR
VAR
_stateKicking : BOOL;
- _openCycleCount : ULINT;
- _multipleExecuteIsCalled : BOOL;
+ _openCycleCount : ULINT;
_rtmInvalid : BOOL;
+ _context : IAxoContext;
END_VAR
SUPER.Run(inParent);
-
+ _context := THIS.GetContext();
IF(_context = NULL) THEN
_context := THIS.GetContext();
END_IF;
@@ -538,172 +181,13 @@ NAMESPACE AXOpen.Core
END_IF;
_messenger.Serve(THIS);
+ _multipleExecuteIsCalled := FALSE;
+ Execute := SUPER.Execute(inParent);
- _openCycleCount := _context.OpenCycleCount();
-
- IF NOT _suspendMultipleExecuteCallCheck THEN
- IF _openCycleCountExecute = _openCycleCount THEN
- _multipleExecuteIsCalled := TRUE;
- Status := eAxoTaskState#Error;
- ErrorDetails := 'MultipleExecuteIsCalled';
- END_IF;
- END_IF;
- _messenger.ActivateOnCondition(ULINT#2,_multipleExecuteIsCalled,eAxoMessageCategory#ProgrammingError);
-
- _openCycleCountExecute := _openCycleCount;
-
-
- // If the Invoke() method was called in more then one PLC cycle back without calling the Execute() method
- // and the Execute() is subsequently called without calling the Invoke() method in the same PLC cycle,
- // CommandTask is set back to ready and does not start the execution.
- //IF Status = eAxoTaskState#Kicking AND NOT THIS.IsInvokeCalledInThisPlcCycle() AND NOT THIS.WasInvokeCalledInPreviousPlcCycle() THEN
-
- _stateKicking := Status = eAxoTaskState#Kicking;
-
- _isFirstExecutionCycle := FALSE;
-
- IF _stateKicking then
- IF (_openCycleCountInvoke <> _openCycleCountExecute) then
- IF ((_openCycleCountInvoke + ULINT#1) <> _openCycleCountExecute) THEN
- Status := eAxoTaskState#Ready;
- _stateKicking := false;
- END_IF;
- END_IF;
- END_IF;
-
- IF _stateKicking THEN
- Status := eAxoTaskState#Busy;
-
- // This null check is due to implementation of RTC in unit tests
- IF(_context.GetRtc() <> NULL) THEN
- StartTimeStamp := _context.GetRtc().NowUTC();
- END_IF;
-
- // Don't touch this, it is used for remote execs.
- StartSignature := _openCycleCountExecute;//_context.OpenCycleCount();
- _context.GetLogger().Log('Task started.', eLogLevel#Verbose, THIS);
- THIS.OnStart();
- _isFirstExecutionCycle := TRUE;
- _startCycleCount := _context.OpenCycleCount();
- END_IF;
-
- IF(Status = eAxoTaskState#Error) THEN
- THIS.WhileError();
- END_IF;
-
- IF IsDisabled THEN
- IF Status <> eAxoTaskState#Error THEN
- Status := eAxoTaskState#Disabled;
- END_IF;
- ELSE
- IF Status = eAxoTaskState#Disabled THEN
- Status := eAxoTaskState#Ready;
- END_IF;
- END_IF;
-
- Execute := Status = eAxoTaskState#Busy;
-
- _taskTimer.OnDelay(THIS, Execute, LT#99999D);
-
- IF(Execute) THEN
- Duration := _taskTimer.ElapsedTime;
- END_IF;
-
- // IF(NOT _suspendRtmCheck) THEN
- // IF(_context.GetRtm() = NULL) THEN
- // _rtmInvalid := TRUE;
- // Status := eAxoTaskState#Error;
- // ErrorDetails := 'RtmInvalid';
- // END_IF;
- // END_IF;
- // _messenger.ActivateOnCondition(ULINT#3,_rtmInvalid,eAxoMessageCategory#ProgrammingError);
+ _messenger.ActivateOnCondition(ULINT#2,_multipleExecuteIsCalled,eAxoMessageCategory#ProgrammingError);
END_METHOD
- ///
- /// Makes this task enter into `Error` state, when `HasErrorState` argument is `TRUE`
- /// task in error state stops its execution.
- ///
- METHOD PUBLIC ThrowWhen
- VAR_INPUT
- HasErrorState : BOOL;
- END_VAR
-
- IF(HasErrorState) THEN
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- Status := eAxoTaskState#Error;
- _context.GetLogger().Log('Task failed', eLogLevel#Error, THIS);
- THIS.OnError();
- THIS.WhileError();
- _errorCycleCount := _context.OpenCycleCount();
- END_IF;
- END_METHOD
-
- ///
- /// Makes this task enter into `Error` state, when `HasErrorState` argument is `TRUE`
- /// task in error state stops its execution.
- ///
- METHOD PUBLIC ThrowWhen
- VAR_INPUT
- HasErrorState : BOOL;
- ErrorDescription : STRING[254];
- END_VAR
- IF(HasErrorState) THEN
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- ErrorDetails := ErrorDescription;
- _context.GetLogger().Log(ErrorDetails, eLogLevel#Error, THIS);
- END_IF;
- THIS.ThrowWhen(HasErrorState);
- END_METHOD
-
- ///
- /// Sets the value of the `IsDisabled` variable
- ///
- METHOD PUBLIC SetIsDisabled
- VAR_INPUT
- Disabled : BOOL;
- END_VAR
- IsDisabled := Disabled;
- END_METHOD
-
- ///
- /// Returns the value of the `IsDisabled` variable
- ///
- METHOD PUBLIC GetIsDisabled : BOOL
- GetIsDisabled := IsDisabled;
- END_METHOD
-
- ///
- /// Aborts the execution of the task if running and sets its state to aborted.
- ///
- METHOD PUBLIC Abort
- IF THIS.Status = eAxoTaskState#Busy THEN
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- THIS.Status := eAxoTaskState#Aborted;
- THIS.OnAbort();
- _abortCycleCount := _context.OpenCycleCount();
- END_IF;
- END_METHOD
-
- ///
- /// Resume the execution of the task if aborted and sets its state to busy.
- ///
- METHOD PUBLIC Resume
- IF THIS.Status = eAxoTaskState#Aborted THEN
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- THIS.Status := eAxoTaskState#Busy;
- THIS.OnResume();
- _resumeCycleCount := _context.OpenCycleCount();
- END_IF;
- END_METHOD
-
+
///
/// Sets the remote restore functionality based on the provided input.
/// Enables or disables remote restoration based on the value of the 'Enable' parameter.
@@ -714,7 +198,7 @@ NAMESPACE AXOpen.Core
/// When enabled, remote restoration functionality is activated, allowing tasks to be restored remotely.
/// When disabled, remote restoration functionality is deactivated, preventing tasks from being restored remotely.
///
- METHOD PUBLIC SetRemoteRestoreEnabled
+ METHOD PUBLIC OVERRIDE SetRemoteRestoreEnabled
VAR_INPUT
Enable : BOOL; // Input parameter to enable or disable remote restore.
END_VAR
@@ -762,115 +246,6 @@ NAMESPACE AXOpen.Core
///
METHOD PUBLIC GetRemoteAbortEnabled : BOOL
GetRemoteAbortEnabled := _RemoteAbortEnabled; // Returns the current status of remote abort functionality.
- END_METHOD
-
- ///
- /// Executes once when the task is aborted.
- ///
- METHOD PROTECTED OnAbort
- ;
- END_METHOD
-
- ///
- /// Executes once when the task is resumed.
- ///
- METHOD PROTECTED OnResume
- ;
- END_METHOD
-
- ///
- /// Executes once when the task reaches the `Done` state.
- ///
- METHOD PROTECTED OnDone
- ;
- END_METHOD
-
- ///
- /// Executes once when the task reaches the `Error` state.
- ///
- METHOD PROTECTED OnError
- ;
- END_METHOD
-
- ///
- /// Executes once when the task is restored.
- ///
- METHOD PROTECTED OnRestore
- ;
- END_METHOD
-
- ///
- /// Executes once when the task starts (at the moment of transition from the `Kicking` state into the `Busy` state).
- ///
- METHOD PROTECTED OnStart
- ;
- END_METHOD
-
- ///
- /// Executes repeatedly while the task is in `Error` state (and `Execute()` method is called).
- ///
- METHOD PROTECTED WhileError
- ;
- END_METHOD
-
- ///
- /// Returns `TRUE` when the task has been aborted in this or previous PLC cycle.
- ///
- METHOD PUBLIC AbortTriggered : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- AbortTriggered := _abortCycleCount > ULINT#0 AND _abortCycleCount >= _context.OpenCycleCount() - ULINT#1;
- END_METHOD
-
- ///
- /// Returns `TRUE` when the task has been resumed in this or previous PLC cycle.
- ///
- METHOD PUBLIC ResumeTriggered : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- ResumeTriggered := _resumeCycleCount> ULINT#0 AND _resumeCycleCount >= _context.OpenCycleCount() - ULINT#1;
- END_METHOD
-
- ///
- /// Returns `TRUE` when the task has reached the `Done` state in this or previous PLC cycle.
- ///
- METHOD PUBLIC DoneReached : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- DoneReached := _doneCycleCount > ULINT#0 AND _doneCycleCount >= _context.OpenCycleCount() - ULINT#1;
- END_METHOD
-
- ///
- /// Returns `TRUE` when the task has reached the `Error` state in this or previous PLC cycle.
- ///
- METHOD PUBLIC ErrorOccured : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- ErrorOccured := _errorCycleCount > ULINT#0 AND _errorCycleCount >= _context.OpenCycleCount() - ULINT#1;
- END_METHOD
-
- ///
- /// Returns `TRUE` when the task has been restored in this or previous PLC cycle.
- ///
- METHOD PUBLIC RestoreTriggered : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- RestoreTriggered := _restoreCycleCount > ULINT#0 AND _restoreCycleCount >= _context.OpenCycleCount() - ULINT#1;
- END_METHOD
-
- ///
- /// Returns `TRUE` when the task has been started in this or previous PLC cycle.
- ///
- METHOD PUBLIC StartTriggered : BOOL
- IF(_context = NULL) THEN
- _context := THIS.GetContext();
- END_IF;
- StartTriggered := _startCycleCount > ULINT#0 AND _startCycleCount >= _context.OpenCycleCount() - ULINT#1;
- END_METHOD
+ END_METHOD
END_CLASS
END_NAMESPACE
diff --git a/src/core/ctrl/src/AxoTask/AxoTaskLight.st b/src/core/ctrl/src/AxoTask/AxoTaskLight.st
new file mode 100644
index 000000000..987468c18
--- /dev/null
+++ b/src/core/ctrl/src/AxoTask/AxoTaskLight.st
@@ -0,0 +1,754 @@
+USING AXOpen.Logging;
+USING AXOpen.Timers;
+
+USING AXOpen.Messaging;
+USING AXOpen.Messaging.Static;
+
+NAMESPACE AXOpen.Core
+
+ {S7.extern=ReadWrite}
+ CLASS PUBLIC AxoTaskLight EXTENDS AxoObject IMPLEMENTS IAxoTask, IAxoTaskState
+ VAR PUBLIC
+ ///
+ /// Gets the state of this task.
+ ///
+ {#ix-set:AttributeName = "<#Command state#>"}
+ {#ix-attr:[ReadOnly()]}
+ Status : eAxoTaskState;
+
+ ///
+ /// Gets or sets whether this task is disabled for execution.
+ ///
+ IsDisabled : BOOL;
+
+ ///
+ /// Contains contex cycle number when this task started.
+ ///
+ StartSignature : ULINT;
+
+ ///
+ /// Gets elapsed time of last task execution.
+ ///
+ {#ix-attr:[ReadOnly()]}
+ Duration : LTIME;
+
+ ///
+ /// Gets date and time when the task started.
+ ///
+ {#ix-attr:[ReadOnly()]}
+ StartTimeStamp : LDATE_AND_TIME;
+
+ ///
+ /// Contains details about the error.
+ ///
+ ErrorDetails : STRING[254];
+ END_VAR
+
+ VAR PROTECTED
+ _openCycleCountInvoke : ULINT;
+ _openCycleCountExecute : ULINT;
+ _taskTimer : AXOpen.Timers.OnDelayTimer;
+ _isFirstExecutionCycle : BOOL;
+
+ _suspendCyclicExecuteIsNotCalledCheck : BOOL := FALSE;
+ _suspendMultipleExecuteCallCheck : BOOL := FALSE;
+ _RemoteRestoreEnabled : BOOL := TRUE;
+ _RemoteAbortEnabled : BOOL := FALSE;
+
+ _restoreCycleCount : ULINT;
+ _doneCycleCount : ULINT;
+ _startCycleCount : ULINT;
+ _errorCycleCount : ULINT;
+ _abortCycleCount : ULINT;
+ _resumeCycleCount : ULINT;
+
+ _cyclicExecuteIsNotCalled : BOOL;
+ _multipleExecuteIsCalled : BOOL;
+ END_VAR
+
+
+
+ ///
+ /// Gets the actual state of this task.
+ ///
+ METHOD PUBLIC GetState : eAxoTaskState
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ END_IF;
+ END_IF;
+
+ GetState := Status;
+ END_METHOD
+
+ METHOD PUBLIC GetErrorDetails : STRING[254]
+ GetErrorDetails := ErrorDetails;
+ END_METHOD
+
+ ///
+ /// Gets true when the task is ready.
+ ///
+ METHOD PUBLIC IsReady : BOOL
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ IsReady := false;
+ RETURN;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ IsReady := TRUE;
+ RETURN;
+ END_IF;
+ END_IF;
+
+ IsReady := Status = eAxoTaskState#Ready;
+ END_METHOD
+
+ ///
+ /// Gets true when the task is done.
+ ///
+ METHOD PUBLIC IsDone : BOOL
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ IsDone := false;
+ RETURN;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ IsDone := false;
+ RETURN;
+ END_IF;
+ END_IF;
+
+ IsDone := Status = eAxoTaskState#Done ;
+ END_METHOD
+
+ ///
+ /// Gets true when the task is busy/executing.
+ ///
+ METHOD PUBLIC IsBusy : BOOL
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ IsBusy := false;
+ RETURN;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ IsBusy := false;
+ RETURN;
+ END_IF;
+ END_IF;
+
+ IsBusy := Status = eAxoTaskState#Busy;
+ END_METHOD
+
+ ///
+ /// Gets true when the task is aborted.
+ ///
+ METHOD PUBLIC IsAborted : BOOL
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ IsAborted := false;
+ RETURN;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ IsAborted := false;
+ RETURN;
+ END_IF;
+ END_IF;
+
+ IsAborted := Status = eAxoTaskState#Aborted;
+ END_METHOD
+
+ ///
+ /// Gets true when the task has error.
+ ///
+ METHOD PUBLIC HasError : BOOL
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ HasError := FALSE;
+ RETURN;
+ ELSE
+ HasError := TRUE;
+ RETURN;
+ END_IF;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ HasError := FALSE;
+ RETURN;
+ END_IF;
+ END_IF;
+
+ HasError := Status = eAxoTaskState#Error;
+ END_METHOD
+
+ ///
+ /// Checks if the current execution cycle is the first cycle.
+ ///
+ ///A boolean value indicating whether the current execution cycle is the first cycle (TRUE) or not (FALSE).
+ ///
+ /// This method provides information about whether the current execution cycle is the initial cycle.
+ /// It returns TRUE if the code is being executed for the first time in the cycle.
+ /// It returns FALSE if the code is not in the first execution cycle.
+ ///
+ METHOD PUBLIC IsFirstExecutionCycle : BOOL
+ IsFirstExecutionCycle := _isFirstExecutionCycle; // Returns the status of the first execution cycle flag.
+ END_METHOD
+
+ ///
+ /// Enables or disables the suspension of cyclic execute check operations.
+ ///
+ ///
+ /// A boolean value that controls the execution state:
+ /// - TRUE: Suspends execute check operations, preventing further execution.
+ /// - FALSE: Resumes execute check operations, allowing normal execution.
+ ///
+ ///
+ /// This method allows dynamic control over cyclic execution checks.
+ /// Setting the flag to TRUE halts execution, while setting it to FALSE resumes normal operation.
+ ///
+ METHOD PUBLIC SetSuspendCyclicExecuteIsNotCalledCheck
+ VAR_INPUT
+ Suspend : BOOL; // TRUE to suspend execution, FALSE to resume.
+ END_VAR
+ _suspendCyclicExecuteIsNotCalledCheck := Suspend; // Update the system state based on input.
+ END_METHOD
+
+ ///
+ /// Retrieves the current state of the cyclic execute check suspension flag.
+ ///
+ ///
+ /// A boolean value indicating whether execution checks are suspended:
+ /// - TRUE: Execution checks are suspended.
+ /// - FALSE: Execution checks are active.
+ ///
+ ///
+ /// This method provides visibility into the current execution state.
+ /// It returns TRUE if execution is suspended and FALSE if execution is running normally.
+ ///
+ METHOD PUBLIC GetSuspendCyclicExecuteIsNotCalledCheckState : BOOL
+ GetSuspendCyclicExecuteIsNotCalledCheckState := _suspendCyclicExecuteIsNotCalledCheck; // Return the current flag state.
+ END_METHOD
+
+ METHOD PROTECTED IsNewInvokeCall : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+
+ _context := THIS.GetContext();
+
+ IF _context <> NULL THEN
+ IsNewInvokeCall := _openCycleCountInvoke < _context.OpenCycleCount() - ULINT#1;
+ ELSE
+ IsNewInvokeCall := FALSE;
+ END_IF;
+ END_METHOD
+
+ METHOD PROTECTED IsNewExecuteCall : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+
+ _context := THIS.GetContext();
+
+ IF _context <> NULL THEN
+ IsNewExecuteCall := _openCycleCountExecute < _context.OpenCycleCount() - ULINT#1;
+ ELSE
+ IsNewExecuteCall := FALSE;
+ END_IF;
+ END_METHOD
+
+ METHOD PROTECTED IsExecuteCalledInThisPlcCycle : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ IF _context <> NULL THEN
+ IsExecuteCalledInThisPlcCycle := _openCycleCountExecute = _context.OpenCycleCount();
+ ELSE
+ IsExecuteCalledInThisPlcCycle := FALSE;
+ END_IF;
+ END_METHOD
+
+ METHOD PROTECTED WasExecuteCalledInPreviousPlcCycle : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+ IF _context <> NULL THEN
+ WasExecuteCalledInPreviousPlcCycle := _openCycleCountExecute + ULINT#1 = _context.OpenCycleCount();
+ ELSE
+ WasExecuteCalledInPreviousPlcCycle := FALSE;
+ END_IF;
+ END_METHOD
+
+
+ ///
+ /// Invokes this task.
+ ///
+ METHOD PUBLIC Invoke : IAxoTaskState
+ VAR_INPUT
+ inParent : IAxoObject;
+ END_VAR
+ VAR
+ _isNullContext : BOOL;
+ _context : IAxoContext;
+ END_VAR;
+
+ SUPER.Run(inParent);
+
+ _context := THIS.GetContext();
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+
+ IF _context = NULL THEN
+ Status := eAxoTaskState#Error;
+ ErrorDetails := 'NULL CONTEXT';
+ RETURN;
+ END_IF;
+
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ END_IF;
+ END_IF;
+
+
+
+ IF Status = eAxoTaskState#Done AND THIS.IsNewInvokeCall() THEN
+ Status := eAxoTaskState#Ready;
+ END_IF;
+
+ _openCycleCountInvoke := _context.OpenCycleCount();
+
+ // task should not be Invoked, if the execute method was not called in this or previous PLC cycle
+ IF Status = eAxoTaskState#Ready THEN
+ IF (THIS.IsExecuteCalledInThisPlcCycle() OR THIS.WasExecuteCalledInPreviousPlcCycle()) THEN
+ Status := eAxoTaskState#Kicking;
+ _context.GetLogger().Log('Task invoked', eLogLevel#Verbose, THIS);
+ ELSE
+ IF(NOT _suspendCyclicExecuteIsNotCalledCheck) THEN
+ _cyclicExecuteIsNotCalled := TRUE;
+ Status := eAxoTaskState#Error;
+ ErrorDetails := 'CyclicExecuteIsNotCalled';
+ END_IF;
+ END_IF;
+ END_IF;
+
+ Invoke := THIS;
+ END_METHOD
+
+ ///
+ /// Restores this task.
+ ///
+ METHOD PUBLIC Restore : IAxoTaskState
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ IF(Status <> eAxoTaskState#Ready AND Status <> eAxoTaskState#Disabled) THEN
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+ _context.GetLogger().Log('Task restored', eLogLevel#Verbose, THIS);
+ _restoreCycleCount := _context.OpenCycleCount();
+ END_IF;
+ Status := eAxoTaskState#Ready;
+ ErrorDetails := '';
+
+
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ END_IF;
+ END_IF;
+
+ Restore := THIS;
+ THIS.OnRestore();
+ END_METHOD
+
+ ///
+ /// Makes this task to transition in `Done` state
+ /// when `Condition` argument is `TRUE`.
+ ///
+ METHOD PUBLIC DoneWhen
+ VAR_INPUT
+ Condition : BOOL;
+ END_VAR
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ IF Condition AND Status = eAxoTaskState#Busy THEN
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+ _context.GetLogger().Log('Task done.', eLogLevel#Verbose, THIS);
+ Status := eAxoTaskState#Done;
+ THIS.OnDone();
+ _doneCycleCount := _context.OpenCycleCount();
+ END_IF;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` if the task is Busy, otherwise false.
+ /// This method needs to be called cyclically.
+ ///
+ METHOD PUBLIC Execute : BOOL
+ VAR_INPUT
+ inParent : IAxoObject;
+ END_VAR
+ VAR
+ _stateKicking : BOOL;
+ _openCycleCount : ULINT;
+ _rtmInvalid : BOOL;
+ _context : IAxoContext;
+ END_VAR
+
+ SUPER.Run(inParent);
+
+ _context := THIS.GetContext();
+
+ _openCycleCount := _context.OpenCycleCount();
+
+ IF NOT _suspendMultipleExecuteCallCheck THEN
+ IF _openCycleCountExecute = _openCycleCount THEN
+ _multipleExecuteIsCalled := TRUE;
+ Status := eAxoTaskState#Error;
+ ErrorDetails := 'MultipleExecuteIsCalled';
+ END_IF;
+ END_IF;
+
+
+ _openCycleCountExecute := _openCycleCount;
+
+
+ // If the Invoke() method was called in more then one PLC cycle back without calling the Execute() method
+ // and the Execute() is subsequently called without calling the Invoke() method in the same PLC cycle,
+ // CommandTask is set back to ready and does not start the execution.
+ //IF Status = eAxoTaskState#Kicking AND NOT THIS.IsInvokeCalledInThisPlcCycle() AND NOT THIS.WasInvokeCalledInPreviousPlcCycle() THEN
+
+ _stateKicking := Status = eAxoTaskState#Kicking;
+
+ _isFirstExecutionCycle := FALSE;
+
+ IF _stateKicking then
+ IF (_openCycleCountInvoke <> _openCycleCountExecute) then
+ IF ((_openCycleCountInvoke + ULINT#1) <> _openCycleCountExecute) THEN
+ Status := eAxoTaskState#Ready;
+ _stateKicking := false;
+ END_IF;
+ END_IF;
+ END_IF;
+
+ IF _stateKicking THEN
+ Status := eAxoTaskState#Busy;
+
+ // This null check is due to implementation of RTC in unit tests
+ IF(_context.GetRtc() <> NULL) THEN
+ StartTimeStamp := _context.GetRtc().NowUTC();
+ END_IF;
+
+ // Don't touch this, it is used for remote execs.
+ StartSignature := _openCycleCountExecute;//_context.OpenCycleCount();
+ _context.GetLogger().Log('Task started.', eLogLevel#Verbose, THIS);
+ THIS.OnStart();
+ _isFirstExecutionCycle := TRUE;
+ _startCycleCount := _context.OpenCycleCount();
+ END_IF;
+
+ IF(Status = eAxoTaskState#Error) THEN
+ THIS.WhileError();
+ END_IF;
+
+ IF IsDisabled THEN
+ IF Status <> eAxoTaskState#Error THEN
+ Status := eAxoTaskState#Disabled;
+ END_IF;
+ ELSE
+ IF Status = eAxoTaskState#Disabled THEN
+ Status := eAxoTaskState#Ready;
+ END_IF;
+ END_IF;
+
+ Execute := Status = eAxoTaskState#Busy;
+
+ _taskTimer.OnDelay(THIS, Execute, LT#99999D);
+
+ IF(Execute) THEN
+ Duration := _taskTimer.ElapsedTime;
+ END_IF;
+
+ // IF(NOT _suspendRtmCheck) THEN
+ // IF(_context.GetRtm() = NULL) THEN
+ // _rtmInvalid := TRUE;
+ // Status := eAxoTaskState#Error;
+ // ErrorDetails := 'RtmInvalid';
+ // END_IF;
+ // END_IF;
+ // _messenger.ActivateOnCondition(ULINT#3,_rtmInvalid,eAxoMessageCategory#ProgrammingError);
+ END_METHOD
+
+ ///
+ /// Makes this task enter into `Error` state, when `HasErrorState` argument is `TRUE`
+ /// task in error state stops its execution.
+ ///
+ METHOD PUBLIC ThrowWhen
+ VAR_INPUT
+ HasErrorState : BOOL;
+ END_VAR
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ IF(HasErrorState) THEN
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+ Status := eAxoTaskState#Error;
+ _context.GetLogger().Log('Task failed', eLogLevel#Error, THIS);
+ THIS.OnError();
+ THIS.WhileError();
+ _errorCycleCount := _context.OpenCycleCount();
+ END_IF;
+ END_METHOD
+
+ ///
+ /// Makes this task enter into `Error` state, when `HasErrorState` argument is `TRUE`
+ /// task in error state stops its execution.
+ ///
+ METHOD PUBLIC ThrowWhen
+ VAR_INPUT
+ HasErrorState : BOOL;
+ ErrorDescription : STRING[254];
+ END_VAR
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+
+ IF(HasErrorState) THEN
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+ ErrorDetails := ErrorDescription;
+ _context.GetLogger().Log(ErrorDetails, eLogLevel#Error, THIS);
+ END_IF;
+ THIS.ThrowWhen(HasErrorState);
+ END_METHOD
+
+ ///
+ /// Sets the value of the `IsDisabled` variable
+ ///
+ METHOD PUBLIC SetIsDisabled
+ VAR_INPUT
+ Disabled : BOOL;
+ END_VAR
+ IsDisabled := Disabled;
+ END_METHOD
+
+ ///
+ /// Returns the value of the `IsDisabled` variable
+ ///
+ METHOD PUBLIC GetIsDisabled : BOOL
+ GetIsDisabled := IsDisabled;
+ END_METHOD
+
+ ///
+ /// Aborts the execution of the task if running and sets its state to aborted.
+ ///
+ METHOD PUBLIC Abort
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+
+ IF THIS.Status = eAxoTaskState#Busy THEN
+ IF(_context = NULL) THEN
+ _context := THIS.GetContext();
+ END_IF;
+ THIS.Status := eAxoTaskState#Aborted;
+ THIS.OnAbort();
+ _abortCycleCount := _context.OpenCycleCount();
+ END_IF;
+ END_METHOD
+
+ ///
+ /// Resume the execution of the task if aborted and sets its state to busy.
+ ///
+ METHOD PUBLIC Resume
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+
+ IF THIS.Status = eAxoTaskState#Aborted THEN
+
+ THIS.Status := eAxoTaskState#Busy;
+ THIS.OnResume();
+ _resumeCycleCount := _context.OpenCycleCount();
+ END_IF;
+ END_METHOD
+
+ ///
+ /// Sets the remote restore functionality based on the provided input.
+ /// Enables or disables remote restoration based on the value of the 'Enable' parameter.
+ ///
+ ///A boolean value indicating whether remote restore functionality should be enabled (TRUE) or disabled (FALSE).
+ ///
+ /// This method allows dynamic control over the ability to perform remote restoration tasks.
+ /// When enabled, remote restoration functionality is activated, allowing tasks to be restored remotely.
+ /// When disabled, remote restoration functionality is deactivated, preventing tasks from being restored remotely.
+ ///
+ METHOD PUBLIC SetRemoteRestoreEnabled
+ VAR_INPUT
+ Enable : BOOL; // Input parameter to enable or disable remote restore.
+ END_VAR
+ _RemoteRestoreEnabled := Enable; // Assign the input value to the variable.
+ END_METHOD
+
+
+ ///
+ /// Executes once when the task is aborted.
+ ///
+ METHOD PROTECTED OnAbort
+ ;
+ END_METHOD
+
+ ///
+ /// Executes once when the task is resumed.
+ ///
+ METHOD PROTECTED OnResume
+ ;
+ END_METHOD
+
+ ///
+ /// Executes once when the task reaches the `Done` state.
+ ///
+ METHOD PROTECTED OnDone
+ ;
+ END_METHOD
+
+ ///
+ /// Executes once when the task reaches the `Error` state.
+ ///
+ METHOD PROTECTED OnError
+ ;
+ END_METHOD
+
+ ///
+ /// Executes once when the task is restored.
+ ///
+ METHOD PROTECTED OnRestore
+ ;
+ END_METHOD
+
+ ///
+ /// Executes once when the task starts (at the moment of transition from the `Kicking` state into the `Busy` state).
+ ///
+ METHOD PROTECTED OnStart
+ ;
+ END_METHOD
+
+ ///
+ /// Executes repeatedly while the task is in `Error` state (and `Execute()` method is called).
+ ///
+ METHOD PROTECTED WhileError
+ ;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` when the task has been aborted in this or previous PLC cycle.
+ ///
+ METHOD PUBLIC AbortTriggered : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ AbortTriggered := _abortCycleCount > ULINT#0 AND _abortCycleCount >= _context.OpenCycleCount() - ULINT#1;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` when the task has been resumed in this or previous PLC cycle.
+ ///
+ METHOD PUBLIC ResumeTriggered : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ ResumeTriggered := _resumeCycleCount> ULINT#0 AND _resumeCycleCount >= _context.OpenCycleCount() - ULINT#1;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` when the task has reached the `Done` state in this or previous PLC cycle.
+ ///
+ METHOD PUBLIC DoneReached : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ DoneReached := _doneCycleCount > ULINT#0 AND _doneCycleCount >= _context.OpenCycleCount() - ULINT#1;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` when the task has reached the `Error` state in this or previous PLC cycle.
+ ///
+ METHOD PUBLIC ErrorOccured : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ ErrorOccured := _errorCycleCount > ULINT#0 AND _errorCycleCount >= _context.OpenCycleCount() - ULINT#1;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` when the task has been restored in this or previous PLC cycle.
+ ///
+ METHOD PUBLIC RestoreTriggered : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ RestoreTriggered := _restoreCycleCount > ULINT#0 AND _restoreCycleCount >= _context.OpenCycleCount() - ULINT#1;
+ END_METHOD
+
+ ///
+ /// Returns `TRUE` when the task has been started in this or previous PLC cycle.
+ ///
+ METHOD PUBLIC StartTriggered : BOOL
+ VAR
+ _context : IAxoContext;
+ END_VAR
+ _context := THIS.GetContext();
+ StartTriggered := _startCycleCount > ULINT#0 AND _startCycleCount >= _context.OpenCycleCount() - ULINT#1;
+ END_METHOD
+ END_CLASS
+END_NAMESPACE
diff --git a/src/core/ctrl/src/abstractions/NULLs.st b/src/core/ctrl/src/abstractions/NULLs.st
index a041c2a10..daf275bb9 100644
--- a/src/core/ctrl/src/abstractions/NULLs.st
+++ b/src/core/ctrl/src/abstractions/NULLs.st
@@ -91,7 +91,7 @@ NAMESPACE AXOpen.Core
CLASS PUBLIC _NULL_LOGGER IMPLEMENTS IAxoLogger
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
_sender : IAxoObject;
END_VAR
@@ -100,7 +100,7 @@ NAMESPACE AXOpen.Core
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
END_VAR
;
diff --git a/src/core/ctrl/test/AxoLogger/AxoLogger.st b/src/core/ctrl/test/AxoLogger/AxoLogger.st
index 7f129b26e..308b8a427 100644
--- a/src/core/ctrl/test/AxoLogger/AxoLogger.st
+++ b/src/core/ctrl/test/AxoLogger/AxoLogger.st
@@ -48,7 +48,7 @@ NAMESPACE AXOpen.MessagingTests
{Test}
METHOD PUBLIC Log_should_log_info_message_2
VAR
- _message : STRING[80];
+ _message : STRING[254];
_isInformation : BOOL;
_isToDequeue : BOOL;
END_VAR
diff --git a/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs b/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs
index 247ef864a..60d77e87f 100644
--- a/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs
+++ b/src/core/src/AXOpen.Core/AxoLogger/AxoLogger.cs
@@ -36,48 +36,56 @@ public async Task Dequeue()
{
await Task.Run(async () =>
{
- var dequeued = new List();
- var index = 0;
- var caretValue = await this.Carret.GetAsync();
- var toDequeue = this.LogEntries.Take(caretValue).ToArray();
-
- if (toDequeue.Length <= 0)
- return;
+ try
+ {
+ var dequeued = new List();
+ var index = 0;
+ var caretValue = await this.Carret.GetAsync();
+ var toDequeue = this.LogEntries.Take(caretValue).ToArray();
- var a = toDequeue.SelectMany(p => p.GetValueTags()).ToArray();
- await this.GetConnector()?.ReadBatchAsync(a)!;
+ if (toDequeue.Length <= 0)
+ return;
- foreach (var entry in toDequeue.Where(p => p.ToDequeue.LastValue))
- {
- var senderIdentity = entry.Sender.LastValue;
- var sender = entry.GetConnector().IdentityProvider.GetTwinByIdentity(senderIdentity) as ITwinObject;
- var message = string.Empty;
- var level = (eLogLevel)entry.Level.LastValue;
+ var a = toDequeue.SelectMany(p => p.GetValueTags()).ToArray();
+ await this.GetConnector()?.ReadBatchAsync(a)!;
- switch (sender)
+ foreach (var entry in toDequeue.Where(p => p.ToDequeue.LastValue))
{
- case AxoMessenger messenger:
- await messenger.ReadAsync();
- message = $"{entry.Message.LastValue} : {messenger.GetMessageText()}";
- break;
- case AxoStep step:
- await step.ReadAsync();
- message = $"Step : {entry.Message.LastValue} : {step.StepDescription.LastValue ?? step.Description}";
- break;
- case null:
- message = $"{entry.Message.LastValue} : [no identity provided '{entry.Sender.LastValue}']";
- break;
- default:
- message = entry.Message.LastValue;
- break;
- }
+ var senderIdentity = entry.Sender.LastValue;
+ var sender = entry.GetConnector().IdentityProvider.GetTwinByIdentity(senderIdentity) as ITwinObject;
+ var message = string.Empty;
+ var level = (eLogLevel)entry.Level.LastValue;
- CreateLogEntry(level, $"{message}", sender);
- dequeued.Add(entry.ToDequeue);
- entry.ToDequeue.Cyclic = false;
- }
+ switch (sender)
+ {
+ case AxoMessenger messenger:
+ await messenger.ReadAsync();
+ message = $"{entry.Message.LastValue} : {messenger.GetMessageText()}";
+ break;
+ case AxoStep step:
+ await step.ReadAsync();
+ message = $"Step : {entry.Message.LastValue} : {step.StepDescription.LastValue ?? step.Description}";
+ break;
+ case null:
+ message = $"{entry.Message.LastValue} : [no identity provided '{entry.Sender.LastValue}']";
+ break;
+ default:
+ message = entry.Message.LastValue;
+ break;
+ }
- this.LogEntries.FirstOrDefault()?.GetConnector().WriteBatchAsync(dequeued);
+ CreateLogEntry(level, $"{message}", sender);
+ dequeued.Add(entry.ToDequeue);
+ entry.ToDequeue.Cyclic = false;
+ }
+
+ await this.GetConnector().WriteBatchAsync(dequeued);
+ }
+ catch (Exception e)
+ {
+ AxoApplication.Current.Logger.Information($"There was in issue with getting logs from `{this.Carret.Symbol}`", this, new GenericIdentity("anonymous"), this);
+ }
+
});
}
diff --git a/src/data/src/AXOpen.Data.Blazor/DataExchangeRoleNames.cs b/src/data/src/AXOpen.Data.Blazor/DataExchangeRoleNames.cs
index d7164c33b..6a34c6909 100644
--- a/src/data/src/AXOpen.Data.Blazor/DataExchangeRoleNames.cs
+++ b/src/data/src/AXOpen.Data.Blazor/DataExchangeRoleNames.cs
@@ -31,7 +31,7 @@ public static IEnumerable GetRoles()
}
// insert all new role names in the middle of documentation tag
//
-
+
public const string can_data_item_create = nameof(can_data_item_create);
public const string can_data_item_edit = nameof(can_data_item_edit);
public const string can_data_item_copy = nameof(can_data_item_copy);
diff --git a/src/simatic1500/ctrl/assets/6ES7516-3AP03-0AB0_v3_1.hwl.yml b/src/simatic1500/ctrl/assets/6ES7516-3AP03-0AB0_v3_1.hwl.yml
index 671f52eb0..fc70d4769 100644
--- a/src/simatic1500/ctrl/assets/6ES7516-3AP03-0AB0_v3_1.hwl.yml
+++ b/src/simatic1500/ctrl/assets/6ES7516-3AP03-0AB0_v3_1.hwl.yml
@@ -18,6 +18,8 @@ Templates:
Value: plcname_profinet_interface_x3
- Name: AdminName
Value: adm
+ - Name: CycleCommunicationLoad
+ Value : 20
Content:
Name: "${PLCName}"
TypeIdentifier:
@@ -100,7 +102,7 @@ Templates:
AdditionalInformation: ""
# ClockMemoryByteAddress: 0
ClockMemoryByte: False
- CycleCommunicationLoad: 20
+ CycleCommunicationLoad: ${CycleCommunicationLoad}
CycleEnableMinimumCycleTime: True
CycleMaximumCycleTime: 150
CycleMinimumCycleTime: 1
diff --git a/src/timers/ctrl/test/Abstractions.st b/src/timers/ctrl/test/Abstractions.st
index a973f50e9..3c2e525da 100644
--- a/src/timers/ctrl/test/Abstractions.st
+++ b/src/timers/ctrl/test/Abstractions.st
@@ -13,7 +13,7 @@ NAMESPACE AXOpen.Timers_tests
CLASS INTERNAL _NULL_LOGGER IMPLEMENTS IAxoLogger
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
_sender : IAxoObject;
END_VAR
@@ -22,7 +22,7 @@ NAMESPACE AXOpen.Timers_tests
METHOD PUBLIC Log
VAR_INPUT
- _message : STRING[80];
+ _message : STRING[254];
_level : eLogLevel;
END_VAR
;