You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+70-26Lines changed: 70 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,39 @@
1
1
# PLCopen Snippets
2
2
3
3
The following block-template snippets for AX Code are based on the
4
-
PLCopen standard **'Function Blocks for Motion Control' V2.0** which can also be found in the LGF library for TIA Portal [here](https://support.industry.siemens.com/cs/ww/en/view/109479728).
4
+
PLCopen-like standard **'Function Blocks for Motion Control' V2.0** which can also be found in the LGF library for TIA Portal [here](https://support.industry.siemens.com/cs/ww/en/view/109479728).
5
5
6
-
Besides this collection consists of 6 PLCopen snippets (3x "Execute"-variants / 3x "Enable"-variants) we also added 4x basic FC's and 4x basic FB's variants inspired by PLCopen that should emphasise you to build more predictable block interfaces.
6
+
This collection consists of 6x PLCopen FB code-snippets (3x "Execute"-variants / 3x "Enable"-variants) plus 2x complementary structured-types. We also added 4x basic FC's and 4x basic FB's variants inspired by PLCopen, which in addition should emphasise you to build more predictable blocks(interfaces) with standardized execution behaviours.
7
+
These vscode snippets gives you a head-start in content creation for your very own SIMATIC AX library or application.
7
8
9
+
## About: PLCopen <br/>
10
+
*"The PLCopen organization has defined a standard for Motion Control blocks. This standard can be generalized in that way, that it can be applied to all asynchronous blocks. Asynchronous means in this context, that the execution of the function inside the block extends over multiple (more than one) execution cycles of the PLC, e.g. for communication, closed loop control or motion control applications."*
8
11
<br/>
9
12
<br/>
10
13
11
-
## Install the snippets collection
14
+
### A function block with an **"enable"** - behaviour:
15
+
*"Blocks which are started and initialized only once and afterwards remain in operation to respond to inputs have an "enable" input parameter.
16
+
Example: A communication block (acting as server) waits after initialization for incoming connection requests from a client. After a successful data exchange the server waits for other incoming connection requests.
17
+
Setting the parameter "enable" starts the execution of an asynchronous task. If "enable" remains set, the task execution remains active and new values are being accepted and processed.
18
+
Resetting the parameter "enable" will shut down the working state of the block."*
### A function block with an **"execute"** - behaviour:
26
+
*"Blocks, which get executed only once have an input parameter "execute".
27
+
Example: A communication block (client) requests data of a server only once. This is triggered by an edge at the input signal "execute". After the processing the reply the execution is done. A new request is placed by another edge on "execute". A rising edge on "execute" starts the task and the values at the input parameters are applied.
28
+
Any changes to the values after the start of the task only take effect after a start of a new task, unless "continuousUpdate" is being used.
29
+
The reset of the parameter "execute" does no stop the execution of the current task but has an influence on the display duration of the execution status. If "execute" gets reset before the current task has finished, then the parameter "done", "error" and "commandAborted" will be set for only one cycle."*
Before installing the snippets collection, the URL to the package registry need to be defined in the apax.yml
14
39
@@ -17,47 +42,60 @@ registries:
17
42
'@simatic-ax': 'https://npm.pkg.github.com/'
18
43
```
19
44
20
-
To install the snippets collection to your workspace enter the following command in a terminal:
45
+
Install the snippets collection to your workspace by entering the following command in a terminal:
21
46
22
47
```bash
23
48
apax add @simatic-ax/plcopen-snippets --dev
24
49
```
25
50
26
-
> To install this package you need to login into the GitHub registry. You'll find more information [here](https://github.com/simatic-ax/.sharedstuff/blob/main/doc/personalaccesstoken.md).
27
-
> Installing snippet-packages to your project / ax code-instance may cause you to restart the IDE in order to make them work for the intellicense.
51
+
> - For installing this package you need to login into the GitHub registry. You'll find more information [here](https://github.com/simatic-ax/.sharedstuff/blob/main/doc/personalaccesstoken.md).
52
+
> -Installing snippet-packages to your project / ax code-instance may cause you to restart the IDE in order to make them work for the intellicense.
28
53
29
54
<br/>
30
55
<br/>
31
56
32
-
## Insert PLCopen block templates
33
-
34
-
Available variants:
57
+
## Use PLCopen block templates
58
+
You can use the intellicense in the scope of a .st file to make use of the snippets. <br>
59
+
Just start typing-in the following available variants:
- all variants consists of the corresponding statemachines, all its needed variables and an proper error/ output-handling
47
-
- all *"_adv"* variants have an additional diagnostic-structure handling holding on to the block last error info
72
+
- all *"#_adv"* variants have an additional diagnostic-structure handling holding on to the block last error info
48
73
- the *"3_adv"* variant adds a frame to abort the enable/execute statemachines beforehand
74
+
75
+
Complementary plc-types: <br>
49
76
50
-
<detailsopen>
51
-
<summary>Show Output example:</summary>
77
+
```json
78
+
"type, plcopen," : ["Diagnostics struct"]
79
+
```
80
+
81
+
```json
82
+
"type, plcopen," : ["FbStates enum"]
83
+
```
84
+
These types can be used to complete a clean block & type plcopen construct. After insertion you easily can change the name and it's type-references in the block-templates by
85
+
86
+
<detailsclose>
87
+
<summary>Show usage example:</summary>
52
88
53
-

89
+

54
90
55
91
</details>
56
-
<br/>
57
92
58
-
## Insert general block templates
93
+
<br/>
94
+
<br/>
59
95
60
-
Available variants:
96
+
## Use general block templates
97
+
You can use the intellicense in the scope of a .st file to make use of the snippets. <br>
98
+
Just start typing-in the following available variants:
- the *"3_simple"* variant additional have a subfunction block-status info
75
113
- the *"4_adv"* variant have an additional diagnostic-structure handling holding on to the block last error info
76
114
77
-
<detailsopen>
78
-
<summary>Show Output example:</summary>
115
+
<detailsclose>
116
+
<summary>Show usage example:</summary>
79
117
80
-

118
+

81
119
82
120
</details>
83
121
<br/>
84
122
<br/>
85
123
86
-
## Notes from the developer
124
+
# Notes from the developer
125
+
126
+
BEWARE !
127
+
- This package currently has no ST OOP content
128
+
- This package only ships .json vs-code snippet files that work for .st files
129
+
- The code-snippets follow our [SIMATIC AX style-guide](https://console.simatic-ax.siemens.io/docs/st-styleguide) for ST-programming
130
+
- The snippets may or may not include TIAX restrictions, which unfortunatly cause unwanted transformations or compile errors using it blank in "AX2TIA" library-projects, that used to be converted to TIA Portal. Please always check back the latest [news](https://console.simatic-ax.siemens.io/docs/ax2tia/restrictions) on these restrictions. There are no workarounds implemented.
131
+
<br>
87
132
88
-
BEWARE ! This package has no ST OOP content and currently include TIAX restrictions, which unfortunatly will cause compile errors using it blank in "AX2TIA" projects. Otherwise it's fine. <br>
89
-
We are working on it.
133
+
Happy coding ...
90
134
91
135
🐱💻 BEEP, BOOP, BEEP, BEEP, BOOP 🐱🏍
92
136
93
137
<br/>
94
138
<br/>
95
139
96
-
##Contribution
140
+
# Contribution
97
141
98
-
Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the "Issues" section or, even better, is free to propose any changes to this repository using "Merge-Requests".
142
+
Thanks for your interest in contributing. Anybody is free to report bugs, improvements, unclear documentation, and other problems regarding this repository in the "Issues" section ... or, even better, is free to propose any changes to this repository using "Merge-Requests". The CODEOWNERS will take care.
0 commit comments