Skip to content

Commit

Permalink
[NEW-FEATURE] Update to sld v2.0.5 (#264)
Browse files Browse the repository at this point in the history
* Create draft PR for #263

* [wip] taking s7 pragmas into account when compiling twins

* adds missing accessibility pragmas

* [wip] adds possiblity to ignore s7 pragmas for TIA2AX scenario

* additions to documentation

* mend

---------

Co-authored-by: PTKu <PTKu@users.noreply.github.com>
Co-authored-by: Peter <61538034+PTKu@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 24, 2023
1 parent 6bcb0fa commit 55f6c08
Show file tree
Hide file tree
Showing 162 changed files with 2,404 additions and 584 deletions.
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mode: ContinuousDeployment
next-version: 0.17.0
next-version: 0.18.0
branches:
main:
regex: ^master$|^main$
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ In simple terms, the AX# takes the PLC program and translates the data structure
### Write PLC code

~~~iecst
{S7.extern=ReadWrite}
{#ix-attr:[Container(Layout.Stack)]}
{#ix-attr:[Group(Layout.GroupBox)]}
{#ix-set:AttributeName = "Location"}
Expand Down
4 changes: 4 additions & 0 deletions docfx/articles/compiler/ADDED_MEMBERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Syntax
Example

~~~iecst
{S7.extern=ReadWrite}
{#ix-prop:public string Description}
CLASS PUBLIC MyClass
VAR PUBLIC
Expand Down Expand Up @@ -49,6 +50,7 @@ CLASS_DECLARATION | STRUCTURED_TYPE_DECLARATION
Example

~~~iecst
{S7.extern=ReadWrite}
{#ix-prop:public string Description}
{#ix-set:Description = "This is my classy description."}
CLASS PUBLIC MyClass
Expand Down Expand Up @@ -81,13 +83,15 @@ FIELD_DECLARATION | VARIABLE_DECLARATION
~~~

~~~iecst
{S7.extern=ReadWrite}
CLASS PUBLIC MyClass
VAR PUBLIC
{#ix-set:Description = "This is my nested classy description."}
Nested : MyNestedStructure;
END_VAR
END_CLASS
{S7.extern=ReadWrite}
{#ix-prop:public string Description}
CLASS PUBLIC MyNestedStructure
END_CLASS
Expand Down
7 changes: 5 additions & 2 deletions docfx/articles/compiler/ATTRIBUTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Syntax
Example

~~~iecst
{S7.extern=ReadWrite}
{#ix-attr:[Container(Layout.Wrap)]} (* Example of an attribute declared at type level. *)
CLASS PUBLIC MyClass
VAR PUBLIC
Expand All @@ -35,7 +36,7 @@ ReadOnce attribute can be only applied to members (property, field), not type (C
Example

~~~iecst
{S7.extern=ReadWrite}
CLASS PUBLIC MyClass
VAR PUBLIC
{#ix-attr:[ReadOnce()]} // this structure will be read only once
Expand All @@ -52,7 +53,7 @@ ReadOnly attribute render the member (variable) inaccessible for write operation


~~~iecst
{S7.extern=ReadWrite}
CLASS PUBLIC MyClass
VAR PUBLIC
{#ix-attr:[ReadOnly()]} // this structure will be read only
Expand All @@ -75,6 +76,7 @@ CompilerOmits attribute instructs the compiler to skip the compilation of a memb


~~~iecst
{S7.extern=ReadWrite}
CLASS PUBLIC MyClass
VAR PUBLIC
{#ix-attr:[CompilerOmits()]}
Expand All @@ -94,6 +96,7 @@ END_CLASS
To minimize the communication overhead between the application and the controller during POCO operations, you can annotate specific members of a type to bypass data exchange. This attribute should be applied when the compiler omits the compilation of particular members in the POCO object.

```iecst
{S7.extern=ReadWrite}
CLASS PUBLIC MyClass
VAR PUBLIC
{#ix-attr:[CompilerOmits("POCO")]}
Expand Down
12 changes: 10 additions & 2 deletions docfx/articles/compiler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@

**AXSharp Compiler (`ixc`) translates PLC data structures into C# (PLC .NET Twin), which makes the PLC data available in a structured way for any .NET application.**

### Adding types and members to the communication over WebAPI

Starting from the version v2.0.0+ of `sld`, to make member or type accessible over the communication there is a need to add pragma `{S7.extern=ReadWrite}` or `{S7.extern=ReadOnly}` in the appropriate place in the code.

For details see [here](https://console.simatic-ax.siemens.io/docs/sld/extern-accessibility)


### Write PLC code

~~~iecst
{#ix-attr:[Container(Layout.Stack)]}
{#ix-attr:[Group(Layout.GroupBox)]}
{#ix-set:AttributeName = "Location"}
{S7.extern=ReadWrite}
CLASS GeoLocation
VAR PUBLIC
{#ix-set:AttributeName = "Latitude [°]"}
Expand Down Expand Up @@ -76,15 +84,15 @@ Entry.Plc.weather.GeoLocation.Write();
- [Config file](CONFIG_FILE.md)
- [Packaging and dependency management](PACKAGING.md)

AXSharp compiles transpiles following project blocks:
AXSharp compiles transpiles the following project blocks:

- [Configuration's global variables](https://console.simatic-ax.siemens.io/docs/st/language/program-structure/configuration#global-variables)
- [Elementary data types](https://console.simatic-ax.siemens.io/docs/st/language/types-and-variables#elementary-data-types)
- [Class](https://console.simatic-ax.siemens.io/docs/st/language/program-structure/program-organization-unit#class-declaration)
- [User defined data types](https://console.simatic-ax.siemens.io/docs/st/language/types-and-variables#user-defined-data-types)
- [Strucured types](https://console.simatic-ax.siemens.io/docs/st/language/types-and-variables#structured-type-without-relative-addressing)
- [Data type with named values as enums](https://console.simatic-ax.siemens.io/docs/st/language/types-and-variables#data-type-with-named-values)
-[Enumerations](https://console.simatic-ax.siemens.io/docs/st/language/types-and-variables#enumeration)
- [Enumerations](https://console.simatic-ax.siemens.io/docs/st/language/types-and-variables#enumeration)


Expand Down
3 changes: 3 additions & 0 deletions docfx/articles/connectors/WebAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@

This connector offers an interface to interact with S7-15XX PLC systems through the WebAPI.

For details how to make the data available see [extern accessibility](https://console.simatic-ax.siemens.io/docs/sld/extern-accessibility).

Here is an example of how to create an instance of this connector:

```C#
public static <PLC_TWIN_TYPE> Plc { get; } = new (ConnectorAdapterBuilder.Build().CreateWebApi(Environment.GetEnvironmentVariable("AXTARGET") ?? "10.10.101.1", "Everybody", "", true));
```


## Considerations for WebAPI Connector Performance

When working with S7-1500 based PLC systems, especially hardware-based ones, there are limitations regarding the volume of items that can be communicated over a specific communication interface. To prevent performance degradation, it's vital to prudently manage the number of PLC items your application uses at any given time. It is recommended to utilize polling instead of an automatic variable subscription.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"ProjectFile":"ax_blazor_example.csproj"}
{"OutputProjectFolder":"ix","UseBase":false,"NoDependencyUpdate":false,"IgnoreS7Pragmas":false,"ProjectFile":"ax_blazor_example.csproj"}
Loading

0 comments on commit 55f6c08

Please sign in to comment.