Skip to content

Commit 5040acd

Browse files
committed
inital commit
1 parent 1bcd88d commit 5040acd

File tree

13 files changed

+331
-98
lines changed

13 files changed

+331
-98
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
/.vscode/
44
bin
55
obj
6-
testresult
6+
testresult
7+
*.tgz

CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# These owners will be the default owners for everything in the repo.
2-
# Unless a later match takes precedence, the listed user will be
1+
# These owners will be the default owners for everything in the repo.
2+
# Unless a later match takes precedence, the listed user will be
33
# requested for review when someone opens a pull request.
4-
# * @global-user1 @global-user2 @global-user1
4+
@christof.ochs @KPirmer

README.md

Lines changed: 17 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,36 @@
1-
# @simatic-ax/sinamics-drive-functions
1+
# Simatic.Ax.Sinamics
22

3-
## Description
4-
5-
*please insert a description of the library*
3+
This package contains functionality for handling drive functions such as moving an axis with a given speed or to a target position (EPOS).
64

75
## Getting started
86

97
Install with Apax:
108

11-
> If not yet done login to the GitHub registry first.
12-
> More information you'll find [here](https://github.com/simatic-ax/.github/blob/main/docs/personalaccesstoken.md)
13-
149
```cli
1510
apax add @simatic-ax/sinamics-drive-functions
1611
```
1712

1813
Add the namespace in your ST code:
1914

2015
```iec-st
21-
Using sinamics-drive-functions;
16+
USING Simatic.Ax.Sinamics
2217
```
2318

24-
## Library functionality
25-
26-
| Classes | Description |
27-
|---------|---------------------|
28-
| *xyz* | *description for xyz* |
29-
30-
| Functions | Description |
31-
|-------------|-------------------------|
32-
| *xyz* | *description for *xyz** |
33-
34-
| Function Blocks | Description |
35-
|-----------------|-----------------------|
36-
| *xyz* | *description for xyz* |
37-
38-
## Folder structure
39-
```bash
40-
sinamics-drive-functions
41-
|
42-
+- .github
43-
| | # GitHub workflows for maintaining the library
44-
| |- package-development-workflow.yml
45-
| |- package-release-workflow.yml
46-
|
47-
+- docs
48-
| | # the place for additional user-documentation
49-
| |- MyClass.md
50-
|
51-
+- snippets
52-
| | # may contain helpful snippets for using the library
53-
| |- namespacesupport.json
54-
| |- usingNamespace.json
55-
|
56-
+- src
57-
| | # adjust and add library src files here
58-
| |- myClass.st
59-
|
60-
+- test
61-
| | # adjust and add test-programs here
62-
| |- dummy.st
63-
|
64-
| # additional meta-information for GitHub/-workflows
65-
|- .gitattributes
66-
|- .gitignore
67-
|
68-
| # settings file for activating the renovate-bot
69-
|- renovate.json
70-
|
71-
| # adjust the project description file / add apax-scripts
72-
|- apax.yml
73-
|
74-
| # essential git project files, pls. adjust
75-
|- CODEOWNERS
76-
|- README.md
77-
|- LICENSE.md #do not change!
78-
```
19+
## Functions
7920

80-
## Contribution
21+
| Function Blocks | Description |
22+
| ------------------------------------------- | ---------------------------------------------------------------------- |
23+
| [SinaSpeed](./docs/function_blocks/sinaspeed.md) | Moves an axis with a given speed via telegram 1 |
24+
| [SinaPos](./docs/function_blocks/sinapos.md) | Controls an axis via the basic positioner technology from SINAMICS S/G |
8125

