Git Product home page Git Product logo

ix-ax / axsharp Goto Github PK

View Code? Open in Web Editor NEW
47.0 3.0 11.0 9.72 MB

[This repository is for active development.] AX# binds SIMATIC AX based projects with .NET ecosystem.

Home Page: https://ix-ax.github.io/axsharp/

License: MIT License

PowerShell 0.07% Shell 0.01% C# 65.01% HTML 7.72% CSS 0.77% SCSS 6.44% JavaScript 15.58% Smalltalk 4.38% StringTemplate 0.03% Batchfile 0.01%
plc s7-plc s71500 siemens simatic-ax ax plc-programming siemens-plc siemens-s7-plcs iec-st

axsharp's Introduction

dev preview master semver GitHub license

NOTE We have just gone through project-wide refactoring changing the name from IX to AX# (AXSharp). Some links and documentation may still be using the IX and some links are still broken at this point. We are working hard on fixing those issues. Should any of these block you please feel free to reach out to the team.

AX#

The AX# is a series of tools that extend SIMATIC AX (Automation Xpansion) with a flexible and powerful connection with .NET ecosystem. AX# includes a compiler (ixc) that translates PLC data structures into C# (PLC .NET Twin), which makes the PLC data available in a structured way for any .NET application. Furthermore, presentation libraries provide additional features for the automated rendering of PLC data in the UI/HMI.

State of the project

This project is under development; however, we are releasing versions that you can play with before the release of the full version. This project follows semantic versioning.

All versions released with a major version number 0 (e.g. 0.10.0) can have breaking changes to the previous version at any moment. Stable versions will be released with a major version number greater than 0 (e.g. 1.2.1).

We plan to have production-ready libraries and tools in early spring 2024, that will cover:

  • compiler for building .NET twin object (ix compiler)
  • communication layer between .NET twin objects and S71500 series PLCs
  • user interface generator for Blazor application
  • application templates for quick development and deployment.

Documentation is a work in progress should you find missing, unclear, or misleading content please feel free to add an issue or to create a pull request with the fix you find appropriate.

There are some known issues that we are looking into in the development process. The list of known issues is here.

AX# is the underlying technology for the AXOpen that will be rendered public in this organization and will provide a series of libraries and components for building automation projects.

Disclaimer

It is necessary to have a valid license for SIMATIC AX in order to use AX#!
SIMATIC AX is currently in a limited sales release in selected European countries only. You will need to request access from the AX team which will check if your use case is suitable for the current state of the product. The first step to getting the approval is contacting your local SIEMENS sales representative or writing an email to [email protected].

How it works

In simple terms, the AX# takes the PLC program and translates the data structured into .NET classes.

Write PLC code

