Skip to content

Commit

Permalink
Merge pull request #15 from ix-ax/dev
Browse files Browse the repository at this point in the history
v0.11 - public preview
  • Loading branch information
PTKu authored Jan 25, 2023
2 parents 8613dd6 + adc7f14 commit 95298be
Show file tree
Hide file tree
Showing 17 changed files with 213 additions and 208 deletions.
28 changes: 6 additions & 22 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,17 @@ jobs:
matrix:
configuration: [Release]

runs-on: [ubuntu-latest] # For a list of available runner types, refer to
runs-on: [self-hosted, Windows, X64, L2] # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'

- name: "Setup the apax in the ci runner"
#uses: simatic-ax/actions/setup-apax-runner@main
uses: ./.github/actions/setup-apax-runner
with:
APAX_TOKEN: ${{ secrets.APAX_TOKEN }}

- name: "Get github nuget source"
#uses: simatic-ax/actions/setup-apax-runner@main
run: sudo dotnet nuget add source --username ix-ax --password ${{ secrets.GH_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ix-ax/index.json"

- name: "login to apax"
run: sudo apax login -p ${{ secrets.APAX_TOKEN }}
shell: bash

fetch-depth: '0'

- name: "Build script"
run: sudo dotnet build cake/Build.csproj
shell: bash

run: dotnet build cake/Build.csproj

- name: "Run build script"
run: sudo dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 1
shell: bash
run: dotnet run --project cake/Build.csproj --do-test true --do-pack true --test-level 1

2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
configuration: [Release]

runs-on: [self-hosted] # For a list of available runner types, refer to
runs-on: [self-hosted, Windows, X64, L3] # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
configuration: [Release]

runs-on: [self-hosted] # For a list of available runner types, refer to
runs-on: [self-hosted, Windows, X64, L3] # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
steps:
- name: Checkout
Expand Down
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.10.0
next-version: 0.12.0
branches:
main:
regex: ^master$|^main$
Expand Down
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
# [WIP] RUNNING SOME POST PUBLISH TESTS

![](assets/pics/banner_wider.png)
# IX

The **IX** is a series of tools that extend SIMATIC AX (Automation Xpansion) with a flexible and powerful connection with .NET ecosystem. IX 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.

**IX** is the underlying technology for the [ix.framework](https://github.com/ix-ax/ix.framework) that will provide a series of libraries and components for building automation projects.
## State of the project

This project is under development; however, we are [releasing versions](https://github.com/ix-ax/ix/releases) that you can play with before the release of the full version. This project follows [semantic versioning](https://semver.org/).

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](https://github.com/ix-ax/ix/issues/new/choose) 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](https://github.com/ix-ax/ix/issues?q=is%3Aissue+is%3Aopen+label%3Aknown-issue).



**IX** is the underlying technology for the [ix.framework](https://github.com/ix-ax/ix.framework) that will be rendered public in this organization and will provide a series of libraries and components for building automation projects.

## Disclaimer

Expand Down Expand Up @@ -87,12 +110,6 @@ Entry.Plc.weather.GeoLocation.Write();
![](assets/pics/2022-12-20-06-54-08.png)


## State of the project

This project is under development; however, we will be releasing versions that you can play with before the release of the full version. This project follows [semantic versioning](https://semver.org/).
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).

## Getting started

To get started, visit the documentation [here](docs/README.md#getting-started).
Expand All @@ -102,6 +119,7 @@ To get started, visit the documentation [here](docs/README.md#getting-started).

Examples can be found [here](src/ix.examples)


## Contributing

Contributions are welcomed. Have a look at this repo [contributing document](CONTRIBUTING.md).
Contributions are welcomed. Have a look at [contributing document](CONTRIBUTING.md).
Binary file added assets/pics/banner_wider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions docs/_coverpage.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# ix
![](_media/readme/logo-color-sm.png)

# INDUSTRIAL AUTOMATION EXPANSION
## Bind SIMATIC AX based projects with .NET ecosystem

# take your PLC into .NET world.
Binary file added docs/_media/readme/logo-color-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/readme/logo-no-background-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_media/readme/logo-no-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/_navbar.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
* # About

* [README](README.md)
* [What's in](README.md)


106 changes: 54 additions & 52 deletions docs/articles/blazor/LAYOUTS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Layouts

This file describes layouts, which are supported by Vortex.Presentation.Blazor framework. You will see examples and usage of supported layouts and how they can be nested.
This file describes layouts, which are supported by Ix.Presentation.Blazor framework.

Following layouts are supported within the framework:

Expand All @@ -11,9 +11,9 @@ Following layouts are supported within the framework:
- Border
- GroupBox

You can specify a layout in PLC code with the following attribute:
Layout can by specified in PLC code with the following attribute:
```
{attribute wpf [Container(Layout.Name)]}
{#ix-attr:[Container(Layout.Name)]}
```
Where *Name* is replaced with the name of one of the supported layouts.

Expand All @@ -28,16 +28,17 @@ UniformGrid will place elements in a row, where each element is of uniform width

Let's have the following PLC code with a container attribute:
```
{attribute wpf [Container(Layout.UniformGrid)]}
TYPE stExample :
STRUCT
testInteger : INT;
testEnum : stTestEnum;
testString : STRING := 'Hello World';
testBool : BOOL;
END_STRUCT
END_TYPE
{#ix-attr:[Container(Layout.UniformGrid)]}
CLASS stExample :
VAR PUBLIC
testInteger : INT;
testEnum : stTestEnum;
testString : STRING := 'Hello World';
testBool : BOOL;
END_VAR
END_CLASS
```

And this is the result:

![alt text](assets/uniform.png "RenderIgnore and custom labels")
Expand All @@ -54,21 +55,22 @@ This is the example behavior of wrap panel:
## Tabs
Tabs layout will place each element in its own tab. You are able to switch between tabs to see corresponding UI. In example below, you can see PLC code with Layout.Tabs container attribute and corresponding auto-generated UI.
```
{attribute wpf [Container(Layout.Tabs)]}
FUNCTION_BLOCK fbWorldWeatherWatch
VAR
{attribute addProperty Name "<#North pole station#>"}
NorthPole : structWeatherStation := (StationICAO := 'CYRB');
{attribute addProperty Name "<#South pole station#>"}
SouthPole : structWeatherStation := (StationICAO := 'NZSP');
{attribute addProperty Name "<#Verl, Germany#>"}
Verl : structWeatherStation := (StationICAO := 'EDLP');
{attribute addProperty Name "<#Kriva, Slovakia#>"}
Kriva : structWeatherStation := (StationICAO := 'LZIB');
END_VAR
{#ix-attr:[Container(Layout.Tabs)]}
CLASS fbWorldWeatherWatch
VAR PUBLIC
{#ix-set:AttributeName = "North pole station"}
NorthPole : structWeatherStation := (StationICAO := 'CYRB');
{#ix-set:AttributeName = "South pole station"}
SouthPole : structWeatherStation := (StationICAO := 'NZSP');
{#ix-set:AttributeName = "Verl, Germany"}
Verl : structWeatherStation := (StationICAO := 'EDLP');
{#ix-set:AttributeName = "Kriva, Slovakia"}
Kriva : structWeatherStation := (StationICAO := 'LZIB');
END_VAR
END_CLASS
```
![alt text](assets/tabs.gif "Tabs layout")
Expand All @@ -87,33 +89,33 @@ GroupBox layout will create border with name of first element around auto-genera

---
## Nested and multiple layouts
You can combine multiple container attributes in PLC code to create a complex layout of your elements.
It is possible to nest multiple container attributes in PLC code to create a complex layouts.
Consider following the plc code:
```
{attribute wpf [Container(Layout.Tabs)]}
TYPE stMultipleLayouts :
STRUCT
{attribute wpf [Container(Layout.Stack)]}
{attribute addProperty Name "A1"}
Piston_A1 : STRING;
{attribute addProperty Name "A2"}
Piston_A2 : STRING;
{attribute addProperty Name "A3"}
Piston_A3 : STRING;
{attribute addProperty Name "A4"}
Piston_A4 : STRING;
{attribute wpf [Container(Layout.Wrap)]}
{attribute addProperty Name "A5"}
Piston_A21 : INT;
{attribute addProperty Name "A6"}
Piston_A22 : INT;
{attribute addProperty Name "A7"}
Piston_A23 : INT;
{attribute addProperty Name "A8"}
Piston_A24 : INT;
END_STRUCT
END_TYPE
{#ix-attr:[Container(Layout.Tabs)]}
CLASS stMultipleLayouts
VAR PUBLIC
{#ix-attr:[Container(Layout.Stack)]}
{#ix-set:AttributeName = "A1"}
Piston_A1 : STRING;
{#ix-set:AttributeName = "A2"}
Piston_A2 : STRING;
{#ix-set:AttributeName = "A3"}
Piston_A3 : STRING;
{#ix-set:AttributeName = "A4"}
Piston_A4 : STRING;
{#ix-attr:[Container(Layout.Wrap)]}
{#ix-set:AttributeName = "A5"}
Piston_A21 : INT;
{#ix-set:AttributeName = "A6"}
Piston_A22 : INT;
{#ix-set:AttributeName = "A7"}
Piston_A23 : INT;
{#ix-set:AttributeName = "A8"}
Piston_A24 : INT;
END_VAR
END_CLASS
```
You will get the following auto-generated UI:
Expand Down
27 changes: 13 additions & 14 deletions docs/articles/blazor/LIBRARIES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Custom libraries
Custom libraries are a way to store own created views with different presentation types.

To create a custom components library, you have to create two projects:
To create a custom components library, two projects must be created:
- **Connector project** - which will contain PLC compiled classes from Ix Builder.
- **Razor components project** - Razor class library, which will contain the implementation of corresponding views. Also, there must be a dependency on the Connector project.
- **Razor components project** - Razor class library, which will contain the implementation of corresponding views with dependency on Connector project.

It's important to note that the generated classes in the Connector project and created Razor views must be in **same namespace** to correctly locate views.
It is important to note that the generated classes in the Connector project and created Razor views must be in **same namespace** to correctly locate views.

See the example below:

Expand All @@ -19,26 +20,25 @@ Files in the *ComponentsExample* and the *PlcConnector* are in the same namespac

*ComponentsExamples* library must contain `RenderableBlazorAssemblyAttribute()`. Thanks to this attribute RenderableContentControl is able to load its assembly and find all created custom view.

You can add this attribute to `AssemblyInfo.cs` class located in `Properties` folder. If there is no `Properties` folder, just create it with `AssemblyInfo.cs` class and paste there following code:
This attribute can be added to `AssemblyInfo.cs` class located in `Properties` folder. If there is no `Properties` folder, just create it with `AssemblyInfo.cs` class and paste there following code:

```C#
using Ix.Presentation.Blazor.Attributes;

[assembly: RenderableBlazorAssemblyAttribute()]
```

If your PLC defined type has a C# counterpart in a `PlcConnector` project and `ComponentsExamples` contains a corresponding Razor view, it will be rendered by the RenderableContentControl.

There are two ways how to implement custom component:

There are two ways for implementation of custom component:
- Custom component with **code-behind**
- Custom component with **ViewModel** support

## Component with code-behind
This is simple approach, where your Blazor view inherits from `RenderableComplexComponentBase<T>` base class, where `T` is your custom component PLC type. However logic of your component must be specified in code-behind of view class. Important is, that both view and code-behind must be in same namespace as your `PlcConnector`.
This is simple approach, where Blazor view inherits from `RenderableComplexComponentBase<T>` base class, where `T` is your custom component PLC type. However logic of your component must be specified in code-behind of view class. Important is, that both view and code-behind must be in same namespace as your `PlcConnector`.

Look at the example below:


Blazor view `IxComponentServiceView.razor`:

```C#
Expand Down Expand Up @@ -72,9 +72,10 @@ namespace Plc
If you want your UI to be updated everytime, when PLC values change, you must call `UpdateValuesOnChange(Component)` method in `OnInitialized()` method in code-behind.

## Component with ViewModel
With this approach you can create component using MVVM design pattern. With MVVM, implementation of view and logic of your component is separated. Therefore your code is loosely coupled, more testable and reusable.

First, you need to create your ViewModel, which will inherits from abstract class `RenderableViewModelBase`:
With this approach it is possible to create component using MVVM design pattern.

First, ViewModel must be created, which will inherits from abstract class `RenderableViewModelBase`:

ViewModel `IxComponentBaseViewModel.cs`
```C#
Expand All @@ -90,7 +91,7 @@ namespace Plc
}
}
```
After that, you can create your Blazor view `IxComponentBaseView.razor`:
After that, Blazor view `IxComponentBaseView.razor` can be created:

```C#
@namespace Plc
Expand All @@ -111,7 +112,7 @@ After that, you can create your Blazor view `IxComponentBaseView.razor`:
}

```
Your view must inherits from `RenderableViewModelComponentBase<T>` base class, where `T` is type of your ViewModel. Thanks to this, ViewModel instance is created and initialized with PLC type instance acquired within `RenderableContentControl`. After that, you are able to access your ViewModel within Blazor view.
The view must inherits from `RenderableViewModelComponentBase<T>` base class, where `T` is type of your ViewModel. Thanks to this, ViewModel instance is created and initialized with PLC type instance acquired within `RenderableContentControl`. After that, ViewModel can be accessed within Blazor view.

If you want your UI update everytime, when PLC values change, you can add `UpdatesValuesOnChange(ViewModel.Component)` directly to code section in view, or you can create partial class same as in previous example.

Expand All @@ -127,5 +128,3 @@ When you call RenderableContentControl component like this:
You will get generated UI, which you specified in your custom view:

![alt text](assets/baseview.png "Renderignore and custom labels")

View contains real-time values from PLC.
Loading

0 comments on commit 95298be

Please sign in to comment.