Skip to content

Commit

Permalink
refactor cms for SDK2311
Browse files Browse the repository at this point in the history
  • Loading branch information
sjuergen committed Feb 1, 2024
1 parent 4e26304 commit 7afc3c0
Show file tree
Hide file tree
Showing 16 changed files with 119 additions and 269 deletions.
8 changes: 0 additions & 8 deletions apax-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,5 @@
"version": "1.0.0",
"resolved": "https://npm.pkg.github.com/download/@simatic-ax/snippetscollection/1.0.0/60302d7e0da15a914ce0126503398063a42e1917",
"integrity": "sha512-8BNldIIGZuuLSiMjJxcBmHt7sL7kSlc0dss88BcrfnL/7iXPmHwhlnh4XobcVoOHXaz5f8cbMbXCUrffBIwecQ=="
},
"@simatic-ax/statemachine": {
"version": "5.0.0",
"resolved": "https://npm.pkg.github.com/download/@simatic-ax/statemachine/5.0.0/0fd13378ef5af659a4ef7301c32440f236d4761c",
"integrity": "sha512-JYrBAcecUQPZbEmQx3/AKmmJl6xoJ90P0cPIgjDFe3Iso7LbrBHlQecBSy2v27313Azu+1VSPRNHumcS9xCUFQ==",
"dependencies": {
"@ax/system-timer": "6.0.94"
}
}
}
1 change: 0 additions & 1 deletion apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ files:
dependencies:
"@ax/simatic-1500-clocks": 6.0.37
"@simatic-ax/simple-control-modules": 5.0.1
"@simatic-ax/statemachine": 5.0.0
"@simatic-ax/io": 5.0.0
"@ax/system-timer": 6.0.94
5 changes: 5 additions & 0 deletions src/Actuator/ActuatorStates.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NAMESPACE Simatic.Ax.axftcmlib
TYPE
ActuatorState : (Retracted, Activating, Activated, Retracting) := Retracted;
END_TYPE
END_NAMESPACE
61 changes: 61 additions & 0 deletions src/Actuator/ActuatorTimeBased.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
USING System.Timer;
USING Simatic.Ax.Io.Output;

NAMESPACE Simatic.Ax.axftcmlib

CLASS ActuatorTimeBased
EXTENDS ControlModuleAbstract
IMPLEMENTS IActuator
VAR PUBLIC
ControlPush : IBinOutput;
OnDuration : TIME;
END_VAR
VAR
_tonOnDuration : OnDelay;
_state : ActuatorState;
END_VAR

METHOD PROTECTED OVERRIDE _constructor
;
END_METHOD

METHOD PROTECTED OVERRIDE _runCyclicCustom
IF (ControlPush = NULL) THEN
THIS.SetError(WORD#16#8101);
RETURN;
ELSE
THIS.SetError(FALSE);
END_IF;
_tonOnDuration(signal := ControlPush.IsOn(), Duration := OnDuration);
CASE _state OF
ActuatorState#Retracted:
// IF ()
ControlPush.SetOff();
ActuatorState#Activating:
ControlPush.SetOn();
_state := ActuatorState#Activated;
ActuatorState#Activated:
IF (_tonOnDuration.output) THEN
_state := ActuatorState#Retracting;
ControlPush.SetOff();
END_IF;
ActuatorState#Retracting:
ControlPush.SetOff();
_state := ActuatorState#Retracted;
END_CASE;
END_METHOD

METHOD PUBLIC Enable
_state := ActuatorState#Activating;
END_METHOD

METHOD PUBLIC Disable
_state := ActuatorState#Retracted;
END_METHOD

METHOD PUBLIC GetState : ActuatorState
GetState := _state;
END_METHOD
END_CLASS

END_NAMESPACE
8 changes: 8 additions & 0 deletions src/Actuator/IActuator.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NAMESPACE Simatic.Ax.axftcmlib
INTERFACE IActuator
METHOD Enable END_METHOD
METHOD Disable END_METHOD
METHOD GetState : ActuatorState
END_METHOD
END_INTERFACE
END_NAMESPACE
29 changes: 29 additions & 0 deletions src/ControlModuleAbstract.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ NAMESPACE Simatic.Ax.axftcmlib
END_VAR
VAR PROTECTED
_init : BOOL;
_hasError : BOOL;
_errorState : WORD;
END_VAR

METHOD PUBLIC RunCyclic
Expand All @@ -25,6 +27,33 @@ NAMESPACE Simatic.Ax.axftcmlib
METHOD PROTECTED ABSTRACT _constructor

END_METHOD

METHOD PROTECTED SetError
VAR_INPUT
ErrorCode : WORD;
END_VAR
_errorState := ErrorCode;
_hasError := TRUE;
;
END_METHOD

METHOD PROTECTED SetError
VAR_INPUT
Set : BOOL;
END_VAR
_hasError := Set;
;
END_METHOD

// control module has an error
METHOD PUBLIC HasError : BOOL;
HasError := _hasError;
END_METHOD

METHOD PUBLIC GetErrorStatus : WORD
GetErrorStatus := _errorState;
END_METHOD

END_CLASS

END_NAMESPACE
12 changes: 0 additions & 12 deletions src/Cylinder/IPneumaticCylinder.st

This file was deleted.

114 changes: 0 additions & 114 deletions src/Cylinder/PneumaticCylinder.st

This file was deleted.

11 changes: 0 additions & 11 deletions src/Cylinder/StatePushed.st

This file was deleted.

16 changes: 0 additions & 16 deletions src/Cylinder/StatePushing.st

This file was deleted.

14 changes: 0 additions & 14 deletions src/Cylinder/StateRetract.st

This file was deleted.

11 changes: 0 additions & 11 deletions src/Cylinder/StateRetracted.st

This file was deleted.

18 changes: 0 additions & 18 deletions src/Guards/BinSignalRiseGuard.st

This file was deleted.

21 changes: 0 additions & 21 deletions src/Guards/PLCOpentateGuard.st

This file was deleted.

Loading

0 comments on commit 7afc3c0

Please sign in to comment.