{S7.extern=ReadWrite}
{#ix-attr:[Container(Layout.Stack)]}
{#ix-attr:[Group(Layout.GroupBox)]}
{#ix-set:AttributeName = "Location"}
CLASS  GeoLocation
    VAR PUBLIC
        {#ix-set:AttributeName = "Latitude [°]"}
        {#ix-set:AttributeMinimum = -90.0f}
        {#ix-set:AttributeMaximum = 90.0f}
        Latitude : REAL;
        {#ix-set:AttributeName = "Logitude [°]"}
        {#ix-set:AttributeMinimum = 0.0f}
        {#ix-set:AttributeMaximum = 180.0f}
        Longitude : REAL;
        {#ix-set:AttributeName = "Altitude [m]"}
        Altitude : REAL;
        {#ix-set:AttributeName = "Short descriptor"}
        Description : STRING[10];
        {#ix-set:AttributeName = "Long descriptor"}
        LongDescription : STRING[254];
    END_VAR    
END_CLASS

Compile to get .NET twin

using System;
using AXSharp.Connector;
using AXSharp.Connector.ValueTypes;
using System.Collections.Generic;

[Container(Layout.Stack)]
[Group(Layout.GroupBox)]
public partial class GeoLocation : AXSharp.Connector.ITwinObject
{
    public OnlinerReal Latitude { get; }

    public OnlinerReal Longitude { get; }

    public OnlinerReal Altitude { get; }

    public OnlinerString Description { get; }

    public OnlinerString LongDescription { get; }

    --- truncated ----

You can then access the data in your .NET application

Use in any .NET application

// Write
await Entry.Plc.weather.GeoLocation.Longitude.SetAsync(10);

// Read
var longitude = await Entry.Plc.weather.GeoLocation.Longitude.GetAsync();

// Bulk read
Entry.Plc.weather.GeoLocation.Read();

// Bulk write
Entry.Plc.weather.GeoLocation.Write();

Automatically render in HMI

Getting started

To get started, visit the documentation here.

Examples

Examples can be found here

Contributing

Contributions are welcomed. Have a look at contributing document.

axsharp's People

Contributors

brano5 avatar ix-bot avatar krisztianolah avatar kuh0005 avatar lukaskytka avatar ptku avatar specter-13 avatar tomkovac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

axsharp's Issues

add partial initialization methods for Onliners

Constructor

this.@SymbolTail = symbolTail;
this.@Connector = parent.GetConnector();
this.@Parent = parent;
_humanReadable = Vortex.Connector.IConnector.CreateSymbol(parent.HumanReadable, readableTail);
PreConstruct(parent, readableTail, symbolTail);
			
PostConstruct(parent, readableTail, symbolTail);

Partial declaration

partial void PreConstruct(Vortex.Connector.IVortexObject parent, string readableTail, string symbolTail);

partial void PostConstruct(Vortex.Connector.IVortexObject parent, string readableTail, string symbolTail);

Partial implementation

partial void PreConstruct(IVortexObject parent, string readableTail, string symbolTail)
{
    // Do some initialization
}

partial void PostConstruct(IVortexObject parent, string readableTail, string symbolTail)
{
    // Do some initialization
}

[BUG] Rendering of components from custom library doesn't work

Renderer cannot find component in custom library, because compiled C# classes doesn't contains namespaces:

Therefore code,

var name = twinType.FullName;

will return only type name, not fully qualified name with namespace, therefore comparison will fail and component won't be found.

Also, documentation for custom libraries should be updated.

[NEW-FEATURE] Compiler should delete previous generated .cs file, if corresponding plc instance is removed

When I create plc enum structure (or any structure) and its instance for example:

TYPE myEnum :
    (
        Unknown,
        Available,
        UnAvailable	
    );
    END_TYPE
myEnum_instance : myEnum;

Compiler will generate myEnum.cs file. That is perfectly okay.

But when I completely remove my myEnum.st structure from PLC program, C# compiled file myEnum.cs is still present and is causing errors.

It would be nice, if compiler removes unnecessary structures automatically.

[KNOWN ISSUE] Incomplete implementation of some types of Named Value Types

Only Named Value Types issue
Compiler misses implementation for STRING, WSTRING, CHAR, WCHAR, Time and date types for named value types

Numerical types should work just fine.


Details

Following named 'Named Value Type Declaration'

TYPE
    ColorAsString : STRING (Red := '1', Green := '2', Blue := '3') := Red;
END_TYPE

will translate like this...

public enum ColorAsString : String
{
    Red = 49,
    Green = 50,
    Blue = 51
}

and

TYPE
    ColorAsString : STRING (Red := 'A1', Green := 'A2', Blue := 'A3') := Red;
END_TYPE
public enum ColorAsString : String
{
    Red = 0,
    Green = 0,
    Blue = 0
}

[IDEA] More integration tests for Blazor renderer

It would be nice to have more integration test for Blazor renderer.
Create some structure for tests, specify correct test-cases.

  • tests for each basic layout
  • tests for groupbox and border group layouts

[QUESTION] Acquiring variables in VAR_OUTPUT section in method declaration

Hello,
I would like to acquire output variables of method.

I have following plc code sample:

CLASS MyTestClass

    VAR PUBLIC
      myINT : INT ;
    END_VAR

 METHOD PUBLIC MyMethod : INT

        VAR_INPUT
            varin1 : INT;
            varin2 : INT;
        END_VAR

        myINT := varin1;

        VAR_OUTPUT
            varout1 : INT;
            varout2 : INT;
        END_VAR

    END_METHOD

END_CLASS

For input variables I'm using following code which is working just fine:

var inputVars = methodDeclaration.Variables.Where(v => v.Section == Section.Input);

where methodDeclaration is type of IMethodDeclaration from AX semantic model.

However, for output variables following code doesn't work:

var outputVars = methodDeclaration.Variables.Where(v => v.Section == Section.Output);

I would expect to get a list of variables in VAR_OUTPUT, but I've got an empty list.

Am I missing something or is there a different way to acquire output variables?

Thanks.

[NEW-FEATURE] Add border when rendering arrays of complex types

Having following:

NAMESPACE MonsterData
    CLASS MonsterBase
        VAR PUBLIC
            ArrayOfBytes : ARRAY[0..3] OF BYTE;
            ArrayOfDrives : ARRAY[0..3] OF DriveBase;
        END_VAR        
    END_CLASS
    CLASS Monster EXTENDS MonsterBase
        VAR PUBLIC
            DriveA : DriveBase;
        END_VAR        
    END_CLASS

    CLASS DriveBase
        VAR PUBLIC
            Position : LREAL;
            Velo : LREAL;
            Acc : LREAL;
            Dcc : LREAL;            
        END_VAR        
    END_CLASS
END_NAMESPACE

The arrays are now rendered as:

For primitive types we are good:
image

For complex types we should add a border (or something like that) with label to delimit the part belonging to an index of an array
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.