Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemt axis concept #28

Merged
merged 8 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ first-line-h1: false
no-emphasis-as-header: false
MD024:
allow_different_nesting: true
siblings_only: true
siblings_only: true
MD036: false
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These owners will be the default owners for everything in the repo.
# Unless a later match takes precedence, the listed user will be
# requested for review when someone opens a pull request.
# * @michijudge @sjuergen
# * @sjuergen
60 changes: 47 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,66 @@ Simatic.Ax.axftcmlib

## Classes

### Class PneumaticCylinder
## ControlModuleAbstract

This is a base class for all control modules

```mermaid
---
title: ControlModuleAbstract
---
classDiagram
ExecuteCommand <|-- ControlModuleAbstract
class ControlModuleAbstract{
+WORD GetErrorStatus()
}
class ExecuteCommand{
+BOOL Busy()
+BOOL Done()
+BOOL Error()
+WORD ErrorID()
}
```

PneumaticCylinder (*Note: Needs an active compressor to function with the model)
### Class ActuatorTimeBased

```mermaid
---
title: ActuatorTimeBased
---
classDiagram
ControlModuleAbstract <|-- ActuatorTimeBased
class ControlModuleAbstract{
+WORD GetErrorStatus()
}
class ActuatorTimeBased{
+QControl : IBinOutput;
+OnDuration : TIME;
+itfCommand Start()
}
```

|Method|Description|
|-|-|
|PneumaticCylinderPush()|Cylinder pushes|
|PneumaticCylinderRetract()|Cylinder retracts|
|Start()| Activates StateMachine and executes it once|
|Start()|Actuator will be activated for the time `OnDuration`|

<details><summary>Example for the class Cylinder ... </summary>

