Skip to content

Commit 5343a29

Browse files
authored
Merge pull request #44 from simatic-ax/SDK_2311_integration
Sdk 2311 integration
2 parents 3d2756b + 7edeb0d commit 5343a29

13 files changed

Lines changed: 858 additions & 442 deletions

.vs/slnx.sqlite

-88 KB
Binary file not shown.

apax-lock.json

Lines changed: 704 additions & 395 deletions
Large diffs are not rendered by default.

apax.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: Library to create state machines according an OOP state pattern
88
type: lib
99
targets:
1010
- '1500'
11-
- 'axunit-llvm'
11+
- 'llvm'
1212
# URL to repository
1313
repository:
1414
type: git
@@ -29,7 +29,7 @@ scripts:
2929
- apax pack
3030
# Dependencies
3131
devDependencies:
32-
'@ax/sdk': 4.0.2
32+
'@ax/sdk': 2311.0.1
3333
"@simatic-ax/snippetscollection": 0.1.3
3434
dependencies:
3535
"@ax/system-timer": 6.0.94
@@ -43,3 +43,5 @@ files:
4343
- 'doc'
4444
- 'src' # ship library with source
4545
# - 'bin/1500/' # ship library with binary
46+
installStrategy: strict
47+
apaxVersion: 3.1.0

src/StateFramework/State/StateController.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ NAMESPACE Simatic.Ax.StateFramework
141141
EXIT;
142142
END_IF;
143143
END_FOR;
144+
ELSE
145+
_status := StateControllerStatus#STATUS_NO_TRANSITION;
146+
RETURN;
144147
END_IF;
145148
_status := StateControllerStatus#STATUS_IS_RUNNING;
146149
// TODO action will be called after OnExit --> has to be changed

src/StateFramework/State/StateControllerStatus.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ NAMESPACE Simatic.Ax.StateFramework
55
STATUS_IS_RUNNING := WORD#16#7001,
66
STATUS_STATE_CHANGED := WORD#16#7002,
77
STATUS_NO_INITIALSTATE := WORD#16#8100,
8-
STATUS_NO_NEXTSTATE := WORD#16#8101
8+
STATUS_NO_NEXTSTATE := WORD#16#8101,
9+
STATUS_NO_TRANSITION := WORD#16#8102
910
) := STATUS_NO_ERR;
1011
END_TYPE
1112
END_NAMESPACE

test/Assert.st

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
USING Simatic.Ax.Stateframework;
22

33
NAMESPACE AxUnit.Assert
4-
FUNCTION Equal
5-
VAR_INPUT
6-
expected: StateControllerStatus;
7-
actual: StateControllerStatus;
8-
END_VAR
9-
Equal(expected := TRUE, actual := expected = actual);
10-
END_FUNCTION
4+
115

126
FUNCTION Equal
137
VAR_INPUT
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
USING Simatic.Ax.StateFramework;
2+
USING AxUnit.ResultFunctions;
3+
USING System.Strings;
4+
5+
NAMESPACE AxUnit.Assert
6+
FUNCTION PUBLIC Equal2
7+
VAR_INPUT
8+
expected : StateControllerStatus;
9+
actual : StateControllerStatus;
10+
{CallerFilePath}
11+
file : WSTRING[1024];
12+
{CallerLineNumber}
13+
line : INT;
14+
END_VAR
15+
16+
IF actual = expected THEN
17+
axunit_Succeed();
18+
ELSE
19+
;
20+
axunit_Fail(Concat('Expected ', ToString(expected), ', but found ', ToString(actual)), file, line);
21+
END_IF;
22+
23+
END_FUNCTION
24+
25+
FUNCTION INTERNAL ToString : STRING
26+
VAR_INPUT
27+
actual : StateControllerStatus;
28+
END_VAR
29+
IF (actual = StateControllerStatus#STATUS_NO_ERR) THEN
30+
ToString := 'STATUS_NO_ERR';
31+
ELSIF (actual = StateControllerStatus#STATUS_IS_RUNNING) THEN
32+
ToString := 'STATUS_IS_RUNNING';
33+
ELSIF (actual = StateControllerStatus#STATUS_STATE_CHANGED) THEN
34+
ToString := 'STATUS_STATE_CHANGED';
35+
ELSIF (actual = StateControllerStatus#STATUS_NO_INITIALSTATE) THEN
36+
ToString := 'STATUS_NO_INITIALSTATE';
37+
ELSIF (actual = StateControllerStatus#STATUS_NO_NEXTSTATE) THEN
38+
ToString := 'STATUS_NO_NEXTSTATE';
39+
END_IF;
40+
;
41+
END_FUNCTION
42+
END_NAMESPACE

test/StateFramework/Guards/GuardTest.st

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ NAMESPACE Simatic.Ax.StateFramework.Test
88
CLASS CountGuardTest
99
VAR
1010
_guard : Simatic.Ax.StateFramework.CountGuard;
11+
_guardStateless : Simatic.Ax.StateFramework.CountGuard;
1112
END_VAR
1213

14+
{TestSetup}
15+
METHOD PUBLIC MyTestSetup
16+
// Will be called before each test
17+
_guard := _guardStateless;
18+
END_METHOD
19+
1320
{Test}
1421
METHOD PUBLIC TestCheck_Two_Times_Expect_TRUE
1522
_guard.Count := 2;

test/StateFramework/Transitions/TestState1Transition.st

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@ NAMESPACE Simatic.Ax.StateFramework.Test
55
{TestFixture}
66
CLASS TestTransition1
77
VAR
8-
state1 : State1Transition := (StateId := 99, StateName := 'blabla');
8+
state1 : State1Transition;
9+
state1StateLess : State1Transition := (StateId := 99, StateName := 'blabla');
910
trans : Transition;
1011
END_VAR
1112

13+
14+
{TestSetup}
15+
METHOD PUBLIC MyTestSetup
16+
// Will be called before each test
17+
state1 := state1StateLess;
18+
END_METHOD
19+
1220
{Test}
1321
METHOD PUBLIC TransitionCount_Expect_0
1422
Equal(expected := UINT#0, actual := state1.TransitionCount());

test/StateFramework/Transitions/TestState2Transition.st

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,17 @@ NAMESPACE Simatic.Ax.StateFramework.Test
66
CLASS TestTransition2
77
VAR
88
state2 : State2Transition;
9+
state2StateLess : State2Transition;
910
trans1 : Transition;
1011
trans2 : Transition;
1112
END_VAR
1213

14+
{TestSetup}
15+
METHOD PUBLIC MyTestSetup
16+
// Will be called before each test
17+
state2 := state2StateLess;
18+
END_METHOD
19+
1320
{Test}
1421
METHOD PUBLIC Set_no_trans_And_Expect_0
1522
Equal(expected := UINT#0, actual := state2.TransitionCount());

0 commit comments

Comments
 (0)