82-
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 a pull request.
26+
Please refer to the documentation from SIOS [Blocks for activating SINAMICS drive functions with SIMATIC S7-1200/1500](https://support.industry.siemens.com/cs/ar/en/view/109475044), for further information about description and functionality of these blocks. Additionally for the drive functions and used telegrams also refer to the respective manual for each drive system [Landing page for SINAMICS drive functions](https://support.industry.siemens.com/cs/do/en/view/109781535).
8327

84-
## License and Legal information
28+
## Additional information
8529

86-
Please read the [Legal information](LICENSE.md)
30+
> NOTE
31+
>
32+
> No implementation for target `llvm` are provided, ensure that all necessary functionality is mocked in unit tests.
33+
<!-- -->
34+
> NOTE
35+
>
36+
> This implementation of SinaSpeed and SinaPos for SIMATIC AX has been only validated on a SINAMICS S120 drive system. Other SINAMICS drive system from the G and S series have not been tested, but should be compatible in general.

apax.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# General information
22
name: "sinamics-drive-functions"
3-
version: 0.0.0-placeholder
3+
version: 1.0.0
44
author: Siemens AG
55

66
# Description will be displayed in the apax extension
7-
description: <add your description here, which will be shown in the apax extension>
7+
description: This library contains several implementations of drive functions (SINA_POS, SINA_SPEED) known from TIAP.
88
type: lib
99

10+
keywords:
11+
- SINAMICS
12+
- SINA_SPEED
13+
- SINA_POS
14+
1015
#URL to the repository
1116
repository:
1217
type: git
@@ -28,9 +33,11 @@ publicKeys:
2833
"@simatic-ax": "3792a7e926775425ccdd29ceed8c368c3008b5b33d7d5550b3cb1f58093e1dff"
2934

3035
# Dependencies
36+
dependencies:
37+
"@ax/simatic-1500-distributedio": 10.0.1
38+
3139
devDependencies:
3240
'@ax/sdk': ^2504.0.0
33-
"@simatic-ax/snippetscollection": ^1.0.0
3441

3542
# Project variables
3643
variables:
@@ -43,7 +50,6 @@ files:
4350
- 'LICENSE.md'
4451
- 'docs'
4552
- 'bin'
46-
- 'snippets'
4753

4854
# Catalog to be intalled
4955
catalogs:

docs/MyClass.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/function_blocks/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Function Blocks

docs/function_blocks/sinapos.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# SinaPos
2+
3+
You use the function block `SinaPos` to control the axis via basic positioner technology function (EPOS) of SINAMICS drive systems. This requires that the basic positioner technology has been properly configured and telegram 111 has been selected in the drive. Connect the according hardware identifier of the drive telegram to the inputs `hwidSTW` and `hwidZSW`. With the `mode` input you can change beetween the operation modes such as positioning, setup mode, homing and jogging of the axis.
4+
5+
## Parameters
6+
7+
| Name | Section | Type | Description |
8+
| --------------------- | ------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------- |
9+
| mode | Input | `SinaPosMode` | Operating mode selection for MDI, see [SinaPosMode](../types/sinapos.md.md#sinaposmode) for further details |
10+
| enableAxis | Input | `BOOL` | TRUE = enable axis, FALSE = switch off drive (OFF1) |
11+
| acknowledgeError | Input | `BOOL` | Acknowledge drive errors with rising edge |
12+
| cancelTraversing | Input | `BOOL` | FALSE = Rejects the active traversing job |
13+
| intermediateStop | Input | `BOOL` | FALSE = Interrupts the active traversing job |
14+
| positive | Input | `BOOL` | Positive traversing direction |
15+
| negative | Input | `BOOL` | Negative traversing direction |
16+
| jog1 | Input | `BOOL` | Jog signal source 1 |
17+
| jog2 | Input | `BOOL` | Jog signal source 2 |
18+
| flyingReferencing | Input | `BOOL` | Controls selection for flying referencing |
19+
| executeMode | Input | `BOOL` | Activate traversing job/setpoint or activates homing or takes over home position |
20+
| position | Input | `DINT` | Position setpoint in LU for direct traversing operating modes or traversing block number in traversing block operation mode |
21+
| velocity | Input | `DINT` | Velocity in 1000 LU/min for MDI operating mode |
22+
| overrideVelocity | Input | `INT` | Velocity override in %, effective from 0% to 199% |
23+
| overrideAcceleration | Input | `INT` | Acceleration override in %, effective from 0% to 100% |
24+
| overrideDeceleration | Input | `INT` | Deceleration override in %, effective from 0% to 100% |
25+
| config | Input | `SinaPosConfiguration` | Configuration for axis, see [SinaPosConfiguration](../types/sinapos.md#sinaposconfiguration) for further details |
26+
| hwidSTW | Input | `UINT` | Hardware ID of the SIMATIC S7-1200/1500 setpoint slot |
27+
| hwidZSW | Input | `UINT` | Hardware ID of the SIMATIC S7-1200/1500 actual value slot |
28+
| axisEnabled | Output | `BOOL` | TRUE = axis is enabled |
29+
| axisPositionOk | Output | `BOOL` | TRUE = target position of the axis reached |
30+
| axisSetpointFixed | Output | `BOOL` | TRUE = setpoint is stationary (SINAMICS S/G120 FW < 4.8 / 4.7.9: r2199.0, SINAMICS S/G120 FW >= 4.8 / >= 4.7.9: r2683.2) |
31+
| axisReferenced | Output | `BOOL` | TRUE = home position is set |
32+
| axisWarning | Output | `BOOL` | TRUE = alarm of the drive pending |
33+
| axisError | Output | `BOOL` | TRUE = drive fault |
34+
| lockout | Output | `BOOL` | TRUE = switch-on inhibited |
35+
| actualVeloctiy | Output | `DINT` | Actual veloctiy (standardized 40000000h = 100% p2000) |
36+
| actualPosition | Output | `DINT` | Actual position in LU |
37+
| actualTraversingBlock | Output | `UINT` | Actual traversing block (0-63) |
38+
| actualMode | Output | `SinaPosMode` | Actual operating mode |
39+
| posZSW1 | Output | `SinaPosZSW1` | Status of POS_ZSW1, see [SinaPosZSW1](../types/sinapos.md#sinaposzsw1) for further details |
40+
| posZSW2 | Output | `SinaPosZSW2` | Status of POS_ZSW2, see [SinaPosZSW2](../types/sinapos.md#sinaposzsw2) for further detials |
41+
| actualWarning | Output | `WORD` | Current alarm number |
42+
| actualFault | Output | `WORD` | Current fault number |
43+
| error | Output | `BOOL` | TRUE = fault in function block present |
44+
| status | Output | `SinaPosStatus` | Status of the function block, see [SinaPosStatus](../types/sinapos.md#sinaposstatus) for further details |
45+
| diagnosticsId | Output | `WORD` | Return values of communication errors (ReadData and WriteData) |
46+
47+
## Example
48+
49+
```iec-st
50+
PROGRAM SampleProgram
51+
VAR_EXTERNAL
52+
axisTelegram111: UINT;
53+
END_VAR
54+
55+
VAR
56+
_enableAxis: BOOL;
57+
_acknowledgeError: BOOL;
58+
_moveDistance: BOOL;
59+
_sinaPos: SinaPos;
60+
END_VAR
61+
62+
// check axis is enabled and select speed and direction
63+
IF _sinaPos.axisEnabled THEN
64+
// select mode when axis is in standstill
65+
IF _sinaPos.axisPositionOk THEN
66+
_sinaPos.mode := SinaPosMode#RelativePositioning;
67+
68+
// check mode is active and execute traversing job
69+
IF _sinaPos.actualMode = SinaPosMode#RelativePositioning THEN
70+
_sinaPos.position := 10000;
71+
_sinaPos.velocity := 500;
72+
_sinaPos.executeMode := TRUE;
73+
END_IF;
74+
ELSE
75+
// reset job parameters whenever axis is moving
76+
_sinaPos.position := 0;
77+
_sinaPos.velocity := 0;
78+
_sinaPos.executeMode := FALSE;
79+
END_IF;
80+
END_IF;
81+
82+
// call sina pos cyclically
83+
_sinaPos(enableAxis := _enableAxis, acknowledgeError := _acknowledgeError, hwidSTW := axisTelegram111, hwidZSW := axisTelegram111);
84+
END_PROGRAM
85+
```

docs/function_blocks/sinaspeed.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SinaSpeed
2+
3+
You use the function block `SinaSpeed` to cyclically control the speed of an axis. Connect the according hardware identifier of the drive telegram to the inputs `hwidSTW` and `hwidZSW`. Set the input `referenceSpeed` to the respective value configured in the drive system (For SINAMICS drive system the value is stored in parameter p2000).
4+
5+
## Parameters
6+
7+
| Name | Section | Type | Description |
8+
| ---------------- | ------- | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
9+
| enableAxis | Input | `BOOL` | TRUE = enable axis, FALSE = switch off drive (OFF1) |
10+
| acknowledgeError | Input | `BOOL` | Acknowledge drive errors with rising edge |
11+
| speedSetpoint | Input | `REAL` | Speed setpoint in rpm |
12+
| referenceSpeed | Input | `REAL` | Reference speed in rpm |
13+
| config | Input | `SinaSpeedConfiguration` | Configuration for axis, see [SinaSpeedConfiguration](../types/sinaspeed.md#sinaspeedconfiguration) for further details |
14+
| hwidSTW | Input | `UINT` | Hardware ID of the SIMATIC S7-1200/1500 setpoint slot |
15+
| hwidZSW | Input | `UINT` | Hardware ID of the SIMATIC S7-1200/1500 actual value slot |
16+
| axisEnabled | Output | `BOOL` | TRUE = axis is enabled |
17+
| lockout | Output | `BOOL` | TRUE = switch-on inhibited |
18+
| actualVeloctiy | Output | `REAL` | Actual veloctiy in rpm |
19+
| ZSW1 | Output | `SinaSpeedZSW1` | Status of ZSW1, see [SinaSpeedZSW1](../types/sinaspeed.md#sinaspeedzsw1) |
20+
| error | Output | `BOOL` | TRUE = fault in function block present |
21+
| status | Output | `SinaSpeedStatus` | Status of the function block, see [SinaSpeedStatus](../types/sinaspeed.md#sinaspeedstatus) for further details |
22+
| diagnosticsId | Output | `WORD` | Return values of communication errors (ReadData and WriteData) |
23+
24+
## Example
25+
26+
```iec-st
27+
USING Simatic.Ax.Sinamics;
28+
29+
PROGRAM SampleProgram
30+
VAR_EXTERNAL
31+
axisTelegram1: UINT;
32+
END_VAR
33+
34+
VAR
35+
_enableAxis: BOOL;
36+
_acknowledgeError: BOOL;
37+
_moveForward: BOOL;
38+
_moveBackward: BOOL;
39+
_sinaSpeed: SinaSpeed;
40+
END_VAR
41+
42+
VAR CONSTANT
43+
REFERENCE_SPEED: REAL := 6000;
44+
END_VAR
45+
46+
// check axis is enabled and select speed and direction
47+
IF _sinaSpeed.axisEnabled THEN
48+
IF _moveForward AND NOT _moveBackward THEN
49+
_sinaSpeed.speedSetpoint := 3000;
50+
ELSIF _moveBackward AND NOT _moveForward THEN
51+
_sinaSpeed.speedSetpoint := -3000;
52+
ELSE
53+
_sinaSpeed.speedSetpoint := 0;
54+
END_IF;
55+
ELSE
56+
_sinaSpeed.speedSetpoint := 0;
57+
END_IF;
58+
59+
// call sina speed cyclically
60+
_sinaSpeed(enableAxis := _enableAxis, acknowledgeError := _acknowledgeError, referenceSpeed := REFERENCE_SPEED, hwidSTW := axisTelegram1, hwidZSW := axisTelegram1);
61+
END_PROGRAM
62+
```

docs/types/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Types

0 commit comments

Comments
 (0)