```iec-st
VAR_GLOBAL
SortingLineValveEjector : BOOL; //Actual PLC-variable
CylinderOutputWriter : BinOutput; //Used to write on the PLC-variable
CylinderClassInstance : PneumaticCylinder := (CoilPushing := CylinderOutputWriter); //Class instance initialized with the needed OutputWriter
EnableCylinder : BOOL;
Actuator : ActuatorTimeBased := (QControl := Q_Actuator) ;
Q_Actuator : BinOutput;
DQ : BOOL;
END_VAR

PROGRAM
CylinderClassInstance.RunCyclic(); //Class Setup-> needs to be called in every cycle
IF (EnableCylinder) THEN
CylinderClassInstance.Start(); // start pushing the cylinder for a configured time
cmd := Actuator.Start();
IF NOT(cmd.Busy()) THEN
IF (cmd.Done()) THEN
; // your code
END_IF;
END_IF;
CylinderOutputWriter.WriteCyclic(Q => SortingLineValveEjector); //Writing on the Actual PLC-variable ->needs to be called in every cycle
DQ := Q_Actuator.Q(); // True if actuator is active
END_PROGRAM

```
Expand Down
174 changes: 90 additions & 84 deletions apax-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"@simatic-ax/io": "6.0.0",
"@ax/system-timer": "7.0.17",
"@simatic-ax/commands": "1.0.0",
"@simatic-ax/statemachine": "^6.0.1"
"@simatic-ax/statemachine": "^6.0.1",
"@simatic-ax/types": "^1.0.0"
},
"devDependencies": {
"@ax/sdk": "2405.0.0",
Expand Down Expand Up @@ -50,16 +51,15 @@
},
"@ax/axunitst": {
"name": "@ax/axunitst",
"version": "5.1.23",
"integrity": "sha512-SAfV92MvnhERKpyZ3rH3gh91ymcrhvU3CRaezbuyVFt2HhZblR/4heF+wQ4mC+dj0Z1U4NHrCiyN1R0N7VuNkg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst/-/axunitst-5.1.23.tgz",
"version": "5.2.6",
"integrity": "sha512-j2gfKb3tperrm4aRuFWlh0dvvqBya055+FiIo0PJyIT7bRlNLTgu0OSRulObAUn9rJBZL8OkOmGjz2Wsz9gipA==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst/-/axunitst-5.2.6.tgz",
"dependencies": {
"@ax/axunitst-library": "5.1.23",
"@ax/axunitst-test-director": "5.1.23",
"@ax/axunitst-docs": "5.1.23",
"@ax/axunitst-library": "5.2.6",
"@ax/axunitst-test-director": "5.2.6",
"@ax/axunitst-docs": "5.2.6",
"@ax/build-native": "16.0.3"
},
"deprecated": ""
}
},
"@simatic-ax/snippetscollection": {
"name": "@simatic-ax/snippetscollection",
Expand Down Expand Up @@ -117,6 +117,13 @@
"@ax/system-timer": "7.0.17"
}
},
"@simatic-ax/types": {
"name": "@simatic-ax/types",
"version": "1.0.0",
"integrity": "sha512-E8yKADC1HQAIpEAGNDmr4LQkijtlkUHcOwDNDCiUpG2Eyck3eib2dGsQoBdyDk8fQjBsMm1imYeq81Xw3S7Xaw==",
"resolved": "https://npm.pkg.github.com/download/@simatic-ax/types/1.0.0/8d5234b7b6cab437eb92be9fc3f0ae6715514701",
"dependencies": {}
},
"@ax/apax-build": {
"name": "@ax/apax-build",
"version": "1.0.0",
Expand Down Expand Up @@ -293,30 +300,29 @@
},
"@ax/axunitst-library": {
"name": "@ax/axunitst-library",
"version": "5.1.23",
"integrity": "sha512-0D0FFFqVLHgHDDSde8xZJx84Zvx4YnoGmxcq+H0x1D9hEwJIsOVQFSVsmR4MfomNNaE5840kQ5rMh9gR0FRR5Q==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-library/-/axunitst-library-5.1.23.tgz",
"version": "5.2.6",
"integrity": "sha512-j411mz5F1NKscxVXRLD6bDPYfDDPOsmQbneQqXHZVWfyzymoyYDn8biWjWKgmliGdHzgMsg1SxDYb7qcGz99dA==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-library/-/axunitst-library-5.2.6.tgz",
"dependencies": {
"@ax/system-strings": "^7.0.17"
}
},
"@ax/axunitst-test-director": {
"name": "@ax/axunitst-test-director",
"version": "5.1.23",
"integrity": "sha512-ezbqpJdHyU7ig8cfiAtvb90CkAEhQVbmki1XPnCaS4XStixao0sTa06qcfLzzYZC2EVa1CxzRIfgXtyHgu+nMQ==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-test-director/-/axunitst-test-director-5.1.23.tgz",
"version": "5.2.6",
"integrity": "sha512-sVo6jaiyedRul6MOJnjBKAzKwBF/g6y6kFq5l0mQzQtr4ek5d0Wj/E0XcrVIRSfq9/jvCaLFfkNt/ae+5gda9w==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-test-director/-/axunitst-test-director-5.2.6.tgz",
"dependencies": {
"@ax/axunitst-test-director-linux-x64": "5.1.23",
"@ax/axunitst-test-director-win-x64": "5.1.23"
"@ax/axunitst-test-director-linux-x64": "5.2.6",
"@ax/axunitst-test-director-win-x64": "5.2.6"
}
},
"@ax/axunitst-docs": {
"name": "@ax/axunitst-docs",
"version": "5.1.23",
"integrity": "sha512-nUjL4G8k0d+JKVSy+/alN947dZOgITDagj4uKSAnFib+BfyqDJsuX4afzv8hizUMpGTlepDODhVYJ75DMvu/Ug==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-docs/-/axunitst-docs-5.1.23.tgz",
"dependencies": {},
"deprecated": ""
"version": "5.2.6",
"integrity": "sha512-G6VNc9uiytIeuu1vG8YzsgYlLG/7BMsjv4CR/SIVFsqRhFMNQO2xTLte2DoZiD2DfhTjYwuExo1hRhCBuLfssQ==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-docs/-/axunitst-docs-5.2.6.tgz",
"dependencies": {}
},
"@ax/build-native": {
"name": "@ax/build-native",
Expand All @@ -328,68 +334,6 @@
"@ax/build-native-linux": "16.0.3"
}
},
"@ax/system-strings": {
"name": "@ax/system-strings",
"version": "7.0.17",
"integrity": "sha512-xrT2GzVqeTXVF5Nq7wXKwYTb9FqIV3F5DWWGGEUwZvrm5t2unyFqsBDXoFBWDicPuhUFaH0FUwp1NqvMSN95pQ==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/system-strings/-/system-strings-7.0.17.tgz",
"dependencies": {
"@ax/system-math": "7.0.17",
"@ax/system-datetime": "7.0.17"
}
},
"@ax/axunitst-test-director-linux-x64": {
"name": "@ax/axunitst-test-director-linux-x64",
"version": "5.1.23",
"integrity": "sha512-vHEj+8zr5nsfg6tSC5dVLqYVgTtusYW9O0Rkx02ttiPdJa3seRcNgqMDmgdFp1QAb/YcsmhOTohWbvi8cPQcHg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-test-director-linux-x64/-/axunitst-test-director-linux-x64-5.1.23.tgz",
"os": [
"linux"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/axunitst-test-director-win-x64": {
"name": "@ax/axunitst-test-director-win-x64",
"version": "5.1.23",
"integrity": "sha512-J/QImr7Fa9Gk+y+df9gp3md0f57HqsEOTdU/19yrOCvQ077PNjs4zl4E2uzWFlVbYo0Cer3JrL/8ARIXuKedpA==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-test-director-win-x64/-/axunitst-test-director-win-x64-5.1.23.tgz",
"os": [
"win32"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/build-native-winx64": {
"name": "@ax/build-native-winx64",
"version": "16.0.3",
"integrity": "sha512-M1qk2yNNsGzz6NXKB0miyfOO4bpYkVcfnGhkHirXcJSLFnWDSx7hnRi0yhLp6jny99RkXEcRn9Cwx8lqynmUDg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/build-native-winx64/-/build-native-winx64-16.0.3.tgz",
"os": [
"win32"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/build-native-linux": {
"name": "@ax/build-native-linux",
"version": "16.0.3",
"integrity": "sha512-CfqbzR+wPnocP0+pDpb3cYBxdefkS6WvHbGaDNGAoCkK3Y8WnNfWbxXr37e5XIi7iPMZ8BONWaRFIN5h4RMeOA==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/build-native-linux/-/build-native-linux-16.0.3.tgz",
"os": [
"linux"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/simatic-package-tool": {
"name": "@ax/simatic-package-tool",
"version": "1.0.3",
Expand Down Expand Up @@ -754,6 +698,68 @@
"dependencies": {},
"deprecated": ""
},
"@ax/system-strings": {
"name": "@ax/system-strings",
"version": "7.0.17",
"integrity": "sha512-xrT2GzVqeTXVF5Nq7wXKwYTb9FqIV3F5DWWGGEUwZvrm5t2unyFqsBDXoFBWDicPuhUFaH0FUwp1NqvMSN95pQ==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/system-strings/-/system-strings-7.0.17.tgz",
"dependencies": {
"@ax/system-math": "7.0.17",
"@ax/system-datetime": "7.0.17"
}
},
"@ax/axunitst-test-director-linux-x64": {
"name": "@ax/axunitst-test-director-linux-x64",
"version": "5.2.6",
"integrity": "sha512-FQo2kcqxf6JoPWVZJbO43E1V2yJWrawWajHR+NKdMaAwXWsraH5AFmYKMmbQqiodCW6jBdQ/5dBOivGa0hmuSw==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-test-director-linux-x64/-/axunitst-test-director-linux-x64-5.2.6.tgz",
"os": [
"linux"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/axunitst-test-director-win-x64": {
"name": "@ax/axunitst-test-director-win-x64",
"version": "5.2.6",
"integrity": "sha512-9gnw1YUW0Jfdpreha7g1GmgFYjhwufPHcSiDKzI/wpozzJYCqc25W9rmkKK0ROcY2X9hMb56kQE0h4O/+ufOWQ==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/axunitst-test-director-win-x64/-/axunitst-test-director-win-x64-5.2.6.tgz",
"os": [
"win32"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/build-native-winx64": {
"name": "@ax/build-native-winx64",
"version": "16.0.3",
"integrity": "sha512-M1qk2yNNsGzz6NXKB0miyfOO4bpYkVcfnGhkHirXcJSLFnWDSx7hnRi0yhLp6jny99RkXEcRn9Cwx8lqynmUDg==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/build-native-winx64/-/build-native-winx64-16.0.3.tgz",
"os": [
"win32"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/build-native-linux": {
"name": "@ax/build-native-linux",
"version": "16.0.3",
"integrity": "sha512-CfqbzR+wPnocP0+pDpb3cYBxdefkS6WvHbGaDNGAoCkK3Y8WnNfWbxXr37e5XIi7iPMZ8BONWaRFIN5h4RMeOA==",
"resolved": "https://registry.simatic-ax.siemens.io/@ax/build-native-linux/-/build-native-linux-16.0.3.tgz",
"os": [
"linux"
],
"cpu": [
"x64"
],
"dependencies": {}
},
"@ax/system-math": {
"name": "@ax/system-math",
"version": "7.0.17",
Expand Down
2 changes: 2 additions & 0 deletions apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ dependencies:
"@ax/system-timer": 7.0.17
"@simatic-ax/commands": 1.0.0
"@simatic-ax/statemachine": ^6.0.1
"@simatic-ax/types": ^1.0.0
# "@ax/simatic-1500-technology-objects": ^0.1.52
installStrategy: overridable
26 changes: 9 additions & 17 deletions src/Actuator/ActuatorTimeBased.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ USING Simatic.Ax.Io.Output;

NAMESPACE Simatic.Ax.axftcmlib
CLASS ActuatorTimeBased
EXTENDS ControlModuleAbstract
EXTENDS ExecuteControlModuleAbstract
IMPLEMENTS IActuator
VAR PUBLIC
ControlPush : IBinOutput;
QControl : IBinOutput;
OnDuration : TIME;
END_VAR
VAR
Expand All @@ -20,44 +20,36 @@ NAMESPACE Simatic.Ax.axftcmlib
END_METHOD

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

METHOD PUBLIC Start : itfCommand
THIS.InitState();
THIS.Enable();
Start := THIS;
END_METHOD

METHOD PUBLIC Enable
_state := ActuatorState#Activating;
END_METHOD

METHOD PUBLIC Disable
_state := ActuatorState#Retracted;
Start := THIS;
END_METHOD

METHOD PUBLIC GetState : ActuatorState
Expand Down
Loading
Loading