Skip to content

Commit

Permalink
Fw4 template alignment (#427)
Browse files Browse the repository at this point in the history
* this is to allight with the work on templates

* fixes tests after refactoring

* CRUD operations now can succed in the same context cycle

* if persistent data not exist on Read in DB -> create it

* persistent exchange view

* simple docu

* spelling

* Refactor AxoRemoteTask to handle exceptions and restore task state

* Refactor AxoTask to handle exceptions and restore task state

- Added a new private variable `_suspendExecuteCallAnalisis` to the `AxoTask` class
- Implemented the `SuspendExecuteAnalisis` method to set the flag for suspending execute call analysis
- Modified the `CyclicExecute` method to check the `_suspendExecuteCallAnalisis` flag before activating an error message

* Add Rtm mechanism to measure time at runtime.
- Provides indipendent mechanism from rtc to provide accurate time measurement for timers
- Multiple refactoring required to make rtm accessible from application context.

* Refactor test classes to use Dummies.MockAxoContext for better test isolation

* Add system-timer dependency for runtime measurement in Rtm

---------

Co-authored-by: TK <61820360+TomKovac@users.noreply.github.com>
Co-authored-by: blazej.kuhajda <blazej.kuhajda@mts.sk>
  • Loading branch information
3 people authored Sep 26, 2024
1 parent 67485c7 commit cad9f11
Show file tree
Hide file tree
Showing 68 changed files with 1,073 additions and 1,296 deletions.
6 changes: 5 additions & 1 deletion src/abstractions/ctrl/src/AxoContext/IAxoContext.st
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
USING AXOpen.Rtc;
USING AXOpen.Rtm;
USING AXOpen.Logging;

NAMESPACE AXOpen.Core
INTERFACE PUBLIC IAxoContext
METHOD CreateIdentity : ULINT END_METHOD
METHOD OpenCycleCount : ULINT END_METHOD
METHOD GetRtc : IAxoRtc END_METHOD
METHOD InjectRtc VAR_INPUT Rtc : IAxoRtc; END_VAR END_METHOD
METHOD GetLogger : IAxoLogger END_METHOD
METHOD InjectLogger VAR_INPUT _logger : IAxoLogger; END_VAR END_METHOD
METHOD InjectLogger VAR_INPUT _logger : IAxoLogger; END_VAR END_METHOD
METHOD InjectRtm VAR_INPUT Rtm : IAxoRtm; END_VAR END_METHOD
METHOD GetRtm : IAxoRtm END_METHOD
END_INTERFACE
END_NAMESPACE

5 changes: 5 additions & 0 deletions src/abstractions/ctrl/src/AxoRtm/IAxoRtm.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NAMESPACE AXOpen.Rtm
INTERFACE PUBLIC IAxoRtm
METHOD Elapsed : LTIME END_METHOD
END_INTERFACE
END_NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ public RepositoryNotInitializedException()
/// <param name="message">The message that describes the error. </param>
public RepositoryNotInitializedException(string message) : base(message)
{

}

/// <summary>Initializes a new instance of the <see cref="RepositoryNotInitializedException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
Expand Down
49 changes: 4 additions & 45 deletions src/components.abb.robotics/ctrl/test/AxoAbbRoboticsTests.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,10 @@ USING AXOpen.Logging;

NAMESPACE Cylinder.Tests
{S7.extern=ReadWrite}
CLASS TestContext IMPLEMENTS AXOpen.Core.IAxoContext
VAR
_openCounter : ULINT;
_closeCounter : ULINT;
END_VAR

METHOD PUBLIC Open : ULINT
_openCounter := _openCounter + ULINT#1;
END_METHOD

METHOD PUBLIC Close : ULINT
_closeCounter := _closeCounter + ULINT#1;
END_METHOD

METHOD PUBLIC CreateIdentity : ULINT
;
END_METHOD

METHOD PUBLIC OpenCycleCount : ULINT
OpenCycleCount := _openCounter;
END_METHOD

METHOD PUBLIC GetRtc : AXOpen.Rtc.IAxoRtc
;
END_METHOD

METHOD PUBLIC InjectRtc
VAR_INPUT
Rtc : IAxoRtc;
END_VAR

;
END_METHOD

METHOD PUBLIC GetLogger : IAxoLogger
;
END_METHOD

METHOD PUBLIC InjectLogger
VAR_INPUT
_logger : IAxoLogger;
END_VAR

;
END_METHOD
CLASS TestContext EXTENDS AXOpen.Core.Dummies.MockAxoContext
METHOD PROTECTED OVERRIDE Main
;
END_METHOD
END_CLASS
{TestFixture}
{S7.extern=ReadWrite}
Expand Down
51 changes: 5 additions & 46 deletions src/components.balluff.identification/ctrl/test/Tests.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,11 @@ USING AXOpen.Logging;

NAMESPACE Tests
{S7.extern=ReadWrite}
CLASS TestContext IMPLEMENTS AXOpen.Core.IAxoContext
VAR
_openCounter : ULINT;
_closeCounter : ULINT;
END_VAR

METHOD PUBLIC Open : ULINT
_openCounter := _openCounter + ULINT#1;
END_METHOD

METHOD PUBLIC Close : ULINT
_closeCounter := _closeCounter + ULINT#1;
END_METHOD

METHOD PUBLIC CreateIdentity : ULINT
;
END_METHOD

METHOD PUBLIC OpenCycleCount : ULINT
OpenCycleCount := _openCounter;
END_METHOD

METHOD PUBLIC GetRtc : AXOpen.Rtc.IAxoRtc
;
END_METHOD

METHOD PUBLIC InjectRtc
VAR_INPUT
Rtc : IAxoRtc;
END_VAR

;
END_METHOD

METHOD PUBLIC GetLogger : IAxoLogger
;
END_METHOD

METHOD PUBLIC InjectLogger
VAR_INPUT
_logger : IAxoLogger;
END_VAR

;
END_METHOD
END_CLASS
CLASS TestContext EXTENDS AXOpen.Core.Dummies.MockAxoContext
METHOD PROTECTED OVERRIDE Main
;
END_METHOD
END_CLASS
{TestFixture}
{S7.extern=ReadWrite}
CLASS TestClass
Expand Down
51 changes: 5 additions & 46 deletions src/components.desoutter.tightening/ctrl/test/CVIIC_II_Tests.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,11 @@ USING AXOpen.Logging;

NAMESPACE Cylinder.Tests
{S7.extern=ReadWrite}
CLASS TestContext IMPLEMENTS AXOpen.Core.IAxoContext
VAR
_openCounter : ULINT;
_closeCounter : ULINT;
END_VAR

METHOD PUBLIC Open : ULINT
_openCounter := _openCounter + ULINT#1;
END_METHOD

METHOD PUBLIC Close : ULINT
_closeCounter := _closeCounter + ULINT#1;
END_METHOD

METHOD PUBLIC CreateIdentity : ULINT
;
END_METHOD

METHOD PUBLIC OpenCycleCount : ULINT
OpenCycleCount := _openCounter;
END_METHOD

METHOD PUBLIC GetRtc : AXOpen.Rtc.IAxoRtc
;
END_METHOD

METHOD PUBLIC InjectRtc
VAR_INPUT
Rtc : IAxoRtc;
END_VAR

;
END_METHOD

METHOD PUBLIC GetLogger : IAxoLogger
;
END_METHOD

METHOD PUBLIC InjectLogger
VAR_INPUT
_logger : IAxoLogger;
END_VAR

;
END_METHOD
END_CLASS
CLASS TestContext EXTENDS AXOpen.Core.Dummies.MockAxoContext
METHOD PROTECTED OVERRIDE Main
;
END_METHOD
END_CLASS
{TestFixture}
{S7.extern=ReadWrite}
CLASS AxoCVIC_II_Tests
Expand Down
51 changes: 5 additions & 46 deletions src/components.drives/ctrl/test/AxoDriveTests.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,11 @@ USING AXOpen.Logging;

NAMESPACE AxoDriveTests.Tests
{S7.extern=ReadWrite}
CLASS TestContext IMPLEMENTS AXOpen.Core.IAxoContext
VAR
_openCounter : ULINT;
_closeCounter : ULINT;
END_VAR

METHOD PUBLIC Open : ULINT
_openCounter := _openCounter + ULINT#1;
END_METHOD

METHOD PUBLIC Close : ULINT
_closeCounter := _closeCounter + ULINT#1;
END_METHOD

METHOD PUBLIC CreateIdentity : ULINT
;
END_METHOD

METHOD PUBLIC OpenCycleCount : ULINT
OpenCycleCount := _openCounter;
END_METHOD

METHOD PUBLIC GetRtc : AXOpen.Rtc.IAxoRtc
;
END_METHOD

METHOD PUBLIC InjectRtc
VAR_INPUT
Rtc : IAxoRtc;
END_VAR

;
END_METHOD

METHOD PUBLIC GetLogger : IAxoLogger
;
END_METHOD

METHOD PUBLIC InjectLogger
VAR_INPUT
_logger : IAxoLogger;
END_VAR

;
END_METHOD
END_CLASS
CLASS TestContext EXTENDS AXOpen.Core.Dummies.MockAxoContext
METHOD PROTECTED OVERRIDE Main
;
END_METHOD
END_CLASS

{TestFixture}
{S7.extern=ReadWrite}
Expand Down
59 changes: 7 additions & 52 deletions src/components.elements/ctrl/test/TestContext.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,13 @@ USING AXOpen.Logging;

NAMESPACE AxoIO.Tests
{S7.extern=ReadWrite}
CLASS TestContext IMPLEMENTS AXOpen.Core.IAxoContext
VAR
_openCounter : ULINT;
_closeCounter : ULINT;
_RtcMock : AxoRtcMock;
_LoggerMock : AxoLoggerMock;

END_VAR

var PUBLIC
CLASS TestContext EXTENDS AXOpen.Core.Dummies.MockAxoContext

VAR PUBLIC
SignalParent : AxoObject;
END_VAR

METHOD PUBLIC Open : ULINT
_openCounter := _openCounter + ULINT#1;
SignalParent.Initialize(this);
END_METHOD

METHOD PUBLIC Close : ULINT
_closeCounter := _closeCounter + ULINT#1;
END_METHOD

METHOD PUBLIC CreateIdentity : ULINT
;
END_METHOD

METHOD PUBLIC OpenCycleCount : ULINT
OpenCycleCount := _openCounter;
END_METHOD

METHOD PUBLIC GetRtc : AXOpen.Rtc.IAxoRtc
GetRtc := _RtcMock;
END_METHOD

METHOD PUBLIC InjectRtc
VAR_INPUT
Rtc : IAxoRtc;
END_VAR

;
END_METHOD

METHOD PUBLIC GetLogger : IAxoLogger
GetLogger := _LoggerMock;
END_METHOD

METHOD PUBLIC InjectLogger
VAR_INPUT
_logger : IAxoLogger;
END_VAR

;
END_METHOD
END_CLASS
METHOD PROTECTED OVERRIDE Main
;
END_METHOD
END_CLASS
END_NAMESPACE
51 changes: 5 additions & 46 deletions src/components.festo.drives/ctrl/test/AxoCmmtAsDriveTests.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,11 @@ USING AXOpen.Logging;

NAMESPACE AxoCmmtAsDriveTests.Tests
{S7.extern=ReadWrite}
CLASS TestContext IMPLEMENTS AXOpen.Core.IAxoContext
VAR
_openCounter : ULINT;
_closeCounter : ULINT;
END_VAR

METHOD PUBLIC Open : ULINT
_openCounter := _openCounter + ULINT#1;
END_METHOD

METHOD PUBLIC Close : ULINT
_closeCounter := _closeCounter + ULINT#1;
END_METHOD

METHOD PUBLIC CreateIdentity : ULINT
;
END_METHOD

METHOD PUBLIC OpenCycleCount : ULINT
OpenCycleCount := _openCounter;
END_METHOD

METHOD PUBLIC GetRtc : AXOpen.Rtc.IAxoRtc
;
END_METHOD

METHOD PUBLIC InjectRtc
VAR_INPUT
Rtc : IAxoRtc;
END_VAR

;
END_METHOD

METHOD PUBLIC GetLogger : IAxoLogger
;
END_METHOD

METHOD PUBLIC InjectLogger
VAR_INPUT
_logger : IAxoLogger;
END_VAR

;
END_METHOD
END_CLASS
CLASS TestContext EXTENDS AXOpen.Core.Dummies.MockAxoContext
METHOD PROTECTED OVERRIDE Main
;
END_METHOD
END_CLASS
{TestFixture}
{S7.extern=ReadWrite}
CLASS AxoCmmtAsDriveTests
Expand Down
Loading

0 comments on commit cad9f11

Please sign in to comment.