diff --git a/.commitlintrc.json b/.commitlintrc.json index 152feb5..96b0617 100644 --- a/.commitlintrc.json +++ b/.commitlintrc.json @@ -28,15 +28,12 @@ "monitor-server", "docs", "config", + "ci", "deps" ] ], "scope-empty": [0], - "subject-case": [ - 2, - "always", - "lower-case" - ], + "subject-case": [0], "subject-empty": [2, "never"], "subject-full-stop": [2, "never", "."], "header-max-length": [2, "always", 72], diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index 4df238e..0511781 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -20,14 +20,14 @@ jobs: runs-on: ubuntu-latest steps: - name: CLA Assistant - uses: contributor-assistant/github-action@v2 + uses: contributor-assistant/github-action@v2.6.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: path-to-signatures: "signatures/cla.json" path-to-document: "https://gist.github.com/q-soriarty/615e916cd19a34f5f1efa1110592b32a" - branch: "main" - allowlist: "dependabot[bot],github-actions[bot]" + branch: "cla-signatures" + allowlist: "q-soriarty,dependabot[bot],github-actions[bot]" custom-notsigned-prcomment: | Thank you for your contribution! Before we can merge this PR, you need to sign our [Contributor License Agreement](https://gist.github.com/q-soriarty/615e916cd19a34f5f1efa1110592b32a). diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index a37d9b0..3f4e103 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -19,7 +19,6 @@ jobs: uses: actions/setup-node@v6 with: node-version: '20' - cache: 'npm' - name: Install commitlint run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 5477a44..d1b6db9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 --- +## [0.3.0] - 2026-02-14 + +Architecture skeleton and Beckhoff ADS integration. + +### Added +- **Shared DTO library** (`src/shared/FlowForge.Shared/`): common DTOs (Flow, Build, Deploy, Project, Target, Auth, Monitor), enums (Permission, ProjectRole, BuildStatus, DeployStatus), MQTT topic constants +- **Backend Clean Architecture** (3-project split): + - `FlowForge.Backend.Application` — entities, service/repository interfaces, business logic stubs + - `FlowForge.Backend.Infrastructure` — EF Core persistence, repository implementations, external service integrations (Git, MQTT, Docker, Keycloak, AES encryption) + - Refactored `FlowForge.Backend.Api` — added controller stubs (Projects, Build, Deploy, Targets, Monitor, Admin), middleware (error handling, request logging), Keycloak JWT authentication setup +- **Build Server architecture** — pipeline pattern (IBuildStep), code generation (INodeTranslator strategy), TwinCAT COM facades (IVisualStudioInstance, IAutomationInterface), MessageFilter, template manager, workspace manager +- **Monitor Server architecture** — typed SignalR hub interface (IPlcDataHubClient), subscription manager, token validator +- **Frontend architecture** — feature-based folder structure (editor, projects, build, deploy, targets, monitoring, admin), auth layer (Keycloak OIDC), layout components, API client with JWT interceptor; added zustand, react-query, keycloak-js, @microsoft/signalr, react-router-dom +- **Test projects** (6): xUnit + NSubstitute + FluentAssertions for Shared, Backend.Api, Backend.Application, Backend.Infrastructure, BuildServer, MonitorServer +- **Root solution** (`src/FlowForge.sln`) including all 12 .NET projects with solution folders +- **Architecture design documents**: `doc/BUILD_SERVER_DESIGN.md`, `doc/MODULE_ARCHITECTURE.md`, `doc/ADS_INTEGRATION.md` +- **Beckhoff ADS integration** — direct ADS communication replacing custom MQTT relay: + - Shared ADS types: `PlcAdsState` enum, `PlcStateDto`, `AdsConnectionInfo`, `AdsVariableSubscription` DTOs + - Monitor Server: `IAdsClient` + `AdsClientWrapper` using `Beckhoff.TwinCAT.Ads` + `TcpRouter` for Linux/Docker + - Build Server: `IAdsDeployClient` + `AdsDeployClient` for deploy-time PLC state management + - `DeployService` and `TargetService` stubs for deploy workflow and target management + - `DeployStatus` MQTT topic for deploy progress notifications + +### Changed +- Monitor Server: replaced `IMqttAdsClient` with direct `IAdsClient` (Beckhoff ADS over TCP) +- MQTT topics: removed `AdsRead`, `AdsWrite`, `AdsNotification` relay topics — MQTT now used for FlowForge internal messaging only +- Architecture docs updated to reflect ADS-direct design + +### Removed +- `IMqttAdsClient` and `MqttAdsClient` (MQTT ADS relay no longer needed) + +--- + ## [0.2.0] - 2026-02-14 Open source preparation release — AGPL-3.0 dual licensing. diff --git a/CLAUDE.md b/CLAUDE.md index 7c05bcb..5ea624c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,13 +10,18 @@ FlowForge is a visual no-code PLC programming environment inspired by Unreal Eng Four main components: **Visual Editor** (web frontend) → **.NET Backend API** → **PLC Build Server(s)** + **Monitor Server(s)** → Beckhoff PLC via ADS over MQTT. -- `src/frontend/` — Web-based node editor (React + TypeScript + React Flow); direct SignalR to monitor containers for live PLC data -- `src/backend/` — ASP.NET Core API (Controllers, PostgreSQL/EF Core, SignalR, MQTTnet, LibGit2Sharp); manages projects, routes build requests to version-specific build servers, orchestrates monitor containers, authenticates via OIDC (Keycloak), exposes admin API as facade over Keycloak Admin REST API -- `src/build-server/` — PLC build server (C#/.NET, required for Beckhoff Automation Interface); handles both build and deploy (TwinCAT Engineering needed for PLC activation); version-specific instances on dedicated Windows Servers -- `src/monitor-server/` — On-demand PLC monitoring container (C#/.NET, SignalR, MQTTnet); streams live ADS data directly to frontend via SignalR, backend manages lifecycle only -- `doc/` — Architecture docs, decision log, tech decisions +- `src/shared/FlowForge.Shared/` — Common DTOs, enums, MQTT topic constants. No external dependencies. +- `src/frontend/` — Web-based node editor (React + TypeScript + React Flow + Zustand + React Query); feature-based folder structure with auth (Keycloak), layout, and feature modules (editor, projects, build, deploy, targets, monitoring, admin) +- `src/backend/` — Clean Architecture Lite (3 projects): + - `src/backend/src/FlowForge.Backend.Api/` — ASP.NET Core API (Controllers, Middleware, Auth, SignalR hubs). References Application + Infrastructure + Shared. + - `src/backend/src/FlowForge.Backend.Application/` — Business logic, entities, service/repository interfaces. References Shared only. + - `src/backend/src/FlowForge.Backend.Infrastructure/` — EF Core, external integrations (Git, MQTT, Docker, Keycloak, AES encryption). References Application + Shared. +- `src/build-server/` — PLC build server (C#/.NET); pipeline architecture with sequential build steps (IBuildStep), code generation (INodeTranslator strategy pattern), TwinCAT COM facades (IVisualStudioInstance, IAutomationInterface). References Shared. +- `src/monitor-server/` — On-demand PLC monitoring container (C#/.NET, SignalR, MQTTnet); typed hub interface, subscription manager, MQTT ADS client. References Shared. +- `doc/` — Architecture docs (`ARCHITECTURE.md`, `BUILD_SERVER_DESIGN.md`, `MODULE_ARCHITECTURE.md`), decision log, tech decisions - `samples/` — Example visual programs -- `test/` — Tests (framework TBD) +- `test/` — xUnit + NSubstitute + FluentAssertions test projects: `FlowForge.Shared.Tests`, `FlowForge.Backend.Api.Tests`, `FlowForge.Backend.Application.Tests`, `FlowForge.Backend.Infrastructure.Tests`, `FlowForge.BuildServer.Tests`, `FlowForge.MonitorServer.Tests` +- `src/FlowForge.sln` — Root solution including all .NET projects **Key architectural decisions:** - **Keycloak as auth layer**: all authentication/authorization via Keycloak (local users, LDAP federation, external SSO — all Keycloak config). Backend only validates JWT from Keycloak. User management via FlowForge admin UI (facade over Keycloak Admin REST API). @@ -43,6 +48,25 @@ npm install .\scripts\setup-dev.ps1 # Windows PowerShell ``` +## Build & Test Commands + +```bash +# Build all .NET projects +dotnet build src/FlowForge.sln + +# Run all .NET tests +dotnet test src/FlowForge.sln + +# Build/test individual modules +dotnet build src/backend/FlowForge.Backend.sln +dotnet build src/build-server/FlowForge.BuildServer.sln +dotnet build src/monitor-server/FlowForge.MonitorServer.sln + +# Frontend +cd src/frontend && npm run build +cd src/frontend && npm run dev +``` + ## Commit Conventions Commits are validated by commitlint via husky git hook. **All commits must follow Conventional Commits format:** @@ -53,7 +77,7 @@ Commits are validated by commitlint via husky git hook. **All commits must follo Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert` -Scopes: `frontend`, `backend`, `build-server`, `monitor-server`, `docs`, `config`, `deps` +Scopes: `frontend`, `backend`, `build-server`, `monitor-server`, `docs`, `config`, `ci`, `deps` Rules: imperative mood, lowercase subject, no trailing period, max 72 chars. Use `!` after type/scope for breaking changes. diff --git a/doc/ADS_INTEGRATION.md b/doc/ADS_INTEGRATION.md new file mode 100644 index 0000000..f0b6c9a --- /dev/null +++ b/doc/ADS_INTEGRATION.md @@ -0,0 +1,212 @@ +# ADS Integration Architecture + +## Decision + +**Use Beckhoff.TwinCAT.Ads for direct ADS communication** instead of a custom ADS-over-MQTT relay protocol. + +### Context + +The original architecture assumed a custom relay where the monitor server would exchange ADS read/write commands as MQTT messages (`flowforge/ads/read/*`, `flowforge/ads/write/*`, `flowforge/ads/notification/*`). Research revealed this is unnecessary: + +- **ADS-over-MQTT is a native TwinCAT router feature** — transparent to application code. Once configured on the PLC via `TcConfig.xml`, any `AdsClient` connects normally via `AmsNetId`. +- **`Beckhoff.TwinCAT.Ads.TcpRouter`** provides a software ADS router for non-TwinCAT systems (Linux Docker containers). +- MQTT remains for **FlowForge internal messaging** (build notifications, progress updates) but is no longer used for ADS relay. + +### Consequences + +| Component | Before | After | +|-----------|--------|-------| +| **Monitor Server** | MQTT relay topics for ADS reads | `Beckhoff.TwinCAT.Ads` + `TcpRouter` for direct ADS-over-TCP | +| **Build Server** | MQTT relay for deploy commands | `Beckhoff.TwinCAT.Ads` natively (Windows/TwinCAT router) | +| **Shared MQTT Topics** | `flowforge/ads/read/*`, `write/*`, `notification/*` | Removed — MQTT for build notifications only | + +--- + +## NuGet Packages + +| Package | Version | Used By | Purpose | +|---------|---------|---------|---------| +| `Beckhoff.TwinCAT.Ads` | 7.0.* | Monitor Server, Build Server | Core ADS client (`AdsClient`) | +| `Beckhoff.TwinCAT.Ads.TcpRouter` | 7.0.* | Monitor Server only | Software ADS router for Linux/Docker | + +Both packages target .NET 8.0, .NET 10.0, and .NET Standard 2.0. They work with .NET 9.0 via the .NET Standard 2.0 target. + +--- + +## Key API Patterns + +### Connection + +```csharp +// On Windows with TwinCAT installed (build server): +var client = new AdsClient(); +client.Connect(AmsNetId.Parse("192.168.1.100.1.1"), 851); + +// On Linux/Docker with TcpRouter (monitor server): +// TcpRouter must be started first, then AdsClient connects normally. +``` + +**Port 851** = PLC Runtime 1 (default). Ports 852, 853 for additional runtimes. + +### Variable Access + +**Symbol-based read** (dynamic, for discovery): +```csharp +var loader = SymbolLoaderFactory.Create(client, settings); +var value = loader.Symbols["MAIN.nCounter"].ReadValue(); +``` + +**Handle-based read** (faster for repeated access): +```csharp +uint handle = client.CreateVariableHandle("MAIN.nCounter"); +int value = (int)client.ReadAny(handle, typeof(int)); +client.DeleteVariableHandle(handle); +``` + +**Sum Commands** (batch — critical for performance): +- 4000 individual reads = 4–8 seconds +- 4000 reads via Sum Command = ~10 ms +- Max 500 sub-commands per call + +### Notifications (Monitor Server) + +```csharp +client.AddDeviceNotificationEx( + "MAIN.nCounter", + AdsTransMode.OnChange, + cycleTime: 100, // ms — check interval + maxDelay: 0, // ms — max delay before notification + userData: null, + type: typeof(int)); +``` + +- **Max 1024 notifications per connection** +- Notifications fire on background threads +- Always unregister when done (`DeleteDeviceNotification`) + +### PLC State Management (Build Server — Deploy) + +```csharp +// Read state +StateInfo state = client.ReadState(); +// state.AdsState == AdsState.Run / Stop / Config / etc. + +// Switch to config mode (required before activation) +client.WriteControl(new StateInfo(AdsState.Reconfig, 0)); + +// Restart to run mode +client.WriteControl(new StateInfo(AdsState.Run, 0)); +``` + +--- + +## PlcAdsState Enum + +Mirrored in `FlowForge.Shared.Models.Ads.PlcAdsState` (no Beckhoff dependency in Shared): + +| Value | Name | FlowForge Meaning | +|-------|------|--------------------| +| 5 | **Run** | PLC running — deploy needs approval if production target | +| 6 | **Stop** | PLC stopped — safe for deploy | +| 11 | **Error** | PLC error — needs investigation | +| 15 | **Config** | Config mode — safe for deploy | +| 16 | **Reconfig** | Transitioning to config mode | + +Deploy lock logic: `IsSafeForDeploy = State is Stop or Config`. + +--- + +## Component Architecture + +### Monitor Server (Linux/Docker) + +``` +┌─────────────────────────────────┐ +│ Monitor Container │ +│ │ +│ ┌──────────────────────────┐ │ +│ │ IAdsClient │ │ ADS-over-TCP +│ │ (AdsClientWrapper) │───────────────────────► PLC +│ │ Uses: AdsClient + │ │ Port 48898 +│ │ TcpRouter │ │ +│ └──────────┬───────────────┘ │ +│ │ │ +│ ┌──────────▼───────────────┐ │ +│ │ SubscriptionManager │ │ +│ └──────────┬───────────────┘ │ +│ │ │ +│ ┌──────────▼───────────────┐ │ SignalR +│ │ PlcDataHub (SignalR) │◄─────────────────── Frontend +│ └──────────────────────────┘ │ +└─────────────────────────────────┘ +``` + +- Each container gets a unique local `AmsNetId` (derived from IP or session ID). +- `TcpRouter` establishes the ADS-over-TCP connection to the target PLC. +- `AdsClient` connects through the local `TcpRouter`. + +### Build Server (Windows/TwinCAT) + +``` +┌─────────────────────────────────┐ +│ Build Server (Windows) │ +│ │ +│ ┌──────────────────────────┐ │ +│ │ IAdsDeployClient │ │ Native ADS +│ │ (AdsDeployClient) │───────────────────────► PLC +│ │ Uses: AdsClient │ │ (via TwinCAT router) +│ └──────────────────────────┘ │ +│ │ +│ ┌──────────────────────────┐ │ +│ │ IAutomationInterface │ │ COM Interop +│ │ (ActivateConfiguration) │───────────────────────► TwinCAT XAE +│ └──────────────────────────┘ │ +└─────────────────────────────────┘ +``` + +- No `TcpRouter` needed — uses the native TwinCAT router on Windows. +- Deploy sequence: connect → read state → switch to config → activate → restart → verify. + +--- + +## Deploy Sequence (Build Server) + +1. **Connect** to target PLC via ADS (`IAdsDeployClient.ConnectAsync`) +2. **Read PLC state** — deploy lock check (`ReadPlcStateAsync`) +3. If running + production → require 4-eyes approval (handled by backend before queuing) +4. **Switch to config mode** (`SwitchToConfigModeAsync` → `AdsState.Reconfig`) +5. **Activate configuration** via Automation Interface (`IAutomationInterface.ActivateConfiguration`) +6. **Start/restart TwinCAT** via ADS (`StartRestartTwinCatAsync` → `AdsState.Run`) +7. **Verify** PLC is in Run state +8. **Disconnect** + +--- + +## MQTT Topic Changes + +### Removed +- `flowforge/ads/read/{amsNetId}` — replaced by direct ADS reads +- `flowforge/ads/write/{amsNetId}` — replaced by direct ADS writes +- `flowforge/ads/notification/{amsNetId}` — replaced by ADS notifications + +### Retained +- `flowforge/build/notify/{twincat-version}` — backend → build servers (wake-up signal) +- `flowforge/build/progress/{build-id}` — build server → backend (progress updates) + +### Added +- `flowforge/deploy/status/{deploy-id}` — build server → backend (deploy progress) + +--- + +## References + +- [Beckhoff.TwinCAT.Ads NuGet](https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads) +- [Beckhoff.TwinCAT.Ads.TcpRouter NuGet](https://www.nuget.org/packages/Beckhoff.TwinCAT.Ads.TcpRouter/) +- [ADS-over-MQTT Manual](https://download.beckhoff.com/download/document/automation/twincat3/ADS-over-MQTT_en.pdf) +- [Beckhoff/ADS-over-MQTT_Samples](https://github.com/Beckhoff/ADS-over-MQTT_Samples) +- [Beckhoff/TF6000_ADS_DOTNET_V5_Samples](https://github.com/Beckhoff/TF6000_ADS_DOTNET_V5_Samples) +- [ADS Notifications](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7312578699.html) +- [ADS Sum Commands](https://infosys.beckhoff.com/content/1033/tc3_adssamples_net/185258507.html) +- [AdsState Enum](https://infosys.beckhoff.com/content/1033/tc3_adsnetref/7313023115.html) +- [ITcSysManager.ActivateConfiguration](https://infosys.beckhoff.com/content/1033/tc3_automationinterface/242759819.html) +- [Secure ADS](https://download.beckhoff.com/download/document/automation/twincat3/Secure_ADS_EN.pdf) diff --git a/doc/ARCHITECTURE.md b/doc/ARCHITECTURE.md index bdbf2ef..ffd4a4a 100644 --- a/doc/ARCHITECTURE.md +++ b/doc/ARCHITECTURE.md @@ -16,10 +16,10 @@ FlowForge is a visual PLC programming platform: - **Backend → MQTT Broker**: Build notify (wake up build servers) - **Backend → Monitor Container**: Container lifecycle management (start/stop on demand) - **Build Server → Backend**: REST (poll for work, report results) -- **Build Server ↔ MQTT Broker**: Receive build notify, send progress updates, deploy commands (ADS over MQTT) +- **Build Server ↔ MQTT Broker**: Receive build notify, send progress/deploy status updates - **Build Server ↔ GitHub**: Git clone/fetch + push generated PLC solution -- **Monitor Container ↔ MQTT Broker**: ADS over MQTT reads/subscriptions for live PLC data -- **Build Server → MQTT Broker → PLC**: Deploy/activate via ADS over MQTT (requires TwinCAT Engineering on the build server) +- **Build Server → PLC**: Deploy/activate via direct ADS (Beckhoff.TwinCAT.Ads, native TwinCAT router) +- **Monitor Container → PLC**: Live PLC data via direct ADS-over-TCP (Beckhoff.TwinCAT.Ads + TcpRouter) ## User Workflow @@ -59,15 +59,19 @@ FlowForge is a visual PLC programming platform: 2. Backend spins up a dedicated monitor container for that session 3. Backend issues a short-lived auth token and returns the container's SignalR endpoint to the frontend 4. Frontend connects directly to the monitor container via SignalR -5. Monitor container reads PLC data via ADS over MQTT and streams it to the frontend in real-time +5. Monitor container reads PLC data via direct ADS (Beckhoff.TwinCAT.Ads + TcpRouter) and streams it to the frontend in real-time 6. User closes the monitoring view → backend stops the container ## Components +> **Detailed design documents**: See [MODULE_ARCHITECTURE.md](MODULE_ARCHITECTURE.md) for project structure, dependency graphs, and technology choices per module. See [BUILD_SERVER_DESIGN.md](BUILD_SERVER_DESIGN.md) for Beckhoff Automation Interface patterns, pipeline architecture, and COM interop details. + ### 1. Visual Editor (Frontend) **Purpose**: Provide intuitive node-based visual programming interface +**Architecture**: Feature-based folder organization with shared utilities. See [MODULE_ARCHITECTURE.md](MODULE_ARCHITECTURE.md). + **Key Responsibilities**: - Render visual programming canvas - Handle user interactions (drag-drop, connections) @@ -84,6 +88,8 @@ FlowForge is a visual PLC programming platform: **Purpose**: Manage projects, orchestrate builds, and handle authentication +**Architecture**: Clean Architecture Lite (3 projects: Application, Infrastructure, Api). See [MODULE_ARCHITECTURE.md](MODULE_ARCHITECTURE.md). + **Key Responsibilities**: - User authentication via Keycloak (OIDC JWT validation) with role-based access control - User management admin API (facade over Keycloak Admin REST API) @@ -105,6 +111,8 @@ FlowForge is a visual PLC programming platform: **Purpose**: Convert visual programs to TwinCAT PLC projects +**Architecture**: Single project with pipeline pattern (Pipeline, CodeGen, TwinCat, Services). See [BUILD_SERVER_DESIGN.md](BUILD_SERVER_DESIGN.md). + **Key Responsibilities**: - Clone/fetch project repo from GitHub - Parse JSON intermediate format (flow JSON) @@ -112,9 +120,9 @@ FlowForge is a visual PLC programming platform: - Create TwinCAT project structure - Commit/push generated PLC solution back to the repo - Interface with Beckhoff Automation Interface for compilation -- Deploy (activate) TwinCAT solution on target PLC via ADS over MQTT (requires TwinCAT Engineering) +- Deploy (activate) TwinCAT solution on target PLC via direct ADS (requires TwinCAT Engineering) -**Note**: Build and Deploy are separate operations with a shared permission hierarchy. The build server handles both: generation/compilation (build) and PLC activation via ADS over MQTT (deploy). Deploy requires TwinCAT Engineering, which is only available on the build server. The backend orchestrates the requests; the build server executes them. +**Note**: Build and Deploy are separate operations with a shared permission hierarchy. The build server handles both: generation/compilation (build) and PLC activation via direct ADS (deploy). Deploy requires TwinCAT Engineering, which is only available on the build server. The backend orchestrates the requests; the build server executes them. **Technology**: C# (.NET) - Required for Automation Interface compatibility @@ -124,8 +132,10 @@ FlowForge is a visual PLC programming platform: **Purpose**: Provide real-time PLC data streaming to the frontend without loading the backend API +**Architecture**: Single project with organized folders (Hubs, Auth, Services). See [MODULE_ARCHITECTURE.md](MODULE_ARCHITECTURE.md). + **Key Responsibilities**: -- Read PLC variables via ADS over MQTT (cyclic reads or event-based subscriptions) +- Read PLC variables via direct ADS (Beckhoff.TwinCAT.Ads + TcpRouter; cyclic reads or event-based subscriptions) - Convert ADS data to frontend-consumable format - Stream live data directly to the frontend via SignalR - Authenticate frontend connections using short-lived tokens issued by the backend @@ -134,11 +144,11 @@ FlowForge is a visual PLC programming platform: **Why separate from the backend?** - Monitoring is long-lived and resource-intensive (continuous ADS reads); the backend API is short-lived request-response -- The ADS data is already on the MQTT broker — routing it back through MQTT just to proxy via the backend is an unnecessary round-trip +- Direct ADS-over-TCP from the container to the PLC avoids unnecessary MQTT round-trips - Isolation: a slow or crashing PLC connection does not affect the backend API - Scalability: containers scale independently per monitoring session -**Technology**: C# (.NET) + SignalR + MQTTnet +**Technology**: C# (.NET) + SignalR + Beckhoff.TwinCAT.Ads + TcpRouter **Authentication**: Backend generates a short-lived token on monitor start; the container validates this token on SignalR connection — no need to implement full SSO in the container. @@ -161,7 +171,8 @@ Build scheduling uses PostgreSQL as the queue backend with MQTT for lightweight **MQTT topics:** - `flowforge/build/notify/{twincat-version}` — backend → build servers (lightweight wake-up signal) - `flowforge/build/progress/{build-id}` — build server → backend (real-time progress) -- `flowforge/deploy/request/{target-id}` — build server → PLC (ADS over MQTT activation, requires TwinCAT Engineering) +- `flowforge/deploy/request/{target-id}` — backend → build server (deploy request) +- `flowforge/deploy/status/{deploy-id}` — build server → backend (deploy progress) ## Authentication & Authorization @@ -232,7 +243,7 @@ project-repo/ 3. **Deploy Phase** (executed by build server): - Backend routes deploy request to the appropriate build server - - Build server activates the TwinCAT solution on the target PLC via ADS over MQTT (requires TwinCAT Engineering) + - Build server activates the TwinCAT solution on the target PLC via direct ADS (requires TwinCAT Engineering) - Separate permissions, blocked by deploy lock on running PLCs - Status updates sent back through SignalR - User receives success/error feedback @@ -241,7 +252,7 @@ project-repo/ - User requests monitoring for a target PLC - Backend starts a dedicated monitor container, returns SignalR endpoint + short-lived token - Frontend connects directly to the monitor container via SignalR - - Monitor container reads PLC data via ADS over MQTT and streams to the frontend + - Monitor container reads PLC data via direct ADS-over-TCP and streams to the frontend - Backend is not in the data path — only manages container lifecycle - Session ends → backend stops the container @@ -351,7 +362,7 @@ All services except the build server run as Docker containers in a single Docker | **Backend** | ASP.NET Core | API server, build orchestration, monitor container lifecycle, admin API (Keycloak facade) | | **Keycloak** | quay.io/keycloak/keycloak | Authentication & authorization — local users, LDAP federation, external SSO (OIDC/SAML). Admin console not exposed; managed via FlowForge admin UI | | **PostgreSQL** | postgres | Metadata, build queue, target registry, audit + Keycloak data | -| **MQTT Broker** | mosquitto / emqx | ADS over MQTT communication, build notifications | +| **MQTT Broker** | mosquitto / emqx | FlowForge internal messaging: build notifications, progress, deploy status | | **docker-socket-proxy** | tecnativa/docker-socket-proxy | Filtered Docker API access for backend (containers only) | | **Monitor Containers** | On-demand (C#/.NET) | Live PLC data streaming via SignalR, created/destroyed per session | @@ -378,7 +389,7 @@ This limits the blast radius if the backend is compromised — it can only manag The build server runs on dedicated Windows Server instances (not in the Docker stack): - **Requirement**: TwinCAT Engineering (Windows desktop dependency for Beckhoff Automation Interface) -- **Connectivity**: Connects to the stack via REST (poll backend for build jobs) and MQTT (receive notifications, send progress, deploy via ADS over MQTT) +- **Connectivity**: Connects to the stack via REST (poll backend for build jobs) and MQTT (receive notifications, send progress). Deploy uses direct ADS via native TwinCAT router. - **Scaling**: One instance per supported TwinCAT version - **Cannot be containerized**: TwinCAT Engineering requires Windows desktop environment with COM interop @@ -410,7 +421,7 @@ Monitor containers are registered with Traefik automatically via Docker labels ( - **Service user**: Minimal permissions — repo creation only - **Authorization**: Role-based access control via Keycloak roles/groups - **Deploy protection**: 4-eyes principle for production targets, deploy lock on running PLCs -- **PLC Access**: ADS over MQTT via central broker (no per-server ADS route configuration) +- **PLC Access**: Direct ADS via Beckhoff.TwinCAT.Ads (TcpRouter for Linux containers, native router for Windows build servers). See [ADS_INTEGRATION.md](doc/ADS_INTEGRATION.md). - **Docker socket isolation**: Backend accesses Docker API only through docker-socket-proxy (filtered to container create/start/stop/remove) - **Monitor container auth**: Short-lived tokens issued by backend, validated by container on SignalR connect — no full auth stack in containers - **Code Injection**: Validate all user inputs to prevent malicious code generation diff --git a/doc/BUILD_SERVER_DESIGN.md b/doc/BUILD_SERVER_DESIGN.md new file mode 100644 index 0000000..7d63cd8 --- /dev/null +++ b/doc/BUILD_SERVER_DESIGN.md @@ -0,0 +1,49 @@ +# Build Server Design + +## Overview + +The build server converts visual flow programs into deployable TwinCAT PLC projects. It runs on dedicated Windows Server instances (one per TwinCAT version) and connects to the FlowForge stack via REST + MQTT. + +## Pipeline Architecture + +Build jobs are processed through a sequential pipeline of `IBuildStep` implementations: + +1. **CloneRepoStep** — Clone/fetch the project repo from GitHub +2. **ParseFlowStep** — Deserialize flow JSON from the repo +3. **ValidateFlowStep** — Validate node graph structure and connections +4. **GenerateCodeStep** — Generate IEC 61131-3 Structured Text from flow nodes +5. **CreateProjectStep** — Create TwinCAT project structure via Automation Interface +6. **ConfigureTasksStep** — Configure PLC tasks and I/O mappings +7. **CompileStep** — Compile the TwinCAT project +8. **GenerateBootProjectStep** — Generate boot project for target deployment +9. **CommitResultStep** — Commit/push generated PLC solution to the repo +10. **DeployStep** — (Deploy jobs only) Activate on target PLC via ADS + +## Code Generation + +The `INodeTranslator` strategy pattern maps flow node types to Structured Text: +- Each node type has a dedicated translator (e.g., `TimerTranslator`, `CounterTranslator`, `ComparisonTranslator`) +- `StructuredTextGenerator` orchestrates translation using registered translators +- `PlcProjectBuilder` assembles POUs, GVLs, and DUTs into the TwinCAT project structure + +## TwinCAT Integration + +- **IVisualStudioInstance** — Manages the TwinCAT XAE Shell (Visual Studio) COM automation +- **IAutomationInterface** — Facade over `ITcSysManager` for project creation, POU management, compilation, and activation +- **MessageFilter** — COM message filter for handling OLE callbacks during automation + +## ADS Integration + +Deploy operations use `Beckhoff.TwinCAT.Ads` for direct ADS communication with target PLCs: + +- **IAdsDeployClient** — Connect, read state, switch to config mode, restart TwinCAT +- Uses the native TwinCAT router on Windows (no TcpRouter needed) +- Deploy sequence documented in [ADS_INTEGRATION.md](ADS_INTEGRATION.md) + +## Build Queue Integration + +- Build servers poll the backend REST API for jobs (`FOR UPDATE SKIP LOCKED`) +- MQTT `flowforge/build/notify/{twincat-version}` provides lightweight wake-up signals +- Progress reported via MQTT `flowforge/build/progress/{build-id}` +- Deploy status reported via MQTT `flowforge/deploy/status/{deploy-id}` +- Final results reported via backend REST API diff --git a/doc/MODULE_ARCHITECTURE.md b/doc/MODULE_ARCHITECTURE.md new file mode 100644 index 0000000..ecb4f1a --- /dev/null +++ b/doc/MODULE_ARCHITECTURE.md @@ -0,0 +1,78 @@ +# Module Architecture + +## Shared Library (`FlowForge.Shared`) + +Dependency-free library containing DTOs, enums, and constants shared across all .NET components. + +### Models +- **Ads/** — `PlcAdsState`, `PlcStateDto`, `AdsConnectionInfo`, `AdsVariableSubscription` +- **Auth/** — `UserInfoDto` +- **Build/** — `BuildStatus`, `BuildJobDto`, `BuildProgressDto`, `BuildResultDto` +- **Deploy/** — `DeployStatus`, `DeployRequestDto`, `DeployResultDto` +- **Flow/** — `FlowDocument`, `FlowNode`, `FlowConnection`, `FlowPort`, `NodePosition` +- **Monitor/** — `MonitorSessionDto`, `PlcVariableValueDto` +- **Project/** — `ProjectSummaryDto`, `ProjectDetailDto` +- **Target/** — `PlcTargetDto`, `TargetGroupDto` + +### MQTT +- `MqttTopics` — Topic string builders for FlowForge internal messaging (build notifications, progress, deploy status). ADS communication uses `Beckhoff.TwinCAT.Ads` directly. + +--- + +## Backend (`FlowForge.Backend`) + +Clean Architecture Lite with three layers: + +### Api (ASP.NET Core) +Controllers, middleware, auth (Keycloak JWT validation), SignalR hubs for build/deploy status. + +### Application (Business Logic) +- **Services**: `ProjectService`, `BuildService`, `DeployService`, `TargetService`, `MonitorService`, `AdminService` +- **Interfaces**: Repository and service contracts (Git, Docker, MQTT, Keycloak, encryption) +- No external dependencies — references Shared only + +### Infrastructure +EF Core (PostgreSQL), external integrations (Git via LibGit2Sharp, MQTT via MQTTnet, Docker API, Keycloak Admin REST API, AES encryption). + +--- + +## Build Server (`FlowForge.BuildServer`) + +Windows-only service for PLC project generation and deployment. + +### Pipeline +Sequential `IBuildStep` pipeline: clone → parse → validate → generate code → create project → configure tasks → compile → generate boot project → commit → deploy. + +### Code Generation +`INodeTranslator` strategy pattern for flow-to-Structured Text translation. `PlcProjectBuilder` for TwinCAT project assembly. + +### TwinCAT Integration +- **IAutomationInterface** — COM facade over `ITcSysManager` (Visual Studio/TwinCAT XAE Shell) +- **IAdsDeployClient** — Direct ADS via `Beckhoff.TwinCAT.Ads` for deploy operations (state management, config mode switch, restart). Uses native TwinCAT router. + +### Services +- `BuildJobClient` — REST client for backend API (claim jobs, report results) +- `MqttHandler` — FlowForge internal messaging (build notifications, progress updates) +- `Worker` — Background service polling for build jobs + +--- + +## Monitor Server (`FlowForge.MonitorServer`) + +On-demand Linux/Docker container for live PLC data streaming. + +### ADS Client +- **IAdsClient** — Direct ADS via `Beckhoff.TwinCAT.Ads` + `Beckhoff.TwinCAT.Ads.TcpRouter` (software ADS router for non-TwinCAT systems) +- Supports: single reads, batch reads (Sum Commands), ADS notifications (`OnChange`), PLC state reads +- Each container maintains a single long-lived ADS-over-TCP connection to the target PLC + +### SignalR Hub +- **PlcDataHub** — Frontend subscribes to PLC variables; hub streams values via `IPlcDataHubClient` +- **IPlcDataHubClient** — `ReceiveVariableValues`, `ReceiveConnectionStatus`, `ReceiveError` + +### Services +- **SubscriptionManager** — Thread-safe tracking of per-connection variable subscriptions +- **TokenValidator** — Short-lived auth token validation for SignalR connections + +### Lifecycle +Backend creates container on monitoring request, injects config as env vars (`MonitorOptions`), Traefik auto-discovers via Docker labels, frontend connects directly via SignalR, backend destroys on session end. diff --git a/src/FlowForge.sln b/src/FlowForge.sln new file mode 100644 index 0000000..0b76d3c --- /dev/null +++ b/src/FlowForge.sln @@ -0,0 +1,109 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{10000000-0000-0000-0000-000000000001}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Shared", "shared\FlowForge.Shared\FlowForge.Shared.csproj", "{F3A4B5C6-D7E8-9012-CDEF-123456789013}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "backend", "backend", "{10000000-0000-0000-0000-000000000002}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Api", "backend\src\FlowForge.Backend.Api\FlowForge.Backend.Api.csproj", "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Application", "backend\src\FlowForge.Backend.Application\FlowForge.Backend.Application.csproj", "{D1E2F3A4-B5C6-7890-ABCD-EF1234567891}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Infrastructure", "backend\src\FlowForge.Backend.Infrastructure\FlowForge.Backend.Infrastructure.csproj", "{E2F3A4B5-C6D7-8901-BCDE-F12345678902}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build-server", "build-server", "{10000000-0000-0000-0000-000000000003}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.BuildServer", "build-server\src\FlowForge.BuildServer\FlowForge.BuildServer.csproj", "{B2C3D4E5-F6A7-8901-BCDE-F12345678901}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "monitor-server", "monitor-server", "{10000000-0000-0000-0000-000000000004}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.MonitorServer", "monitor-server\src\FlowForge.MonitorServer\FlowForge.MonitorServer.csproj", "{C3D4E5F6-A7B8-9012-CDEF-123456789012}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{10000000-0000-0000-0000-000000000005}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Shared.Tests", "..\test\FlowForge.Shared.Tests\FlowForge.Shared.Tests.csproj", "{20000000-0000-0000-0000-000000000001}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Api.Tests", "..\test\FlowForge.Backend.Api.Tests\FlowForge.Backend.Api.Tests.csproj", "{20000000-0000-0000-0000-000000000002}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Application.Tests", "..\test\FlowForge.Backend.Application.Tests\FlowForge.Backend.Application.Tests.csproj", "{20000000-0000-0000-0000-000000000003}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Infrastructure.Tests", "..\test\FlowForge.Backend.Infrastructure.Tests\FlowForge.Backend.Infrastructure.Tests.csproj", "{20000000-0000-0000-0000-000000000004}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.BuildServer.Tests", "..\test\FlowForge.BuildServer.Tests\FlowForge.BuildServer.Tests.csproj", "{20000000-0000-0000-0000-000000000005}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.MonitorServer.Tests", "..\test\FlowForge.MonitorServer.Tests\FlowForge.MonitorServer.Tests.csproj", "{20000000-0000-0000-0000-000000000006}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Release|Any CPU.Build.0 = Release|Any CPU + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.Build.0 = Release|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Release|Any CPU.Build.0 = Release|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Release|Any CPU.Build.0 = Release|Any CPU + {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Release|Any CPU.Build.0 = Release|Any CPU + {C3D4E5F6-A7B8-9012-CDEF-123456789012}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C3D4E5F6-A7B8-9012-CDEF-123456789012}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3D4E5F6-A7B8-9012-CDEF-123456789012}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C3D4E5F6-A7B8-9012-CDEF-123456789012}.Release|Any CPU.Build.0 = Release|Any CPU + {20000000-0000-0000-0000-000000000001}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20000000-0000-0000-0000-000000000001}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20000000-0000-0000-0000-000000000001}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20000000-0000-0000-0000-000000000001}.Release|Any CPU.Build.0 = Release|Any CPU + {20000000-0000-0000-0000-000000000002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20000000-0000-0000-0000-000000000002}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20000000-0000-0000-0000-000000000002}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20000000-0000-0000-0000-000000000002}.Release|Any CPU.Build.0 = Release|Any CPU + {20000000-0000-0000-0000-000000000003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20000000-0000-0000-0000-000000000003}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20000000-0000-0000-0000-000000000003}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20000000-0000-0000-0000-000000000003}.Release|Any CPU.Build.0 = Release|Any CPU + {20000000-0000-0000-0000-000000000004}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20000000-0000-0000-0000-000000000004}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20000000-0000-0000-0000-000000000004}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20000000-0000-0000-0000-000000000004}.Release|Any CPU.Build.0 = Release|Any CPU + {20000000-0000-0000-0000-000000000005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20000000-0000-0000-0000-000000000005}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20000000-0000-0000-0000-000000000005}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20000000-0000-0000-0000-000000000005}.Release|Any CPU.Build.0 = Release|Any CPU + {20000000-0000-0000-0000-000000000006}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20000000-0000-0000-0000-000000000006}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20000000-0000-0000-0000-000000000006}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20000000-0000-0000-0000-000000000006}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {F3A4B5C6-D7E8-9012-CDEF-123456789013} = {10000000-0000-0000-0000-000000000001} + {A1B2C3D4-E5F6-7890-ABCD-EF1234567890} = {10000000-0000-0000-0000-000000000002} + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891} = {10000000-0000-0000-0000-000000000002} + {E2F3A4B5-C6D7-8901-BCDE-F12345678902} = {10000000-0000-0000-0000-000000000002} + {B2C3D4E5-F6A7-8901-BCDE-F12345678901} = {10000000-0000-0000-0000-000000000003} + {C3D4E5F6-A7B8-9012-CDEF-123456789012} = {10000000-0000-0000-0000-000000000004} + {20000000-0000-0000-0000-000000000001} = {10000000-0000-0000-0000-000000000005} + {20000000-0000-0000-0000-000000000002} = {10000000-0000-0000-0000-000000000005} + {20000000-0000-0000-0000-000000000003} = {10000000-0000-0000-0000-000000000005} + {20000000-0000-0000-0000-000000000004} = {10000000-0000-0000-0000-000000000005} + {20000000-0000-0000-0000-000000000005} = {10000000-0000-0000-0000-000000000005} + {20000000-0000-0000-0000-000000000006} = {10000000-0000-0000-0000-000000000005} + EndGlobalSection +EndGlobal diff --git a/src/backend/FlowForge.Backend.sln b/src/backend/FlowForge.Backend.sln index f083044..40ca31e 100644 --- a/src/backend/FlowForge.Backend.sln +++ b/src/backend/FlowForge.Backend.sln @@ -5,6 +5,12 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Api", "src\FlowForge.Backend.Api\FlowForge.Backend.Api.csproj", "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Application", "src\FlowForge.Backend.Application\FlowForge.Backend.Application.csproj", "{D1E2F3A4-B5C6-7890-ABCD-EF1234567891}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Backend.Infrastructure", "src\FlowForge.Backend.Infrastructure\FlowForge.Backend.Infrastructure.csproj", "{E2F3A4B5-C6D7-8901-BCDE-F12345678902}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Shared", "..\shared\FlowForge.Shared\FlowForge.Shared.csproj", "{F3A4B5C6-D7E8-9012-CDEF-123456789013}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,5 +21,17 @@ Global {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.Build.0 = Debug|Any CPU {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.ActiveCfg = Release|Any CPU {A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.Build.0 = Release|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1E2F3A4-B5C6-7890-ABCD-EF1234567891}.Release|Any CPU.Build.0 = Release|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2F3A4B5-C6D7-8901-BCDE-F12345678902}.Release|Any CPU.Build.0 = Release|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/backend/src/FlowForge.Backend.Api/Auth/ClaimsPrincipalExtensions.cs b/src/backend/src/FlowForge.Backend.Api/Auth/ClaimsPrincipalExtensions.cs new file mode 100644 index 0000000..46410a8 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Auth/ClaimsPrincipalExtensions.cs @@ -0,0 +1,22 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using System.Security.Claims; + +namespace FlowForge.Backend.Api.Auth; + +public static class ClaimsPrincipalExtensions +{ + public static string? GetUserId(this ClaimsPrincipal principal) => + principal.FindFirstValue(ClaimTypes.NameIdentifier); + + public static string? GetEmail(this ClaimsPrincipal principal) => + principal.FindFirstValue(ClaimTypes.Email); + + public static string? GetDisplayName(this ClaimsPrincipal principal) => + principal.FindFirstValue("name") ?? principal.FindFirstValue(ClaimTypes.Name); + + public static bool HasPermission(this ClaimsPrincipal principal, string permission) => + principal.HasClaim("permission", permission) || + principal.IsInRole("admin"); +} diff --git a/src/backend/src/FlowForge.Backend.Api/Auth/KeycloakJwtSetup.cs b/src/backend/src/FlowForge.Backend.Api/Auth/KeycloakJwtSetup.cs new file mode 100644 index 0000000..1bc9317 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Auth/KeycloakJwtSetup.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Api.Configuration; +using Microsoft.AspNetCore.Authentication.JwtBearer; + +namespace FlowForge.Backend.Api.Auth; + +public static class KeycloakJwtSetup +{ + public static IServiceCollection AddKeycloakAuthentication(this IServiceCollection services, IConfiguration configuration) + { + var keycloakOptions = configuration.GetSection(KeycloakOptions.Section).Get() + ?? new KeycloakOptions(); + + services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) + .AddJwtBearer(options => + { + options.Authority = $"{keycloakOptions.BaseUrl}/realms/{keycloakOptions.Realm}"; + options.Audience = keycloakOptions.ClientId; + options.RequireHttpsMetadata = keycloakOptions.RequireHttps; + }); + + services.AddAuthorization(); + + return services; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Configuration/KeycloakOptions.cs b/src/backend/src/FlowForge.Backend.Api/Configuration/KeycloakOptions.cs new file mode 100644 index 0000000..cda0bb8 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Configuration/KeycloakOptions.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Api.Configuration; + +public class KeycloakOptions +{ + public const string Section = "Keycloak"; + + public string BaseUrl { get; set; } = "http://keycloak:8080"; + public string Realm { get; set; } = "flowforge"; + public string ClientId { get; set; } = "flowforge-backend"; + public string AdminUrl { get; set; } = "http://keycloak:8080"; + public bool RequireHttps { get; set; } = false; +} diff --git a/src/backend/src/FlowForge.Backend.Api/Configuration/MqttOptions.cs b/src/backend/src/FlowForge.Backend.Api/Configuration/MqttOptions.cs new file mode 100644 index 0000000..6e0e64a --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Configuration/MqttOptions.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Api.Configuration; + +public class MqttOptions +{ + public const string Section = "Mqtt"; + + public string Host { get; set; } = "mqtt-broker"; + public int Port { get; set; } = 1883; + public string? ClientId { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Controllers/AdminController.cs b/src/backend/src/FlowForge.Backend.Api/Controllers/AdminController.cs new file mode 100644 index 0000000..f247ae1 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Controllers/AdminController.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Services; +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class AdminController : ControllerBase +{ + private readonly AdminService _adminService; + + public AdminController(AdminService adminService) + { + _adminService = adminService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Controllers/BuildController.cs b/src/backend/src/FlowForge.Backend.Api/Controllers/BuildController.cs new file mode 100644 index 0000000..0a2906f --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Controllers/BuildController.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Services; +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class BuildController : ControllerBase +{ + private readonly BuildService _buildService; + + public BuildController(BuildService buildService) + { + _buildService = buildService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Controllers/DeployController.cs b/src/backend/src/FlowForge.Backend.Api/Controllers/DeployController.cs new file mode 100644 index 0000000..215bf71 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Controllers/DeployController.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Services; +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class DeployController : ControllerBase +{ + private readonly DeployService _deployService; + + public DeployController(DeployService deployService) + { + _deployService = deployService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Controllers/MonitorController.cs b/src/backend/src/FlowForge.Backend.Api/Controllers/MonitorController.cs new file mode 100644 index 0000000..b311cc4 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Controllers/MonitorController.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Services; +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class MonitorController : ControllerBase +{ + private readonly MonitorService _monitorService; + + public MonitorController(MonitorService monitorService) + { + _monitorService = monitorService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Controllers/ProjectsController.cs b/src/backend/src/FlowForge.Backend.Api/Controllers/ProjectsController.cs new file mode 100644 index 0000000..b4aa9bf --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Controllers/ProjectsController.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Services; +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class ProjectsController : ControllerBase +{ + private readonly ProjectService _projectService; + + public ProjectsController(ProjectService projectService) + { + _projectService = projectService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Controllers/TargetsController.cs b/src/backend/src/FlowForge.Backend.Api/Controllers/TargetsController.cs new file mode 100644 index 0000000..d536fc3 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Controllers/TargetsController.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Services; +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Controllers; + +[ApiController] +[Route("api/[controller]")] +public class TargetsController : ControllerBase +{ + private readonly TargetService _targetService; + + public TargetsController(TargetService targetService) + { + _targetService = targetService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/FlowForge.Backend.Api.csproj b/src/backend/src/FlowForge.Backend.Api/FlowForge.Backend.Api.csproj index a9fe9f7..9cdf665 100644 --- a/src/backend/src/FlowForge.Backend.Api/FlowForge.Backend.Api.csproj +++ b/src/backend/src/FlowForge.Backend.Api/FlowForge.Backend.Api.csproj @@ -8,14 +8,13 @@ - - - - all - runtime; build; native; contentfiles; analyzers - - - + + + + + + + diff --git a/src/backend/src/FlowForge.Backend.Api/Middleware/ErrorHandlingMiddleware.cs b/src/backend/src/FlowForge.Backend.Api/Middleware/ErrorHandlingMiddleware.cs new file mode 100644 index 0000000..2c8eeeb --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Middleware/ErrorHandlingMiddleware.cs @@ -0,0 +1,39 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using Microsoft.AspNetCore.Mvc; + +namespace FlowForge.Backend.Api.Middleware; + +public class ErrorHandlingMiddleware +{ + private readonly RequestDelegate _next; + private readonly ILogger _logger; + + public ErrorHandlingMiddleware(RequestDelegate next, ILogger logger) + { + _next = next; + _logger = logger; + } + + public async Task InvokeAsync(HttpContext context) + { + try + { + await _next(context); + } + catch (Exception ex) + { + _logger.LogError(ex, "Unhandled exception"); + context.Response.StatusCode = StatusCodes.Status500InternalServerError; + context.Response.ContentType = "application/problem+json"; + var problem = new ProblemDetails + { + Status = StatusCodes.Status500InternalServerError, + Title = "An unexpected error occurred", + Type = "https://tools.ietf.org/html/rfc9110#section-15.6.1" + }; + await context.Response.WriteAsJsonAsync(problem); + } + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Middleware/RequestLoggingMiddleware.cs b/src/backend/src/FlowForge.Backend.Api/Middleware/RequestLoggingMiddleware.cs new file mode 100644 index 0000000..5babaa5 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Api/Middleware/RequestLoggingMiddleware.cs @@ -0,0 +1,34 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using System.Diagnostics; + +namespace FlowForge.Backend.Api.Middleware; + +public class RequestLoggingMiddleware +{ + private readonly RequestDelegate _next; + private readonly ILogger _logger; + + public RequestLoggingMiddleware(RequestDelegate next, ILogger logger) + { + _next = next; + _logger = logger; + } + + public async Task InvokeAsync(HttpContext context) + { + var sw = Stopwatch.StartNew(); + try + { + await _next(context); + } + finally + { + sw.Stop(); + _logger.LogInformation("{Method} {Path} responded {StatusCode} in {Elapsed}ms", + context.Request.Method, context.Request.Path, + context.Response.StatusCode, sw.ElapsedMilliseconds); + } + } +} diff --git a/src/backend/src/FlowForge.Backend.Api/Program.cs b/src/backend/src/FlowForge.Backend.Api/Program.cs index a125c2b..ca0acdb 100644 --- a/src/backend/src/FlowForge.Backend.Api/Program.cs +++ b/src/backend/src/FlowForge.Backend.Api/Program.cs @@ -1,8 +1,13 @@ // Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) // SPDX-License-Identifier: AGPL-3.0-or-later +using FlowForge.Backend.Api.Auth; using FlowForge.Backend.Api.Configuration; using FlowForge.Backend.Api.Hubs; +using FlowForge.Backend.Api.Middleware; +using FlowForge.Backend.Application.Services; +using FlowForge.Backend.Application.Validation; +using FlowForge.Backend.Infrastructure; var builder = WebApplication.CreateBuilder(args); @@ -11,18 +16,31 @@ // --------------------------------------------------------------------------- builder.Services.Configure( builder.Configuration.GetSection(FlowForgeOptions.Section)); +builder.Services.Configure( + builder.Configuration.GetSection(KeycloakOptions.Section)); +builder.Services.Configure( + builder.Configuration.GetSection(MqttOptions.Section)); // --------------------------------------------------------------------------- -// Database (EF Core + PostgreSQL) +// Infrastructure (EF Core, repositories, external services) // --------------------------------------------------------------------------- -// builder.Services.AddDbContext(options => -// options.UseNpgsql(builder.Configuration.GetConnectionString("PostgreSQL"))); +builder.Services.AddInfrastructure(builder.Configuration); + +// --------------------------------------------------------------------------- +// Application services +// --------------------------------------------------------------------------- +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddSingleton(); // --------------------------------------------------------------------------- // Authentication — Keycloak OIDC (JWT validation) // --------------------------------------------------------------------------- -// TODO: Wire up OIDC JWT Bearer authentication against Keycloak -// TODO: Add admin API endpoints as facade over Keycloak Admin REST API +builder.Services.AddKeycloakAuthentication(builder.Configuration); // --------------------------------------------------------------------------- // SignalR @@ -54,12 +72,15 @@ // --------------------------------------------------------------------------- // Middleware pipeline // --------------------------------------------------------------------------- +app.UseMiddleware(); +app.UseMiddleware(); + app.UseCors(); -// app.UseAuthentication(); -// app.UseAuthorization(); +app.UseAuthentication(); +app.UseAuthorization(); app.MapControllers(); app.MapHub("/hub/build"); -app.Run(); \ No newline at end of file +app.Run(); diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/AuditEntry.cs b/src/backend/src/FlowForge.Backend.Application/Entities/AuditEntry.cs new file mode 100644 index 0000000..6053605 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/AuditEntry.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Entities; + +public class AuditEntry +{ + public Guid Id { get; set; } + public string Action { get; set; } = string.Empty; + public string EntityType { get; set; } = string.Empty; + public string EntityId { get; set; } = string.Empty; + public string UserId { get; set; } = string.Empty; + public string? Details { get; set; } + public DateTimeOffset Timestamp { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/BuildJob.cs b/src/backend/src/FlowForge.Backend.Application/Entities/BuildJob.cs new file mode 100644 index 0000000..d5fa0c3 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/BuildJob.cs @@ -0,0 +1,25 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Shared.Models.Build; + +namespace FlowForge.Backend.Application.Entities; + +public class BuildJob +{ + public Guid Id { get; set; } + public Guid ProjectId { get; set; } + public string TwinCatVersion { get; set; } = string.Empty; + public BuildStatus Status { get; set; } + public bool IncludeDeploy { get; set; } + public string? TargetAmsNetId { get; set; } + public string RequestedBy { get; set; } = string.Empty; + public string? ClaimedBy { get; set; } + public string? CommitSha { get; set; } + public string? ErrorMessage { get; set; } + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset? StartedAt { get; set; } + public DateTimeOffset? CompletedAt { get; set; } + + public Project? Project { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/DeployRecord.cs b/src/backend/src/FlowForge.Backend.Application/Entities/DeployRecord.cs new file mode 100644 index 0000000..dd6afb3 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/DeployRecord.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Shared.Models.Deploy; + +namespace FlowForge.Backend.Application.Entities; + +public class DeployRecord +{ + public Guid Id { get; set; } + public Guid BuildJobId { get; set; } + public string TargetAmsNetId { get; set; } = string.Empty; + public DeployStatus Status { get; set; } + public string RequestedBy { get; set; } = string.Empty; + public string? ApprovedBy { get; set; } + public string? ErrorMessage { get; set; } + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset? CompletedAt { get; set; } + + public BuildJob? BuildJob { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/PlcTarget.cs b/src/backend/src/FlowForge.Backend.Application/Entities/PlcTarget.cs new file mode 100644 index 0000000..5ec487f --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/PlcTarget.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Entities; + +public class PlcTarget +{ + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string AmsNetId { get; set; } = string.Empty; + public string TwinCatVersion { get; set; } = string.Empty; + public List Labels { get; set; } = []; + public Guid? GroupId { get; set; } + public bool IsProductionTarget { get; set; } + public bool DeployLocked { get; set; } + + public TargetGroup? Group { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/Project.cs b/src/backend/src/FlowForge.Backend.Application/Entities/Project.cs new file mode 100644 index 0000000..00c074a --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/Project.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Entities; + +public class Project +{ + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + public string RepoUrl { get; set; } = string.Empty; + public string Branch { get; set; } = "main"; + public string? LastCommitSha { get; set; } + public string CreatedBy { get; set; } = string.Empty; + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset UpdatedAt { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/TargetGroup.cs b/src/backend/src/FlowForge.Backend.Application/Entities/TargetGroup.cs new file mode 100644 index 0000000..0b66209 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/TargetGroup.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Entities; + +public class TargetGroup +{ + public Guid Id { get; set; } + public string Name { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; + + public List Targets { get; set; } = []; +} diff --git a/src/backend/src/FlowForge.Backend.Application/Entities/UserToken.cs b/src/backend/src/FlowForge.Backend.Application/Entities/UserToken.cs new file mode 100644 index 0000000..2fadb85 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Entities/UserToken.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Entities; + +public class UserToken +{ + public Guid Id { get; set; } + public string UserId { get; set; } = string.Empty; + public string Provider { get; set; } = string.Empty; + public byte[] EncryptedToken { get; set; } = []; + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset? ExpiresAt { get; set; } +} diff --git a/src/backend/src/FlowForge.Backend.Application/FlowForge.Backend.Application.csproj b/src/backend/src/FlowForge.Backend.Application/FlowForge.Backend.Application.csproj new file mode 100644 index 0000000..2b9ae99 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/FlowForge.Backend.Application.csproj @@ -0,0 +1,14 @@ + + + + net9.0 + enable + enable + FlowForge.Backend.Application + + + + + + + diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IAuditRepository.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IAuditRepository.cs new file mode 100644 index 0000000..a157282 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IAuditRepository.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; + +namespace FlowForge.Backend.Application.Interfaces.Repositories; + +public interface IAuditRepository +{ + Task AddAsync(AuditEntry entry, CancellationToken ct = default); + Task> GetByEntityAsync(string entityType, string entityId, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IBuildJobRepository.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IBuildJobRepository.cs new file mode 100644 index 0000000..2610a05 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IBuildJobRepository.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; + +namespace FlowForge.Backend.Application.Interfaces.Repositories; + +public interface IBuildJobRepository +{ + Task GetByIdAsync(Guid id, CancellationToken ct = default); + Task> GetByProjectIdAsync(Guid projectId, CancellationToken ct = default); + Task AddAsync(BuildJob job, CancellationToken ct = default); + Task UpdateAsync(BuildJob job, CancellationToken ct = default); + Task ClaimNextAsync(string twinCatVersion, string claimedBy, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IDeployRecordRepository.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IDeployRecordRepository.cs new file mode 100644 index 0000000..7fa866b --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IDeployRecordRepository.cs @@ -0,0 +1,14 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; + +namespace FlowForge.Backend.Application.Interfaces.Repositories; + +public interface IDeployRecordRepository +{ + Task GetByIdAsync(Guid id, CancellationToken ct = default); + Task> GetByBuildJobIdAsync(Guid buildJobId, CancellationToken ct = default); + Task AddAsync(DeployRecord record, CancellationToken ct = default); + Task UpdateAsync(DeployRecord record, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IPlcTargetRepository.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IPlcTargetRepository.cs new file mode 100644 index 0000000..6802025 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IPlcTargetRepository.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; + +namespace FlowForge.Backend.Application.Interfaces.Repositories; + +public interface IPlcTargetRepository +{ + Task GetByIdAsync(Guid id, CancellationToken ct = default); + Task> GetAllAsync(CancellationToken ct = default); + Task AddAsync(PlcTarget target, CancellationToken ct = default); + Task UpdateAsync(PlcTarget target, CancellationToken ct = default); + Task DeleteAsync(Guid id, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IProjectRepository.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IProjectRepository.cs new file mode 100644 index 0000000..1db588a --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IProjectRepository.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; + +namespace FlowForge.Backend.Application.Interfaces.Repositories; + +public interface IProjectRepository +{ + Task GetByIdAsync(Guid id, CancellationToken ct = default); + Task> GetAllAsync(CancellationToken ct = default); + Task AddAsync(Project project, CancellationToken ct = default); + Task UpdateAsync(Project project, CancellationToken ct = default); + Task DeleteAsync(Guid id, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IUserTokenRepository.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IUserTokenRepository.cs new file mode 100644 index 0000000..7362215 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Repositories/IUserTokenRepository.cs @@ -0,0 +1,13 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; + +namespace FlowForge.Backend.Application.Interfaces.Repositories; + +public interface IUserTokenRepository +{ + Task GetByUserAndProviderAsync(string userId, string provider, CancellationToken ct = default); + Task AddOrUpdateAsync(UserToken token, CancellationToken ct = default); + Task DeleteAsync(string userId, string provider, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IDockerService.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IDockerService.cs new file mode 100644 index 0000000..299ac3d --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IDockerService.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Interfaces.Services; + +public interface IDockerService +{ + Task CreateMonitorContainerAsync(string sessionId, string targetAmsNetId, string authToken, CancellationToken ct = default); + Task StartContainerAsync(string containerId, CancellationToken ct = default); + Task StopContainerAsync(string containerId, CancellationToken ct = default); + Task RemoveContainerAsync(string containerId, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IGitService.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IGitService.cs new file mode 100644 index 0000000..d39cd53 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IGitService.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Interfaces.Services; + +public interface IGitService +{ + Task CloneOrFetchAsync(string repoUrl, string localPath, string branch, CancellationToken ct = default); + Task CommitAndPushAsync(string localPath, string message, string userName, string userEmail, CancellationToken ct = default); + Task CreateRepoAsync(string name, string description, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IKeycloakAdminService.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IKeycloakAdminService.cs new file mode 100644 index 0000000..241659f --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IKeycloakAdminService.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Shared.Models.Auth; + +namespace FlowForge.Backend.Application.Interfaces.Services; + +public interface IKeycloakAdminService +{ + Task> GetUsersAsync(CancellationToken ct = default); + Task GetUserByIdAsync(string userId, CancellationToken ct = default); + Task CreateUserAsync(string userName, string email, string? password, CancellationToken ct = default); + Task UpdateUserAsync(string userId, string? email, string? displayName, CancellationToken ct = default); + Task DeleteUserAsync(string userId, CancellationToken ct = default); + Task AssignRoleAsync(string userId, string roleName, CancellationToken ct = default); + Task RemoveRoleAsync(string userId, string roleName, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IMqttService.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IMqttService.cs new file mode 100644 index 0000000..b978488 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/IMqttService.cs @@ -0,0 +1,11 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Interfaces.Services; + +public interface IMqttService +{ + Task PublishAsync(string topic, string payload, CancellationToken ct = default); + Task SubscribeAsync(string topic, Func handler, CancellationToken ct = default); + Task UnsubscribeAsync(string topic, CancellationToken ct = default); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/ITokenEncryptionService.cs b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/ITokenEncryptionService.cs new file mode 100644 index 0000000..d1afbd2 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Interfaces/Services/ITokenEncryptionService.cs @@ -0,0 +1,10 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +namespace FlowForge.Backend.Application.Interfaces.Services; + +public interface ITokenEncryptionService +{ + byte[] Encrypt(string plainText); + string Decrypt(byte[] cipherText); +} diff --git a/src/backend/src/FlowForge.Backend.Application/Services/AdminService.cs b/src/backend/src/FlowForge.Backend.Application/Services/AdminService.cs new file mode 100644 index 0000000..c994a0c --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Services/AdminService.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Application.Services; + +public class AdminService +{ + private readonly IKeycloakAdminService _keycloakAdminService; + + public AdminService(IKeycloakAdminService keycloakAdminService) + { + _keycloakAdminService = keycloakAdminService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Services/BuildService.cs b/src/backend/src/FlowForge.Backend.Application/Services/BuildService.cs new file mode 100644 index 0000000..1f9dec5 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Services/BuildService.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Application.Services; + +public class BuildService +{ + private readonly IBuildJobRepository _buildJobRepository; + private readonly IMqttService _mqttService; + + public BuildService(IBuildJobRepository buildJobRepository, IMqttService mqttService) + { + _buildJobRepository = buildJobRepository; + _mqttService = mqttService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Services/DeployService.cs b/src/backend/src/FlowForge.Backend.Application/Services/DeployService.cs new file mode 100644 index 0000000..39c2ad7 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Services/DeployService.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Application.Interfaces.Services; +using FlowForge.Shared.Models.Deploy; + +namespace FlowForge.Backend.Application.Services; + +public class DeployService +{ + private readonly IDeployRecordRepository _deployRecordRepository; + private readonly IPlcTargetRepository _targetRepository; + private readonly IMqttService _mqttService; + + public DeployService( + IDeployRecordRepository deployRecordRepository, + IPlcTargetRepository targetRepository, + IMqttService mqttService) + { + _deployRecordRepository = deployRecordRepository; + _targetRepository = targetRepository; + _mqttService = mqttService; + } + + // TODO: RequestDeployAsync(DeployRequestDto) — validate target, check deploy lock, create record, queue job + // TODO: ApproveDeployAsync(Guid deployId, string approverId) — 4-eyes approval for production targets + // TODO: GetDeployStatusAsync(Guid deployId) — return current deploy status +} diff --git a/src/backend/src/FlowForge.Backend.Application/Services/MonitorService.cs b/src/backend/src/FlowForge.Backend.Application/Services/MonitorService.cs new file mode 100644 index 0000000..77f90cf --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Services/MonitorService.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Application.Services; + +public class MonitorService +{ + private readonly IDockerService _dockerService; + + public MonitorService(IDockerService dockerService) + { + _dockerService = dockerService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Services/ProjectService.cs b/src/backend/src/FlowForge.Backend.Application/Services/ProjectService.cs new file mode 100644 index 0000000..fef2194 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Services/ProjectService.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Application.Services; + +public class ProjectService +{ + private readonly IProjectRepository _projectRepository; + private readonly IGitService _gitService; + + public ProjectService(IProjectRepository projectRepository, IGitService gitService) + { + _projectRepository = projectRepository; + _gitService = gitService; + } +} diff --git a/src/backend/src/FlowForge.Backend.Application/Services/TargetService.cs b/src/backend/src/FlowForge.Backend.Application/Services/TargetService.cs new file mode 100644 index 0000000..0975b18 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Services/TargetService.cs @@ -0,0 +1,20 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Repositories; + +namespace FlowForge.Backend.Application.Services; + +public class TargetService +{ + private readonly IPlcTargetRepository _targetRepository; + + public TargetService(IPlcTargetRepository targetRepository) + { + _targetRepository = targetRepository; + } + + // TODO: GetTargetsAsync() — list all targets with cached PLC state (PlcAdsState from last known read) + // TODO: SetDeployLockAsync(Guid targetId, bool locked) — manual deploy lock toggle + // TODO: IsDeployAllowedAsync(Guid targetId, string userId) — checks lock + production rules + 4-eyes +} diff --git a/src/backend/src/FlowForge.Backend.Application/Validation/FlowDocumentValidator.cs b/src/backend/src/FlowForge.Backend.Application/Validation/FlowDocumentValidator.cs new file mode 100644 index 0000000..4eec727 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Application/Validation/FlowDocumentValidator.cs @@ -0,0 +1,15 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Shared.Models.Flow; + +namespace FlowForge.Backend.Application.Validation; + +public class FlowDocumentValidator +{ + public IReadOnlyList Validate(FlowDocument document) + { + // TODO: Validate connections reference existing nodes/ports, detect cycles, etc. + return []; + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/DependencyInjection.cs b/src/backend/src/FlowForge.Backend.Infrastructure/DependencyInjection.cs new file mode 100644 index 0000000..48f2022 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/DependencyInjection.cs @@ -0,0 +1,57 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Application.Interfaces.Services; +using FlowForge.Backend.Infrastructure.Docker; +using FlowForge.Backend.Infrastructure.Git; +using FlowForge.Backend.Infrastructure.Keycloak; +using FlowForge.Backend.Infrastructure.Mqtt; +using FlowForge.Backend.Infrastructure.Persistence; +using FlowForge.Backend.Infrastructure.Repositories; +using FlowForge.Backend.Infrastructure.Security; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; + +namespace FlowForge.Backend.Infrastructure; + +public static class DependencyInjection +{ + public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration) + { + // Database + services.AddDbContext(options => + options.UseNpgsql(configuration.GetConnectionString("PostgreSQL"))); + + // Repositories + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + + // Services + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + + // Docker service (HttpClient-based) + services.AddHttpClient(client => + { + client.BaseAddress = new Uri(configuration["FlowForge:DockerSocketProxyUrl"] ?? "http://docker-socket-proxy:2375"); + }); + + // Keycloak admin service (HttpClient-based) + services.AddHttpClient(client => + { + client.BaseAddress = new Uri(configuration["Keycloak:AdminUrl"] ?? "http://keycloak:8080"); + }); + + // MQTT background connection + services.AddHostedService(); + + return services; + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Docker/DockerService.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Docker/DockerService.cs new file mode 100644 index 0000000..edc54f0 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Docker/DockerService.cs @@ -0,0 +1,40 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Infrastructure.Docker; + +public class DockerService : IDockerService +{ + private readonly HttpClient _httpClient; + + public DockerService(HttpClient httpClient) + { + _httpClient = httpClient; + } + + public Task CreateMonitorContainerAsync(string sessionId, string targetAmsNetId, string authToken, CancellationToken ct) + { + // TODO: POST to docker-socket-proxy to create monitor container with Traefik labels + throw new NotImplementedException(); + } + + public Task StartContainerAsync(string containerId, CancellationToken ct) + { + // TODO: POST to docker-socket-proxy + throw new NotImplementedException(); + } + + public Task StopContainerAsync(string containerId, CancellationToken ct) + { + // TODO: POST to docker-socket-proxy + throw new NotImplementedException(); + } + + public Task RemoveContainerAsync(string containerId, CancellationToken ct) + { + // TODO: DELETE to docker-socket-proxy + throw new NotImplementedException(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/FlowForge.Backend.Infrastructure.csproj b/src/backend/src/FlowForge.Backend.Infrastructure/FlowForge.Backend.Infrastructure.csproj new file mode 100644 index 0000000..fb73d72 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/FlowForge.Backend.Infrastructure.csproj @@ -0,0 +1,28 @@ + + + + net9.0 + enable + enable + FlowForge.Backend.Infrastructure + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Git/GitService.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Git/GitService.cs new file mode 100644 index 0000000..ca9cd62 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Git/GitService.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Infrastructure.Git; + +public class GitService : IGitService +{ + public Task CloneOrFetchAsync(string repoUrl, string localPath, string branch, CancellationToken ct) + { + // TODO: Implement using LibGit2Sharp + throw new NotImplementedException(); + } + + public Task CommitAndPushAsync(string localPath, string message, string userName, string userEmail, CancellationToken ct) + { + // TODO: Implement using LibGit2Sharp + throw new NotImplementedException(); + } + + public Task CreateRepoAsync(string name, string description, CancellationToken ct) + { + // TODO: Implement using GitHub API (service user) + throw new NotImplementedException(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Keycloak/KeycloakAdminService.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Keycloak/KeycloakAdminService.cs new file mode 100644 index 0000000..ea8f3f2 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Keycloak/KeycloakAdminService.cs @@ -0,0 +1,59 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; +using FlowForge.Shared.Models.Auth; + +namespace FlowForge.Backend.Infrastructure.Keycloak; + +public class KeycloakAdminService : IKeycloakAdminService +{ + private readonly HttpClient _httpClient; + + public KeycloakAdminService(HttpClient httpClient) + { + _httpClient = httpClient; + } + + public Task> GetUsersAsync(CancellationToken ct) + { + // TODO: GET /admin/realms/{realm}/users + throw new NotImplementedException(); + } + + public Task GetUserByIdAsync(string userId, CancellationToken ct) + { + // TODO: GET /admin/realms/{realm}/users/{id} + throw new NotImplementedException(); + } + + public Task CreateUserAsync(string userName, string email, string? password, CancellationToken ct) + { + // TODO: POST /admin/realms/{realm}/users + throw new NotImplementedException(); + } + + public Task UpdateUserAsync(string userId, string? email, string? displayName, CancellationToken ct) + { + // TODO: PUT /admin/realms/{realm}/users/{id} + throw new NotImplementedException(); + } + + public Task DeleteUserAsync(string userId, CancellationToken ct) + { + // TODO: DELETE /admin/realms/{realm}/users/{id} + throw new NotImplementedException(); + } + + public Task AssignRoleAsync(string userId, string roleName, CancellationToken ct) + { + // TODO: POST /admin/realms/{realm}/users/{id}/role-mappings/realm + throw new NotImplementedException(); + } + + public Task RemoveRoleAsync(string userId, string roleName, CancellationToken ct) + { + // TODO: DELETE /admin/realms/{realm}/users/{id}/role-mappings/realm + throw new NotImplementedException(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Mqtt/MqttHostedService.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Mqtt/MqttHostedService.cs new file mode 100644 index 0000000..b0a72ea --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Mqtt/MqttHostedService.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +namespace FlowForge.Backend.Infrastructure.Mqtt; + +public class MqttHostedService : BackgroundService +{ + private readonly ILogger _logger; + + public MqttHostedService(ILogger logger) + { + _logger = logger; + } + + protected override async Task ExecuteAsync(CancellationToken stoppingToken) + { + // TODO: Connect to MQTT broker and maintain connection + _logger.LogInformation("MQTT hosted service started"); + await Task.CompletedTask; + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Mqtt/MqttService.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Mqtt/MqttService.cs new file mode 100644 index 0000000..e62d1a8 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Mqtt/MqttService.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Infrastructure.Mqtt; + +public class MqttService : IMqttService +{ + public Task PublishAsync(string topic, string payload, CancellationToken ct) + { + // TODO: Implement using MQTTnet + throw new NotImplementedException(); + } + + public Task SubscribeAsync(string topic, Func handler, CancellationToken ct) + { + // TODO: Implement using MQTTnet + throw new NotImplementedException(); + } + + public Task UnsubscribeAsync(string topic, CancellationToken ct) + { + // TODO: Implement using MQTTnet + throw new NotImplementedException(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/AppDbContext.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/AppDbContext.cs new file mode 100644 index 0000000..bdfabfd --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/AppDbContext.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Persistence; + +public class AppDbContext : DbContext +{ + public AppDbContext(DbContextOptions options) : base(options) + { + } + + public DbSet Projects => Set(); + public DbSet BuildJobs => Set(); + public DbSet PlcTargets => Set(); + public DbSet TargetGroups => Set(); + public DbSet DeployRecords => Set(); + public DbSet UserTokens => Set(); + public DbSet AuditEntries => Set(); + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.ApplyConfigurationsFromAssembly(typeof(AppDbContext).Assembly); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/AuditEntryConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/AuditEntryConfiguration.cs new file mode 100644 index 0000000..ef151eb --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/AuditEntryConfiguration.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class AuditEntryConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(a => a.Id); + builder.HasIndex(a => new { a.EntityType, a.EntityId }); + builder.HasIndex(a => a.Timestamp); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/BuildJobConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/BuildJobConfiguration.cs new file mode 100644 index 0000000..c742908 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/BuildJobConfiguration.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class BuildJobConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(b => b.Id); + builder.Property(b => b.Status).HasConversion(); + builder.HasOne(b => b.Project).WithMany().HasForeignKey(b => b.ProjectId); + builder.HasIndex(b => new { b.Status, b.TwinCatVersion }); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/DeployRecordConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/DeployRecordConfiguration.cs new file mode 100644 index 0000000..7344de6 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/DeployRecordConfiguration.cs @@ -0,0 +1,18 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class DeployRecordConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(d => d.Id); + builder.Property(d => d.Status).HasConversion(); + builder.HasOne(d => d.BuildJob).WithMany().HasForeignKey(d => d.BuildJobId); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/PlcTargetConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/PlcTargetConfiguration.cs new file mode 100644 index 0000000..ae5c20a --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/PlcTargetConfiguration.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class PlcTargetConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(t => t.Id); + builder.Property(t => t.AmsNetId).IsRequired().HasMaxLength(50); + builder.HasOne(t => t.Group).WithMany(g => g.Targets).HasForeignKey(t => t.GroupId); + builder.HasIndex(t => t.AmsNetId).IsUnique(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/ProjectConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/ProjectConfiguration.cs new file mode 100644 index 0000000..4db6e2f --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/ProjectConfiguration.cs @@ -0,0 +1,19 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class ProjectConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(p => p.Id); + builder.Property(p => p.Name).IsRequired().HasMaxLength(200); + builder.Property(p => p.RepoUrl).IsRequired().HasMaxLength(500); + builder.HasIndex(p => p.Name).IsUnique(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/TargetGroupConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/TargetGroupConfiguration.cs new file mode 100644 index 0000000..4837f64 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/TargetGroupConfiguration.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class TargetGroupConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(g => g.Id); + builder.Property(g => g.Name).IsRequired().HasMaxLength(200); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/UserTokenConfiguration.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/UserTokenConfiguration.cs new file mode 100644 index 0000000..848b657 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Persistence/Configurations/UserTokenConfiguration.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace FlowForge.Backend.Infrastructure.Persistence.Configurations; + +public class UserTokenConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.HasKey(t => t.Id); + builder.HasIndex(t => new { t.UserId, t.Provider }).IsUnique(); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/AuditRepository.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/AuditRepository.cs new file mode 100644 index 0000000..1a29397 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/AuditRepository.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Repositories; + +public class AuditRepository : IAuditRepository +{ + private readonly AppDbContext _db; + + public AuditRepository(AppDbContext db) => _db = db; + + public async Task AddAsync(AuditEntry entry, CancellationToken ct) + { + _db.AuditEntries.Add(entry); + await _db.SaveChangesAsync(ct); + } + + public async Task> GetByEntityAsync(string entityType, string entityId, CancellationToken ct) => + await _db.AuditEntries + .Where(a => a.EntityType == entityType && a.EntityId == entityId) + .OrderByDescending(a => a.Timestamp) + .ToListAsync(ct); +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/BuildJobRepository.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/BuildJobRepository.cs new file mode 100644 index 0000000..8ae4d7e --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/BuildJobRepository.cs @@ -0,0 +1,53 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Infrastructure.Persistence; +using FlowForge.Shared.Models.Build; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Repositories; + +public class BuildJobRepository : IBuildJobRepository +{ + private readonly AppDbContext _db; + + public BuildJobRepository(AppDbContext db) => _db = db; + + public async Task GetByIdAsync(Guid id, CancellationToken ct) => + await _db.BuildJobs.Include(b => b.Project).FirstOrDefaultAsync(b => b.Id == id, ct); + + public async Task> GetByProjectIdAsync(Guid projectId, CancellationToken ct) => + await _db.BuildJobs.Where(b => b.ProjectId == projectId).OrderByDescending(b => b.CreatedAt).ToListAsync(ct); + + public async Task AddAsync(BuildJob job, CancellationToken ct) + { + _db.BuildJobs.Add(job); + await _db.SaveChangesAsync(ct); + return job; + } + + public async Task UpdateAsync(BuildJob job, CancellationToken ct) + { + _db.BuildJobs.Update(job); + await _db.SaveChangesAsync(ct); + } + + public async Task ClaimNextAsync(string twinCatVersion, string claimedBy, CancellationToken ct) + { + // TODO: Use raw SQL with FOR UPDATE SKIP LOCKED for proper queue semantics + var job = await _db.BuildJobs + .Where(b => b.Status == BuildStatus.Pending && b.TwinCatVersion == twinCatVersion) + .OrderBy(b => b.CreatedAt) + .FirstOrDefaultAsync(ct); + + if (job is null) return null; + + job.Status = BuildStatus.Claimed; + job.ClaimedBy = claimedBy; + job.StartedAt = DateTimeOffset.UtcNow; + await _db.SaveChangesAsync(ct); + return job; + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/DeployRecordRepository.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/DeployRecordRepository.cs new file mode 100644 index 0000000..06b734c --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/DeployRecordRepository.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Repositories; + +public class DeployRecordRepository : IDeployRecordRepository +{ + private readonly AppDbContext _db; + + public DeployRecordRepository(AppDbContext db) => _db = db; + + public async Task GetByIdAsync(Guid id, CancellationToken ct) => + await _db.DeployRecords.Include(d => d.BuildJob).FirstOrDefaultAsync(d => d.Id == id, ct); + + public async Task> GetByBuildJobIdAsync(Guid buildJobId, CancellationToken ct) => + await _db.DeployRecords.Where(d => d.BuildJobId == buildJobId).ToListAsync(ct); + + public async Task AddAsync(DeployRecord record, CancellationToken ct) + { + _db.DeployRecords.Add(record); + await _db.SaveChangesAsync(ct); + return record; + } + + public async Task UpdateAsync(DeployRecord record, CancellationToken ct) + { + _db.DeployRecords.Update(record); + await _db.SaveChangesAsync(ct); + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/PlcTargetRepository.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/PlcTargetRepository.cs new file mode 100644 index 0000000..2c72c6e --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/PlcTargetRepository.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Repositories; + +public class PlcTargetRepository : IPlcTargetRepository +{ + private readonly AppDbContext _db; + + public PlcTargetRepository(AppDbContext db) => _db = db; + + public async Task GetByIdAsync(Guid id, CancellationToken ct) => + await _db.PlcTargets.Include(t => t.Group).FirstOrDefaultAsync(t => t.Id == id, ct); + + public async Task> GetAllAsync(CancellationToken ct) => + await _db.PlcTargets.Include(t => t.Group).ToListAsync(ct); + + public async Task AddAsync(PlcTarget target, CancellationToken ct) + { + _db.PlcTargets.Add(target); + await _db.SaveChangesAsync(ct); + return target; + } + + public async Task UpdateAsync(PlcTarget target, CancellationToken ct) + { + _db.PlcTargets.Update(target); + await _db.SaveChangesAsync(ct); + } + + public async Task DeleteAsync(Guid id, CancellationToken ct) + { + var target = await _db.PlcTargets.FindAsync([id], ct); + if (target is not null) + { + _db.PlcTargets.Remove(target); + await _db.SaveChangesAsync(ct); + } + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/ProjectRepository.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/ProjectRepository.cs new file mode 100644 index 0000000..8262ed7 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/ProjectRepository.cs @@ -0,0 +1,45 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Repositories; + +public class ProjectRepository : IProjectRepository +{ + private readonly AppDbContext _db; + + public ProjectRepository(AppDbContext db) => _db = db; + + public async Task GetByIdAsync(Guid id, CancellationToken ct) => + await _db.Projects.FindAsync([id], ct); + + public async Task> GetAllAsync(CancellationToken ct) => + await _db.Projects.OrderByDescending(p => p.UpdatedAt).ToListAsync(ct); + + public async Task AddAsync(Project project, CancellationToken ct) + { + _db.Projects.Add(project); + await _db.SaveChangesAsync(ct); + return project; + } + + public async Task UpdateAsync(Project project, CancellationToken ct) + { + _db.Projects.Update(project); + await _db.SaveChangesAsync(ct); + } + + public async Task DeleteAsync(Guid id, CancellationToken ct) + { + var project = await _db.Projects.FindAsync([id], ct); + if (project is not null) + { + _db.Projects.Remove(project); + await _db.SaveChangesAsync(ct); + } + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/UserTokenRepository.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/UserTokenRepository.cs new file mode 100644 index 0000000..e0ce399 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Repositories/UserTokenRepository.cs @@ -0,0 +1,46 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Entities; +using FlowForge.Backend.Application.Interfaces.Repositories; +using FlowForge.Backend.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; + +namespace FlowForge.Backend.Infrastructure.Repositories; + +public class UserTokenRepository : IUserTokenRepository +{ + private readonly AppDbContext _db; + + public UserTokenRepository(AppDbContext db) => _db = db; + + public async Task GetByUserAndProviderAsync(string userId, string provider, CancellationToken ct) => + await _db.UserTokens.FirstOrDefaultAsync(t => t.UserId == userId && t.Provider == provider, ct); + + public async Task AddOrUpdateAsync(UserToken token, CancellationToken ct) + { + var existing = await GetByUserAndProviderAsync(token.UserId, token.Provider, ct); + if (existing is not null) + { + existing.EncryptedToken = token.EncryptedToken; + existing.ExpiresAt = token.ExpiresAt; + _db.UserTokens.Update(existing); + } + else + { + _db.UserTokens.Add(token); + } + await _db.SaveChangesAsync(ct); + return existing ?? token; + } + + public async Task DeleteAsync(string userId, string provider, CancellationToken ct) + { + var token = await GetByUserAndProviderAsync(userId, provider, ct); + if (token is not null) + { + _db.UserTokens.Remove(token); + await _db.SaveChangesAsync(ct); + } + } +} diff --git a/src/backend/src/FlowForge.Backend.Infrastructure/Security/AesTokenEncryptionService.cs b/src/backend/src/FlowForge.Backend.Infrastructure/Security/AesTokenEncryptionService.cs new file mode 100644 index 0000000..8a662c6 --- /dev/null +++ b/src/backend/src/FlowForge.Backend.Infrastructure/Security/AesTokenEncryptionService.cs @@ -0,0 +1,21 @@ +// Copyright (c) 2026 Qubernetic (Biró, Csaba Attila) +// SPDX-License-Identifier: AGPL-3.0-or-later + +using FlowForge.Backend.Application.Interfaces.Services; + +namespace FlowForge.Backend.Infrastructure.Security; + +public class AesTokenEncryptionService : ITokenEncryptionService +{ + public byte[] Encrypt(string plainText) + { + // TODO: Implement AES-256-GCM encryption + throw new NotImplementedException(); + } + + public string Decrypt(byte[] cipherText) + { + // TODO: Implement AES-256-GCM decryption + throw new NotImplementedException(); + } +} diff --git a/src/build-server/FlowForge.BuildServer.sln b/src/build-server/FlowForge.BuildServer.sln index 50108a8..8ccb795 100644 --- a/src/build-server/FlowForge.BuildServer.sln +++ b/src/build-server/FlowForge.BuildServer.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.BuildServer", "src\FlowForge.BuildServer\FlowForge.BuildServer.csproj", "{B2C3D4E5-F6A7-8901-BCDE-F12345678901}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlowForge.Shared", "..\shared\FlowForge.Shared\FlowForge.Shared.csproj", "{F3A4B5C6-D7E8-9012-CDEF-123456789013}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,5 +17,9 @@ Global {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Debug|Any CPU.Build.0 = Debug|Any CPU {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Release|Any CPU.ActiveCfg = Release|Any CPU {B2C3D4E5-F6A7-8901-BCDE-F12345678901}.Release|Any CPU.Build.0 = Release|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3A4B5C6-D7E8-9012-CDEF-123456789013}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/CodeGenerationDemo.exe.config b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/CodeGenerationDemo.exe.config new file mode 100644 index 0000000..cb2586b --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/CodeGenerationDemo.exe.config @@ -0,0 +1,3 @@ + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Orders.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Orders.xml new file mode 100644 index 0000000..28e5dee --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Orders.xml @@ -0,0 +1,167 @@ + + + + ConfigA + Beckhoff Automation GmbH + 2012-11-30 + 10001 + Test01 + Please run extended Hardware Test! + + + ConfigB + Beckhoff Automation GmbH + 2013-02-28 + 10051 + Test02 + Deliver together with Serial number 10039 + + + ConfigD + Beckhoff Automation GmbH + 2013-11-12 + 10042 + Test03 + Include Hardware Simulation + + + + + + + + + + + 2-Axes, PTP Motion, Servo Terminal not included + + MachineTypeA + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/MachineTypeA/POUs/FB_Axis.xml + Templates/MachineTypeA/POUs/MAIN.xml + > + + + + + Templates/MachineTypeA/Axis1.xml + Templates/MachineTypeA/Axis2.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeA/Links.xml + + + + + + + + + 4-Axes, NCI + + MachineTypeB + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_NCI + Templates/MachineTypeB/Datatypes/E_Commands.xml + Templates/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml + Templates/MachineTypeB/Datatypes/E_States.xml + Templates/MachineTypeB/GVLs/GlobalVariables.xml + Templates/MachineTypeB/POUs/FB_NciChannel.xml + Templates/MachineTypeB/POUs/FB_NciSequence.xml + Templates/MachineTypeB/POUs/MAIN.xml + + + + + + Templates/MachineTypeB/Axis1.xml + Templates/MachineTypeB/Axis2.xml + Templates/MachineTypeB/Axis3.xml + Templates/MachineTypeB/Axis4.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeB/Links.xml + + + + + + PLC project, Measurement project + + MachineTypeD + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Templates/MachineTypeD/Datatypes/E_FunctionType.xml + Templates/MachineTypeD/POUs/FB_FunctionGenerator.xml + Templates/MachineTypeD/POUs/MAIN.xml + Templates/MachineTypeD/GVLs/GVL_Constants.xml + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/ScriptingTestContainerBase.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/ScriptingTestContainerBase.xml new file mode 100644 index 0000000..9cc0bf6 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/ScriptingTestContainerBase.xml @@ -0,0 +1,3893 @@ + + + + ScriptingTestContainerBase + + + + + Progress provider interface + + + + + Sets the progress. + + The progress. + + + + Gets or sets the status string. + + The status. + + + + Occurs when the progress has been changed. + + + + + Occurs when the status has been changed. + + + + + Event arguments indicating, that the Progress status has been changed. + + + + + Contains the current Status as string + + + + + Initializes a new instance of the class. + + The status. + + + + Default MacIds + + + + + Broadcast Address + + + + + First Multicast Address + + + + + Empty Address + + + + + EtherCAT Multicast Address + + + + + Network variables Multicast Address + + + + + Profinet DCP Multicast Address + + + + + AMS/ADS Net ID + + + + + Constructor + + + + + + Converts the netId to string + + + + + Converts the NetId object to byte array + + + + + + Converts the string representation of the address to . + + + + + + + + Converts the string representation of the address to . + + + + + + + Creates an empty NetId ("0.0.0.0.0.0") + + + + + Creates the local NetId ("127.0.0.1.1.1") + + + + + TwinCAT Configuration Factory interface + + + + + Initializes the factory (Creates the configuration) + + + + + Executes the script. + + The script to execute + + + + Closes the configuration. + + + + + Gets or sets the Application ID for the TwinCAT XAE Shell + + The app ID. + + + + Gets or sets a value indicating whether the IDE will be shown during Script processing + + true if [show application]; otherwise, false. + + + + Gets or sets a value indicating whether the IDE instance will left to UserControl after script execution. + + + true if this instance is IDE user control; otherwise, false. + + + + + Gets a value indicating whether an TwinCAT XAE Configuration is opened by this factory class. + + + true if this instance is configuration open; otherwise, false. + + + + + Gets a value indicating whether this instance is generating. + + + true if this instance is generating; otherwise, false. + + + + + Gets the created DTE object. + + The DTE. + + + + Gets created solution object. + + The solution. + + + + Gets the Visual Studio Factory + + + The Visual Studio Factory + + + + + Gets the Visual Studio Process ID. + + The Visual Studio process identifier. + + + + DTE Info Object + + + + + DTE Name + + + + + DTE Prog ID + + + + + DTE Guid + + + + + Initializes a new instance of the class. + + The name. + The prog id. + The GUID. + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Visual Studio Factory interface + + + + + Creates the DTE. + + Application ID to use. + if set to true the ide will be visible. + if set to true UI will be suppressed. + if set to true Visual Studio will be started with user control. + + + + + Creates a new Visual Studio project. + + DTE object. + Name of the project. + The template path. + The project root folder. + + + + + Visual Studio Factory implementation + + + + + Creates the DTE. + + Application ID to use. + if set to true the ide will be visible. + if set to true UI will be suppressed. + if set to true Visual Studio will be started with user control. + + + + + Creates the new project. + + The DTE Object. + Name of the project. + The template path. + The script root folder. + + + + + Abstract implementation of the interface. + + + + + ProgID of the VisualStudio.DTE object + + + + + Initializes a new instance of the class. + + + + + Handler function creating the Visual Studio instance. + + + + + + Creates the solution and project configuration for the script. + + + + + Handler function to create the script configuration. + + + + + Executes the specified script with the specified worker context. + + The script to execute. + + + + Closes the configuration / Configuration Cleanup + + + + + Handler function for Configuration cleanup. + + + + + Gets a dictionary of the currently installed Visual Studio ProgIds. + + Current index. + Default index. + + + + + Application ID of the Program to be created + + + + + Indicates that the configuration is open. + + + + + Indicates that a script is executing + + + + + Gets the currently used application path. + + The application path. + + + + Occurs when the Visual Studio instance is initialized and the configuration(s) are open. + + + + + Gets or sets the Application ID + + The app ID. + + + + Gets a value indicating whether a configuration is opened. + + + true if this instance is configuration open; otherwise, false. + + + + + Gets a value indicating whether a script created by this Factory is Executing. + + + true if this instance is generating; otherwise, false. + + + + + VisualStudio.DTE object created by this factory. + + The DTE. + + + + VisualStudio Solution created by this factory. + + The solution. + + + + Gets or sets a value indicating whether the IDE will be shown during Script processing + + true if [show application]; otherwise, false. + + + + Gets or sets a value indicating whether this instance is IDE user control. + + + true if this instance is IDE user control; otherwise, false. + + + + + Gets or sets a value indicating whether UI in Visual Studio is supressed. + + true if UI is suppressed; otherwise, false. + + + + Gets the Visual Studio Factory + + + The Visual Studio Factory + + + + + Gets the Visual Studio Process ID. + + The Visual Studio process identifier. + + + + Configuration Factory for Early Binding + + DTE and Solution objects are stored in static types. + + + + Initializes a new instance of the class. + + + + + Tree Item Type for the Tree Item + + This is the CLS-compliant, corresponding type to TCatSysManagerLibs TREEITEMTYPE + + + + NotProcessed Tree Item object (Uninitialized, 0) + + + + + System configuration Tree Item ("SYSTEM-Konfiguration") TIRC (Has no valid Type at the moment == 0) + + + + + Task item (Task, 1) + + + + + Device item (Device, 2) + + + + + Process-Image (Image, 3) + + + + + Mapping (Mapping, 4) + + + + + Box item (Box, 5) + + + + + Terminal item (Term, 6) + + + + + Variable / Symbol item (Var, 7) + + + + + Variable group item (VarGrp, 8) or Channels in Terminals + + + + + PlcControl project item (IecPrj, 9) + + + + + Cnc Project Item. (CncPrj, 10) + + + + + GSD Described Module + + + + + CDL Item. + + + + + PLC Runtime item (IecLzs, 13) + + + + + + + + + + Plc configuration (LzsGrp) + + + + + IO configuration + + + + + Additional Tasks (AddTasks, 16) + + + + + Device Group Item + + + + + Map Group + + + + + NC Configuration (NCDEF, 19) + + + + + NC Axes + + + + + NC Channel (e.g. the Node 'Axes') (NCChannel, 21) + + + + + NC Axis + + + + + Axis Encoder (ID: 23) + + + + + Axis drive (ID: 24) + + + + + Axis controller + + + + + NC Group + + + + + NC Interpreter + + + + + CanPDO + + + + + Real time Settings ATTENTION THE TYPE IS IDENTICAL TO RouteSettings(RTimeSet, 31) + + + + + Route Settings (RTimeSet, 31) + + + + + PLC Variables of the BC + + + + + File Name item. + + + + + DnetConnect. + + + + + Network variable publisher + + + + + Network variable subscriber + + + + + FlbCmd + + + + + NC Table Group Item + + + + + NC Table + + + + + NC Table Slave Item. + + + + + EipConnection item. + + + + + PnIoApi Item. + + + + + PnIoMod Item. + + + + + PnIoSubMod item. + + + + + Ethernet Protocol Item. + + + + + TCOM object (48) + x0d\x0a + + + + TCOM Object group (49) + + + + + UdpIpSendData Item. + + + + + UdpIpReceiveData Item. + + + + + + + + + + + + + + + + + + + + + + + + + Nested Plc Project (56) + + + + + + + + + + + + + + + + + + + + "TIAC" CAM Configuration + + Path: "TIAC" + + + + CamGroup item. + + + + + Cam Item. + + + + + CamEncoder Item. + + + + + CamToolGroup Item. + + + + + CamTool Item. + + + + + LineDef Item. + + + + + CNC Configuration (400) + + + + + ISG Channel item + + + + + CNC Axis Group Item + + + + + CNC Axis (ISG, 403) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Plc Application (Root Plc Object, 600) + + + + + Plc Folder object (601) + + + + + Plc POU Program (602) + + + + + Plc POU Function (603) + + + + + Plc POU Function Block (604) + + + + + Plc Enum Datatype (605) + + + + + Plc Struct DataType (606) + + + + + Plc Union DataType (607) + + + + + Plc Action (608) + + + + + Plc Method (609) + + + + + Plc Interface Method (610) + + + + + Plc Property (611) + + + + + Plc InterfaceProperty (612) + + + + + Plc Property Getter (613) + + + + + Plc Property Setter (614) + + + + + Plc Global Variables List (615) + + + + + Plc Transient Object (616) + + + + + Plc Library Manager (617) + + + + + Plc Interface (618) + + + + + Plc Visual Object (619) + + + + + Plc Visual Manager (620) + + + + + Plc Task object (621) + + + + + Plc DataType Alias (623) + + + + + Target Visu (624) + + + + + Global Text List (625) + + + + + Text List (626) + + + + + Global Image Pool (627) + + + + + Image Pool (628) + + + + + Parameter List (629) + + + + + Plc Program Reference (650) + + + + + Plc External Data Type (Defined in System Manager) (651) + + + + + Plc External Data Type Container (652) + + + + + Plc Tmc Description File (653) + + + + + Plc interface property getter (654) + + + + + Plc Interface property setter (655) + + + + + Nested SAFETY Project Root (800) + + + + + "Safety Application (801) + + + + + "Safety Alias Device Folder (802) + + + + + "Safety Group Folder (803) + + + + + "Safety Generated Code Folder (804) + + + + + "Safety Application Language File (805) + + + + + "Safety C Header File File (806) + + + + + "Safety C Implementation File File (807) + + + + + "Nested SAFETY Project Root (808) + + + + + Safety target System config file (*.xml) (809)) + + + + + Safety dependent file node (809)) + + + + + "Nested CPP Project Root (900) + + + + + Box Type + + + + + NotProcessed Box Type (BOXTYPE_UNKNOWN) + + + + + Lightbus-Buskoppler für bis zu 64 Busklemmen (BK2000) (BOXTYPE_BK2000) + + + + + Lightbus-Modul, 32 Bit Digital-Ein-/Ausgabemodul, 24 V DC (32Bit Box)(BOXTYPE_M1400) + + + + + Lightbus Modul, 4 Analog-Eingabe und 16 digitale E/A-Kanäle (M2400) (BOXTYPE_M2400) + + + + + Lightbus Modul, Mehrkanal-Inkremental-Encoder (M3xx0)(BOXTYPE_M3120_1) + + + + + Lightbus Modul, Mehrkanal-Inkremental-Encoder (M3120-2)(BOXTYPE_M3120_2) + + + + + Lightbus Modul, Mehrkanal-Inkremental-Encoder (M3120_3)(BOXTYPE_M3120_3) + + + + + Lightbus Modul, Mehrkanal-Inkremental-Encoder (M3120_4)(BOXTYPE_M3120_4) + + + + + Lightbus Modul, Absolut-Encoder (M3000) (BOXTYPE_M3000) + + + + + C1120 Slave Module (in S5-Rack) (C1120-Slave) (BOXTYPE_C1120) + + + + + Lightbus-Buskoppler für bis zu 64 digitale Busklemmen (BK2010)(BOXTYPE_BK2010) + + + + + Antriebstechnik: Digital Kompakt Servoverstärker(BOXTYPE_AX2000_B200) + + + + + Lightbus Modul, 4 Analog-Eingabemodul (M2510)(BOXTYPE_M2510) + + + + + Programable CDL (Lightbus) (Prog-CDL)(BOXTYPE_PROG_CDL) + + + + + Lightbus-"Economy plus"-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung) (BK2020)(BOXTYPE_BK2020) + + + + + Lightbus-Busklemmen Controller (BC2000) (BOXTYPE_BC2000) + + + + + Fox-Module FOX-20 (FOX20) (BOXTYPE_FOX20) + + + + + TR Fox 50 Modul (24 Bit Absolut (SSI)) (FOX50) (BOXTYPE_FOX50) + + + + + Fox-Module FOX-RK001 (FOXRK001)(BOXTYPE_FOXRK001) + + + + + Fox-Module FOX-RK002 (FOXRK002)(BOXTYPE_FOXRK002) + + + + + CP10x1 (Folientasten 8 Kanal, LightBus) (CP10x1) (BOXTYPE_CP1001) + + + + + IPxxxx-B200 (compact box, LightBus)(IPx-B200)(BOXTYPE_IPXB2) + + + + + ILxxxx-B200 (coupler box, LightBus)(ILx-B200)(BOXTYPE_ILXB2) + + + + + ILxxxx-C200 (plc box, LightBus) (ILx-C200) (BOXTYPE_ILXC2) + + + + + CX1500-B200 (CX1500-B200)(BOXTYPE_CX1500_B200) + + + + + Profibus DP/FMS-Buskoppler für bis zu 64 Busklemmen, 1,5 MBaud (BK3000) (BOXTYPE_BK3000) + + + + + Profibus DP/FMS-Buskoppler für bis zu 64 Busklemmen, 12 MBaud (BK3100) (BOXTYPE_BK3100) + + + + + GSD Box (GSD Box)(BOXTYPE_PBDP_GSD) + + + + + Profibus DP-Buskoppler für bis zu 64 digitale Busklemmen, 1,5 MBaud (BK3010)(BOXTYPE_BK3010) + + + + + Profibus DP-Buskoppler für bis zu 64 digitale Busklemmen, 12 MBaud (BK3110)(BOXTYPE_BK3110) + + + + + Profibus DP-Buskoppler mit LWL-Anschluss, 1,5 MBaud (BK3500)(BOXTYPE_BK3500) + + + + + Profibus DP-"Low Cost"-Buskoppler für bis zu 64 digitale Busklemmen, 12 MBaud (LC3100) (BOXTYPE_LC3100) + + + + + ProfiDrive MC (ProfiDrive MC) (BOXTYPE_PBDP_DRIVE) + + + + + Profibus DP-"Economy Plus"-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung), 12 MBaud (BK3120)(BOXTYPE_BK3120) + + + + + Profibus DP-Busklemmen Controller (BC3100) (BOXTYPE_BC3100) + + + + + Profidrive MC (double) (ProfiDrive2 MC) (BOXTYPE_PBDP_DRIVE2) + + + + + Profidrive MC (triple)(ProfiDrive3 MC)(BOXTYPE_PBDP_DRIVE3) + + + + + Profidrive MC (fourfold)(ProfiDrive4 MC)(BOXTYPE_PBDP_DRIVE4) + + + + + Profidrive MC (fivefold)(ProfiDrive5 MC)(BOXTYPE_PBDP_DRIVE5) + + + + + Profidrive MC (sixfold)(ProfiDrive6 MC)(BOXTYPE_PBDP_DRIVE6) + + + + + Profidrive MC (sevenfold)(ProfiDrive7 MC)(BOXTYPE_PBDP_DRIVE7) + + + + + Profidrive MC (eightfold)(ProfiDrive8 MC)(BOXTYPE_PBDP_DRIVE8) + + + + + Profibus DP-"Compact"-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung), 12 MBaud (BK3150)(BOXTYPE_BK3150) + + + + + Profibus Slave BC3150 (BC3150) (BOXTYPE_BC3150) + + + + + IPxxxx-B3xx (compact box, Profibus)(IPx-B3xx)(BOXTYPE_IPXB3) + + + + + ILxxxx-B3xx (coupler box, Profibus)(ILB3xx)(BOXTYPE_ILXB3) + + + + + ILxxxx-C3xx (plc box, Profibus)(ILC3xx)(BOXTYPE_ILXC3) + + + + + TwinCAT Slave (Profibus)(TSMBOX_310)(BOXTYPE_TSMBOX_310) + + + + + Profibus DP-Busklemmen Controller(BX3100)(BOXTYPE_BX3100) + + + + + Profibus Slave CX1500-B310, PC104 (CX1500-B310)(BOXTYPE_CX1500_B310) + + + + + FC310x-Slave (FC310x-Slave)(BOXTYPE_FC310X_SLAVE) + + + + + Antriebstechnik: Digital Kompakt Servoverstärker (Profibus) (AX2xxx-B310)(BOXTYPE_AX2000_B310) + + + + + Interbus-Buskoppler für bis zu 64 Busklemmen (BK4000)(BOXTYPE_BK4000) + + + + + IBS Box (IBS Box)(BOXTYPE_IBS_GENERIC) + + + + + Interbus-Buskoppler für bis zu 64 digitale Busklemmen (BK4010)(BOXTYPE_BK4010) + + + + + Interbus-Buskoppler mit LWL-Anschluss für bis zu 64 Busklemmen (BK4500)(BOXTYPE_BK4500) + + + + + BK4510 (economy fieldbus coupler, InterBus-S Fiber)("BK4510)(BOXTYPE_BK4510) + + + + + Interbus-Busklemmen Controller (BC4000)(BOXTYPE_BC4000) + + + + + Interbus-"Economy plus"-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung)(BK4020)(BOXTYPE_BK4020) + + + + + IPxxxx-B400 (compact box, InterBus-S)(IPx-B400)(BOXTYPE_IPXB4) + + + + + ILxxxx-B400 (coupler box, InterBus-S)(ILx-B400)(BOXTYPE_ILXB4) + + + + + ILxxxx-C400 (plc box, InterBus-S)(ILx-C400)(BOXTYPE_ILXC4) + + + + + CP9020 ('fieldbus coupler', Control Panel)(CP9020)(BOXTYPE_CP2020) + + + + + Sercos Drive (Sercos Drive)(BOXTYPE_SERCOSAXIS) + + + + + Antriebstechnik: Digital Kompakt Servoverstärker (SERCOS)(AX2xxx-B750)(BOXTYPE_AX2000_B750) + + + + + BK7500 (fieldbus coupler, SERCOS 2/4 MBaud)" (BK7500)(BOXTYPE_BK7500) + + + + + BK7510 (economy fieldbus coupler, SERCOS 2/4/8/16 MBaud)(BK7510)(BOXTYPE_BK7510) + + + + + BK7520 (economy plus fieldbus coupler, SERCOS 2/4/8/16 MBaud)(BK7520)(BOXTYPE_BK7520) + + + + + BK8100 (fieldbus coupler, COM Port, RS232)(BK8100)(BOXTYPE_BK8100) + + + + + RS485-Buskoppler für bis zu 64 Busklemmen(BK8000)(BOXTYPE_BK8000) + + + + + CP9040 ('fieldbus coupler', Control Panel)(CP9040)(BOXTYPE_CP9040) + + + + + RS485-Busklemmen Controller (BC8000)(BOXTYPE_BC8000) + + + + + RS232-Busklemmen Controller (BC8100)(BOXTYPE_BC8100) + + + + + IPxxxx-B800 (compact box, COM Port, RS485)(IPx-B800)(BOXTYPE_IPXB80) + + + + + ILxxxx-B800 (coupler box, COM Port, RS485)(ILx-B800)(BOXTYPE_ILXB80) + + + + + ILxxxx-C800 (plc box, COM Port, RS485)(ILx-C800)(BOXTYPE_ILXC80) + + + + + IPxxxx-B810 (compact box, COM Port, RS232)(IPx-B810)(BOXTYPE_IPXB81) + + + + + ILxxxx-B810 (coupler box, COM Port, RS232)(ILx-B810)(BOXTYPE_ILXB81) + + + + + ILxxxx-C810 (plc box, COM Port, RS232)(ILx-C810)(BOXTYPE_ILXC81) + + + + + CANopen Buskoppler Lowcost (BK5100)(BOXTYPE_BK5100) + + + + + CAN CAL-Buskoppler für bis zu 64 Busklemmen (BK5110)(BOXTYPE_BK5110) + + + + + CANopen Node (CANopen Node)(BOXTYPE_CANNODE) (ItemType 5003) + + + + + CANopen-Buskoppler „Economy plus“ für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung (BK5120)(BOXTYPE_BK5120) + + + + + CANopen-„Low Cost“-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung)(LC5100)(BOXTYPE_LC5100) + + + + + CANopen Drive (CANopen Drive)(BOXTYPE_CANDRIVE) + + + + + Antriebstechnik: Digital Kompakt Servoverstärker (CANOpen) (AX2xxx-B510)(BOXTYPE_AX2000_B510) + + + + + CANopen-„Compact“-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung)(BK5150)(BOXTYPE_BK5150) + + + + + CANopen-Busklemmen Controller(BC5150)(BOXTYPE_BC5150) + + + + + IPxxxx-B51x (compact box, CANopen)(IPx-B51x)(BOXTYPE_IPXB51) + + + + + ILxxxx-B51x (coupler box, CANopen)(ILx-B51x)(BOXTYPE_ILXB51) + + + + + ILxxxx-C51x (plc box, CANopen)(ILx-C51x)(BOXTYPE_ILXC51) + + + + + TwinCAT Slave (CANopen)(TSMBOX_510)(BOXTYPE_TSMBOX_510) + + + + + BX5100 (CANopen Slave)(BX5100)(BOXTYPE_BX5100) + + + + + CX1500-B510 (CX1500-B510)(BOXTYPE_CX1500_B510) + + + + + FC510x Slave (FC510x Slave)(BOXTYPE_FC510XSLV) + + + + + DeviceNet-Buskoppler für bis zu 64 Busklemmen (BK5200)(BOXTYPE_BK5200) + + + + + DeviceNet-Buskoppler für bis zu 64 digitale Busklemmen (BK5210)(BOXTYPE_BK5210) + + + + + DeviceNet Node (DN Node) (BOXTYPE_DEVICENET) + + + + + DeviceNet-„Compact“-Buskoppler für bis zu 64 Busklemmen (255 mit K-Bus-Verlängerung) (BK5220)(BOXTYPE_BK5220) + + + + + DeviceNet-„Low Cost“-Buskoppler für bis zu 64 digitale Busklemmen (255 mit K-Bus-Verlängerung) (LC5200)(BOXTYPE_LC5200) + + + + + IPxxxx-B52x (compact box, DeviceNet)(IPx-B52x)(BOXTYPE_IPXB52) + + + + + ILxxxx-B52x (coupler box, DeviceNet)(ILx-B52x)(BOXTYPE_ILXB52) + + + + + ILxxxx-C52x (plc box, DeviceNet)(ILx-C52x)(BOXTYPE_ILXC52) + + + + + DeviceNet-Busklemmen Controller(BX5200)(BOXTYPE_BX5200) + + + + + CX1500-B520(CX1500-B520)(BOXTYPE_CX1500_B520) + + + + + FC5201 Slave (FC5201 Slave) (BOXTYPE_FC520XSLV) + + + + + Safety PLC EL6900 + + + + + Safety Digital Inputs + + + + + Safety Digital Outputs + + + + + Ethernet TCP/IP Bus Coupler up to 64 Terminals (BOXTYPE_BK9000) + + + + + Ethernet-TCP/IP Bus Coupler up to 64 Terminals and integrated 2-Channel Switch (BK9100) + + + + + Ethernet TCP/IP "Compact" Bus Coupler BK9050 + + + + + Ethernet TCP/IP-Busklemmen Controller(BOXTYPE_BC9000) + + + + + Ethernet TCP/IP-Busklemmen Controller(BOXTYPE_BC9000) + + + + + Ethernet TCP/IP-Busklemmen Controller(BOXTYPE_BC9000) + + + + + Ethernet TCP/IP-Busklemmen Controller(BOXTYPE_BC9000) + + + + + IPxxxx-B900 (compact box, Ethernet)(IPx-B900)(BOXTYPE_IPXB9) + + + + + ILxxxx-B900 (coupler box, Ethernet)(ILx-B900)(BOXTYPE_ILXB9) + + + + + ILxxxx-C900 (plc box, Ethernet)(ILx-C900)(BOXTYPE_ILXC9) + + + + + Remote TwinCAT Task (RemoteTask)(BOXTYPE_REMOTETASK) + + + + + Netzwerkvariable Publisher(Publisher)(BOXTYPE_NV_PUB) + + + + + Netzwerkvariablen Subscriber(Subscriber)(BOXTYPE_NV_SUB) + + + + + Antriebstechnik: Digital Kompakt Servoverstärker (Ethernet)(AX2xxx-B900)(BOXTYPE_AX2000_B900) + + + + + EtherCAT Frame (EtherCAT Frame)(BOXTYPE_FLB_FRAME) + + + + + BK1120 (economy plus fieldbus coupler, EtherCAT)(BOXTYPE_BK1120) + + + + + EK1000 Ethernet Bridge (Ethernet/EtherCAT)(EK1000)(BOXTYPE_EK1000) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EK1100) + + Should not be inserted directly + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EL6731) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EL6751) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EL6752) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EL6731SLV) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EL6751SLV) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EL6752SLV) + + + + + EK1100 Ethernet Coupler (EtherCAT)(BOXTYPE_EXXXXX = 9099) + + + + + BOXTYPE_EL6601 = 9100, + + + + + BOXTYPE_EL6001 = 9101, + + + + + BOXTYPE_EL69XX = 9102, + + + + + BOXTYPE_EL6021 = 9103 + + + + + BOXTYPE_EL6720 = 9104 + + + + + BOXTYPE_FSOESLAVE = 9105 + + + + + BOXTYPE_EL6631 = 9106 + + + + + BOXTYPE_EL6631SLV = 9107 + + + + + USB-Buskoppler für bis zu 64 Busklemmen(BK9500)(BOXTYPE_BK9500) + + + + + Control Panel (USB)(CPX8XX)(BOXTYPE_CPX8XX) + + + + + CX1100 or CX9100 KBus extension('terminal coupler', CX1100-0002)(CX1100-BK)(BOXTYPE_CX1102) (SubType 9700) + + + + + CX9000 KBus extension('terminal coupler') (SubType: 9700) + + + + + CX1100 ('ip-link coupler', CX1100-0003)(CX1100-IP)(BOXTYPE_CX1103) (SubType 9701) + + + + + CX1190 UPS ('uninterruptable power supplier')(CX1190-UPS)(BOXTYPE_CX1190) (Subtype 9702) + + + + + Type of the Device + + + + + + + + + + Lightbus ISA interface card C1220 with communications processor (IODEVICETYPE_C1220, ID: 1) + + + + + Lightbus ISA interface card C1200 (IODEVICETYPE_C1200, ID: 2) + + + + + ProfiBus Slave SPC3/IM182 (Siemens-Karte, IODEVICETYPE_SPC3, ID: 3) + + + + + ISA ProfiBus-Master CIF30 DPM(Hilscher-Karte, IODEVICETYPE_CIF30DPM, ID: 4) + + + + + ISA Interbus-S-Master CIF40 IBSM (Hilscher-Karte, IODEVICETYPE_CIF40IBSM, ID: 5) + + + + + Beckhoff PC C2001 (IODEVICETYPE_BKHFPC, ID: 6) + + + + + ProfiBus-Master CP5412 (Siemens-Karte,IODEVICETYPE_CP5412A2, ID: 7) + + + + + Sercos Master SERCOS ISA (Indramat,IODEVICETYPE_SERCANSISA, ID: 8) + + + + + Lpt Port (IODEVICETYPE_LPTPORT, ID: 9) + + + + + Generic DPRAM NOV/DP-RAM (IODEVICETYPE_DPRAM, ID: 10) + + + + + COM Port (IODEVICETYPE_COMPORT, ID: 11) + + + + + ISA CANopen-Master CIF30 CAN (Hilscher-Karte, IODEVICETYPE_CIF30CAN, ID:12) + + + + + ISA ProfiBus-Master CIF30 PB (Hilscher-Karte, IODEVICETYPE_CIF30PB, ID:13) + + + + + Beckhoff CP2030 (v1.0)(Beckhoff Panel Link (V1.0), IODEVICETYPE_BKHFCP2030, ID:14) + + + + + ISA Interbus-S-Master CIF30 IBM (Hilscher-Karte, IODEVICETYPE_CIF30IBM, ID:16) + + + + + ISA DeviceNet-Master CIF30 DNM(Hilscher-Karte, IODEVICETYPE_CIF30DNM, ID:17) + + + + + PCI ProfiBus-Master CIF50 PB (Hilscher-Karte, IODEVICETYPE_CIF50PB, ID:19) + + + + + PCI Interbus-S-Master CIF50 IBM (Hilscher-Karte, IODEVICETYPE_CIF50IBM) + + + + + PCI DeviceNet-Master CIF50 DNM (Hilscher-Karte, IODEVICETYPE_CIF50DNM) + + + + + PCI CANopen-Master CIF50 CAN (Hilscher-Karte, IODEVICETYPE_CIF50CAN) + + + + + PCMCIA ProfiBus-Master CIF60 PB (Hilscher-Karte, IODEVICETYPE_CIF60PB) + + + + + PCMCIA DeviceNet-Master CIF60 DNM(Hilscher-Karte, IODEVICETYPE_CIF60DNM) + + + + + PCMCIA CANopen-Master CIF60 CAN(Hilscher-Karte, IODEVICETYPE_CIF60CAN) + + + + + PC104 ProfiBus-Master CIF104 DPM (Hilscher-Karte, IODEVICETYPE_CIF104DP) + + + + + PC104 ProfiBus-Master CIF104 PB (Hilscher-Karte, IODEVICETYPE_C104PB) + + + + + PC104 Interbus-S-Master CIF104 IBM (Hilscher-Karte, IODEVICETYPE_C104IBM) + + + + + PC104 CANopen-Master CIF104 CAN (Hilscher-Karte, IODEVICETYPE_C104CAN) + + + + + PC104 DeviceNet-Master CIF104 DNM (Hilscher-Karte, IODEVICETYPE_C104DNM) + + + + + Beckhoff CP9030 Beckhoff Link (ISA, Panel-Link with UPS, IODEVICETYPE_BKHFCP9030) + + + + + Motherboard System Management Bus SMB (IODEVICETYPE_SMB) + + + + + PCI ProfiBus-Master CP5613 (Siemens-Karte, IODEVICETYPE_CP5613) + + + + + PCMCIA Interbus-S-Master CIF60 IBM (Hilscher-Karte, IODEVICETYPE_CIF60IBM) + + + + + Beckhoff-Lightbus-I/II-PCI-Karte FC200x (IODEVICETYPE_FC200X) + + + + + Beckhoff-Profibus-PCI-Karte FC310x (IODEVICETYPE_FC3100) (ItemType 38) + + + + + Beckhoff-CanOpen-PCI-Karte FC510x (IODEVICETYPE_FC5100) (ItemType 39) + + + + + Beckhoff-DeviceNet-PCI-Karte FC520x (IODEVICETYPE_FC5200) (ItemType 41) + + + + + Beckhoff NC Rückwand Beckhoff NcBp (IODEVICETYPE_BKHFNCBP) (ItemType 43) + + + + + Sercos Master PCI SICAN/IAM PCI(, IODEVICETYPE_SERCANSPCI) + + + + + Virtuelles Ethernet Device (IODEVICETYPE_ETHERNET) + + + + + Sercon 410B oder 816 Chip Master oder Slave (PCI) SERCONCHIP (IODEVICETYPE_SERCONPCI) + + + + + Beckhoff-SERCOS-PCI-Karte FC750x (IODEVICETYPE_FC7500) + + + + + ISA Interbus-S-Slave (Hilscher-Karte,IODEVICETYPE_CIF30IBS) + + + + + PCI Interbus-S-Slave CIF50 IBS (Hilscher-Karte, IODEVICETYPE_CIF50IBS) + + + + + PC104 Interbus-S-Slave (Hilscher-Karte, IODEVICETYPE_C104IBS) + + + + + Beckhoff CP9040 Beckhoff CP PC (CP-PC, IODEVICETYPE_BKHFCP9040) + + + + + Beckhoff AH2000 (Hydraulik Backplane, IODEVICETYPE_BKHFAH2000, ID:53) + + + + + Beckhoff CP9035 (PCI, Panel-Link with UPS, IODEVICETYPE_BKHFCP9035, ID:54) + + + + + Beckhoff-AH2000 mit Profibus-MC (IODEVICETYPE_AH2000MC, ID:55) + + + + + Beckhoff-Profibus-Monitor-PCI-Karte FC310x-Monitor (IODEVICETYPE_FC3100MON, ID:56) + + + + + Virtuelles USB Device (IODEVICETYPE_USB, ID:57) + + + + + Beckhoff-CANopen-Monitor-PCI-Karte FC510x-Monitor (IODEVICETYPE_FC5100MON, ID: 58) + + + + + Beckhoff-DeviceNet-Monitor-PCI-Karte FC520x-Monitor (IODEVICETYPE_FC5200MON) + + + + + Beckhoff-Profibus-PCI-Karte als Slave FC310x-Slave (IODEVICETYPE_FC3100SLV) + + + + + Beckhoff-CanOpen-PCI-Karte als Slave FC510x-Slave (IODEVICETYPE_FC5100SLV) + + + + + Beckhoff-DeviceNet-PCI-Karte als Slave FC520x-Slave (IODEVICETYPE_FC5200SLV) + + + + + PCI Interbus-S-Master IBS PCI SC/I-T (Phoenix-Karte, IODEVICETYPE_IBSSCITPCI) + + + + + Beckhoff-CX1100 Klemmenbus Netzteil CX1100 (IODEVICETYPE_CX1100_BK, 65) + + + + + Ethernet Real Time Miniport RT-Ethernet (IODEVICETYPE_ENETRTMP, 66) + + + + + + + + + + PC104 Lightbus-Master CX1500-M200 (IODEVICETYPE_CX1500_M200, 67) + + + + + PC104 Lightbus-Slave CX1500-B200 (IODEVICETYPE_CX1500_B200) + + + + + PC104 ProfiBus-Master CX1500-M310 (IODEVICETYPE_CX1500_M310) + + + + + PC104 ProfiBus-Slave CX1500-B310 (IODEVICETYPE_CX1500_B310) + + + + + PC104 CANopen-Master CX1500-M510 (IODEVICETYPE_CX1500_M510) + + + + + PC104 CANopen-Slave CX1500-B510 (IODEVICETYPE_CX1500_B510) + + + + + PC104 DeviceNet-Master CX1500-M520 (IODEVICETYPE_CX1500_M520) + + + + + PC104 DeviceNet-Slave CX1500-B520 (IODEVICETYPE_CX1500_B520) + + + + + PC104 Sercos-Master CX1500-M750 (IODEVICETYPE_CX1500_M750) + + + + + PC104 Sercos-Slave (IODEVICETYPE_CX1500_B750) + + + + + BX Klemmenbus Interface BX-BK (IODEVICETYPE_BX_BK) + + + + + BX SSB-Master BX-M510(IODEVICETYPE_BX_M510) + + + + + BX ProfiBus-Slave BX-B310 (IODEVICETYPE_BX_B310) + + + + + PCIInterbus-S-Master mit Slave-Teil auf Kupfer Basis IBS PCI SC/RI/I-T (Phoenix-Karte, IODEVICETYPE_IBSSCRIRTPCI) + + + + + BX CANopen-Slave BX-B510 (IODEVICETYPE_BX_B510) + + + + + BX DeviceNet-Slave BX-B520 (IODEVICETYPE_BX_B520) + + + + + BCxx50 ProfiBus-Slave BC3150 (IODEVICETYPE_BC3150) + + + + + BCxx50 CANopen-Slave (IODEVICETYPE_BC5150) + + + + + BCxx50 DeviceNet-Slave BC5250 (IODEVICETYPE_BC5250) + + + + + Beckhoff-Profibus-EtherCAT-Klemme (IODEVICETYPE_EL6731) + + + + + Beckhoff-CanOpen-EtherCAT-Klemme (IODEVICETYPE_EL6751) + + + + + Beckhoff-DeviceNet-EtherCAT-Klemme (IODEVICETYPE_EL6752) + + + + + COM ProfiBus-Master 8 kByte (Hilscher-Karte)(IODEVICETYPE_COMPB) + + + + + COM Interbus-S-Master (Hilscher-Karte)(IODEVICETYPE_COMIBM) + + + + + COM DeviceNet-Master (Hilscher-Karte)(IODEVICETYPE_COMDNM) + + + + + COM CANopen-Master (Hilscher-Karte)(IODEVICETYPE_COMCAN) + + + + + COM CANopen-Slave (Hilscher-Karte)(IODEVICETYPE_COMIBS) + + + + + EtherCAT in direct mode (v2.10 only) (IODEVICETYPE_ETHERCAT) + + + + + PROFINET Master (IODEVICETYPE_PROFINETIOCONTROLLER) + + + + + PROFINET Slave (IODEVICETYPE_PROFINETIODEVICE) + + + + + Beckhoff-Profibus-Slave-EtherCAT-Klemme (IODEVICETYPE_EL6731SLV) + + + + + Beckhoff-CanOpen-Slave-EtherCAT-Klemme (IODEVICETYPE_EL6751SLV) + + + + + Beckhoff-DeviceNet-Slave-EtherCAT-Klemme (IODEVICETYPE_EL6752SLV) + + + + + PC104+ ProfiBus-Master 8 kByte (Hilscher-Karte) (IODEVICETYPE_C104PPB) + + + + + PC104+ CANopen-Master (Hilscher-Karte) (IODEVICETYPE_C104PCAN) + + + + + PC104+ DeviceNet-Master (Hilscher-Karte) (IODEVICETYPE_C104PDNM) + + + + + BCxx50 serieller Slave (IODEVICETYPE_BC8150) + + + + + BX9000 Ethernet Slave (IODEVICETYPE_BX9000) + + + + + CX9000 Terminal Device (K-BUS) + + + + + EtherCAT Automation Protocol, EL6601 (IODEVICETYPE_EL6601 = 106) + + + + + BC9050 Etherent Slave (IODEVICETYPE_BC9050 = 107) + + + + + RT-Ethernet Adapter (BC9120 Ethernet Slave) IODEVICETYPE_BC9120 = 108) + + + + + RT-Ethernet Multiple Protocol Handler, Ethernet Miniport Adapter (IODEVICETYPE_ENETADAPTER = 109) + + + + + + + + + + BC9020 Ethernet Slave (IODEVICETYPE_BC9020 = 110) + + + + + EtherCAT Protocol in Direct mode (IODEVICETYPE_ETHERCATPROT = 111) + + + + + EtherCAT Network Variables (Automation protocol, IODEVICETYPE_ETHERNETNVPROT = 112) + + + + + + + + + + Profinet Controller (IODEVICETYPE_ETHERNETPNMPROT = 113) + + + + + Beckhoff-Lightbus-EtherCAT-Klemme (IODEVICETYPE_EL6720 = 114) + + + + + Profinet Device (IODEVICETYPE_ETHERNETPNSPROT = 115) + + + + + Beckhoff CP PC (Beckhoff CP6608(IXP PC), IODEVICETYPE_BKHFCP6608 = 116) + + + + + IEEE 1588 (PTP) (IODEVICETYPE_PTP_IEEE1588 = 117) + + + + + EL6631-0010 (IODEVICETYPE_EL6631SLV = 118) + + + + + EL6631 (IODEVICETYPE_EL6631 = 119) + + + + + CX5000-BK (Beckhoff-CX5100 Klemmenbus Netzteil, IODEVICETYPE_CX5000_BK = 120) + + + + + PCI DP-RAM (Generic PCI DPRAM (TCOM), IODEVICETYPE_PCIDEVICE = 121) + + + + + IODEVICETYPE_ETHERNETEAPPOLL = 122, // EtherCAT Automation Protocoll polled connection + + + + + IODEVICETYPE_ETHERNETAUTOPROT = 123, // Automation Protocol + + + + + IODEVICETYPE_CCAT = 124, // CCAT + + + + + IODEVICETYPE_CPLINK3 = 125, // Virtuelles USB Device (remote via CPLINK3) + + + + + IODEVICETYPE_EL6632 = 126, // EL6632 + + + + + IODEVICETYPE_CCAT_PBM = 127, // CCAT Profibus Master + + + + + IODEVICETYPE_CCAT_PBS = 128, // CCAT Profibus Slave + + + + + IODEVICETYPE_CCAT_CNM = 129, // CCAT CANopen Master + + + + + IODEVICETYPE_ETHERCATSLAVE = 130, // EtherCAT Slave + + + + + IODEVICETYPE_BACNET = 131, // BACnet device + + + + + IODEVICETYPE_CCAT_CNS = 132, // CCAT CANopen Slave + + + + + IODEVICETYPE_ETHIP_SCANNER = 133, // ETHERNET IP Master + + + + + IODEVICETYPE_ETHIP_ADAPTER = 134, // ETHERNET IP Slave + + + + + IODEVICETYPE_CX8000_BK = 135, // Beckhoff-CX8100 Klemmenbus Netzteil + + + + + IODEVICETYPE_ETHERNETUDPPROT = 136, // Upd Protocol + + + + + IODEVICETYPE_BC9191 = 137, // BC9191 Etherent Slave + + + + + IODEVICETYPE_ENETPROTOCOL = 138, // Real-Time Ethernet Protocol (BK90xx, AX2000-B900) + + + + + Disabled state type for the TreeItem + + + This is the CLS-compliant, corresponding type to TCatSysManagerLibs DISABLED_STATE + + + + + The state is unknown/not initialized + + + + + The item is not disabled + + + + + The item is disabled itself + + + + + A parent of the item is disabled (and implicitely the item itself) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Extension class for the + + + + + Converts the to an Int32 + + The type. + + + + + Converts the to string identifyer + + The type. + + + + + Extension class for the . + + + + + Gets the description of the + + The type. + + + + + Converts the to Int32. + + The type. + + + + + Extension class for the . + + + + + Gets the description of the + + The type. + + + + + Converts the to Int32. + + The type. + + + + + Extension class for + + + + + Gets the description of the . + + The type. + + + + + Gets the as Int32. + + The type. + + + + + Group type of variables + + + + + Variable Group is unknown + + + + + Input variable group + + + + + Output variable group + + + + + Channel variable group + + + + + Late bound configuration factory + + Configuration items (and all script types) will be stored in late bound types (e.g 'dynamic' in C#) + + + + Initializes a new instance of the class. + + + + + Message Handler demo implementiation to preserve the E_REJECTED_XXX Errros (See Msdn documentation for Visual Studio) + + + + + Definition of the IOleMessageFilter interface + + + + + Handles the in coming call. + + Type of the dw call. + The h task caller. + The dw tick count. + The lp interface info. + + + + + Retries the rejected call. + + The h task callee. + The dw tick count. + Type of the dw reject. + + + + + Messages the pending. + + The h task callee. + The dw tick count. + Type of the dw pending. + + + + + Start the filter + + + + + Done with the filter, close it. + + + + + Handles the in coming thread requests. + + Type of the dw call. + The h task caller. + The dw tick count. + The lp interface info. + + + + + Retries the rejected call. + + The h task callee. + The dw tick count. + Type of the dw reject. + + + + + + + The h task callee. + The dw tick count. + Type of the dw pending. + + + + + Gets a value indicating whether the is registered already. + + + true if is registered; otherwise, false. + + + + + Running Object Table Access + + + + + Get a snapshot of the running object table (ROT). + + A dictionary mapping the name of the object in the ROT to the corresponding object (COM Object) + + + + Get a table of the currently running instances of the Visual Studio .NET IDE. + + A dictionary mapping common information about the DTE object to the EnvDte.DTE object itself + + + + Gets the DTE Object which has opened a solution with the specified name. + + Name of the solution (without path, without extension) + The DTE Object + + + + DTE Information Object + + + + + The version of the DTE + + + + + The process identifier of the devenv process + + + + + Initializes a new instance of the class. + + The version. + The solution path. + The process identifier. + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Parses the specified string. + + The string. + + + + + + Tries to parse the specified string to an instance. + + The string. + The object. + true if succeeded, false if not. + + + + Gets the solution path of the Info object + + + The solution path. + + + + + Gets the name of the solution. + + + The name of the solution. + + + + + Actual status of the Script + + + + + None / Uninitialized + + + + + Initializing the Script and its initial configuration + + + + + Cleaning up the Script / Configuration + + + + + Script currently executing. + + + + + Abstract base class for scripts + + + + + Initializes a new instance of the class. + + + + + Script context + + + + + Initializes the script with DTE, Solution and Script Worker object + + The Script Context. + + + + Script status + + + + + Executes the script with worker context. + + The worker. + + + + Cleans the Script up after usage. + + The worker. + + + + Script Start time + + + + + Sets the start time. + + + + + Script stop time + + + + + Sets the stop time. + + + + + Handler function Before Initializing the Script (Configuration preparations) + + The Script Context + Usually used to to the open a prepared or new XAE configuration + + + + Handler function Initializing the Script (Configuration preparations) + + The Script Context + Usually used to to the open a prepared or new XAE configuration + + + + Handler function Executing the Script code. + + The worker. + + + + Cleaning up the XAE configuration after script execution. + + The worker. + + + + XAE Base Template (TwinCAT 30 + + + + + XAE Base Template new (>= TwinCAT 3.1) + + + + + Template Name for the XAE PLC Empty template + + + + + Template Name for the XAE PLC Standard template + + + + + Template Name for the XAE Saftey Standard template + + + + + + Deletes the solution folder. + + + + + Creates an empty Visual Studio Solution + + + + + Handler function called after the Solution object has been created. + + + + + Creates the new project. + + Name of the project. + + + + + Creates the new project. + + + + + + Creates the new project. + + Name of the project. + The template path. + + + + + Deletes all files in the subtree + + Target directory. + + + + Copies a directory from Source to Destination + + Source Folder + Destingation Folder + + + + Sets the Script Status + + The script status. + + + + Handler function fireing the event. + + The old status. + The script status. + + + + Script Result + + + + + Sets the result. + + The script result. + + + + Returns a that represents this instance. + + + A that represents this instance. + + + + + Gets the context. + + The context. + + + + Gets the Script Status + + The status. + + + + Gets the start time of the Script + + + The start time. + + + + + Gets the Script stop time + + + The stop time. + + + + + Gets the Scripts execution duration. + + + The duration. + + + + + Gets the Script description + + The description. + + + + Gets the detailed description of the that is shown in the Method Tips. + + The detailed description. + + + + Gets the keywords, describing the Script features + + The keywords. + + + + Gets the programming language of the Script + + The programming language. + + + + Gets the Version number of TwinCAT that is necessary for script execution. + + The TwinCAT version. + + + + Gets the build number of TwinCAT that is necessary for script execution. + + The TwinCAT build. + + + + Gets the category of this script. + + The script category. + + + + Gets the binding type of the script + + The programming language. + + + + Gets the base Application Directory, where the ScriptingTestContainer base Dlls are residing. + + The application path. + + + + Gets the last execution Exception. + + The exception. + + + + Gets the name of the Script. + + The name. + + + + Gets the script templates folder used for configuration templates. + + The script templates folder. + + + + Gets the Path of the TwinCAT XAE Base Template + + The vs xae template path. + + + + Gets the TwinCAT Installation Directory + + The twin CAT install dir. + + + + Gets the actual activated TwinCAT Version + + The current twin CAT version. + + + + Gets the working folder. + + The working folder. + + + + Gets the Script Root Folder + + The solution folder. + + + + Gets the temp folder (Folder within the Script Root folder (SolutionFolder) + + The temp folder. + + + + Occurs when the has changed. + + + + + Gets the Script Result + + The result. + + + + Script Result enumeration + + + + + None / Initialized / Script not processed + + + + + Script Succeeded + + + + + Script Failed + + + + + Event arguments fired with the event. + + + + + Old State + + + + + New State + + + + + Initializes a new instance of the class. + + The old state. + The new state. + + + + Late Bound Script (uses only late bound variables) + + Take take not to use Referenced Assemblies within derived classes. + + + + + Initializes a new instance of the class. + + + + + DTE Object (Late Bound) + + + + + Solution object (Late Bound) + + + + + Handler function Before Initializing the Script (Configuration preparations) + + The Script Context + Usually used to to the open a prepared or new XAE configuration + + + + Handler function Initializing the Script (Configuration preparations) + + The Script Context + Usually used to to the open a prepared or new XAE configuration + + + + Creates an empty Visual Studio Solution + + + + + Creates the new project. + + Name of the project. + + + + + Creates the new project. + + Name of the project. + The template path. + + + + + Cleaning up the XAE configuration after script execution. + + The worker. + + + + Gets the binding type of the script + + The programming language. + + + + Early Bound Script + + The base class for the Script type uses the typed versions of dte and solution objects directly referencing the VisualStudio TypeLibrary. + References to TwinCAT XAE Connectivity classes like ITcSysManager ITcTreeItem are allowed to use here. + + + + Initializes a new instance of the class. + + + + + Early Bound DTE Object + + + + + Early Bound Solution Object + + + + + Handler function Before Initializing the Script (Configuration preparations) + + The Script Context + Usually used to to the open a prepared or new XAE configuration + + + + Handler function Initializing the Script (Configuration preparations) + + The Script Context + Usually used to to the open a prepared or new XAE configuration + + + + Cleaning up the XAE configuration after script execution. + + The worker. + Saves all open projects and Frees the internal DTE and Solution references + + + + Creates an empty Visual Studio Solution + + + + + Creates the new project. + + Name of the project. + + + + + Creates the new project. + + Name of the project. + The template path. + + + + + Gets the binding type of the script + + The programming language. + + + + Class implements additional OS Environment settings + + + + + Gets a value indicating whether this code is running on a 64 Bit Operating system. + + + true if [is64 bit operating system]; otherwise, false. + + + + + Gets a value indicating whether this code is running within a Wow64 Process (32-Bit Processon 64-Bit Operating system) + + + true if this instance is wow64 process; otherwise, false. + + + + + Gets a value indicating whether this code is running in a native 64 Bit Process. + + true if [is64 bit process]; otherwise, false. + + + + Helper class + + + + + Scans the devices on the target system and returns a list of XML Nodes representing these devices. + + The system manager. + + + + + Scans the devices and Adds an EtherCAT Automation Protocol device if an network adapter is found. + + The system manager. + The type. + Name of the device. + The progress. + + + + + Var Declaration class. + + + + + Initializes a new instance of the class. + + The scope. + The name. + The type. + The address. + The init value. + The comment. + The flags. + + + + Initializes a new instance of the class. + + The scope. + The name. + The type. + The address. + + + + Gets the address. + + The address. + + + + Gets the comment. + + The comment. + + + + Gets the flags. + + The flags. + + + + Gets the init value. + + The init value. + + + + Gets the name. + + The name. + + + + Gets the scope. + + The scope. + + + + Gets the type. + + The type. + + + + Converter class converting instances of the enumeration + + + + + Converts the enumeration to string. + + + + + + + Script Loader class + + + + + Loads the script intances from Assemblies within the Executable folder. + + The script type filter (or null if not filtered). + + + + Gets the script. + + The name. + + + + + Instantiates the scripts from the specified assembly. + + The assembly. + Type filter (or null) + IEnumerable<Script>. + + + + Determines the script types from the specified assembly. + + The assembly. + + + + + Gets or sets the script filter. + + The script filter. + + + + Gets the scripts. + + The scripts. + + + + Xml Converter class for TwinCAT specifics + + + + + Reads the element content as bin hex. + + The reader. + + + + + Reads an hexadecimal integer value from XML string + + The string + The value + + + + Reads an hexadecimal value from XML string + + The string + The value + + + + Converts an hexadecimal value to XML string + + The value + The string representation + + + + Converts an hexadecimal value to XML string + + The value + The string representatino + + + + Reads an hexadecimal integer value from XML string + + The string + The value + + + + Converts an hexadecimal value to XML string + + The value + The string representation + + + + Reads a specified booleaan (from "True", "False", "1" and "0"); + + The STR. + + + + + Script context + + + + + Gets the DTE Object. + + The DTE. + + + + Gets the solution object + + The solution. + + + + Gets the Script Worker. + + The worker. + + + + Gets the Configuration Factory + + The factory. + + + + Gets the Named parameters (Dictionary Name --> ParameterValue) + + The _parameters. + + + + Gets the solution template. + + The solution template. + + + + Script context class + + + + + Initializes a new instance of the class. + + The factory. + The project template. + The parameters. + + + + Initializes a new instance of the class. + + The factory. + + + + Parameters dictionary + + + + + Project template + + + + + Sets the DTE. + + The DTE. + The solution. + + + + Sets the worker. + + The worker. + + + + Gets the Script Worker. + + The worker. + + + + Gets the Configuration Factory + + The factory. + + + + Gets the DTE. + + The DTE. + + + + Gets the solution. + + The solution. + + + + Gets the Named parameters (Dictionary Name --> ParameterValue) + + The _parameters. + + + + Gets the solution template. + + The solution template. + + + + Worker interface wrapping the Worker thread used to execute the script. + + + + + Starts the Script execution asynchronously + + + + + Cancels the script asynchronously. + + + + + Requests the Execution Cancel and wait until the Execution is stopped. + + + + + Gets a value indicating whether a cancellation is pending. + + true if [cancellation pending]; otherwise, false. + + + + Occurs when the worker thread has been completed + + + + + Occurs, when the Visual Studio configuration is fully initialized + + + + + Worker class for asynchronous script execution (within STA) + + + + + Initializes a new instance of the class. + + The script. + The context. + + + + Configuration factory + + + + + Executed Script + + + + + Starts the Script execution asynchronously + + + + + Current status of the script execution + + + + + Current Progress + + + + + Handler function fireing the event. + + + + + Cancels the script asynchronously. + + + + + Requests the Execution Cancel and wait until the Execution is stopped. + + + + + + + Called when [configuration initialized]. + + + + + Occurs when the worker thread has been completed + + + + + Gets or sets the status string. + + The status. + + + + Occurs when the status has been changed. + + + + + Sets the progress value (0-100%) + + The progress. + + + + Occurs when the progress has been changed. + + + + + Gets a value indicating whether a cancellation is pending. + + true if [cancellation pending]; otherwise, false. + + + + Occurs, when the Visual Studio configuration is fully initialized + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA.tszip b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA.tszip new file mode 100644 index 0000000..dc955a0 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA.tszip differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Axis1.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Axis1.xml new file mode 100644 index 0000000..493edcf Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Axis1.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Axis2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Axis2.xml new file mode 100644 index 0000000..664eb2b Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Axis2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Links.xml new file mode 100644 index 0000000..a58b6ce --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/Links.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/POUs/FB_Axis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/POUs/FB_Axis.xml new file mode 100644 index 0000000..f72ad34 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/POUs/FB_Axis.xml @@ -0,0 +1,137 @@ + 0); + bDriveError := AxisRef.NcToPlc.StateDWord.28; + + Timer(IN := bStatus); + IF Timer.Q OR bNcError OR bDriveError THEN + Timer(IN := FALSE); + + IF bDriveError THEN + fbSoEReset(Execute:= FALSE, Axis:= AxisRef); + iState := 10; + ELSIF bNCError THEN + fbMcReset(Execute := FALSE, Axis := AxisRef); + iState := 20; + ELSE + IF lrPosition <> lrPosition1 THEN + lrPosition := lrPosition1; + ELSE + lrPosition := lrPosition2; + END_IF + fbMCMove( + Execute:= FALSE, + Axis := AxisRef + ); + iState := 30; + END_IF + END_IF + +10: (* drive reset *) + A_DriveReset(); + +20: (* MC reset *) + A_MC2Reset(); + +30: (* MC move absolute *) + A_MC2Move(); + +31: (* MC move absolute *) + A_MC2Move(); + +32: (* back to idle *) + iState := 0; + +40: (* MC halt *) + A_MC2Halt(); +END_CASE + +lrActPos := AxisRef.NcToPlc.ActPos;]]> bStatus, +); +]]> lrPosition1 THEN + lrPosition := lrPosition1; + ELSE + lrPosition := lrPosition2; + END_IF + + fbMCMove(Execute := FALSE, Axis := AxisRef); + iState := iState + 1; +END_IF + +IF bHalt THEN + fbMCMove(Execute := FALSE, Axis := AxisRef); + iState := 40; +END_IF]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/POUs/MAIN.xml new file mode 100644 index 0000000..0f6de45 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeA/POUs/MAIN.xml @@ -0,0 +1,33 @@ + lrActPos1 +); + +fbAxis2( + bDriveReset := bDriveReset, + bHalt := bHalt, + lrActPos => lrActPos2 +); + +bEnabled := fbAxis1.bStatus AND fbAxis2.bStatus; +bError := fbAxis1.bDriveError OR fbAxis1.bNcError OR fbAxis2.bNcError OR fbAxis2.bDriveError; +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB.tszip b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB.tszip new file mode 100644 index 0000000..5e3a2b1 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB.tszip differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis1.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis1.xml new file mode 100644 index 0000000..d73b92b Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis1.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis2.xml new file mode 100644 index 0000000..8f75881 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis3.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis3.xml new file mode 100644 index 0000000..75e914d Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis3.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis4.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis4.xml new file mode 100644 index 0000000..9afa7ab Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Axis4.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Channel2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Channel2.xml new file mode 100644 index 0000000..7c461bf Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Channel2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_Commands.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_Commands.xml new file mode 100644 index 0000000..dacb2c4 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_Commands.xml @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml new file mode 100644 index 0000000..bd740bd --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_States.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_States.xml new file mode 100644 index 0000000..2ca6136 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Datatypes/E_States.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/GVLs/GlobalVariables.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/GVLs/GlobalVariables.xml new file mode 100644 index 0000000..f49c99c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/GVLs/GlobalVariables.xml @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Links.xml new file mode 100644 index 0000000..7b6e43f --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/Links.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/FB_NciChannel.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/FB_NciChannel.xml new file mode 100644 index 0000000..a8ec7c0 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/FB_NciChannel.xml @@ -0,0 +1,181 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/FB_NciSequence.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/FB_NciSequence.xml new file mode 100644 index 0000000..0fbaafc --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/FB_NciSequence.xml @@ -0,0 +1,86 @@ += 2 AND iMaxUsedChannels >= 1 THEN + CASE nState OF + 0: + IF bExecute THEN + bBusy := TRUE; + bDone := FALSE; + bError := FALSE; + dwErrorId := 0; + nState := 10; + END_IF + + 10: + fbNciChaA( + bExecute := bExecute, + stNcToPlcX := AxisRef[1].NcToPlc, + stNcToPlcY := AxisRef[2].NcToPlc, + stNcToPlcZ := stNcToPlcDummy, + stNcToPlcC := stNcToPlcDummy, + stPlcToNci := stPlcToNci, + stNciToPlc := stNciToPlc + ); + + IF NOT fbNciChaA.bBusy THEN + fbNciChaA( bExecute:= FALSE, stNcToPlcX:= AxisRef[1].NcToPlc, stNcToPlcY:= AxisRef[2].NcToPlc, stNcToPlcZ:= stNcToPlcDummy, + stNcToPlcC:= stNcToPlcDummy, stPlcToNci:= stPlcToNci, stNciToPlc:= stNciToPlc ); + + bBusy := FALSE; + + IF NOT fbNciChaA.bErr THEN + bDone := TRUE; + ELSE + bError := fbNciChaA.bErr; + dwErrorId := fbNciChaA.nErrId; + END_IF + IF NOT bExecute THEN + nState := 0; + ELSE + nState := 20; + END_IF + END_IF + + 20: + bBusy := FALSE; + IF NOT bExecute THEN + IF fbNciChaA.bErr THEN + bError := fbNciChaA.bErr; + dwErrorId := fbNciChaA.nErrId; + END_IF + nState := 0; + END_IF + END_CASE + +END_IF +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/MAIN.xml new file mode 100644 index 0000000..95576ee --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeB/POUs/MAIN.xml @@ -0,0 +1,152 @@ + 32767 THEN + iNciOverrideRaw := 0; +END_IF +NciOverrideFilter( + OverrideValueRaw := iNciOverrideRaw, + LowerOverrideThreshold := 0, + UpperOverrideThreshold := 32767, + OverrideSteps := 200, + OverrideRecoveryTime := T#150ms, +); + +(* enable *) +A_Enable(); +IF bEnabled THEN + bCallSequence := TRUE; + A_TriggerExec(); +END_IF + +IF bCallSequence THEN + (* call motion sequence *) + IF bNciReq OR fbNciSequence.bBusy THEN + fbNciSequence( + bExecute := TRUE, + iMaxUsedAxes := iMaxUsedAxes, + iMaxUsedChannels:= iMaxUsedChannels, + AxisRef := AxisRef, + stNciToPlc := stiNciToPlc, + stPlcToNci := stoPlcToNci, + bBusy => bBusy, + bDone => bDone, + bError => bError, + dwErrorId => dwErrorId + ); + ELSE + fbNciSequence( + bExecute := FALSE, + AxisRef := AxisRef, + stNciToPlc := stiNciToPlc, + stPlcToNci := stoPlcToNci, + ); + END_IF +END_IF +]]> bAxisEnabled[I] + ); + bEnabled := bEnabled AND bAxisEnabled[I]; + bEnableError := bEnableError OR fbMC_Power[I].Error; +(* bResetReq := bResetReq OR AxisInErrorState(stiNcToPlc[I].nStateDWord);*) +END_FOR + +(* NCI override *) +lrOverrideNci := LIMIT(0, UINT_TO_LREAL(iNciOverrideRaw) * 100.0 / lrOverrideMaxScale, 100); +ItpSetOverridePercent(lrOverrideNci, stoPlcToNci); +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC.tszip b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC.tszip new file mode 100644 index 0000000..f4dda94 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC.tszip differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisX.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisX.xml new file mode 100644 index 0000000..df7fece Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisX.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisY.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisY.xml new file mode 100644 index 0000000..2c98063 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisY.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisZ.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisZ.xml new file mode 100644 index 0000000..df3d926 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/AxisZ.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Datatypes/E_AxisState.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Datatypes/E_AxisState.xml new file mode 100644 index 0000000..a89c0f6 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Datatypes/E_AxisState.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Datatypes/E_MoveCmd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Datatypes/E_MoveCmd.xml new file mode 100644 index 0000000..821477a --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Datatypes/E_MoveCmd.xml @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Links.xml new file mode 100644 index 0000000..3e8f680 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/Links.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml new file mode 100644 index 0000000..9503404 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml @@ -0,0 +1,79 @@ + iDiagNumber + ); + eCurState := eAxisState_Idle; + END_IF + +END_CASE + +M_HardwareDiag := eCurState <> eAxisState_Idle; +bExecHWDiag_ := bExecute; +]]> eAxisState_Idle; +bExecHWRes_ := bExecute;]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/FB_NcAxis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/FB_NcAxis.xml new file mode 100644 index 0000000..517b128 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/FB_NcAxis.xml @@ -0,0 +1,213 @@ + 0); +]]> overwrite method if necessary +CASE eCurState OF +eAxisState_Idle: + IF bExecute AND NOT bExecHWDiag_ THEN + eCurState := eAxisState_Diag; + END_IF + +eAxisState_Diag: + eCurState := eAxisState_Idle; + +END_CASE + +M_HardwareDiag := eCurState <> eAxisState_Idle; +bExecHWDiag_ := bExecute; + +]]> bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveModulo: + fbMcMoveMod( + Execute := bExecute, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveRelative: + fbMcMoveRel( + Execute := bExecute, Distance:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveVelocity: + fbMcMoveVel( + Execute := bExecute, Velocity:= fVelocity, Axis := sAxis, + InVelocity=> bDone, Busy => bBusy, Active => bActive, + Error => bError, ErrorID => iErrorId, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + END_CASE + END_IF + +eAxisState_Move: + CASE eMoveCmd OF + eCmd_MoveAbsolute: + fbMcMoveAbs( + Execute := TRUE, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveAbs(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveModulo: + fbMcMoveMod( + Execute := TRUE, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveMod(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveRelative: + fbMcMoveRel( + Execute := TRUE, Distance:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveRel(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveVelocity: + fbMcMoveVel( + Execute := TRUE, Velocity:= fVelocity, Axis := sAxis, + InVelocity=> bDone, Busy => bBusy, Active => bActive, + Error => bError, ErrorID => iErrorId, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveVel(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + END_CASE +END_CASE + +M_Move := (eCurState <> eAxisState_Idle); +bExecMove_ := bExecute;]]> bDone, + Busy => bBusy, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Reset; + END_IF + +eAxisState_Reset: + fbMcReset( + Execute := FALSE, Axis := sAxis, Done => bDone, + Busy => bBusy, Error => bError, ErrorID => iErrorId + ); + IF fbMcReset.Done OR fbMcReset.Error THEN + eCurState := eAxisState_Idle; + END_IF +END_CASE + +M_Reset := eCurState <> eAxisState_Idle; +bExecReset_ := bExecute;]]> overwrite method if necessary +CASE eCurState OF +eAxisState_Idle: + IF bExecute AND NOT bExecHWRes_ THEN + eCurState := eAxisState_Reset; + END_IF + +eAxisState_Reset: + eCurState := eAxisState_Idle; + +END_CASE + +M_HardwareReset := eCurState <> eAxisState_Idle; +bExecHWRes_ := bExecute;]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/IAxis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/IAxis.xml new file mode 100644 index 0000000..65a5d5c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/Axis/IAxis.xml @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/FB_Table.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/FB_Table.xml new file mode 100644 index 0000000..5715a30 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/FB_Table.xml @@ -0,0 +1,127 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/MAIN.xml new file mode 100644 index 0000000..5d167f2 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeC/POUs/MAIN.xml @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/Datatypes/E_FunctionType.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/Datatypes/E_FunctionType.xml new file mode 100644 index 0000000..f9e3df7 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/Datatypes/E_FunctionType.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/GVLs/GVL_Constants.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/GVLs/GVL_Constants.xml new file mode 100644 index 0000000..18fb326 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/GVLs/GVL_Constants.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/POUs/FB_FunctionGenerator.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/POUs/FB_FunctionGenerator.xml new file mode 100644 index 0000000..8f79711 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/POUs/FB_FunctionGenerator.xml @@ -0,0 +1,331 @@ + + + + + fFrequency THEN + bInit := TRUE; // For automatic initializing + fLastFrequency := fFrequency; + END_IF + IF fLastAmplitude <> fAmplitude THEN + bInit := TRUE; // For automatic initializing + fLastAmplitude := fAmplitude; + END_IF + IF fLastOffset <> fOffset THEN + bInit := TRUE; // For automatic initializing + fLastOffset := fOffset; + END_IF + IF nLastDutyCycle <> nDutyCycle THEN + bInit := TRUE; // For automatic initializing + nLastDutyCycle := nDutyCycle; + END_IF + IF eLastFunction <> eFunction THEN + bInit := TRUE; // For automatic initializing + eLastFunction := eFunction; + END_IF + IF bInit THEN + // Get taks info + fbGetTaskIdx(); + fCycleTime := TwinCAT_SystemInfoVarList._TaskInfo[fbGetTaskIdx.index].CycleTime (*100ns*) / (10.0 * 1000.0 * 1000.0); + fLastSignalValue := 0; + nSign := 1; + fAngularIncrement := 0; + // Flush out old data + MEMSET(ADR(aSignal), 0, SIZEOF(aSignal)); + IF fFrequency <> 0 AND fCycleTime > 0 THEN + // Calculate period, increments per plc cycle, increment per oversample + IF cOversamples <> 0 THEN + IF eFunction = E_FunctionType.eSine THEN + fPeriod := 1/fFrequency; + fAngularIncrementPerCycle := 360*(fCycleTime/fPeriod); + fAngularIncrementPerSample := fAngularIncrementPerCycle/cOversamples; + // no phase adjustment + bInit := FALSE; + ELSIF eFunction = E_FunctionType.eSquare THEN + fPeriod := 1/fFrequency; + fAngularIncrementPerCycle := 360*(fCycleTime/fPeriod); + fAngularIncrementPerSample := fAngularIncrementPerCycle/cOversamples; + fPhase := 0.5*360; + bInit := FALSE; + ELSIF eFunction = E_FunctionType.ePulse THEN + fPeriod := 1/fFrequency; + fAngularIncrementPerCycle := 360*(fCycleTime/fPeriod); + fAngularIncrementPerSample := fAngularIncrementPerCycle/cOversamples; + IF nDutyCycle > 100 THEN + nDutyCycle := 100; + END_IF + fPhase := (UDINT_TO_LREAL(nDutyCycle)/100)*360; + bInit := FALSE; + ELSIF eFunction = E_FunctionType.eTriangular THEN + fPeriod := 1/fFrequency; + fAngularIncrementPerCycle := 360*(fCycleTime/fPeriod); + fAngularIncrementPerSample := fAngularIncrementPerCycle/cOversamples; + fPhase := 0.5*360; + fDelta := 4*(fAmplitude/(360/fAngularIncrementPerSample)); + bInit := FALSE; + ELSIF eFunction = E_FunctionType.eSawtooth THEN + fPeriod := 1/fFrequency; + fAngularIncrementPerCycle := 360*(fCycleTime/fPeriod); + fAngularIncrementPerSample := fAngularIncrementPerCycle/cOversamples; + fDelta := fAmplitude/(360/fAngularIncrementPerSample); + bInit := FALSE; + ELSIF eFunction = E_FunctionType.eAM THEN + fPeriod := 1/fFrequency; + fAngularIncrementPerCycle := 360*(fCycleTime/fPeriod); + fAngularIncrementPerSample := fAngularIncrementPerCycle/cOversamples; + // no phase adjustment + fCarrierPeriod := 1/fCarrierFrequency; + fCarrierAngularIncrementPerCycle := 360*(fCycleTime/fCarrierPeriod); + fCarrierAngularIncrementPerSample := fCarrierAngularIncrementPerCycle/cOversamples; + // no phase adjustment + bInit := FALSE; + ELSE + bError := TRUE; + END_IF + ELSE + bError := TRUE; + END_IF + ELSE + bError := TRUE; + END_IF + END_IF + + // Enable function generator + IF NOT bError THEN + CASE eFunction OF + // sine: typical for vibrations originating from rotating machine + E_FunctionType.eSine: Sine(); + + // square: mixed sine signals good for analyzing spectrum + E_FunctionType.eSquare: Square(); + + // pulse: mixed sine signals good for analyzing spectrum + E_FunctionType.ePulse: Pulse(); + + // sawtooth: ramp-type vibrations, continuously increasing + E_FunctionType.eSawtooth: Sawtooth(); + + // triangular: mixed sine signals good for analyzing spectrum + E_FunctionType.eTriangular: Triangular(); + + // amplitude modulation: typical for vibrations originating from gear-tooth failure or bearing faults + // Carrier signal with own frequency and amplitude + E_FunctionType.eAM: AM(); + END_CASE + END_IF +ELSE + // Flush out old data + MEMSET(ADR(aSignal), 0, SIZEOF(aSignal)); +END_IF]]> + + + + + + + + + + + = 360) THEN + fAngularIncrement := fAngularIncrement - DINT_TO_LREAL(LREAL_TO_DINT(fAngularIncrement/360))*360; + // or with Tc2_Math library: fAngularIncrement := LMOD(fAngularIncrement,360); + fLastSignalValue := fLastSignalValue -fAmplitude; + END_IF + fAngularIncrement := fAngularIncrement + fAngularIncrementPerSample; + + aSignal[nSamples] := fLastSignalValue + fDelta; + + // Store last sample + fLastSignalValue := aSignal[nSamples]; + + aSignal[nSamples] := aSignal[nSamples] + fOffset; +END_FOR +]]> + + + + + + + + + + + + = 360) THEN + fAngularIncrement := fAngularIncrement - DINT_TO_LREAL(LREAL_TO_DINT(fAngularIncrement/360))*360; + // or with Tc2_Math library: fAngularIncrement := LMOD(fAngularIncrement,360); + END_IF + IF (fAngularIncrement < fPhase) THEN + nSign := 1; + ELSIF (fAngularIncrement >= fPhase) THEN + nSign := 0; + END_IF + fAngularIncrement := fAngularIncrement + fAngularIncrementPerSample; + + aSignal[nSamples] := nSign*fAmplitude; + + aSignal[nSamples] := aSignal[nSamples] + fOffset; +END_FOR +]]> + + + + + + = 360) THEN + fAngularIncrement := fAngularIncrement - DINT_TO_LREAL(LREAL_TO_DINT(fAngularIncrement/360))*360; + // or with Tc2_Math library: fAngularIncrement := LMOD(fAngularIncrement,360); + END_IF + IF (fAngularIncrement < fPhase) THEN + nSign := 1; + ELSIF (fAngularIncrement >= fPhase) THEN + nSign := -1; + END_IF + fAngularIncrement := fAngularIncrement + fAngularIncrementPerSample; + + aSignal[nSamples] := nSign*fAmplitude; + + aSignal[nSamples] := aSignal[nSamples] + fOffset; +END_FOR +]]> + + + + + + = 360) THEN + fAngularIncrement := fAngularIncrement - DINT_TO_LREAL(LREAL_TO_DINT(fAngularIncrement/360))*360; + // or with Tc2_Math library: fAngularIncrement := LMOD(fAngularIncrement,360); + END_IF + // Negative delta -> Positive delta + IF fAngularIncrement < fPhase/2 THEN + nSign := 1; + ELSIF fAngularIncrement >= fPhase/2 AND fAngularIncrement < 3*fPhase/2 THEN + nSign := -1; + ELSIF fAngularIncrement >= 3*fPhase/2 THEN + nSign := 1; + END_IF + fAngularIncrement := fAngularIncrement + fAngularIncrementPerSample; + + aSignal[nSamples] := fLastSignalValue + nSign*fDelta; + IF aSignal[nSamples] > fAmplitude THEN + aSignal[nSamples] := aSignal[nSamples] - 2*(aSignal[nSamples]-fAmplitude); + ELSIF aSignal[nSamples] < (-1)*fAmplitude THEN + aSignal[nSamples] := aSignal[nSamples] - 2*(aSignal[nSamples]+fAmplitude); + END_IF + + // Store last sample + fLastSignalValue := aSignal[nSamples]; + + aSignal[nSamples] := aSignal[nSamples] + fOffset; +END_FOR + + + ]]> + + +  + + + + "White" + false + + + + System.Boolean + {bb741845-1ec5-4be9-bb0d-2cf7058af574} + System.String + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/POUs/MAIN.xml new file mode 100644 index 0000000..1b7f1fc --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/MachineTypeD/POUs/MAIN.xml @@ -0,0 +1,86 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis1.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis1.xml new file mode 100644 index 0000000..493edcf Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis1.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis2.xml new file mode 100644 index 0000000..664eb2b Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Drive.xti b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Drive.xti new file mode 100644 index 0000000..5bbcc49 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Drive.xti @@ -0,0 +1,145 @@ + + + + 424dd6020000000000003600000028000000100000000e0000000100180000000000a002000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff808080808080808080808080808080ff00ffff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff0000000000000000000000000000000000000000000000ff0000ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffff0000ff0000ff0000ff00008080800000ffff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffff0000c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0ff0000c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0ff0000c0c0c0808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0ff00008080800000000000000000000000000000000000000000000000000000ff0000ffff00ffff0000c0c0c0c0c0c0ff0000808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0ff0000ff0000c0c0c0808080000000ff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080 + + + __FILENAME__ + 1000 + + 001880002600010001000000800080008000001826010000 + 001a80002200010002000000800080008000001a22010000 + 00100c002400010003000000000000000000001024010000 + 001114002000010004000000000000000000001120010000 + 0000000000000000001000020100000001000000000000000000000000000000 + 0000000000000000001100010100000002000000000000000000000000000000 + 00000000000000000d0800010100000003000000000000000000000000000000 + 0010140200181402 + 3007000090d0030050c30000000000000000ffff000000000000000000000000 + 446353796e633235300000000000000053796e63206379636c652074696d653a20323530b5730000000000000000000090d0030050c3000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 446353796e633132350000000000000053796e63206379636c652074696d653a20313235b5730000000000000000000048e80100a861000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 02000500100000000d000000000000000000000000000000000000000000000003400a8000000000fe070000000000004665617475726520666c61677300 + 02000500100000000d000000000000000000000000000000000000000000000023400a8000000000ff070000000000004665617475726520666c61677300 + 020005000a0000001500000000000000000000000000000000000000000000000340010000000000d007546e637963202d204e43206379636c652074696d6500 + 020005000a0000001700000000000000000000000000000000000000000000000340020000000000d0075473637963202d20436f6d6d206379636c652074696d6500 + 020005000a0000000e000000000000000000000000000000000000000000000003402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000000e000000000000000000000000000000000000000000000023402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000001400000000000000000000000000000000000000000000000340c98000000000fc084e6f6d696e616c206d61696e20766f6c7461676500 + 020005000a0000002500000000000000000000000000000000000000000000000340ca8000000000c8004d61696e20766f6c7461676520706f73697469766520746f6c6572616e63652072616e676500 + 020005000a0000002500000000000000000000000000000000000000000000000340cb8000000000c8004d61696e20766f6c74616765206e6567617469766520746f6c6572616e63652072616e676500 + 020005000a0000001d00000000000000000000000000000000000000000000000340cc80000000000100506f776572204d616e6167656d656e7420636f6e74726f6c20776f726400 + 020005001c0000001500000000000000000000000000000000000000000000000340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005001c000000150000000000000000000000000000000000000000000000034035800000000010002200414d333032312d304334302d30303030436f6e66696775726564206d6f746f72207479706500 + 020005000c00000012000000000000000000000000000000000000000000000003406d00000000009c1800004d6f746f72207065616b2063757272656e7400 + 020005000c0000001e000000000000000000000000000000000000000000000003406f00000000002c0600004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000000340710000000000401f00004d6178696d756d206d6f746f7220737065656400 + 020005000a000000140000000000000000000000000000000000000000000000034033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000a0000000900000000000000000000000000000000000000000000000340378000000000c3004d6f746f7220454d4600 + 020005000a0000001d000000000000000000000000000000000000000000000003404680000000002d004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001100000000000000000000000000000000000000000000000340498000000000930000004d6f746f72207065616b20746f7271756500 + 020005000a0000001d000000000000000000000000000000000000000000000003403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 0200050014000000140000000000000000000000000000000000000000000000034042800000000008000800140500006c070000456c656374726963206d6f746f72206d6f64656c00 + 020005001400000013000000000000000000000000000000000000000000000003403e800000000008000800e001500064000100546865726d616c206d6f746f72206d6f64656c00 + 020005000c00000021000000000000000000000000000000000000000000000003408800000000005e960900506f73697469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000c00000021000000000000000000000000000000000000000000000003408900000000005e9609004e6567617469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000a000000170000000000000000000000000000000000000000000000034032800000000000004d6f746f7220636f6e737472756374696f6e207479706500 + 020005001000000027000000000000000000000000000000000000000000000003404480000000000400040064000000546865726d616c206f7665726c6f616420666163746f7220286d6f746f722077696e64696e672900 + 020005000a0000001900000000000000000000000000000000000000000000000340c9000000000020034d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000000340cc000000000078054d6f746f72207368757420646f776e2074656d706572617475726500 + 02000500140000001500000000000000000000000000000000000000000000000340478000000000080008000b000000000000004d656368616e6963616c206d6f746f72206461746100 + 0200050030000000160000000000000000000000000000000000000000000000034059800000000024002400028000003e0000003e000000c980000084030000fc0800000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000a00000020000000000000000000000000000000000000000000000003406a0000000000440243757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000003406b0000000000050043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002000000000000000000000000000000000000000000000000340348000000000b80b54696d65206c696d69746174696f6e20666f72207065616b2063757272656e7400 + 020005000c0000001f00000000000000000000000000000000000000000000000340388000000000321200004d6178206d6f746f722073706565642077697468206d617820746f7271756500 + 020005000c0000001f000000000000000000000000000000000000000000000003405c8000000000580c0000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000c0000001a000000000000000000000000000000000000000000000003405d80000000002c060000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001c000000000000000000000000000000000000000000000003405b0000000000f90b1b084269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000017000000000000000000000000000000000000000000000003400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005000a0000001b00000000000000000000000000000000000000000000000340c38100000000000043757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a00000018000000000000000000000000000000000000000000000003400380000000007d0056656c6f63697479206374726c206379636c652074696d6500 + 020005000a0000002600000000000000000000000000000000000000000000000340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000a0000001800000000000000000000000000000000000000000000000340048000000000fa00506f736974696f6e206374726c206379636c652074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000000340968000000000e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005000c000000190000000000000000000000000000000000000000000000034098800000000001000000466565646261636b20312067656172206e756d657261746f7200 + 020005000c0000001b0000000000000000000000000000000000000000000000034099800000000001000000466565646261636b203120676561722064656e6f6d696e61746f7200 + 020005000a0000001d000000000000000000000000000000000000000000000003403d800000000000004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000c0000001f000000000000000000000000000000000000000000000003406400000000005e01000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a0000002200000000000000000000000000000000000000000000000340650000000000180056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500140000001b000000000000000000000000000000000000000000000003409a8000000000080008000000000000000000466565646261636b2031207265666572656e6365207369676e616c00 + 020005001800000015000000000000000000000000000000000000000000000023403580000000000c002200414d383032312d7842783000436f6e66696775726564206d6f746f72207479706500 + 020005000a000000140000000000000000000000000000000000000000000000234033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000c0000001e000000000000000000000000000000000000000000000023406f0000000000520300004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000002340c40000000000520300004d6f746f722072617465642063757272656e7400 + 020005000c00000012000000000000000000000000000000000000000000000023406d0000000000241300004d6f746f72207065616b2063757272656e7400 + 020005000a00000013000000000000000000000000000000000000000000000023404d8000000000a00f4d6f746f7220726174656420766f6c7461676500 + 020005000a0000001300000000000000000000000000000000000000000000002340d88000000000c4224d6178204443204c696e6b20766f6c7461676500 + 02000500300000001600000000000000000000000000000000000000000000002340598000000000240024002683000000000000401f00000000000000000000000000000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000c00000011000000000000000000000000000000000000000000000023404980000000000c0100004d6f746f72207065616b20746f7271756500 + 020005005c0000001b000000000000000000000000000000000000000000000023404a800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a110000241300001d0000003a00000057000000720000008e000000a8000000c2000000db000000f40000000c0100004d6f746f7220546f7271756520436861726163746572697374696300 + 020005000a0000000900000000000000000000000000000000000000000000002340378000000000a4014d6f746f7220454d4600 + 0200050014000000140000000000000000000000000000000000000000000000234042800000000008000800640f00002c1a0000456c656374726963206d6f746f72206d6f64656c00 + 020005005c0000001f000000000000000000000000000000000000000000000023404b800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a11000024130000da1100007a0d00002c0b0000060900009e070000c20600002c060000c805000078050000780500004d6f746f7220496e64756374616e636520436861726163746572697374696300 + 020005000c0000001300000000000000000000000000000000000000000000002340710000000000282300004d6178696d756d206d6f746f7220737065656400 + 02000500140000001500000000000000000000000000000000000000000000002340478000000000080008000e000000000000004d656368616e6963616c206d6f746f72206461746100 + 020005000a0000001900000000000000000000000000000000000000000000002340c9000000000078054d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000002340cc0000000000dc054d6f746f72207368757420646f776e2074656d706572617475726500 + 020005001400000013000000000000000000000000000000000000000000000023403e8000000000080008005802500064000000546865726d616c206d6f746f72206d6f64656c00 + 020005003400000027000000000000000000000000000000000000000000000023404c800000000028002800d9fe17003a01440237031604e304a0054e06f20680010002800200038003000480040005800500064d6f746f722054656d70657261747572652053656e736f7220436861726163746572697374696300 + 020005000a0000001b00000000000000000000000000000000000000000000002340c38100000000010443757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a0000001d000000000000000000000000000000000000000000000023403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 020005000a0000001d000000000000000000000000000000000000000000000023403d800000000007004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000a00000017000000000000000000000000000000000000000000000023400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005001c0000001500000000000000000000000000000000000000000000002340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005000c0000001a000000000000000000000000000000000000000000000023405d800000000052030000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023405c8000000000a4060000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000a0000001d0000000000000000000000000000000000000000000000234046800000000033004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001c000000000000000000000000000000000000000000000023405b00000000007b8d410a4269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000020000000000000000000000000000000000000000000000023406a00000000006c0943757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000023406b0000000000080043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002600000000000000000000000000000000000000000000002340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023406400000000001500000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a00000022000000000000000000000000000000000000000000000023406500000000000b0056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000002340968000000000e000e00003000000454b4d33362d304b4630413031384100000000000000000000000000000000000000000000000000000000001800000000000000050018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070018000000000012000c000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960096007d0000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005001800000011000000000000000000000000000000000000000000000023400282000000000c000c0001000000f4012c01bc02000056656c6f63697479206f6273657276657200 + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + + + UINT + + + DINT + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Links.xml new file mode 100644 index 0000000..4bf1d26 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/Links.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/LinksOld.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/LinksOld.xml new file mode 100644 index 0000000..a58b6ce --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/LinksOld.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/FB_Axis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/FB_Axis.xml new file mode 100644 index 0000000..f72ad34 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/FB_Axis.xml @@ -0,0 +1,137 @@ + 0); + bDriveError := AxisRef.NcToPlc.StateDWord.28; + + Timer(IN := bStatus); + IF Timer.Q OR bNcError OR bDriveError THEN + Timer(IN := FALSE); + + IF bDriveError THEN + fbSoEReset(Execute:= FALSE, Axis:= AxisRef); + iState := 10; + ELSIF bNCError THEN + fbMcReset(Execute := FALSE, Axis := AxisRef); + iState := 20; + ELSE + IF lrPosition <> lrPosition1 THEN + lrPosition := lrPosition1; + ELSE + lrPosition := lrPosition2; + END_IF + fbMCMove( + Execute:= FALSE, + Axis := AxisRef + ); + iState := 30; + END_IF + END_IF + +10: (* drive reset *) + A_DriveReset(); + +20: (* MC reset *) + A_MC2Reset(); + +30: (* MC move absolute *) + A_MC2Move(); + +31: (* MC move absolute *) + A_MC2Move(); + +32: (* back to idle *) + iState := 0; + +40: (* MC halt *) + A_MC2Halt(); +END_CASE + +lrActPos := AxisRef.NcToPlc.ActPos;]]> bStatus, +); +]]> lrPosition1 THEN + lrPosition := lrPosition1; + ELSE + lrPosition := lrPosition2; + END_IF + + fbMCMove(Execute := FALSE, Axis := AxisRef); + iState := iState + 1; +END_IF + +IF bHalt THEN + fbMCMove(Execute := FALSE, Axis := AxisRef); + iState := 40; +END_IF]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/MAIN.xml new file mode 100644 index 0000000..0f6de45 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/MAIN.xml @@ -0,0 +1,33 @@ + lrActPos1 +); + +fbAxis2( + bDriveReset := bDriveReset, + bHalt := bHalt, + lrActPos => lrActPos2 +); + +bEnabled := fbAxis1.bStatus AND fbAxis2.bStatus; +bError := fbAxis1.bDriveError OR fbAxis1.bNcError OR fbAxis2.bNcError OR fbAxis2.bDriveError; +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis1.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis1.xml new file mode 100644 index 0000000..d73b92b Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis1.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis2.xml new file mode 100644 index 0000000..8f75881 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis3.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis3.xml new file mode 100644 index 0000000..75e914d Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis3.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis4.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis4.xml new file mode 100644 index 0000000..9afa7ab Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis4.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Channel2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Channel2.xml new file mode 100644 index 0000000..7c461bf Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Channel2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_Commands.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_Commands.xml new file mode 100644 index 0000000..dacb2c4 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_Commands.xml @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml new file mode 100644 index 0000000..bd740bd --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_States.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_States.xml new file mode 100644 index 0000000..2ca6136 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_States.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Drive.xti b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Drive.xti new file mode 100644 index 0000000..5bbcc49 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Drive.xti @@ -0,0 +1,145 @@ + + + + 424dd6020000000000003600000028000000100000000e0000000100180000000000a002000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff808080808080808080808080808080ff00ffff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff0000000000000000000000000000000000000000000000ff0000ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffff0000ff0000ff0000ff00008080800000ffff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffff0000c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0ff0000c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0ff0000c0c0c0808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0ff00008080800000000000000000000000000000000000000000000000000000ff0000ffff00ffff0000c0c0c0c0c0c0ff0000808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0ff0000ff0000c0c0c0808080000000ff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080 + + + __FILENAME__ + 1000 + + 001880002600010001000000800080008000001826010000 + 001a80002200010002000000800080008000001a22010000 + 00100c002400010003000000000000000000001024010000 + 001114002000010004000000000000000000001120010000 + 0000000000000000001000020100000001000000000000000000000000000000 + 0000000000000000001100010100000002000000000000000000000000000000 + 00000000000000000d0800010100000003000000000000000000000000000000 + 0010140200181402 + 3007000090d0030050c30000000000000000ffff000000000000000000000000 + 446353796e633235300000000000000053796e63206379636c652074696d653a20323530b5730000000000000000000090d0030050c3000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 446353796e633132350000000000000053796e63206379636c652074696d653a20313235b5730000000000000000000048e80100a861000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 02000500100000000d000000000000000000000000000000000000000000000003400a8000000000fe070000000000004665617475726520666c61677300 + 02000500100000000d000000000000000000000000000000000000000000000023400a8000000000ff070000000000004665617475726520666c61677300 + 020005000a0000001500000000000000000000000000000000000000000000000340010000000000d007546e637963202d204e43206379636c652074696d6500 + 020005000a0000001700000000000000000000000000000000000000000000000340020000000000d0075473637963202d20436f6d6d206379636c652074696d6500 + 020005000a0000000e000000000000000000000000000000000000000000000003402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000000e000000000000000000000000000000000000000000000023402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000001400000000000000000000000000000000000000000000000340c98000000000fc084e6f6d696e616c206d61696e20766f6c7461676500 + 020005000a0000002500000000000000000000000000000000000000000000000340ca8000000000c8004d61696e20766f6c7461676520706f73697469766520746f6c6572616e63652072616e676500 + 020005000a0000002500000000000000000000000000000000000000000000000340cb8000000000c8004d61696e20766f6c74616765206e6567617469766520746f6c6572616e63652072616e676500 + 020005000a0000001d00000000000000000000000000000000000000000000000340cc80000000000100506f776572204d616e6167656d656e7420636f6e74726f6c20776f726400 + 020005001c0000001500000000000000000000000000000000000000000000000340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005001c000000150000000000000000000000000000000000000000000000034035800000000010002200414d333032312d304334302d30303030436f6e66696775726564206d6f746f72207479706500 + 020005000c00000012000000000000000000000000000000000000000000000003406d00000000009c1800004d6f746f72207065616b2063757272656e7400 + 020005000c0000001e000000000000000000000000000000000000000000000003406f00000000002c0600004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000000340710000000000401f00004d6178696d756d206d6f746f7220737065656400 + 020005000a000000140000000000000000000000000000000000000000000000034033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000a0000000900000000000000000000000000000000000000000000000340378000000000c3004d6f746f7220454d4600 + 020005000a0000001d000000000000000000000000000000000000000000000003404680000000002d004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001100000000000000000000000000000000000000000000000340498000000000930000004d6f746f72207065616b20746f7271756500 + 020005000a0000001d000000000000000000000000000000000000000000000003403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 0200050014000000140000000000000000000000000000000000000000000000034042800000000008000800140500006c070000456c656374726963206d6f746f72206d6f64656c00 + 020005001400000013000000000000000000000000000000000000000000000003403e800000000008000800e001500064000100546865726d616c206d6f746f72206d6f64656c00 + 020005000c00000021000000000000000000000000000000000000000000000003408800000000005e960900506f73697469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000c00000021000000000000000000000000000000000000000000000003408900000000005e9609004e6567617469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000a000000170000000000000000000000000000000000000000000000034032800000000000004d6f746f7220636f6e737472756374696f6e207479706500 + 020005001000000027000000000000000000000000000000000000000000000003404480000000000400040064000000546865726d616c206f7665726c6f616420666163746f7220286d6f746f722077696e64696e672900 + 020005000a0000001900000000000000000000000000000000000000000000000340c9000000000020034d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000000340cc000000000078054d6f746f72207368757420646f776e2074656d706572617475726500 + 02000500140000001500000000000000000000000000000000000000000000000340478000000000080008000b000000000000004d656368616e6963616c206d6f746f72206461746100 + 0200050030000000160000000000000000000000000000000000000000000000034059800000000024002400028000003e0000003e000000c980000084030000fc0800000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000a00000020000000000000000000000000000000000000000000000003406a0000000000440243757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000003406b0000000000050043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002000000000000000000000000000000000000000000000000340348000000000b80b54696d65206c696d69746174696f6e20666f72207065616b2063757272656e7400 + 020005000c0000001f00000000000000000000000000000000000000000000000340388000000000321200004d6178206d6f746f722073706565642077697468206d617820746f7271756500 + 020005000c0000001f000000000000000000000000000000000000000000000003405c8000000000580c0000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000c0000001a000000000000000000000000000000000000000000000003405d80000000002c060000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001c000000000000000000000000000000000000000000000003405b0000000000f90b1b084269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000017000000000000000000000000000000000000000000000003400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005000a0000001b00000000000000000000000000000000000000000000000340c38100000000000043757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a00000018000000000000000000000000000000000000000000000003400380000000007d0056656c6f63697479206374726c206379636c652074696d6500 + 020005000a0000002600000000000000000000000000000000000000000000000340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000a0000001800000000000000000000000000000000000000000000000340048000000000fa00506f736974696f6e206374726c206379636c652074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000000340968000000000e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005000c000000190000000000000000000000000000000000000000000000034098800000000001000000466565646261636b20312067656172206e756d657261746f7200 + 020005000c0000001b0000000000000000000000000000000000000000000000034099800000000001000000466565646261636b203120676561722064656e6f6d696e61746f7200 + 020005000a0000001d000000000000000000000000000000000000000000000003403d800000000000004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000c0000001f000000000000000000000000000000000000000000000003406400000000005e01000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a0000002200000000000000000000000000000000000000000000000340650000000000180056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500140000001b000000000000000000000000000000000000000000000003409a8000000000080008000000000000000000466565646261636b2031207265666572656e6365207369676e616c00 + 020005001800000015000000000000000000000000000000000000000000000023403580000000000c002200414d383032312d7842783000436f6e66696775726564206d6f746f72207479706500 + 020005000a000000140000000000000000000000000000000000000000000000234033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000c0000001e000000000000000000000000000000000000000000000023406f0000000000520300004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000002340c40000000000520300004d6f746f722072617465642063757272656e7400 + 020005000c00000012000000000000000000000000000000000000000000000023406d0000000000241300004d6f746f72207065616b2063757272656e7400 + 020005000a00000013000000000000000000000000000000000000000000000023404d8000000000a00f4d6f746f7220726174656420766f6c7461676500 + 020005000a0000001300000000000000000000000000000000000000000000002340d88000000000c4224d6178204443204c696e6b20766f6c7461676500 + 02000500300000001600000000000000000000000000000000000000000000002340598000000000240024002683000000000000401f00000000000000000000000000000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000c00000011000000000000000000000000000000000000000000000023404980000000000c0100004d6f746f72207065616b20746f7271756500 + 020005005c0000001b000000000000000000000000000000000000000000000023404a800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a110000241300001d0000003a00000057000000720000008e000000a8000000c2000000db000000f40000000c0100004d6f746f7220546f7271756520436861726163746572697374696300 + 020005000a0000000900000000000000000000000000000000000000000000002340378000000000a4014d6f746f7220454d4600 + 0200050014000000140000000000000000000000000000000000000000000000234042800000000008000800640f00002c1a0000456c656374726963206d6f746f72206d6f64656c00 + 020005005c0000001f000000000000000000000000000000000000000000000023404b800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a11000024130000da1100007a0d00002c0b0000060900009e070000c20600002c060000c805000078050000780500004d6f746f7220496e64756374616e636520436861726163746572697374696300 + 020005000c0000001300000000000000000000000000000000000000000000002340710000000000282300004d6178696d756d206d6f746f7220737065656400 + 02000500140000001500000000000000000000000000000000000000000000002340478000000000080008000e000000000000004d656368616e6963616c206d6f746f72206461746100 + 020005000a0000001900000000000000000000000000000000000000000000002340c9000000000078054d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000002340cc0000000000dc054d6f746f72207368757420646f776e2074656d706572617475726500 + 020005001400000013000000000000000000000000000000000000000000000023403e8000000000080008005802500064000000546865726d616c206d6f746f72206d6f64656c00 + 020005003400000027000000000000000000000000000000000000000000000023404c800000000028002800d9fe17003a01440237031604e304a0054e06f20680010002800200038003000480040005800500064d6f746f722054656d70657261747572652053656e736f7220436861726163746572697374696300 + 020005000a0000001b00000000000000000000000000000000000000000000002340c38100000000010443757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a0000001d000000000000000000000000000000000000000000000023403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 020005000a0000001d000000000000000000000000000000000000000000000023403d800000000007004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000a00000017000000000000000000000000000000000000000000000023400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005001c0000001500000000000000000000000000000000000000000000002340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005000c0000001a000000000000000000000000000000000000000000000023405d800000000052030000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023405c8000000000a4060000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000a0000001d0000000000000000000000000000000000000000000000234046800000000033004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001c000000000000000000000000000000000000000000000023405b00000000007b8d410a4269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000020000000000000000000000000000000000000000000000023406a00000000006c0943757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000023406b0000000000080043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002600000000000000000000000000000000000000000000002340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023406400000000001500000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a00000022000000000000000000000000000000000000000000000023406500000000000b0056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000002340968000000000e000e00003000000454b4d33362d304b4630413031384100000000000000000000000000000000000000000000000000000000001800000000000000050018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070018000000000012000c000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960096007d0000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005001800000011000000000000000000000000000000000000000000000023400282000000000c000c0001000000f4012c01bc02000056656c6f63697479206f6273657276657200 + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + + + UINT + + + DINT + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/GVLs/GlobalVariables.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/GVLs/GlobalVariables.xml new file mode 100644 index 0000000..f49c99c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/GVLs/GlobalVariables.xml @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Links.xml new file mode 100644 index 0000000..41d07b7 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/Links.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/LinksOld.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/LinksOld.xml new file mode 100644 index 0000000..7b6e43f --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/LinksOld.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciChannel.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciChannel.xml new file mode 100644 index 0000000..a8ec7c0 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciChannel.xml @@ -0,0 +1,181 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciSequence.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciSequence.xml new file mode 100644 index 0000000..0fbaafc --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciSequence.xml @@ -0,0 +1,86 @@ += 2 AND iMaxUsedChannels >= 1 THEN + CASE nState OF + 0: + IF bExecute THEN + bBusy := TRUE; + bDone := FALSE; + bError := FALSE; + dwErrorId := 0; + nState := 10; + END_IF + + 10: + fbNciChaA( + bExecute := bExecute, + stNcToPlcX := AxisRef[1].NcToPlc, + stNcToPlcY := AxisRef[2].NcToPlc, + stNcToPlcZ := stNcToPlcDummy, + stNcToPlcC := stNcToPlcDummy, + stPlcToNci := stPlcToNci, + stNciToPlc := stNciToPlc + ); + + IF NOT fbNciChaA.bBusy THEN + fbNciChaA( bExecute:= FALSE, stNcToPlcX:= AxisRef[1].NcToPlc, stNcToPlcY:= AxisRef[2].NcToPlc, stNcToPlcZ:= stNcToPlcDummy, + stNcToPlcC:= stNcToPlcDummy, stPlcToNci:= stPlcToNci, stNciToPlc:= stNciToPlc ); + + bBusy := FALSE; + + IF NOT fbNciChaA.bErr THEN + bDone := TRUE; + ELSE + bError := fbNciChaA.bErr; + dwErrorId := fbNciChaA.nErrId; + END_IF + IF NOT bExecute THEN + nState := 0; + ELSE + nState := 20; + END_IF + END_IF + + 20: + bBusy := FALSE; + IF NOT bExecute THEN + IF fbNciChaA.bErr THEN + bError := fbNciChaA.bErr; + dwErrorId := fbNciChaA.nErrId; + END_IF + nState := 0; + END_IF + END_CASE + +END_IF +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/MAIN.xml new file mode 100644 index 0000000..95576ee --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/MAIN.xml @@ -0,0 +1,152 @@ + 32767 THEN + iNciOverrideRaw := 0; +END_IF +NciOverrideFilter( + OverrideValueRaw := iNciOverrideRaw, + LowerOverrideThreshold := 0, + UpperOverrideThreshold := 32767, + OverrideSteps := 200, + OverrideRecoveryTime := T#150ms, +); + +(* enable *) +A_Enable(); +IF bEnabled THEN + bCallSequence := TRUE; + A_TriggerExec(); +END_IF + +IF bCallSequence THEN + (* call motion sequence *) + IF bNciReq OR fbNciSequence.bBusy THEN + fbNciSequence( + bExecute := TRUE, + iMaxUsedAxes := iMaxUsedAxes, + iMaxUsedChannels:= iMaxUsedChannels, + AxisRef := AxisRef, + stNciToPlc := stiNciToPlc, + stPlcToNci := stoPlcToNci, + bBusy => bBusy, + bDone => bDone, + bError => bError, + dwErrorId => dwErrorId + ); + ELSE + fbNciSequence( + bExecute := FALSE, + AxisRef := AxisRef, + stNciToPlc := stiNciToPlc, + stPlcToNci := stoPlcToNci, + ); + END_IF +END_IF +]]> bAxisEnabled[I] + ); + bEnabled := bEnabled AND bAxisEnabled[I]; + bEnableError := bEnableError OR fbMC_Power[I].Error; +(* bResetReq := bResetReq OR AxisInErrorState(stiNcToPlc[I].nStateDWord);*) +END_FOR + +(* NCI override *) +lrOverrideNci := LIMIT(0, UINT_TO_LREAL(iNciOverrideRaw) * 100.0 / lrOverrideMaxScale, 100); +ItpSetOverridePercent(lrOverrideNci, stoPlcToNci); +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisX.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisX.xml new file mode 100644 index 0000000..df7fece Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisX.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisY.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisY.xml new file mode 100644 index 0000000..2c98063 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisY.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisZ.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisZ.xml new file mode 100644 index 0000000..df3d926 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisZ.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_AxisState.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_AxisState.xml new file mode 100644 index 0000000..a89c0f6 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_AxisState.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_MoveCmd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_MoveCmd.xml new file mode 100644 index 0000000..821477a --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_MoveCmd.xml @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Drive.xti b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Drive.xti new file mode 100644 index 0000000..5bbcc49 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Drive.xti @@ -0,0 +1,145 @@ + + + + 424dd6020000000000003600000028000000100000000e0000000100180000000000a002000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff808080808080808080808080808080ff00ffff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff0000000000000000000000000000000000000000000000ff0000ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffff0000ff0000ff0000ff00008080800000ffff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffff0000c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0ff0000c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0ff0000c0c0c0808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0ff00008080800000000000000000000000000000000000000000000000000000ff0000ffff00ffff0000c0c0c0c0c0c0ff0000808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0ff0000ff0000c0c0c0808080000000ff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080 + + + __FILENAME__ + 1000 + + 001880002600010001000000800080008000001826010000 + 001a80002200010002000000800080008000001a22010000 + 00100c002400010003000000000000000000001024010000 + 001114002000010004000000000000000000001120010000 + 0000000000000000001000020100000001000000000000000000000000000000 + 0000000000000000001100010100000002000000000000000000000000000000 + 00000000000000000d0800010100000003000000000000000000000000000000 + 0010140200181402 + 3007000090d0030050c30000000000000000ffff000000000000000000000000 + 446353796e633235300000000000000053796e63206379636c652074696d653a20323530b5730000000000000000000090d0030050c3000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 446353796e633132350000000000000053796e63206379636c652074696d653a20313235b5730000000000000000000048e80100a861000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 02000500100000000d000000000000000000000000000000000000000000000003400a8000000000fe070000000000004665617475726520666c61677300 + 02000500100000000d000000000000000000000000000000000000000000000023400a8000000000ff070000000000004665617475726520666c61677300 + 020005000a0000001500000000000000000000000000000000000000000000000340010000000000d007546e637963202d204e43206379636c652074696d6500 + 020005000a0000001700000000000000000000000000000000000000000000000340020000000000d0075473637963202d20436f6d6d206379636c652074696d6500 + 020005000a0000000e000000000000000000000000000000000000000000000003402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000000e000000000000000000000000000000000000000000000023402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000001400000000000000000000000000000000000000000000000340c98000000000fc084e6f6d696e616c206d61696e20766f6c7461676500 + 020005000a0000002500000000000000000000000000000000000000000000000340ca8000000000c8004d61696e20766f6c7461676520706f73697469766520746f6c6572616e63652072616e676500 + 020005000a0000002500000000000000000000000000000000000000000000000340cb8000000000c8004d61696e20766f6c74616765206e6567617469766520746f6c6572616e63652072616e676500 + 020005000a0000001d00000000000000000000000000000000000000000000000340cc80000000000100506f776572204d616e6167656d656e7420636f6e74726f6c20776f726400 + 020005001c0000001500000000000000000000000000000000000000000000000340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005001c000000150000000000000000000000000000000000000000000000034035800000000010002200414d333032312d304334302d30303030436f6e66696775726564206d6f746f72207479706500 + 020005000c00000012000000000000000000000000000000000000000000000003406d00000000009c1800004d6f746f72207065616b2063757272656e7400 + 020005000c0000001e000000000000000000000000000000000000000000000003406f00000000002c0600004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000000340710000000000401f00004d6178696d756d206d6f746f7220737065656400 + 020005000a000000140000000000000000000000000000000000000000000000034033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000a0000000900000000000000000000000000000000000000000000000340378000000000c3004d6f746f7220454d4600 + 020005000a0000001d000000000000000000000000000000000000000000000003404680000000002d004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001100000000000000000000000000000000000000000000000340498000000000930000004d6f746f72207065616b20746f7271756500 + 020005000a0000001d000000000000000000000000000000000000000000000003403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 0200050014000000140000000000000000000000000000000000000000000000034042800000000008000800140500006c070000456c656374726963206d6f746f72206d6f64656c00 + 020005001400000013000000000000000000000000000000000000000000000003403e800000000008000800e001500064000100546865726d616c206d6f746f72206d6f64656c00 + 020005000c00000021000000000000000000000000000000000000000000000003408800000000005e960900506f73697469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000c00000021000000000000000000000000000000000000000000000003408900000000005e9609004e6567617469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000a000000170000000000000000000000000000000000000000000000034032800000000000004d6f746f7220636f6e737472756374696f6e207479706500 + 020005001000000027000000000000000000000000000000000000000000000003404480000000000400040064000000546865726d616c206f7665726c6f616420666163746f7220286d6f746f722077696e64696e672900 + 020005000a0000001900000000000000000000000000000000000000000000000340c9000000000020034d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000000340cc000000000078054d6f746f72207368757420646f776e2074656d706572617475726500 + 02000500140000001500000000000000000000000000000000000000000000000340478000000000080008000b000000000000004d656368616e6963616c206d6f746f72206461746100 + 0200050030000000160000000000000000000000000000000000000000000000034059800000000024002400028000003e0000003e000000c980000084030000fc0800000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000a00000020000000000000000000000000000000000000000000000003406a0000000000440243757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000003406b0000000000050043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002000000000000000000000000000000000000000000000000340348000000000b80b54696d65206c696d69746174696f6e20666f72207065616b2063757272656e7400 + 020005000c0000001f00000000000000000000000000000000000000000000000340388000000000321200004d6178206d6f746f722073706565642077697468206d617820746f7271756500 + 020005000c0000001f000000000000000000000000000000000000000000000003405c8000000000580c0000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000c0000001a000000000000000000000000000000000000000000000003405d80000000002c060000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001c000000000000000000000000000000000000000000000003405b0000000000f90b1b084269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000017000000000000000000000000000000000000000000000003400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005000a0000001b00000000000000000000000000000000000000000000000340c38100000000000043757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a00000018000000000000000000000000000000000000000000000003400380000000007d0056656c6f63697479206374726c206379636c652074696d6500 + 020005000a0000002600000000000000000000000000000000000000000000000340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000a0000001800000000000000000000000000000000000000000000000340048000000000fa00506f736974696f6e206374726c206379636c652074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000000340968000000000e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005000c000000190000000000000000000000000000000000000000000000034098800000000001000000466565646261636b20312067656172206e756d657261746f7200 + 020005000c0000001b0000000000000000000000000000000000000000000000034099800000000001000000466565646261636b203120676561722064656e6f6d696e61746f7200 + 020005000a0000001d000000000000000000000000000000000000000000000003403d800000000000004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000c0000001f000000000000000000000000000000000000000000000003406400000000005e01000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a0000002200000000000000000000000000000000000000000000000340650000000000180056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500140000001b000000000000000000000000000000000000000000000003409a8000000000080008000000000000000000466565646261636b2031207265666572656e6365207369676e616c00 + 020005001800000015000000000000000000000000000000000000000000000023403580000000000c002200414d383032312d7842783000436f6e66696775726564206d6f746f72207479706500 + 020005000a000000140000000000000000000000000000000000000000000000234033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000c0000001e000000000000000000000000000000000000000000000023406f0000000000520300004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000002340c40000000000520300004d6f746f722072617465642063757272656e7400 + 020005000c00000012000000000000000000000000000000000000000000000023406d0000000000241300004d6f746f72207065616b2063757272656e7400 + 020005000a00000013000000000000000000000000000000000000000000000023404d8000000000a00f4d6f746f7220726174656420766f6c7461676500 + 020005000a0000001300000000000000000000000000000000000000000000002340d88000000000c4224d6178204443204c696e6b20766f6c7461676500 + 02000500300000001600000000000000000000000000000000000000000000002340598000000000240024002683000000000000401f00000000000000000000000000000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000c00000011000000000000000000000000000000000000000000000023404980000000000c0100004d6f746f72207065616b20746f7271756500 + 020005005c0000001b000000000000000000000000000000000000000000000023404a800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a110000241300001d0000003a00000057000000720000008e000000a8000000c2000000db000000f40000000c0100004d6f746f7220546f7271756520436861726163746572697374696300 + 020005000a0000000900000000000000000000000000000000000000000000002340378000000000a4014d6f746f7220454d4600 + 0200050014000000140000000000000000000000000000000000000000000000234042800000000008000800640f00002c1a0000456c656374726963206d6f746f72206d6f64656c00 + 020005005c0000001f000000000000000000000000000000000000000000000023404b800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a11000024130000da1100007a0d00002c0b0000060900009e070000c20600002c060000c805000078050000780500004d6f746f7220496e64756374616e636520436861726163746572697374696300 + 020005000c0000001300000000000000000000000000000000000000000000002340710000000000282300004d6178696d756d206d6f746f7220737065656400 + 02000500140000001500000000000000000000000000000000000000000000002340478000000000080008000e000000000000004d656368616e6963616c206d6f746f72206461746100 + 020005000a0000001900000000000000000000000000000000000000000000002340c9000000000078054d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000002340cc0000000000dc054d6f746f72207368757420646f776e2074656d706572617475726500 + 020005001400000013000000000000000000000000000000000000000000000023403e8000000000080008005802500064000000546865726d616c206d6f746f72206d6f64656c00 + 020005003400000027000000000000000000000000000000000000000000000023404c800000000028002800d9fe17003a01440237031604e304a0054e06f20680010002800200038003000480040005800500064d6f746f722054656d70657261747572652053656e736f7220436861726163746572697374696300 + 020005000a0000001b00000000000000000000000000000000000000000000002340c38100000000010443757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a0000001d000000000000000000000000000000000000000000000023403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 020005000a0000001d000000000000000000000000000000000000000000000023403d800000000007004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000a00000017000000000000000000000000000000000000000000000023400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005001c0000001500000000000000000000000000000000000000000000002340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005000c0000001a000000000000000000000000000000000000000000000023405d800000000052030000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023405c8000000000a4060000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000a0000001d0000000000000000000000000000000000000000000000234046800000000033004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001c000000000000000000000000000000000000000000000023405b00000000007b8d410a4269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000020000000000000000000000000000000000000000000000023406a00000000006c0943757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000023406b0000000000080043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002600000000000000000000000000000000000000000000002340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023406400000000001500000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a00000022000000000000000000000000000000000000000000000023406500000000000b0056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000002340968000000000e000e00003000000454b4d33362d304b4630413031384100000000000000000000000000000000000000000000000000000000001800000000000000050018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070018000000000012000c000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960096007d0000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005001800000011000000000000000000000000000000000000000000000023400282000000000c000c0001000000f4012c01bc02000056656c6f63697479206f6273657276657200 + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + + + UINT + + + DINT + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Links.xml new file mode 100644 index 0000000..3c462ac --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/Links.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/LinksOld.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/LinksOld.xml new file mode 100644 index 0000000..3e8f680 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/LinksOld.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml new file mode 100644 index 0000000..9503404 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml @@ -0,0 +1,79 @@ + iDiagNumber + ); + eCurState := eAxisState_Idle; + END_IF + +END_CASE + +M_HardwareDiag := eCurState <> eAxisState_Idle; +bExecHWDiag_ := bExecute; +]]> eAxisState_Idle; +bExecHWRes_ := bExecute;]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_NcAxis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_NcAxis.xml new file mode 100644 index 0000000..517b128 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_NcAxis.xml @@ -0,0 +1,213 @@ + 0); +]]> overwrite method if necessary +CASE eCurState OF +eAxisState_Idle: + IF bExecute AND NOT bExecHWDiag_ THEN + eCurState := eAxisState_Diag; + END_IF + +eAxisState_Diag: + eCurState := eAxisState_Idle; + +END_CASE + +M_HardwareDiag := eCurState <> eAxisState_Idle; +bExecHWDiag_ := bExecute; + +]]> bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveModulo: + fbMcMoveMod( + Execute := bExecute, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveRelative: + fbMcMoveRel( + Execute := bExecute, Distance:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveVelocity: + fbMcMoveVel( + Execute := bExecute, Velocity:= fVelocity, Axis := sAxis, + InVelocity=> bDone, Busy => bBusy, Active => bActive, + Error => bError, ErrorID => iErrorId, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + END_CASE + END_IF + +eAxisState_Move: + CASE eMoveCmd OF + eCmd_MoveAbsolute: + fbMcMoveAbs( + Execute := TRUE, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveAbs(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveModulo: + fbMcMoveMod( + Execute := TRUE, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveMod(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveRelative: + fbMcMoveRel( + Execute := TRUE, Distance:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveRel(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveVelocity: + fbMcMoveVel( + Execute := TRUE, Velocity:= fVelocity, Axis := sAxis, + InVelocity=> bDone, Busy => bBusy, Active => bActive, + Error => bError, ErrorID => iErrorId, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveVel(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + END_CASE +END_CASE + +M_Move := (eCurState <> eAxisState_Idle); +bExecMove_ := bExecute;]]> bDone, + Busy => bBusy, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Reset; + END_IF + +eAxisState_Reset: + fbMcReset( + Execute := FALSE, Axis := sAxis, Done => bDone, + Busy => bBusy, Error => bError, ErrorID => iErrorId + ); + IF fbMcReset.Done OR fbMcReset.Error THEN + eCurState := eAxisState_Idle; + END_IF +END_CASE + +M_Reset := eCurState <> eAxisState_Idle; +bExecReset_ := bExecute;]]> overwrite method if necessary +CASE eCurState OF +eAxisState_Idle: + IF bExecute AND NOT bExecHWRes_ THEN + eCurState := eAxisState_Reset; + END_IF + +eAxisState_Reset: + eCurState := eAxisState_Idle; + +END_CASE + +M_HardwareReset := eCurState <> eAxisState_Idle; +bExecHWRes_ := bExecute;]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/IAxis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/IAxis.xml new file mode 100644 index 0000000..65a5d5c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/IAxis.xml @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/FB_Table.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/FB_Table.xml new file mode 100644 index 0000000..5715a30 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/FB_Table.xml @@ -0,0 +1,127 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/MAIN.xml new file mode 100644 index 0000000..5d167f2 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/MAIN.xml @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramCFC.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramCFC.xml new file mode 100644 index 0000000..4daade8 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramCFC.xml @@ -0,0 +1,1930 @@ + + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + eOp_Mul + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Sub + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Add + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + tTimerValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + bZero + + + + + + + + + + + + + bPos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + bNeg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + iResultC + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.ET + + + + + + + + + + + + + T#500ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + bTest + + + + + + Timer + + + + + + + + + + + + + State + machine + + + + + + + + + eOperation + + + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + eOperation + + + + + + + + + + + + FB + Call + + + + + + + + + + eOperationPrev + + + + + + + + iResultC + + + + + + + + bZero + + + + + + + + bPos + + + + + + + + bNeg + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramFbd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramFbd.xml new file mode 100644 index 0000000..91b9918 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramFbd.xml @@ -0,0 +1,1280 @@ + + + + + + + + + + + + bZero + + + + + bPos + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + bPos + + + + + bNeg + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bTest + + + + + + Timer + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + operator + + + + + + + tTimerValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + State + machine + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + FB + Call + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bZero + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bPos + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bNeg + + + + + eOperation + + + + + + + eOperationPrev + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramLd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramLd.xml new file mode 100644 index 0000000..1cdb97e --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramLd.xml @@ -0,0 +1,1324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + bTemp1 + + + + + + operator + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + bTemp2 + + + + + + operator + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + bTemp3 + + + + + + operator + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Timer + + + + + + + + + + networktitle + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + operator + + + + + + + tTimerValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + State + machine + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + FB + Call + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + + + eOperationPrev + + + + + + + + 2 + + + + + + + 3 + + + + + + + 4 + + + + + + + 7 + + + + + + + 7 + + + + + + + 8 + + + + + + + 8 + + + + + + + 9 + + + + + + + 9 + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramSfc.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramSfc.xml new file mode 100644 index 0000000..ea16b29 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramSfc.xml @@ -0,0 +1,648 @@ + + + + + + + + + + + + + + + + + Init + + TRUE + + Init_Action + + FALSE + + 0 + + + + + + + + TRUE + + + + + + + + + + + + + + + + TRUE + + FALSE + + 0 + + + + + + + + + + + + + + + + + TRUE + + FALSE + + + + + + + + + + + + + + + + CallFB + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_CallFB + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + Evaluate + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_Evaluate + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + TRUE + + FALSE + + + + + + + + + + + + + + + + Wait + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_Wait + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + Test + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_Test + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + Timer.Q + + FALSE + + 0 + + + + + + + + + + + + + + + + StateMachine + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_StateMachine + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + Timer.Q + + FALSE + + 0 + + + + + + + + + + + + + + Init + + FALSE + + + + + + + + + + iResultC +); + +]]> + + + + + + + 0 THEN + bZero := FALSE; + bPos := TRUE; + bNeg := FALSE; +ELSIF fbSFC_SamplePOU.iResultC < 0 THEN + bZero := FALSE; + bPos := FALSE; + bNeg := TRUE; +END_IF]]> + + + + + + + + + + + + + + TIME#500MS) AND (iResultC <= 0)) OR (Timer.ET <= TIME#500MS); +]]> + + + + + + + + + + + + + + + + + + + + IecSfc + System + 3.4.2.0 + IecSfc + + + + CurrentStep + + False + True + + + + + EnableLimit + + False + True + + + + + Error + + False + True + + + + + ErrorPOU + + False + True + + + + + ErrorStep + + False + True + + + + + Init + + False + True + + + + + Pause + + False + True + + + + + QuitError + + False + True + + + + + Reset + + False + True + + + + + Tip + + False + True + + + + + TipMode + + False + True + + + + + Trans + + False + True + + + + + False + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramSt.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramSt.xml new file mode 100644 index 0000000..bcc98b5 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AU08-IEC-IC/PouProgramSt.xml @@ -0,0 +1,65 @@ + + + + + + + + + TIME#500MS) AND (iResultC <= 0)) OR (Timer.ET <= TIME#500MS); + + +(* Timer *) +Timer(IN := TRUE, PT := tTimerValue); +IF Timer.Q THEN + Timer(IN := FALSE); + + (* State machine *) + CASE eOperation OF + eOp_Add: + eOperation := eOp_MUL; + eOp_Sub: + eOperation := eOp_ADD; + eOp_Mul: + eOperation := eOp_SUB; + END_CASE +END_IF + +(* FB Call *) +fbST_SamplePOU( + eOperation := eOperation, + iResultC => iResultC +); + +(* Evaluation *) +IF fbST_SamplePOU.iResultC = 0 THEN + bZero := TRUE; + bPos := FALSE; + bNeg := FALSE; +ELSIF fbST_SamplePOU.iResultC > 0 THEN + bZero := FALSE; + bPos := TRUE; + bNeg := FALSE; +ELSIF fbST_SamplePOU.iResultC < 0 THEN + bZero := FALSE; + bPos := FALSE; + bNeg := TRUE; +END_IF]]> + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis1.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis1.xml new file mode 100644 index 0000000..493edcf Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis1.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis2.xml new file mode 100644 index 0000000..664eb2b Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Drive.xti b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Drive.xti new file mode 100644 index 0000000..5bbcc49 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Drive.xti @@ -0,0 +1,145 @@ + + + + 424dd6020000000000003600000028000000100000000e0000000100180000000000a002000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff808080808080808080808080808080ff00ffff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff0000000000000000000000000000000000000000000000ff0000ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffff0000ff0000ff0000ff00008080800000ffff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffff0000c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0ff0000c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0ff0000c0c0c0808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0ff00008080800000000000000000000000000000000000000000000000000000ff0000ffff00ffff0000c0c0c0c0c0c0ff0000808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0ff0000ff0000c0c0c0808080000000ff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080 + + + __FILENAME__ + 1000 + + 001880002600010001000000800080008000001826010000 + 001a80002200010002000000800080008000001a22010000 + 00100c002400010003000000000000000000001024010000 + 001114002000010004000000000000000000001120010000 + 0000000000000000001000020100000001000000000000000000000000000000 + 0000000000000000001100010100000002000000000000000000000000000000 + 00000000000000000d0800010100000003000000000000000000000000000000 + 0010140200181402 + 3007000090d0030050c30000000000000000ffff000000000000000000000000 + 446353796e633235300000000000000053796e63206379636c652074696d653a20323530b5730000000000000000000090d0030050c3000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 446353796e633132350000000000000053796e63206379636c652074696d653a20313235b5730000000000000000000048e80100a861000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 02000500100000000d000000000000000000000000000000000000000000000003400a8000000000fe070000000000004665617475726520666c61677300 + 02000500100000000d000000000000000000000000000000000000000000000023400a8000000000ff070000000000004665617475726520666c61677300 + 020005000a0000001500000000000000000000000000000000000000000000000340010000000000d007546e637963202d204e43206379636c652074696d6500 + 020005000a0000001700000000000000000000000000000000000000000000000340020000000000d0075473637963202d20436f6d6d206379636c652074696d6500 + 020005000a0000000e000000000000000000000000000000000000000000000003402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000000e000000000000000000000000000000000000000000000023402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000001400000000000000000000000000000000000000000000000340c98000000000fc084e6f6d696e616c206d61696e20766f6c7461676500 + 020005000a0000002500000000000000000000000000000000000000000000000340ca8000000000c8004d61696e20766f6c7461676520706f73697469766520746f6c6572616e63652072616e676500 + 020005000a0000002500000000000000000000000000000000000000000000000340cb8000000000c8004d61696e20766f6c74616765206e6567617469766520746f6c6572616e63652072616e676500 + 020005000a0000001d00000000000000000000000000000000000000000000000340cc80000000000100506f776572204d616e6167656d656e7420636f6e74726f6c20776f726400 + 020005001c0000001500000000000000000000000000000000000000000000000340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005001c000000150000000000000000000000000000000000000000000000034035800000000010002200414d333032312d304334302d30303030436f6e66696775726564206d6f746f72207479706500 + 020005000c00000012000000000000000000000000000000000000000000000003406d00000000009c1800004d6f746f72207065616b2063757272656e7400 + 020005000c0000001e000000000000000000000000000000000000000000000003406f00000000002c0600004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000000340710000000000401f00004d6178696d756d206d6f746f7220737065656400 + 020005000a000000140000000000000000000000000000000000000000000000034033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000a0000000900000000000000000000000000000000000000000000000340378000000000c3004d6f746f7220454d4600 + 020005000a0000001d000000000000000000000000000000000000000000000003404680000000002d004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001100000000000000000000000000000000000000000000000340498000000000930000004d6f746f72207065616b20746f7271756500 + 020005000a0000001d000000000000000000000000000000000000000000000003403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 0200050014000000140000000000000000000000000000000000000000000000034042800000000008000800140500006c070000456c656374726963206d6f746f72206d6f64656c00 + 020005001400000013000000000000000000000000000000000000000000000003403e800000000008000800e001500064000100546865726d616c206d6f746f72206d6f64656c00 + 020005000c00000021000000000000000000000000000000000000000000000003408800000000005e960900506f73697469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000c00000021000000000000000000000000000000000000000000000003408900000000005e9609004e6567617469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000a000000170000000000000000000000000000000000000000000000034032800000000000004d6f746f7220636f6e737472756374696f6e207479706500 + 020005001000000027000000000000000000000000000000000000000000000003404480000000000400040064000000546865726d616c206f7665726c6f616420666163746f7220286d6f746f722077696e64696e672900 + 020005000a0000001900000000000000000000000000000000000000000000000340c9000000000020034d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000000340cc000000000078054d6f746f72207368757420646f776e2074656d706572617475726500 + 02000500140000001500000000000000000000000000000000000000000000000340478000000000080008000b000000000000004d656368616e6963616c206d6f746f72206461746100 + 0200050030000000160000000000000000000000000000000000000000000000034059800000000024002400028000003e0000003e000000c980000084030000fc0800000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000a00000020000000000000000000000000000000000000000000000003406a0000000000440243757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000003406b0000000000050043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002000000000000000000000000000000000000000000000000340348000000000b80b54696d65206c696d69746174696f6e20666f72207065616b2063757272656e7400 + 020005000c0000001f00000000000000000000000000000000000000000000000340388000000000321200004d6178206d6f746f722073706565642077697468206d617820746f7271756500 + 020005000c0000001f000000000000000000000000000000000000000000000003405c8000000000580c0000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000c0000001a000000000000000000000000000000000000000000000003405d80000000002c060000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001c000000000000000000000000000000000000000000000003405b0000000000f90b1b084269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000017000000000000000000000000000000000000000000000003400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005000a0000001b00000000000000000000000000000000000000000000000340c38100000000000043757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a00000018000000000000000000000000000000000000000000000003400380000000007d0056656c6f63697479206374726c206379636c652074696d6500 + 020005000a0000002600000000000000000000000000000000000000000000000340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000a0000001800000000000000000000000000000000000000000000000340048000000000fa00506f736974696f6e206374726c206379636c652074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000000340968000000000e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005000c000000190000000000000000000000000000000000000000000000034098800000000001000000466565646261636b20312067656172206e756d657261746f7200 + 020005000c0000001b0000000000000000000000000000000000000000000000034099800000000001000000466565646261636b203120676561722064656e6f6d696e61746f7200 + 020005000a0000001d000000000000000000000000000000000000000000000003403d800000000000004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000c0000001f000000000000000000000000000000000000000000000003406400000000005e01000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a0000002200000000000000000000000000000000000000000000000340650000000000180056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500140000001b000000000000000000000000000000000000000000000003409a8000000000080008000000000000000000466565646261636b2031207265666572656e6365207369676e616c00 + 020005001800000015000000000000000000000000000000000000000000000023403580000000000c002200414d383032312d7842783000436f6e66696775726564206d6f746f72207479706500 + 020005000a000000140000000000000000000000000000000000000000000000234033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000c0000001e000000000000000000000000000000000000000000000023406f0000000000520300004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000002340c40000000000520300004d6f746f722072617465642063757272656e7400 + 020005000c00000012000000000000000000000000000000000000000000000023406d0000000000241300004d6f746f72207065616b2063757272656e7400 + 020005000a00000013000000000000000000000000000000000000000000000023404d8000000000a00f4d6f746f7220726174656420766f6c7461676500 + 020005000a0000001300000000000000000000000000000000000000000000002340d88000000000c4224d6178204443204c696e6b20766f6c7461676500 + 02000500300000001600000000000000000000000000000000000000000000002340598000000000240024002683000000000000401f00000000000000000000000000000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000c00000011000000000000000000000000000000000000000000000023404980000000000c0100004d6f746f72207065616b20746f7271756500 + 020005005c0000001b000000000000000000000000000000000000000000000023404a800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a110000241300001d0000003a00000057000000720000008e000000a8000000c2000000db000000f40000000c0100004d6f746f7220546f7271756520436861726163746572697374696300 + 020005000a0000000900000000000000000000000000000000000000000000002340378000000000a4014d6f746f7220454d4600 + 0200050014000000140000000000000000000000000000000000000000000000234042800000000008000800640f00002c1a0000456c656374726963206d6f746f72206d6f64656c00 + 020005005c0000001f000000000000000000000000000000000000000000000023404b800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a11000024130000da1100007a0d00002c0b0000060900009e070000c20600002c060000c805000078050000780500004d6f746f7220496e64756374616e636520436861726163746572697374696300 + 020005000c0000001300000000000000000000000000000000000000000000002340710000000000282300004d6178696d756d206d6f746f7220737065656400 + 02000500140000001500000000000000000000000000000000000000000000002340478000000000080008000e000000000000004d656368616e6963616c206d6f746f72206461746100 + 020005000a0000001900000000000000000000000000000000000000000000002340c9000000000078054d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000002340cc0000000000dc054d6f746f72207368757420646f776e2074656d706572617475726500 + 020005001400000013000000000000000000000000000000000000000000000023403e8000000000080008005802500064000000546865726d616c206d6f746f72206d6f64656c00 + 020005003400000027000000000000000000000000000000000000000000000023404c800000000028002800d9fe17003a01440237031604e304a0054e06f20680010002800200038003000480040005800500064d6f746f722054656d70657261747572652053656e736f7220436861726163746572697374696300 + 020005000a0000001b00000000000000000000000000000000000000000000002340c38100000000010443757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a0000001d000000000000000000000000000000000000000000000023403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 020005000a0000001d000000000000000000000000000000000000000000000023403d800000000007004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000a00000017000000000000000000000000000000000000000000000023400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005001c0000001500000000000000000000000000000000000000000000002340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005000c0000001a000000000000000000000000000000000000000000000023405d800000000052030000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023405c8000000000a4060000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000a0000001d0000000000000000000000000000000000000000000000234046800000000033004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001c000000000000000000000000000000000000000000000023405b00000000007b8d410a4269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000020000000000000000000000000000000000000000000000023406a00000000006c0943757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000023406b0000000000080043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002600000000000000000000000000000000000000000000002340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023406400000000001500000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a00000022000000000000000000000000000000000000000000000023406500000000000b0056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000002340968000000000e000e00003000000454b4d33362d304b4630413031384100000000000000000000000000000000000000000000000000000000001800000000000000050018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070018000000000012000c000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960096007d0000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005001800000011000000000000000000000000000000000000000000000023400282000000000c000c0001000000f4012c01bc02000056656c6f63697479206f6273657276657200 + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + + + UINT + + + DINT + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Links.xml new file mode 100644 index 0000000..21797d0 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/Links.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/LinksOld.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/LinksOld.xml new file mode 100644 index 0000000..a58b6ce --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/LinksOld.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/FB_Axis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/FB_Axis.xml new file mode 100644 index 0000000..f72ad34 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/FB_Axis.xml @@ -0,0 +1,137 @@ + 0); + bDriveError := AxisRef.NcToPlc.StateDWord.28; + + Timer(IN := bStatus); + IF Timer.Q OR bNcError OR bDriveError THEN + Timer(IN := FALSE); + + IF bDriveError THEN + fbSoEReset(Execute:= FALSE, Axis:= AxisRef); + iState := 10; + ELSIF bNCError THEN + fbMcReset(Execute := FALSE, Axis := AxisRef); + iState := 20; + ELSE + IF lrPosition <> lrPosition1 THEN + lrPosition := lrPosition1; + ELSE + lrPosition := lrPosition2; + END_IF + fbMCMove( + Execute:= FALSE, + Axis := AxisRef + ); + iState := 30; + END_IF + END_IF + +10: (* drive reset *) + A_DriveReset(); + +20: (* MC reset *) + A_MC2Reset(); + +30: (* MC move absolute *) + A_MC2Move(); + +31: (* MC move absolute *) + A_MC2Move(); + +32: (* back to idle *) + iState := 0; + +40: (* MC halt *) + A_MC2Halt(); +END_CASE + +lrActPos := AxisRef.NcToPlc.ActPos;]]> bStatus, +); +]]> lrPosition1 THEN + lrPosition := lrPosition1; + ELSE + lrPosition := lrPosition2; + END_IF + + fbMCMove(Execute := FALSE, Axis := AxisRef); + iState := iState + 1; +END_IF + +IF bHalt THEN + fbMCMove(Execute := FALSE, Axis := AxisRef); + iState := 40; +END_IF]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/MAIN.xml new file mode 100644 index 0000000..0f6de45 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/MAIN.xml @@ -0,0 +1,33 @@ + lrActPos1 +); + +fbAxis2( + bDriveReset := bDriveReset, + bHalt := bHalt, + lrActPos => lrActPos2 +); + +bEnabled := fbAxis1.bStatus AND fbAxis2.bStatus; +bError := fbAxis1.bDriveError OR fbAxis1.bNcError OR fbAxis2.bNcError OR fbAxis2.bDriveError; +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis1.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis1.xml new file mode 100644 index 0000000..d73b92b Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis1.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis2.xml new file mode 100644 index 0000000..8f75881 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis3.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis3.xml new file mode 100644 index 0000000..75e914d Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis3.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis4.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis4.xml new file mode 100644 index 0000000..9afa7ab Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis4.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Channel2.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Channel2.xml new file mode 100644 index 0000000..7c461bf Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Channel2.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_Commands.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_Commands.xml new file mode 100644 index 0000000..dacb2c4 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_Commands.xml @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml new file mode 100644 index 0000000..bd740bd --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_States.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_States.xml new file mode 100644 index 0000000..2ca6136 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_States.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Drive.xti b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Drive.xti new file mode 100644 index 0000000..5bbcc49 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Drive.xti @@ -0,0 +1,145 @@ + + + + 424dd6020000000000003600000028000000100000000e0000000100180000000000a002000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff808080808080808080808080808080ff00ffff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff0000000000000000000000000000000000000000000000ff0000ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffff0000ff0000ff0000ff00008080800000ffff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffff0000c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0ff0000c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0ff0000c0c0c0808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0ff00008080800000000000000000000000000000000000000000000000000000ff0000ffff00ffff0000c0c0c0c0c0c0ff0000808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0ff0000ff0000c0c0c0808080000000ff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080 + + + __FILENAME__ + 1000 + + 001880002600010001000000800080008000001826010000 + 001a80002200010002000000800080008000001a22010000 + 00100c002400010003000000000000000000001024010000 + 001114002000010004000000000000000000001120010000 + 0000000000000000001000020100000001000000000000000000000000000000 + 0000000000000000001100010100000002000000000000000000000000000000 + 00000000000000000d0800010100000003000000000000000000000000000000 + 0010140200181402 + 3007000090d0030050c30000000000000000ffff000000000000000000000000 + 446353796e633235300000000000000053796e63206379636c652074696d653a20323530b5730000000000000000000090d0030050c3000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 446353796e633132350000000000000053796e63206379636c652074696d653a20313235b5730000000000000000000048e80100a861000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 02000500100000000d000000000000000000000000000000000000000000000003400a8000000000fe070000000000004665617475726520666c61677300 + 02000500100000000d000000000000000000000000000000000000000000000023400a8000000000ff070000000000004665617475726520666c61677300 + 020005000a0000001500000000000000000000000000000000000000000000000340010000000000d007546e637963202d204e43206379636c652074696d6500 + 020005000a0000001700000000000000000000000000000000000000000000000340020000000000d0075473637963202d20436f6d6d206379636c652074696d6500 + 020005000a0000000e000000000000000000000000000000000000000000000003402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000000e000000000000000000000000000000000000000000000023402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000001400000000000000000000000000000000000000000000000340c98000000000fc084e6f6d696e616c206d61696e20766f6c7461676500 + 020005000a0000002500000000000000000000000000000000000000000000000340ca8000000000c8004d61696e20766f6c7461676520706f73697469766520746f6c6572616e63652072616e676500 + 020005000a0000002500000000000000000000000000000000000000000000000340cb8000000000c8004d61696e20766f6c74616765206e6567617469766520746f6c6572616e63652072616e676500 + 020005000a0000001d00000000000000000000000000000000000000000000000340cc80000000000100506f776572204d616e6167656d656e7420636f6e74726f6c20776f726400 + 020005001c0000001500000000000000000000000000000000000000000000000340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005001c000000150000000000000000000000000000000000000000000000034035800000000010002200414d333032312d304334302d30303030436f6e66696775726564206d6f746f72207479706500 + 020005000c00000012000000000000000000000000000000000000000000000003406d00000000009c1800004d6f746f72207065616b2063757272656e7400 + 020005000c0000001e000000000000000000000000000000000000000000000003406f00000000002c0600004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000000340710000000000401f00004d6178696d756d206d6f746f7220737065656400 + 020005000a000000140000000000000000000000000000000000000000000000034033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000a0000000900000000000000000000000000000000000000000000000340378000000000c3004d6f746f7220454d4600 + 020005000a0000001d000000000000000000000000000000000000000000000003404680000000002d004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001100000000000000000000000000000000000000000000000340498000000000930000004d6f746f72207065616b20746f7271756500 + 020005000a0000001d000000000000000000000000000000000000000000000003403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 0200050014000000140000000000000000000000000000000000000000000000034042800000000008000800140500006c070000456c656374726963206d6f746f72206d6f64656c00 + 020005001400000013000000000000000000000000000000000000000000000003403e800000000008000800e001500064000100546865726d616c206d6f746f72206d6f64656c00 + 020005000c00000021000000000000000000000000000000000000000000000003408800000000005e960900506f73697469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000c00000021000000000000000000000000000000000000000000000003408900000000005e9609004e6567617469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000a000000170000000000000000000000000000000000000000000000034032800000000000004d6f746f7220636f6e737472756374696f6e207479706500 + 020005001000000027000000000000000000000000000000000000000000000003404480000000000400040064000000546865726d616c206f7665726c6f616420666163746f7220286d6f746f722077696e64696e672900 + 020005000a0000001900000000000000000000000000000000000000000000000340c9000000000020034d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000000340cc000000000078054d6f746f72207368757420646f776e2074656d706572617475726500 + 02000500140000001500000000000000000000000000000000000000000000000340478000000000080008000b000000000000004d656368616e6963616c206d6f746f72206461746100 + 0200050030000000160000000000000000000000000000000000000000000000034059800000000024002400028000003e0000003e000000c980000084030000fc0800000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000a00000020000000000000000000000000000000000000000000000003406a0000000000440243757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000003406b0000000000050043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002000000000000000000000000000000000000000000000000340348000000000b80b54696d65206c696d69746174696f6e20666f72207065616b2063757272656e7400 + 020005000c0000001f00000000000000000000000000000000000000000000000340388000000000321200004d6178206d6f746f722073706565642077697468206d617820746f7271756500 + 020005000c0000001f000000000000000000000000000000000000000000000003405c8000000000580c0000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000c0000001a000000000000000000000000000000000000000000000003405d80000000002c060000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001c000000000000000000000000000000000000000000000003405b0000000000f90b1b084269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000017000000000000000000000000000000000000000000000003400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005000a0000001b00000000000000000000000000000000000000000000000340c38100000000000043757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a00000018000000000000000000000000000000000000000000000003400380000000007d0056656c6f63697479206374726c206379636c652074696d6500 + 020005000a0000002600000000000000000000000000000000000000000000000340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000a0000001800000000000000000000000000000000000000000000000340048000000000fa00506f736974696f6e206374726c206379636c652074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000000340968000000000e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005000c000000190000000000000000000000000000000000000000000000034098800000000001000000466565646261636b20312067656172206e756d657261746f7200 + 020005000c0000001b0000000000000000000000000000000000000000000000034099800000000001000000466565646261636b203120676561722064656e6f6d696e61746f7200 + 020005000a0000001d000000000000000000000000000000000000000000000003403d800000000000004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000c0000001f000000000000000000000000000000000000000000000003406400000000005e01000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a0000002200000000000000000000000000000000000000000000000340650000000000180056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500140000001b000000000000000000000000000000000000000000000003409a8000000000080008000000000000000000466565646261636b2031207265666572656e6365207369676e616c00 + 020005001800000015000000000000000000000000000000000000000000000023403580000000000c002200414d383032312d7842783000436f6e66696775726564206d6f746f72207479706500 + 020005000a000000140000000000000000000000000000000000000000000000234033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000c0000001e000000000000000000000000000000000000000000000023406f0000000000520300004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000002340c40000000000520300004d6f746f722072617465642063757272656e7400 + 020005000c00000012000000000000000000000000000000000000000000000023406d0000000000241300004d6f746f72207065616b2063757272656e7400 + 020005000a00000013000000000000000000000000000000000000000000000023404d8000000000a00f4d6f746f7220726174656420766f6c7461676500 + 020005000a0000001300000000000000000000000000000000000000000000002340d88000000000c4224d6178204443204c696e6b20766f6c7461676500 + 02000500300000001600000000000000000000000000000000000000000000002340598000000000240024002683000000000000401f00000000000000000000000000000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000c00000011000000000000000000000000000000000000000000000023404980000000000c0100004d6f746f72207065616b20746f7271756500 + 020005005c0000001b000000000000000000000000000000000000000000000023404a800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a110000241300001d0000003a00000057000000720000008e000000a8000000c2000000db000000f40000000c0100004d6f746f7220546f7271756520436861726163746572697374696300 + 020005000a0000000900000000000000000000000000000000000000000000002340378000000000a4014d6f746f7220454d4600 + 0200050014000000140000000000000000000000000000000000000000000000234042800000000008000800640f00002c1a0000456c656374726963206d6f746f72206d6f64656c00 + 020005005c0000001f000000000000000000000000000000000000000000000023404b800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a11000024130000da1100007a0d00002c0b0000060900009e070000c20600002c060000c805000078050000780500004d6f746f7220496e64756374616e636520436861726163746572697374696300 + 020005000c0000001300000000000000000000000000000000000000000000002340710000000000282300004d6178696d756d206d6f746f7220737065656400 + 02000500140000001500000000000000000000000000000000000000000000002340478000000000080008000e000000000000004d656368616e6963616c206d6f746f72206461746100 + 020005000a0000001900000000000000000000000000000000000000000000002340c9000000000078054d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000002340cc0000000000dc054d6f746f72207368757420646f776e2074656d706572617475726500 + 020005001400000013000000000000000000000000000000000000000000000023403e8000000000080008005802500064000000546865726d616c206d6f746f72206d6f64656c00 + 020005003400000027000000000000000000000000000000000000000000000023404c800000000028002800d9fe17003a01440237031604e304a0054e06f20680010002800200038003000480040005800500064d6f746f722054656d70657261747572652053656e736f7220436861726163746572697374696300 + 020005000a0000001b00000000000000000000000000000000000000000000002340c38100000000010443757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a0000001d000000000000000000000000000000000000000000000023403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 020005000a0000001d000000000000000000000000000000000000000000000023403d800000000007004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000a00000017000000000000000000000000000000000000000000000023400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005001c0000001500000000000000000000000000000000000000000000002340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005000c0000001a000000000000000000000000000000000000000000000023405d800000000052030000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023405c8000000000a4060000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000a0000001d0000000000000000000000000000000000000000000000234046800000000033004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001c000000000000000000000000000000000000000000000023405b00000000007b8d410a4269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000020000000000000000000000000000000000000000000000023406a00000000006c0943757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000023406b0000000000080043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002600000000000000000000000000000000000000000000002340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023406400000000001500000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a00000022000000000000000000000000000000000000000000000023406500000000000b0056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000002340968000000000e000e00003000000454b4d33362d304b4630413031384100000000000000000000000000000000000000000000000000000000001800000000000000050018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070018000000000012000c000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960096007d0000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005001800000011000000000000000000000000000000000000000000000023400282000000000c000c0001000000f4012c01bc02000056656c6f63697479206f6273657276657200 + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + + + UINT + + + DINT + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/GVLs/GlobalVariables.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/GVLs/GlobalVariables.xml new file mode 100644 index 0000000..f49c99c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/GVLs/GlobalVariables.xml @@ -0,0 +1,36 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Links.xml new file mode 100644 index 0000000..f2f3f23 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/Links.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/LinksOld.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/LinksOld.xml new file mode 100644 index 0000000..7b6e43f --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/LinksOld.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciChannel.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciChannel.xml new file mode 100644 index 0000000..a8ec7c0 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciChannel.xml @@ -0,0 +1,181 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciSequence.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciSequence.xml new file mode 100644 index 0000000..0fbaafc --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciSequence.xml @@ -0,0 +1,86 @@ += 2 AND iMaxUsedChannels >= 1 THEN + CASE nState OF + 0: + IF bExecute THEN + bBusy := TRUE; + bDone := FALSE; + bError := FALSE; + dwErrorId := 0; + nState := 10; + END_IF + + 10: + fbNciChaA( + bExecute := bExecute, + stNcToPlcX := AxisRef[1].NcToPlc, + stNcToPlcY := AxisRef[2].NcToPlc, + stNcToPlcZ := stNcToPlcDummy, + stNcToPlcC := stNcToPlcDummy, + stPlcToNci := stPlcToNci, + stNciToPlc := stNciToPlc + ); + + IF NOT fbNciChaA.bBusy THEN + fbNciChaA( bExecute:= FALSE, stNcToPlcX:= AxisRef[1].NcToPlc, stNcToPlcY:= AxisRef[2].NcToPlc, stNcToPlcZ:= stNcToPlcDummy, + stNcToPlcC:= stNcToPlcDummy, stPlcToNci:= stPlcToNci, stNciToPlc:= stNciToPlc ); + + bBusy := FALSE; + + IF NOT fbNciChaA.bErr THEN + bDone := TRUE; + ELSE + bError := fbNciChaA.bErr; + dwErrorId := fbNciChaA.nErrId; + END_IF + IF NOT bExecute THEN + nState := 0; + ELSE + nState := 20; + END_IF + END_IF + + 20: + bBusy := FALSE; + IF NOT bExecute THEN + IF fbNciChaA.bErr THEN + bError := fbNciChaA.bErr; + dwErrorId := fbNciChaA.nErrId; + END_IF + nState := 0; + END_IF + END_CASE + +END_IF +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/MAIN.xml new file mode 100644 index 0000000..95576ee --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/MAIN.xml @@ -0,0 +1,152 @@ + 32767 THEN + iNciOverrideRaw := 0; +END_IF +NciOverrideFilter( + OverrideValueRaw := iNciOverrideRaw, + LowerOverrideThreshold := 0, + UpperOverrideThreshold := 32767, + OverrideSteps := 200, + OverrideRecoveryTime := T#150ms, +); + +(* enable *) +A_Enable(); +IF bEnabled THEN + bCallSequence := TRUE; + A_TriggerExec(); +END_IF + +IF bCallSequence THEN + (* call motion sequence *) + IF bNciReq OR fbNciSequence.bBusy THEN + fbNciSequence( + bExecute := TRUE, + iMaxUsedAxes := iMaxUsedAxes, + iMaxUsedChannels:= iMaxUsedChannels, + AxisRef := AxisRef, + stNciToPlc := stiNciToPlc, + stPlcToNci := stoPlcToNci, + bBusy => bBusy, + bDone => bDone, + bError => bError, + dwErrorId => dwErrorId + ); + ELSE + fbNciSequence( + bExecute := FALSE, + AxisRef := AxisRef, + stNciToPlc := stiNciToPlc, + stPlcToNci := stoPlcToNci, + ); + END_IF +END_IF +]]> bAxisEnabled[I] + ); + bEnabled := bEnabled AND bAxisEnabled[I]; + bEnableError := bEnableError OR fbMC_Power[I].Error; +(* bResetReq := bResetReq OR AxisInErrorState(stiNcToPlc[I].nStateDWord);*) +END_FOR + +(* NCI override *) +lrOverrideNci := LIMIT(0, UINT_TO_LREAL(iNciOverrideRaw) * 100.0 / lrOverrideMaxScale, 100); +ItpSetOverridePercent(lrOverrideNci, stoPlcToNci); +]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisX.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisX.xml new file mode 100644 index 0000000..df7fece Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisX.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisY.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisY.xml new file mode 100644 index 0000000..2c98063 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisY.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisZ.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisZ.xml new file mode 100644 index 0000000..df3d926 Binary files /dev/null and b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisZ.xml differ diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_AxisState.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_AxisState.xml new file mode 100644 index 0000000..a89c0f6 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_AxisState.xml @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_MoveCmd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_MoveCmd.xml new file mode 100644 index 0000000..821477a --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_MoveCmd.xml @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Drive.xti b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Drive.xti new file mode 100644 index 0000000..5bbcc49 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Drive.xti @@ -0,0 +1,145 @@ + + + + 424dd6020000000000003600000028000000100000000e0000000100180000000000a002000000000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ff808080808080808080808080808080ff00ffff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff0000000000000000000000000000000000000000000000ff0000ffff00ffc0c0c0c0c0c0c0c0c0c0c0c08080800000ff000000000000000000000000000000000000000000ff00ffff00ffff00ffff0000ff0000ff0000ff00008080800000ffff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffff0000c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0ff0000c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0ff0000c0c0c0808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0ff00008080800000000000000000000000000000000000000000000000000000ff0000ffff00ffff0000c0c0c0c0c0c0ff0000808080000000000000000000000000000000000000000000000000ff00ffff00ffff00ffc0c0c0ff0000ff0000c0c0c0808080000000ff00ffff00ffff00ff000000ff00ffff00ff000000ff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000000000000000000000000000ff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080000000ff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffff00ffc0c0c0c0c0c0c0c0c0c0c0c0808080 + + + __FILENAME__ + 1000 + + 001880002600010001000000800080008000001826010000 + 001a80002200010002000000800080008000001a22010000 + 00100c002400010003000000000000000000001024010000 + 001114002000010004000000000000000000001120010000 + 0000000000000000001000020100000001000000000000000000000000000000 + 0000000000000000001100010100000002000000000000000000000000000000 + 00000000000000000d0800010100000003000000000000000000000000000000 + 0010140200181402 + 3007000090d0030050c30000000000000000ffff000000000000000000000000 + 446353796e633235300000000000000053796e63206379636c652074696d653a20323530b5730000000000000000000090d0030050c3000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 446353796e633132350000000000000053796e63206379636c652074696d653a20313235b5730000000000000000000048e80100a861000000000000ffff30070000000000000000000000000000000000000000000000000000000000000000 + 02000500100000000d000000000000000000000000000000000000000000000003400a8000000000fe070000000000004665617475726520666c61677300 + 02000500100000000d000000000000000000000000000000000000000000000023400a8000000000ff070000000000004665617475726520666c61677300 + 020005000a0000001500000000000000000000000000000000000000000000000340010000000000d007546e637963202d204e43206379636c652074696d6500 + 020005000a0000001700000000000000000000000000000000000000000000000340020000000000d0075473637963202d20436f6d6d206379636c652074696d6500 + 020005000a0000000e000000000000000000000000000000000000000000000003402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000000e000000000000000000000000000000000000000000000023402000000000000b004f7065726174696f6e206d6f646500 + 020005000a0000001400000000000000000000000000000000000000000000000340c98000000000fc084e6f6d696e616c206d61696e20766f6c7461676500 + 020005000a0000002500000000000000000000000000000000000000000000000340ca8000000000c8004d61696e20766f6c7461676520706f73697469766520746f6c6572616e63652072616e676500 + 020005000a0000002500000000000000000000000000000000000000000000000340cb8000000000c8004d61696e20766f6c74616765206e6567617469766520746f6c6572616e63652072616e676500 + 020005000a0000001d00000000000000000000000000000000000000000000000340cc80000000000100506f776572204d616e6167656d656e7420636f6e74726f6c20776f726400 + 020005001c0000001500000000000000000000000000000000000000000000000340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005001c000000150000000000000000000000000000000000000000000000034035800000000010002200414d333032312d304334302d30303030436f6e66696775726564206d6f746f72207479706500 + 020005000c00000012000000000000000000000000000000000000000000000003406d00000000009c1800004d6f746f72207065616b2063757272656e7400 + 020005000c0000001e000000000000000000000000000000000000000000000003406f00000000002c0600004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000000340710000000000401f00004d6178696d756d206d6f746f7220737065656400 + 020005000a000000140000000000000000000000000000000000000000000000034033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000a0000000900000000000000000000000000000000000000000000000340378000000000c3004d6f746f7220454d4600 + 020005000a0000001d000000000000000000000000000000000000000000000003404680000000002d004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001100000000000000000000000000000000000000000000000340498000000000930000004d6f746f72207065616b20746f7271756500 + 020005000a0000001d000000000000000000000000000000000000000000000003403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 0200050014000000140000000000000000000000000000000000000000000000034042800000000008000800140500006c070000456c656374726963206d6f746f72206d6f64656c00 + 020005001400000013000000000000000000000000000000000000000000000003403e800000000008000800e001500064000100546865726d616c206d6f746f72206d6f64656c00 + 020005000c00000021000000000000000000000000000000000000000000000003408800000000005e960900506f73697469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000c00000021000000000000000000000000000000000000000000000003408900000000005e9609004e6567617469766520616363656c65726174696f6e206c696d69742076616c756500 + 020005000a000000170000000000000000000000000000000000000000000000034032800000000000004d6f746f7220636f6e737472756374696f6e207479706500 + 020005001000000027000000000000000000000000000000000000000000000003404480000000000400040064000000546865726d616c206f7665726c6f616420666163746f7220286d6f746f722077696e64696e672900 + 020005000a0000001900000000000000000000000000000000000000000000000340c9000000000020034d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000000340cc000000000078054d6f746f72207368757420646f776e2074656d706572617475726500 + 02000500140000001500000000000000000000000000000000000000000000000340478000000000080008000b000000000000004d656368616e6963616c206d6f746f72206461746100 + 0200050030000000160000000000000000000000000000000000000000000000034059800000000024002400028000003e0000003e000000c980000084030000fc0800000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000a00000020000000000000000000000000000000000000000000000003406a0000000000440243757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000003406b0000000000050043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002000000000000000000000000000000000000000000000000340348000000000b80b54696d65206c696d69746174696f6e20666f72207065616b2063757272656e7400 + 020005000c0000001f00000000000000000000000000000000000000000000000340388000000000321200004d6178206d6f746f722073706565642077697468206d617820746f7271756500 + 020005000c0000001f000000000000000000000000000000000000000000000003405c8000000000580c0000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000c0000001a000000000000000000000000000000000000000000000003405d80000000002c060000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001c000000000000000000000000000000000000000000000003405b0000000000f90b1b084269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000017000000000000000000000000000000000000000000000003400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005000a0000001b00000000000000000000000000000000000000000000000340c38100000000000043757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a00000018000000000000000000000000000000000000000000000003400380000000007d0056656c6f63697479206374726c206379636c652074696d6500 + 020005000a0000002600000000000000000000000000000000000000000000000340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000a0000001800000000000000000000000000000000000000000000000340048000000000fa00506f736974696f6e206374726c206379636c652074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000000340968000000000e000e0000100000048656e6723414433362d3132313941462e305842493000000000000000000000000000000000000002003200030000000000000001000300000000000008000000000000e8030000e8030000000000000000000000000000000000000000000000000000010003000090185413000c0018000c0001000100000000000000000000000000000002000000060043000100010008000400130001000c005500102705003300460090010500000001000000ff000100000000000000000000000000a600a600780000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005000c000000190000000000000000000000000000000000000000000000034098800000000001000000466565646261636b20312067656172206e756d657261746f7200 + 020005000c0000001b0000000000000000000000000000000000000000000000034099800000000001000000466565646261636b203120676561722064656e6f6d696e61746f7200 + 020005000a0000001d000000000000000000000000000000000000000000000003403d800000000000004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000c0000001f000000000000000000000000000000000000000000000003406400000000005e01000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a0000002200000000000000000000000000000000000000000000000340650000000000180056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500140000001b000000000000000000000000000000000000000000000003409a8000000000080008000000000000000000466565646261636b2031207265666572656e6365207369676e616c00 + 020005001800000015000000000000000000000000000000000000000000000023403580000000000c002200414d383032312d7842783000436f6e66696775726564206d6f746f72207479706500 + 020005000a000000140000000000000000000000000000000000000000000000234033800000000003004e756d626572206f6620706f6c6520706169727300 + 020005000c0000001e000000000000000000000000000000000000000000000023406f0000000000520300004d6f746f7220636f6e74696e756f7573207374616c6c2063757272656e7400 + 020005000c0000001300000000000000000000000000000000000000000000002340c40000000000520300004d6f746f722072617465642063757272656e7400 + 020005000c00000012000000000000000000000000000000000000000000000023406d0000000000241300004d6f746f72207065616b2063757272656e7400 + 020005000a00000013000000000000000000000000000000000000000000000023404d8000000000a00f4d6f746f7220726174656420766f6c7461676500 + 020005000a0000001300000000000000000000000000000000000000000000002340d88000000000c4224d6178204443204c696e6b20766f6c7461676500 + 02000500300000001600000000000000000000000000000000000000000000002340598000000000240024002683000000000000401f00000000000000000000000000000000000000000000000000004d6f746f72206461746120636f6e73747261696e747300 + 020005000c00000011000000000000000000000000000000000000000000000023404980000000000c0100004d6f746f72207065616b20746f7271756500 + 020005005c0000001b000000000000000000000000000000000000000000000023404a800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a110000241300001d0000003a00000057000000720000008e000000a8000000c2000000db000000f40000000c0100004d6f746f7220546f7271756520436861726163746572697374696300 + 020005000a0000000900000000000000000000000000000000000000000000002340378000000000a4014d6f746f7220454d4600 + 0200050014000000140000000000000000000000000000000000000000000000234042800000000008000800640f00002c1a0000456c656374726963206d6f746f72206d6f64656c00 + 020005005c0000001f000000000000000000000000000000000000000000000023404b800000000050005000ea010000d4030000be050000a8070000920900007c0b0000660d0000500f00003a11000024130000da1100007a0d00002c0b0000060900009e070000c20600002c060000c805000078050000780500004d6f746f7220496e64756374616e636520436861726163746572697374696300 + 020005000c0000001300000000000000000000000000000000000000000000002340710000000000282300004d6178696d756d206d6f746f7220737065656400 + 02000500140000001500000000000000000000000000000000000000000000002340478000000000080008000e000000000000004d656368616e6963616c206d6f746f72206461746100 + 020005000a0000001900000000000000000000000000000000000000000000002340c9000000000078054d6f746f72207761726e696e672074656d706572617475726500 + 020005000a0000001b00000000000000000000000000000000000000000000002340cc0000000000dc054d6f746f72207368757420646f776e2074656d706572617475726500 + 020005001400000013000000000000000000000000000000000000000000000023403e8000000000080008005802500064000000546865726d616c206d6f746f72206d6f64656c00 + 020005003400000027000000000000000000000000000000000000000000000023404c800000000028002800d9fe17003a01440237031604e304a0054e06f20680010002800200038003000480040005800500064d6f746f722054656d70657261747572652053656e736f7220436861726163746572697374696300 + 020005000a0000001b00000000000000000000000000000000000000000000002340c38100000000010443757272656e7420636f6e74726f6c6c65722073657474696e677300 + 020005000a0000001d000000000000000000000000000000000000000000000023403980000000007869456c656374726963616c20636f6d6d75746174696f6e206f666673657400 + 020005000a0000001d000000000000000000000000000000000000000000000023403d800000000007004d6f746f722074656d70657261747572652073656e736f72207479706500 + 020005000a00000017000000000000000000000000000000000000000000000023400280000000003e0043757272656e74206374726c206379636c652074696d6500 + 020005001c0000001500000000000000000000000000000000000000000000002340368000000000100022004158353230332d303030302d23232323436f6e66696775726564206472697665207479706500 + 020005000c0000001a000000000000000000000000000000000000000000000023405d800000000052030000436f6e66696775726564206368616e6e656c2063757272656e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023405c8000000000a4060000436f6e66696775726564206368616e6e656c207065616b2063757272656e7400 + 020005000a0000001d0000000000000000000000000000000000000000000000234046800000000033004d6f746f7220636f6e74696e756f7573207374616c6c20746f7271756500 + 020005000c0000001c000000000000000000000000000000000000000000000023405b00000000007b8d410a4269706f6c61722076656c6f63697479206c696d69742076616c756500 + 020005000a00000020000000000000000000000000000000000000000000000023406a00000000006c0943757272656e74206c6f6f702070726f706f7274696f6e616c206761696e203100 + 020005000a0000002b000000000000000000000000000000000000000000000023406b0000000000080043757272656e7420636f6e74726f6c206c6f6f7020696e74656772616c20616374696f6e2074696d65203100 + 020005000a0000002600000000000000000000000000000000000000000000002340ff8100000000fa0056656c6f636974792066696c746572206c6f7720706173732074696d6520636f6e7374616e7400 + 020005000c0000001f000000000000000000000000000000000000000000000023406400000000001500000056656c6f63697479206c6f6f702070726f706f7274696f6e616c206761696e00 + 020005000a00000022000000000000000000000000000000000000000000000023406500000000000b0056656c6f63697479206c6f6f7020696e74656772616c20616374696f6e2074696d6500 + 02000500ec0000000f00000000000000000000000000000000000000000000002340968000000000e000e00003000000454b4d33362d304b4630413031384100000000000000000000000000000000000000000000000000000000001800000000000000050018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000070018000000000012000c000000000002000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000960096007d0000000000000000000000000000000000000000000000466565646261636b2031207479706500 + 020005001800000011000000000000000000000000000000000000000000000023400282000000000c000c0001000000f4012c01bc02000056656c6f63697479206f6273657276657200 + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + DINT + + + + + UINT + + + DINT + + + + + UINT + + + DINT + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Links.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Links.xml new file mode 100644 index 0000000..f06268a --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/Links.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/LinksOld.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/LinksOld.xml new file mode 100644 index 0000000..3e8f680 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/LinksOld.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml new file mode 100644 index 0000000..9503404 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml @@ -0,0 +1,79 @@ + iDiagNumber + ); + eCurState := eAxisState_Idle; + END_IF + +END_CASE + +M_HardwareDiag := eCurState <> eAxisState_Idle; +bExecHWDiag_ := bExecute; +]]> eAxisState_Idle; +bExecHWRes_ := bExecute;]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_NcAxis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_NcAxis.xml new file mode 100644 index 0000000..517b128 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_NcAxis.xml @@ -0,0 +1,213 @@ + 0); +]]> overwrite method if necessary +CASE eCurState OF +eAxisState_Idle: + IF bExecute AND NOT bExecHWDiag_ THEN + eCurState := eAxisState_Diag; + END_IF + +eAxisState_Diag: + eCurState := eAxisState_Idle; + +END_CASE + +M_HardwareDiag := eCurState <> eAxisState_Idle; +bExecHWDiag_ := bExecute; + +]]> bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveModulo: + fbMcMoveMod( + Execute := bExecute, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveRelative: + fbMcMoveRel( + Execute := bExecute, Distance:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + + eCmd_MoveVelocity: + fbMcMoveVel( + Execute := bExecute, Velocity:= fVelocity, Axis := sAxis, + InVelocity=> bDone, Busy => bBusy, Active => bActive, + Error => bError, ErrorID => iErrorId, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Move; + END_CASE + END_IF + +eAxisState_Move: + CASE eMoveCmd OF + eCmd_MoveAbsolute: + fbMcMoveAbs( + Execute := TRUE, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveAbs(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveModulo: + fbMcMoveMod( + Execute := TRUE, Position:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveMod(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveRelative: + fbMcMoveRel( + Execute := TRUE, Distance:= fPosition, Velocity:= fVelocity, + Axis := sAxis, Done => bDone, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveRel(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + + eCmd_MoveVelocity: + fbMcMoveVel( + Execute := TRUE, Velocity:= fVelocity, Axis := sAxis, + InVelocity=> bDone, Busy => bBusy, Active => bActive, + Error => bError, ErrorID => iErrorId, Busy => bBusy, + Active => bActive, Error => bError, ErrorID => iErrorId + ); + IF bDone OR bError THEN + fbMcMoveVel(Execute := FALSE,Axis := sAxis); + eCurState := eAxisState_Idle; + END_IF + END_CASE +END_CASE + +M_Move := (eCurState <> eAxisState_Idle); +bExecMove_ := bExecute;]]> bDone, + Busy => bBusy, Error => bError, ErrorID => iErrorId + ); + eCurState := eAxisState_Reset; + END_IF + +eAxisState_Reset: + fbMcReset( + Execute := FALSE, Axis := sAxis, Done => bDone, + Busy => bBusy, Error => bError, ErrorID => iErrorId + ); + IF fbMcReset.Done OR fbMcReset.Error THEN + eCurState := eAxisState_Idle; + END_IF +END_CASE + +M_Reset := eCurState <> eAxisState_Idle; +bExecReset_ := bExecute;]]> overwrite method if necessary +CASE eCurState OF +eAxisState_Idle: + IF bExecute AND NOT bExecHWRes_ THEN + eCurState := eAxisState_Reset; + END_IF + +eAxisState_Reset: + eCurState := eAxisState_Idle; + +END_CASE + +M_HardwareReset := eCurState <> eAxisState_Idle; +bExecHWRes_ := bExecute;]]> \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/IAxis.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/IAxis.xml new file mode 100644 index 0000000..65a5d5c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/IAxis.xml @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/FB_Table.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/FB_Table.xml new file mode 100644 index 0000000..5715a30 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/FB_Table.xml @@ -0,0 +1,127 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/MAIN.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/MAIN.xml new file mode 100644 index 0000000..5d167f2 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/MAIN.xml @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramCFC.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramCFC.xml new file mode 100644 index 0000000..4daade8 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramCFC.xml @@ -0,0 +1,1930 @@ + + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + eOp_Mul + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Sub + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Add + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + tTimerValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + bZero + + + + + + + + + + + + + bPos + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + bNeg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + iResultC + + + + + + + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + Timer.ET + + + + + + + + + + + + + T#500ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + bTest + + + + + + Timer + + + + + + + + + + + + + State + machine + + + + + + + + + eOperation + + + + + + + + + + + + + + + eOperation + + + + + + + + + + + + + + + eOperation + + + + + + + + + + + + FB + Call + + + + + + + + + + eOperationPrev + + + + + + + + iResultC + + + + + + + + bZero + + + + + + + + bPos + + + + + + + + bNeg + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramFbd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramFbd.xml new file mode 100644 index 0000000..91b9918 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramFbd.xml @@ -0,0 +1,1280 @@ + + + + + + + + + + + + bZero + + + + + bPos + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + bPos + + + + + bNeg + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bTest + + + + + + Timer + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + operator + + + + + + + tTimerValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + State + machine + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + FB + Call + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bZero + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bPos + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + bNeg + + + + + eOperation + + + + + + + eOperationPrev + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramLd.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramLd.xml new file mode 100644 index 0000000..1cdb97e --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramLd.xml @@ -0,0 +1,1324 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + bTemp1 + + + + + + operator + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + bTemp2 + + + + + + operator + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + Timer.ET + + + + + TIME#500ms + + + + + + + + + + + + + + + + + + + + + + + + + + + + bTemp3 + + + + + + operator + + + + + + + + + + + + + + + + + networktitle + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Timer + + + + + + + + + + networktitle + + + + + + + Timer.Q + + + + + + + + + + + + + + + + + operator + + + + + + + tTimerValue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + State + machine + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Add + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + eOp_Mul + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + Timer.Q + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOp_Sub + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + eOperation + + + + + eOperationPrev + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + FB + Call + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + + + + + + + + + + + + + + + functionblock + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + iResultC + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + operator + + + + + + + + + + + + + + + + + + + + + + + + + networktitle + + + + + + + eOperation + + + + + + + eOperationPrev + + + + + + + + 2 + + + + + + + 3 + + + + + + + 4 + + + + + + + 7 + + + + + + + 7 + + + + + + + 8 + + + + + + + 8 + + + + + + + 9 + + + + + + + 9 + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramSfc.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramSfc.xml new file mode 100644 index 0000000..ea16b29 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramSfc.xml @@ -0,0 +1,648 @@ + + + + + + + + + + + + + + + + + Init + + TRUE + + Init_Action + + FALSE + + 0 + + + + + + + + TRUE + + + + + + + + + + + + + + + + TRUE + + FALSE + + 0 + + + + + + + + + + + + + + + + + TRUE + + FALSE + + + + + + + + + + + + + + + + CallFB + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_CallFB + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + Evaluate + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_Evaluate + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + TRUE + + FALSE + + + + + + + + + + + + + + + + Wait + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_Wait + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + Test + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_Test + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + Timer.Q + + FALSE + + 0 + + + + + + + + + + + + + + + + StateMachine + + FALSE + + FALSE + + 0 + + + + + + + + + + + + + + + + + + A_StateMachine + + N + + FALSE + + 0 + + + + + + + + + + + + + + + + + + + + + + Timer.Q + + + + + + + + + + + + + + + + Timer.Q + + FALSE + + 0 + + + + + + + + + + + + + + Init + + FALSE + + + + + + + + + + iResultC +); + +]]> + + + + + + + 0 THEN + bZero := FALSE; + bPos := TRUE; + bNeg := FALSE; +ELSIF fbSFC_SamplePOU.iResultC < 0 THEN + bZero := FALSE; + bPos := FALSE; + bNeg := TRUE; +END_IF]]> + + + + + + + + + + + + + + TIME#500MS) AND (iResultC <= 0)) OR (Timer.ET <= TIME#500MS); +]]> + + + + + + + + + + + + + + + + + + + + IecSfc + System + 3.4.2.0 + IecSfc + + + + CurrentStep + + False + True + + + + + EnableLimit + + False + True + + + + + Error + + False + True + + + + + ErrorPOU + + False + True + + + + + ErrorStep + + False + True + + + + + Init + + False + True + + + + + Pause + + False + True + + + + + QuitError + + False + True + + + + + Reset + + False + True + + + + + Tip + + False + True + + + + + TipMode + + False + True + + + + + Trans + + False + True + + + + + False + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramSt.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramSt.xml new file mode 100644 index 0000000..bcc98b5 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationBins/Templates/TC3-AV09-IEC_TG/PouProgramSt.xml @@ -0,0 +1,65 @@ + + + + + + + + + TIME#500MS) AND (iResultC <= 0)) OR (Timer.ET <= TIME#500MS); + + +(* Timer *) +Timer(IN := TRUE, PT := tTimerValue); +IF Timer.Q THEN + Timer(IN := FALSE); + + (* State machine *) + CASE eOperation OF + eOp_Add: + eOperation := eOp_MUL; + eOp_Sub: + eOperation := eOp_ADD; + eOp_Mul: + eOperation := eOp_SUB; + END_CASE +END_IF + +(* FB Call *) +fbST_SamplePOU( + eOperation := eOperation, + iResultC => iResultC +); + +(* Evaluation *) +IF fbST_SamplePOU.iResultC = 0 THEN + bZero := TRUE; + bPos := FALSE; + bNeg := FALSE; +ELSIF fbST_SamplePOU.iResultC > 0 THEN + bZero := FALSE; + bPos := TRUE; + bNeg := FALSE; +ELSIF fbST_SamplePOU.iResultC < 0 THEN + bZero := FALSE; + bPos := FALSE; + bNeg := TRUE; +END_IF]]> + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo.sln b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo.sln new file mode 100644 index 0000000..fe5de9c --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.30501.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptingTestContainerBase", "ScriptingTestContainerBase\ScriptingTestContainerBase.csproj", "{84BF2917-6A6E-45B9-B1BB-3FB86C57756D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeGenerationDemo", "CodeGenerationDemo\CodeGenerationDemo.csproj", "{793BC15F-83EC-4670-A3BE-3005E9D27EC4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Debug|x64.ActiveCfg = Debug|x64 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Debug|x64.Build.0 = Debug|x64 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Debug|x86.ActiveCfg = Debug|x86 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Debug|x86.Build.0 = Debug|x86 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Release|Any CPU.Build.0 = Release|Any CPU + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Release|x64.ActiveCfg = Release|x64 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Release|x64.Build.0 = Release|x64 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Release|x86.ActiveCfg = Release|x86 + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D}.Release|x86.Build.0 = Release|x86 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Debug|x64.ActiveCfg = Debug|x64 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Debug|x64.Build.0 = Debug|x64 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Debug|x86.ActiveCfg = Debug|x86 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Debug|x86.Build.0 = Debug|x86 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Release|Any CPU.Build.0 = Release|Any CPU + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Release|x64.ActiveCfg = Release|x64 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Release|x64.Build.0 = Release|x64 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Release|x86.ActiveCfg = Release|x86 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/App.xaml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/App.xaml new file mode 100644 index 0000000..b9c1cb7 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/App.xaml.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/App.xaml.cs new file mode 100644 index 0000000..036307e --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/App.xaml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Windows; + +namespace CodeGenerationDemo +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/CodeGenerationDemo.csproj b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/CodeGenerationDemo.csproj new file mode 100644 index 0000000..59fbd27 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/CodeGenerationDemo.csproj @@ -0,0 +1,564 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {793BC15F-83EC-4670-A3BE-3005E9D27EC4} + WinExe + Properties + CodeGenerationDemo + CodeGenerationDemo + v4.0 + + + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + x86 + true + full + false + ..\Binaries\CodeGenerationBins\ + DEBUG;TRACE + prompt + 4 + true + + + x86 + pdbonly + true + ..\Binaries\CodeGenerationBins\ + TRACE + prompt + 4 + true + + + true + ..\Binaries\CodeGenerationBins\ + DEBUG;TRACE + full + AnyCPU + prompt + true + true + true + + + ..\Binaries\CodeGenerationBins\ + TRACE + true + pdbonly + AnyCPU + prompt + true + true + true + + + true + ..\Binaries\CodeGenerationBins\ + DEBUG;TRACE + full + x64 + prompt + true + true + true + + + ..\Binaries\CodeGenerationBins\ + TRACE + true + pdbonly + x64 + prompt + true + true + true + true + + + + False + ..\..\..\..\..\..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\envdte.dll + + + False + ..\..\..\..\..\..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\envdte100.dll + + + False + + + False + ..\..\..\..\..\..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\envdte90.dll + + + False + ..\..\..\..\..\..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\envdte90a.dll + + + + + + + + + + 4.0 + + + ..\SDK\TwinCAT.Measurement.AutomationInterface.dll + + + False + ..\Binaries\CodeGenerationBins\TwinCAT.Scope2.Communications.dll + + + + + + + + MSBuild:Compile + Designer + + + + + + Designer + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + Always + + + Always + + + Always + + + Always + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + + PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + Always + + + PreserveNewest + + + PreserveNewest + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + Always + + + Always + + + Always + + + + + {84BF2917-6A6E-45B9-B1BB-3FB86C57756D} + ScriptingTestContainerBase + + + + + + + + + + {3C49D6C3-93DC-11D0-B162-00A0248C244B} + 2 + 1 + 0 + primary + False + False + + + + + \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/CodeGenerationScript.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/CodeGenerationScript.cs new file mode 100644 index 0000000..dc680bd --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/CodeGenerationScript.cs @@ -0,0 +1,599 @@ +using System; +using System.IO; +using EnvDTE; +using EnvDTE100; +using EnvDTE80; +using TCatSysManagerLib; +using TwinCAT.SystemManager; +using System.Diagnostics; +using System.Timers; +using ScriptingTest; +using System.Xml; +using System.Collections.Generic; +using System.Reflection; +using Scripting.CSharp; + +namespace CodeGenerationDemo +{ + /// + /// Demonstrates the generation + compilation of PLC projects + /// + public abstract class CodeGenerationBaseScript + : ScriptEarlyBound + { + protected ITcSysManager4 systemManager = null; + protected Project project = null; + + /// + /// Handler function Initializing the Script (Configuration preparations) + /// + /// + /// Usually used to to the open a prepared or new XAE configuration + protected override void OnInitialize(IContext context) + { + base.OnInitialize(context); + } + + protected override void OnSolutionCreated() + { + string projectTemplate = null; + + if (string.IsNullOrEmpty(_context.ProjectTemplate)) + projectTemplate = VsXaeTemplatePath; + else + projectTemplate = Path.Combine(ApplicationDirectory, _context.ProjectTemplate); + + bool exists = File.Exists(projectTemplate); + + this.project = (Project)CreateNewProject(this.ScriptName, projectTemplate); + this.systemManager = (ITcSysManager4)project.Object; + //base.OnSolutionCreated(); + } + + /// + /// Cleaning up the XAE configuration after script execution. + /// + /// The worker. + protected override void OnCleanUp(IWorker worker) + { + base.OnCleanUp(worker); + } + + /// + /// Insertion Mode for creating PLC projects. + /// + public enum CreatePlcMode + { + /// + /// Copies a PLC Project + /// + Copy = 0, + /// + /// Moves a PLC Project + /// + Move = 1, + /// + /// References a PLC Project + /// + Reference = 2 + } + + public override string Description + { + get { return this.ScriptName; } + } + + protected void CreateMotion(IWorker worker) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + OrderScriptContext context = (OrderScriptContext)_context; + ConfigurationInfo configurationInfo = context.Order.ConfigurationInfo; + + ITcSmTreeItem ncConfig = systemManager.LookupTreeItem("TINC"); + + foreach (TaskInfo taskInfo in configurationInfo.MotionTasks) + { + ITcSmTreeItem task = null; + + worker.ProgressStatus = string.Format("Creating Motion Task '{0}'", taskInfo.Name); + + if (!TryLookupChild(ncConfig, taskInfo.Name, out task)) + { + task = ncConfig.CreateChild(taskInfo.Name, 1); + } + ITcSmTreeItem axes = null; + TryLookupChild(task, "Axes", out axes); + + if (axes == null) + TryLookupChild(task, "Achsen", out axes); + + foreach (AxisInfo axisInfo in taskInfo.Axes) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + ITcSmTreeItem axis = null; + worker.ProgressStatus = string.Format("Creating Axis '{0}'", axisInfo.Name); + + if (!TryLookupChild(axes, axisInfo.Name, out axis)) + { + axis = axes.CreateChild(axisInfo.Name, 1); + ConsumeTemplate(axis, axisInfo.TemplatePath); + } + } + } + } + + protected void CreateMappings(IWorker worker) + { + OrderScriptContext context = (OrderScriptContext)_context; + ConfigurationInfo configurationInfo = context.Order.ConfigurationInfo; + + MappingsInfo info = configurationInfo.Mappings; + + if (info != null) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + worker.ProgressStatus = "Generating mappings ..."; + ConsumeMappings(info.TemplatePath); + } + } + + protected ITcSmTreeItem CreatePlcProject(IWorker worker) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + OrderScriptContext context = (OrderScriptContext)_context; + ConfigurationInfo configurationInfo = context.Order.ConfigurationInfo; + + string plcProjectName = configurationInfo.PlcProjectName; + ITcSmTreeItem plcConfig = systemManager.LookupTreeItem("TIPC"); + + worker.ProgressStatus = string.Format("Creating empty PLC Project '{0}' ...",plcProjectName); + ITcSmTreeItem plcProjectRoot = plcConfig.CreateChild(plcProjectName, 0, "", vsXaePlcEmptyTemplateName); + + ITcPlcProject plcProjectRootIec = (ITcPlcProject) plcProjectRoot; + plcProjectRootIec.BootProjectAutostart = true; + plcProjectRootIec.GenerateBootProject(true); + + ITcSmTreeItem plcProject = plcProjectRoot.LookupChild(plcProjectName + " Project"); + + foreach (PlcObjectInfo plcObjectInfo in context.Order.ConfigurationInfo.PlcObjects) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + switch (plcObjectInfo.Type) + { + case PlcObjectType.DataType: + createWorksheet((WorksheetInfo)plcObjectInfo, plcProject, worker); + break; + case PlcObjectType.Library: + createLibrary((LibraryInfo)plcObjectInfo,plcProject, worker); + break; + case PlcObjectType.Placeholder: + createPlaceholder((PlaceholderInfo)plcObjectInfo, plcProject, worker); + break; + case PlcObjectType.POU: + createWorksheet((WorksheetInfo)plcObjectInfo, plcProject, worker); + break; + case PlcObjectType.Itf: + createWorksheet((WorksheetInfo)plcObjectInfo, plcProject, worker); + break; + case PlcObjectType.Gvl: + createWorksheet((WorksheetInfo)plcObjectInfo, plcProject, worker); + break; + default: + Debug.Fail(""); + break; + } + } + + ITcSmTreeItem realtimeTasks = systemManager.LookupTreeItem("TIRT"); + ITcSmTreeItem rtTask = realtimeTasks.CreateChild("PlcTask", TreeItemType.Task.AsInt32()); + + ITcSmTreeItem taskRef = null; + worker.ProgressStatus = "Linking PLC instance with task 'PlcTask' ..."; + + if (!TryLookupChild(plcProject, "PlcTask", out taskRef)) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + taskRef = plcProject.CreateChild("PlcTask", TreeItemType.PlcTask.AsInt32(), "", "MAIN"); + } + + //foreach (ITcSmTreeItem prog in taskRef) + //{ + // string name = prog.Name; + //} + + //ErrorItems errors; + + //if (worker.CancellationPending) + // throw new Exception("Execution cancelled!"); + + //bool ok = CompileProject(worker, out errors); + + //if (!ok) + // throw new ApplicationException(string.Format("Plc Project compile produced '{0}' errors. Please see Visual Studio Error Window for details.!", plcProject.Name)); + + return plcProject; + } + + private ITcSmTreeItem createWorksheet(WorksheetInfo info, ITcSmTreeItem plcProject, IWorker worker) + { + string[] plcSide = info.PlcPath.Split('/','\\','^'); + + ITcSmTreeItem parent = plcProject; + ITcSmTreeItem ret = null; + + for (int index = 0; index < plcSide.Length; index++) + { + // Create Folder if not exist + ITcSmTreeItem child = null; + + if (!TryLookupChild(parent, plcSide[index], out child)) + { + child = createPlcFolder(parent, plcSide[index], null, worker); + } + parent = child; + } + + ret = createWorksheet2(info, parent, worker); + return ret; + } + + private void createLibrary(LibraryInfo info, ITcSmTreeItem plcProject, IWorker worker) + { + worker.ProgressStatus = string.Format("Adding Library '{0}' ...", info.LibraryName); + + ITcSmTreeItem referencesItem = plcProject.LookupChild("References"); + ITcPlcLibraryManager libraryManager = (ITcPlcLibraryManager)referencesItem; + libraryManager.AddLibrary(info.LibraryName); + } + + private void createPlaceholder(PlaceholderInfo info, ITcSmTreeItem plcProject, IWorker worker) + { + worker.ProgressStatus = string.Format("Adding Placeholder '{0}' ...", info.PlaceholderName); + + ITcSmTreeItem referencesItem = plcProject.LookupChild("References"); + ITcPlcLibraryManager libraryManager = (ITcPlcLibraryManager)referencesItem; + libraryManager.AddPlaceholder(info.PlaceholderName); + } + + + protected ITcSmTreeItem CreateHardware(IWorker worker, bool scanHardware, bool simulation) + { + OrderScriptContext context = (OrderScriptContext)_context; + ConfigurationInfo configurationInfo = context.Order.ConfigurationInfo; + HardwareInfo hardware = configurationInfo.Hardware; + + ITcSmTreeItem devices = systemManager.LookupTreeItem("TIID"); // Getting IO-Configuration + ITcSmTreeItem device = null; + + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + // Scans the Fieldbus interfaces and adds an EtherCAT Device. + string deviceName = "EtherCAT Master"; + worker.ProgressStatus = string.Format("Creating device '{0}'", deviceName); + device = Helper.CreateEthernetDevice(this.systemManager, DeviceType.EtherCAT_DirectMode, deviceName, worker); + + ITcSmTreeItem parent = device; + + foreach (BoxInfo boxInfo in hardware.Boxes) + { + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + ITcSmTreeItem box = CreateBox(parent, boxInfo, worker); + } + + return device; + } + + private ITcSmTreeItem CreateBox(ITcSmTreeItem parent, BoxInfo boxInfo, IWorker worker) + { + worker.ProgressStatus = string.Format("Creating Box '{0}' ({1})...", boxInfo.Name,boxInfo.Type); + ITcSmTreeItem ret = parent.CreateChild(boxInfo.Name, (int)BoxType.EtherCAT_EXXXXX, "", boxInfo.Type); + + if (boxInfo.ChildBoxes != null) + { + foreach (BoxInfo child in boxInfo.ChildBoxes) + { + ITcSmTreeItem tcChild = CreateBox(ret, child, worker); + } + + } + + return ret; + } + + #region Helpers + private ITcSmTreeItem createPlcFolder(ITcSmTreeItem parent, string folderName, string before, IWorker worker) + { + worker.ProgressStatus = string.Format("Creating Folder '{0}' ...", folderName); + ITcSmTreeItem item = parent.CreateChild(folderName, TreeItemType.PlcFolder.AsInt32(), before, null); + return item; + } + + private ITcSmTreeItem createWorksheet2(WorksheetInfo info, ITcSmTreeItem parent, IWorker worker) + { + string template = Path.Combine(ApplicationDirectory, info.TemplatePath); + + XmlDocument doc = new XmlDocument(); + doc.Load(template); + + ITcSmTreeItem ret = null; + + switch (info.Type) + { + case PlcObjectType.DataType: + ret = createDut((DataTypeInfo)info,parent, worker, doc); + break; + case PlcObjectType.POU: + ret = createPou((POUInfo)info, parent, worker, doc); + break; + case PlcObjectType.Itf: + ret = createItf((ItfInfo)info,parent, worker, doc); + break; + case PlcObjectType.Gvl: + ret = createGvl((GvlInfo)info,parent,worker,doc); + break; + default: + Debug.Fail(""); + break; + } + + return ret; + } + + private ITcSmTreeItem createPou(POUInfo pouInfo, ITcSmTreeItem parent, IWorker worker, XmlDocument doc) + { + XmlNode pouNode = doc.SelectSingleNode("TcPlcObject/POU"); + string pouName = pouNode.Attributes["Name"].Value; + + worker.ProgressStatus = string.Format("Creating POU '{0}' ...", pouName); + + ITcSmTreeItem item = null; + + if (!TryLookupChild(parent, pouName, out item)) + { + item = parent.CreateChild(pouName, TreeItemType.PlcPouFunctionBlock.AsInt32(),"",null); + } + ITcPlcPou pou = (ITcPlcPou)item; + + pou.DocumentXml = doc.OuterXml; + return item; + } + + private ITcSmTreeItem createItf(ItfInfo itfInfo, ITcSmTreeItem parent, IWorker worker, XmlDocument doc) + { + XmlNode itfNode = doc.SelectSingleNode("TcPlcObject/Itf"); + string itfName = itfNode.Attributes["Name"].Value; + + worker.ProgressStatus = string.Format("Creating Interface '{0}' ...", itfName); + + ITcSmTreeItem item = null; + XmlElement node = (XmlElement)doc.SelectSingleNode("TcPlcObject/Itf/Declaration"); + + string declString = node.InnerText; + + if (!TryLookupChild(parent, itfName, out item)) + { + item = parent.CreateChild(itfName, TreeItemType.PlcInterface.AsInt32(),"",declString); + } + + //Debug.Fail(""); + ITcXmlDocument xmlDoc = (ITcXmlDocument)item; + xmlDoc.DocumentXml = doc.OuterXml; + ITcPlcDeclaration decl = (ITcPlcDeclaration)item; + //decl.DeclarationText = node.InnerText; + return item; + } + + private ITcSmTreeItem createGvl(GvlInfo gvlInfo, ITcSmTreeItem parent, IWorker worker, XmlDocument doc) + { + XmlNode gvlNode = doc.SelectSingleNode("TcPlcObject/GVL"); + string gvlName = gvlNode.Attributes["Name"].Value; + + worker.ProgressStatus = string.Format("Creating GlobalVariable Sheet '{0}' ...", gvlName); + + ITcSmTreeItem item = null; + + if (!TryLookupChild(parent, gvlName, out item)) + { + item = parent.CreateChild(gvlName, TreeItemType.PlcGvl.AsInt32()); + } + + ITcXmlDocument xmlDoc = (ITcXmlDocument)item; + ITcPlcDeclaration decl = (ITcPlcDeclaration)item; + + XmlElement node = (XmlElement)doc.SelectSingleNode("TcPlcObject/GVL/Declaration"); + decl.DeclarationText = node.InnerText; + return item; + } + + private ITcSmTreeItem createDut(DataTypeInfo info, ITcSmTreeItem parent, IWorker worker, XmlDocument doc) + { + XmlNode dutNode = doc.SelectSingleNode("TcPlcObject/DUT"); + string typeName = dutNode.Attributes["Name"].Value; + + worker.ProgressStatus = string.Format("Creating Type '{0}' ...", typeName); + + XmlNode declNode = dutNode.SelectSingleNode("Declaration"); + string declaration = string.Empty; + declaration = declNode.InnerText; + + ITcSmTreeItem dataTypeItem = parent.CreateChild(typeName, TreeItemType.PlcDutStruct.AsInt32(), "", declaration); + + ITcPlcDeclaration decl = (ITcPlcDeclaration)dataTypeItem; + ITcXmlDocument tcDoc = (ITcXmlDocument)dataTypeItem; + + string xml = tcDoc.DocumentXml; + + return dataTypeItem; + } + + private bool TryLookupChild(ITcSmTreeItem parent, string childName, out ITcSmTreeItem child) + { + foreach (ITcSmTreeItem c in parent) + { + if (c.Name == childName) + { + child = c; + return true; + } + } + child = null; + return false; + } + + private bool TryLookupChild2(ITcSmTreeItem parent, string childName, out ITcSmTreeItem child) + { + try + { + child = parent.LookupChild(childName); + return true; + } + catch + { + child = null; + return false; + } + } + + private bool TryLookupChild3(ITcSmTreeItem parent, string childName, out ITcSmTreeItem child) + { + string parentPath = parent.PathName; + string path = parentPath + "^" + childName; + + return TryLookupTreeItem(path, out child); + + } + + + private bool TryLookupTreeItem(string itemPath, out ITcSmTreeItem treeItem) + { + try + { + treeItem = this.systemManager.LookupTreeItem(itemPath); + return true; + } + catch + { + treeItem = null; + return false; + } + } + + #endregion + + + private void ConsumeTemplate(ITcSmTreeItem item, string templatePath) + { + string templ = Path.Combine(ApplicationDirectory,templatePath); + + XmlTextReader reader = new XmlTextReader(templ); + reader.MoveToContent(); + item.ConsumeXml(reader.ReadOuterXml()); + } + + private void ConsumeMappings(string templatePath) + { + string templ = Path.Combine(ApplicationDirectory,templatePath); + XmlTextReader reader = new XmlTextReader(templ); + reader.MoveToContent(); + systemManager.ConsumeMappingInfo(reader.ReadOuterXml()); + } + + private bool CompileProject(IWorker worker, out ErrorItems errors) + { + bool buildSucceeded = false; + + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + worker.ProgressStatus = "Compiling project ..."; + + dte.Solution.SolutionBuild.Build(true); + buildSucceeded = waitForBuildAndCheckErrors(worker, out errors); + + if (!buildSucceeded) + { + int overallMessages = errors.Count; + + int errorCount = 0; + int warningCount = 0; + int messageCount = 0; + + for (int i = 1; i <= overallMessages; i++) // List is starting from 1!!! + { + ErrorItem item = errors.Item(i); + + if (item.ErrorLevel == vsBuildErrorLevel.vsBuildErrorLevelHigh) + { + errorCount++; + worker.ProgressStatus = "Compiler error: " + item.Description; + } + else if (item.ErrorLevel == vsBuildErrorLevel.vsBuildErrorLevelMedium) + { + warningCount++; + worker.ProgressStatus = "Compiler warning: " + item.Description; + } + else if (item.ErrorLevel == vsBuildErrorLevel.vsBuildErrorLevelLow) + { + messageCount++; + worker.ProgressStatus = "Compiler message: " + item.Description; + } + + } + } + else + { + worker.ProgressStatus = "Build Succeeded!"; + } + + if (worker.CancellationPending) + throw new Exception("Execution cancelled!"); + + return buildSucceeded; + } + + private bool waitForBuildAndCheckErrors(IWorker worker, out ErrorItems errorItems) + { + bool buildSucceeded = false; + vsBuildState state = dte.Solution.SolutionBuild.BuildState; + + while (state == vsBuildState.vsBuildStateInProgress) + { + System.Threading.Thread.Sleep(500); + + if (worker.CancellationPending) + { + dte.ExecuteCommand("Build.Cancel"); + + } + state = dte.Solution.SolutionBuild.BuildState; + } + + buildSucceeded = (dte.Solution.SolutionBuild.LastBuildInfo == 0 && state == vsBuildState.vsBuildStateDone); + + // The ErrorList is not significant for the succeeded Build!!! + // Because the PLC Project can contain errors within not used types. + // Relevant is only the "LastBuildInfo" object that contains the numer of failed project compilations! + + ErrorList errorList = dte.ToolWindows.ErrorList; + errorItems = errorList.ErrorItems; + + + return buildSucceeded; + } + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptA.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptA.cs new file mode 100644 index 0000000..739a296 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptA.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using EnvDTE; +using EnvDTE100; +using EnvDTE80; +using TCatSysManagerLib; +using TwinCAT.SystemManager; +using System.Diagnostics; +using System.Timers; +using ScriptingTest; +using System.Xml; +using System.Collections.Generic; +using System.Reflection; + +namespace CodeGenerationDemo +{ + /// + /// Demonstrates the generation + compilation of PLC projects + /// + public class ConfigurationScriptA + : CodeGenerationBaseScript + { + /// + /// Handler function Executing the Script code. + /// + /// The worker. + protected override void OnExecute(IWorker worker) + { + worker.Progress = 0; + + bool optScanHardware = this._context.Parameters.ContainsKey("ScanHardware"); + bool optSimulate = this._context.Parameters.ContainsKey("SimulateHardware"); + + ITcSmTreeItem ncConfig = systemManager.LookupTreeItem("TINC"); // Getting NC Configuration + ITcSmTreeItem plcConfig = systemManager.LookupTreeItem("TIPC"); // Getting PLC-Configuration + ITcSmTreeItem devices = systemManager.LookupTreeItem("TIID"); // Getting IO-Configuration + + ITcSmTreeItem device = CreateHardware(worker,optScanHardware,optSimulate); + + CreatePlcProject(worker); + CreateMotion(worker); + CreateMappings(worker); + } + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptB.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptB.cs new file mode 100644 index 0000000..df0546f --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptB.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using EnvDTE; +using EnvDTE100; +using EnvDTE80; +using TCatSysManagerLib; +using TwinCAT.SystemManager; +using System.Diagnostics; +using System.Timers; +using ScriptingTest; +using System.Xml; +using System.Collections.Generic; +using System.Reflection; + +namespace CodeGenerationDemo +{ + /// + /// Demonstrates the generation + compilation of PLC projects + /// + public class ConfigurationScriptB + : CodeGenerationBaseScript + { + /// + /// Handler function Executing the Script code. + /// + /// The worker. + protected override void OnExecute(IWorker worker) + { + worker.Progress = 0; + + bool optScanHardware = this._context.Parameters.ContainsKey("ScanHardware"); + bool optSimulate = this._context.Parameters.ContainsKey("SimulateHardware"); + + ITcSmTreeItem ncConfig = systemManager.LookupTreeItem("TINC"); // Getting NC Configuration + ITcSmTreeItem plcConfig = systemManager.LookupTreeItem("TIPC"); // Getting PLC-Configuration + ITcSmTreeItem devices = systemManager.LookupTreeItem("TIID"); // Getting IO-Configuration + + ITcSmTreeItem device = CreateHardware(worker, optScanHardware, optSimulate); + + CreatePlcProject(worker); + CreateMotion(worker); + CreateMappings(worker); + } + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptC.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptC.cs new file mode 100644 index 0000000..e8e41cf --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptC.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using EnvDTE; +using EnvDTE100; +using EnvDTE80; +using TCatSysManagerLib; +using TwinCAT.SystemManager; +using System.Diagnostics; +using System.Timers; +using ScriptingTest; +using System.Xml; +using System.Collections.Generic; +using System.Reflection; + +namespace CodeGenerationDemo +{ + /// + /// Demonstrates the generation + compilation of PLC projects + /// + public class ConfigurationScriptC + : CodeGenerationBaseScript + { + /// + /// Handler function Executing the Script code. + /// + /// The worker. + protected override void OnExecute(IWorker worker) + { + worker.Progress = 0; + + bool optScanHardware = this._context.Parameters.ContainsKey("ScanHardware"); + bool optSimulate = this._context.Parameters.ContainsKey("SimulateHardware"); + + ITcSmTreeItem ncConfig = systemManager.LookupTreeItem("TINC"); // Getting NC Configuration + ITcSmTreeItem plcConfig = systemManager.LookupTreeItem("TIPC"); // Getting PLC-Configuration + ITcSmTreeItem devices = systemManager.LookupTreeItem("TIID"); // Getting IO-Configuration + + ITcSmTreeItem device = CreateHardware(worker, optScanHardware, optSimulate); + + CreatePlcProject(worker); + CreateMotion(worker); + CreateMappings(worker); + } + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptD.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptD.cs new file mode 100644 index 0000000..b5eed6e --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/ConfigurationScriptD.cs @@ -0,0 +1,152 @@ +using System; +using System.IO; +using EnvDTE; +using EnvDTE100; +using EnvDTE80; +using TCatSysManagerLib; +using TwinCAT.SystemManager; +using System.Diagnostics; +using System.Timers; +using ScriptingTest; +using System.Xml; +using System.Collections.Generic; +using System.Reflection; +using TwinCAT.Measurement.AutomationInterface; + +namespace CodeGenerationDemo +{ + /// + /// Demonstrates the generation + compilation of PLC and Measurement projects + /// + public class ConfigurationScriptD + : CodeGenerationBaseScript + { + /// + /// Handler function Executing the Script code. + /// + /// The worker. + protected override void OnExecute(IWorker worker) + { + worker.Progress = 0; + + bool optScanHardware = this._context.Parameters.ContainsKey("ScanHardware"); + bool optSimulate = this._context.Parameters.ContainsKey("SimulateHardware"); + + ITcSmTreeItem ncConfig = systemManager.LookupTreeItem("TINC"); // Getting NC Configuration + ITcSmTreeItem plcConfig = systemManager.LookupTreeItem("TIPC"); // Getting PLC-Configuration + ITcSmTreeItem devices = systemManager.LookupTreeItem("TIID"); // Getting IO-Configuration + + ITcSmTreeItem plcProject = CreatePlcProject(worker); + + SetTaskCycleTime(10000, worker); + + worker.ProgressStatus = "Activating configuration ..."; + + systemManager.ActivateConfiguration(); + + worker.ProgressStatus = "Restarting TwinCAT ..."; + + systemManager.StartRestartTwinCAT(); + + System.Threading.Thread.Sleep(5000); + + CreateScopeProject(worker); + } + + private void SetTaskCycleTime(int cycleTime, IWorker worker) + { + worker.ProgressStatus = "Setting task cycle time ..."; + string xmlCycleTime = "" + cycleTime + ""; + ITcSmTreeItem task = systemManager.LookupTreeItem("TIRT^PlcTask"); + task.ConsumeXml(xmlCycleTime); + } + + private void CreateScopeProject(IWorker worker) + { + string scopeTemplate = @"C:\TwinCAT\Functions\TE130X-Scope-View\Templates\Projects\Measurement Scope Project.tcmproj"; + string scopeDestination = this.ScriptRootFolder; + string scopeName = "FunctionGeneratorScopeSample"; + + worker.ProgressStatus = "Adding TwinCAT Measurement project ..."; + + Project scopeProject = dte.Solution.AddFromTemplate(scopeTemplate, scopeDestination, scopeName); + + System.Threading.Thread.Sleep(3000); + + worker.ProgressStatus = "Opening Scope control ..."; + + ((IMeasurementScope)scopeProject.ProjectItems.Item(1).Object).ShowControl(); + + worker.ProgressStatus = "Creating new chart ..."; + + ProjectItem ChartPI; + ((IMeasurementScope)scopeProject.ProjectItems.Item(1).Object).CreateChild(out ChartPI); + IMeasurementScope ChartMI = (IMeasurementScope)ChartPI.Object; + ChartMI.ChangeName("Rectangle and Sinus Chart"); + setProperty("StackedYAxis", ChartPI.Properties, true); + + worker.ProgressStatus = "Creating axis for sinus signal ..."; + + ProjectItem AxisPI1; + ChartMI.CreateChild(out AxisPI1); + IMeasurementScope AxisMI1 = (IMeasurementScope)AxisPI1.Object; + AxisMI1.ChangeName("Axis 1"); + + worker.ProgressStatus = "Creating axis for rectangle signal ..."; + + ProjectItem AxisPI2; + ChartMI.CreateChild(out AxisPI2); + IMeasurementScope AxisMI2 = (IMeasurementScope)AxisPI2.Object; + AxisMI2.ChangeName("Axis 2"); + + worker.ProgressStatus = "Creating channel to PLC symbol for sinus signal ..."; + + ProjectItem ChannelPI1; + AxisMI1.CreateChild(out ChannelPI1); + IMeasurementScope ChannelMI1 = (IMeasurementScope)ChannelPI1.Object; + + ChannelMI1.ChangeName("Sinus"); + setProperty("TargetPorts", ChannelPI1.Properties, "851"); + setProperty("Symbolbased", ChannelPI1.Properties, true); + setProperty("SymbolDataType", ChannelPI1.Properties, TwinCAT.Scope2.Communications.Scope2DataType.REAL64); + setProperty("SymbolName", ChannelPI1.Properties, "MAIN.aSineBuffer"); + setProperty("SampleState", ChannelPI1.Properties, 1); + setProperty("LineWidth", ChannelPI1.Properties, 3); + + worker.ProgressStatus = "Creating channel to PLC symbol for rectangle signal ..."; + + ProjectItem ChannelPI2; + AxisMI2.CreateChild(out ChannelPI2); + IMeasurementScope ChannelMI2 = (IMeasurementScope)ChannelPI2.Object; + + ChannelMI2.ChangeName("Rectangle"); + setProperty("TargetPorts", ChannelPI2.Properties, "851"); + setProperty("Symbolbased", ChannelPI2.Properties, true); + setProperty("SymbolDataType", ChannelPI2.Properties, TwinCAT.Scope2.Communications.Scope2DataType.REAL64); + setProperty("SymbolName", ChannelPI2.Properties, "MAIN.aSquareBuffer"); + setProperty("SampleState", ChannelPI2.Properties, 1); + setProperty("LineWidth", ChannelPI2.Properties, 3); + + worker.ProgressStatus = "Starting Scope record ..."; + + ((IMeasurementScope)scopeProject.ProjectItems.Item(1).Object).StartRecord(); + + System.Threading.Thread.Sleep(5000); + + worker.ProgressStatus = "Stopping Scope record ..."; + + ((IMeasurementScope)scopeProject.ProjectItems.Item(1).Object).StopRecord(); + } + + private void setProperty(string name, EnvDTE.Properties props, object value) + { + foreach (Property p in props) + if (p.Name.ToLower().Equals(name.ToLower())) + { + object oldvalue = p.Value; + p.Value = value; + return; + } + } + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/Orders.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/Orders.xml new file mode 100644 index 0000000..28e5dee --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/Orders.xml @@ -0,0 +1,167 @@ + + + + ConfigA + Beckhoff Automation GmbH + 2012-11-30 + 10001 + Test01 + Please run extended Hardware Test! + + + ConfigB + Beckhoff Automation GmbH + 2013-02-28 + 10051 + Test02 + Deliver together with Serial number 10039 + + + ConfigD + Beckhoff Automation GmbH + 2013-11-12 + 10042 + Test03 + Include Hardware Simulation + + + + + + + + + + + 2-Axes, PTP Motion, Servo Terminal not included + + MachineTypeA + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/MachineTypeA/POUs/FB_Axis.xml + Templates/MachineTypeA/POUs/MAIN.xml + > + + + + + Templates/MachineTypeA/Axis1.xml + Templates/MachineTypeA/Axis2.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeA/Links.xml + + + + + + + + + 4-Axes, NCI + + MachineTypeB + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_NCI + Templates/MachineTypeB/Datatypes/E_Commands.xml + Templates/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml + Templates/MachineTypeB/Datatypes/E_States.xml + Templates/MachineTypeB/GVLs/GlobalVariables.xml + Templates/MachineTypeB/POUs/FB_NciChannel.xml + Templates/MachineTypeB/POUs/FB_NciSequence.xml + Templates/MachineTypeB/POUs/MAIN.xml + + + + + + Templates/MachineTypeB/Axis1.xml + Templates/MachineTypeB/Axis2.xml + Templates/MachineTypeB/Axis3.xml + Templates/MachineTypeB/Axis4.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeB/Links.xml + + + + + + PLC project, Measurement project + + MachineTypeD + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Templates/MachineTypeD/Datatypes/E_FunctionType.xml + Templates/MachineTypeD/POUs/FB_FunctionGenerator.xml + Templates/MachineTypeD/POUs/MAIN.xml + Templates/MachineTypeD/GVLs/GVL_Constants.xml + + + + + + + + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/OrdersStandard.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/OrdersStandard.xml new file mode 100644 index 0000000..29cbf21 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/OrdersStandard.xml @@ -0,0 +1,213 @@ + + + + ConfigA + Beckhoff Automation GmbH + 2012-11-30 + 10001 + Test01 + Test01 + + + ConfigB + Beckhoff Automation GmbH + 2013-02-28 + 10051 + Test02 + Test01 + + + ConfigC + Beckhoff Automation GmbH + 2013-05-15 + 10077 + Test03 + Test01 + + + + + + + + + + + Test01 + + MachineTypeA + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/MachineTypeA/POUs/FB_Axis.xml + Templates/MachineTypeA/POUs/MAIN.xml + > + + + + + Templates/MachineTypeA/Axis1.xml + Templates/MachineTypeA/Axis2.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeA/Links.xml + + + + + + + + + Test01 + + MachineTypeB + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_NCI + Templates/MachineTypeB/Datatypes/E_Commands.xml + Templates/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml + Templates/MachineTypeB/Datatypes/E_States.xml + Templates/MachineTypeB/GVLs/GlobalVariables.xml + Templates/MachineTypeB/POUs/FB_NciChannel.xml + Templates/MachineTypeB/POUs/FB_NciSequence.xml + Templates/MachineTypeB/POUs/MAIN.xml + + + + + + Templates/MachineTypeB/Axis1.xml + Templates/MachineTypeB/Axis2.xml + Templates/MachineTypeB/Axis3.xml + Templates/MachineTypeB/Axis4.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeB/Links.xml + + + + + + + + + Test01 + + MachineTypeC + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/MachineTypeC/Datatypes/E_AxisState.xml + Templates/MachineTypeC/Datatypes/E_MoveCmd.xml + Templates/MachineTypeC/POUs/FB_Table.xml + Templates/MachineTypeC/POUs/MAIN.xml + Templates/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml + Templates/MachineTypeC/POUs/Axis/FB_NcAxis.xml + Templates/MachineTypeC/POUs/Axis/IAxis.xml + + + + + + Templates/MachineTypeC/AxisX.xml + Templates/MachineTypeA/AxisY.xml + Templates/MachineTypeA/AxisY.xml + + + + + + + + + + + + + + + + + + + + + Templates/MachineTypeC/Links.xml + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/ReadMe.txt b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/ReadMe.txt new file mode 100644 index 0000000..0dc324d --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/ReadMe.txt @@ -0,0 +1 @@ +Rename the Orders Xml File simply to Orders.xml to activate the Machine-dependent Version \ No newline at end of file diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/TC3_AU08-IEC-IC_Orders.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/TC3_AU08-IEC-IC_Orders.xml new file mode 100644 index 0000000..e811b22 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/TC3_AU08-IEC-IC_Orders.xml @@ -0,0 +1,213 @@ + + + + ConfigA + Beckhoff Automation GmbH + 2012-11-30 + 10001 + Test01 + Please run extended Hardware Test! + + + ConfigB + Beckhoff Automation GmbH + 2013-02-28 + 10051 + Test02 + Deliver together with Serial number 10039 + + + ConfigC + Beckhoff Automation GmbH + 2013-05-15 + 10077 + Test03 + Include Hardware Simulation + + + + + + + + + + + 2-Axes, PTP Motion + + MachineTypeA + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/FB_Axis.xml + Templates/TC3-AU08-IEC-IC/MachineTypeA/POUs/MAIN.xml + > + + + + + Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis1.xml + Templates/TC3-AU08-IEC-IC/MachineTypeA/Axis2.xml + + + + + + + + + + + + + + + + + + + + + Templates/TC3-AU08-IEC-IC/MachineTypeA/Links.xml + + + + + + + + + 4-Axes, NCI + + MachineTypeB + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_NCI + Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_Commands.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/Datatypes/E_States.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/GVLs/GlobalVariables.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciChannel.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/FB_NciSequence.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/POUs/MAIN.xml + + + + + + Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis1.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis2.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis3.xml + Templates/TC3-AU08-IEC-IC/MachineTypeB/Axis4.xml + + + + + + + + + + + + + + + + + + + + + Templates/TC3-AU08-IEC-IC/MachineTypeB/Links.xml + + + + + + + + + 3-Axes, PTP Motion + + MachineTypeC + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_AxisState.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/Datatypes/E_MoveCmd.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/FB_Table.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/MAIN.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/FB_NcAxis.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/POUs/Axis/IAxis.xml + + + + + + Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisX.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisY.xml + Templates/TC3-AU08-IEC-IC/MachineTypeC/AxisZ.xml + + + + + + + + + + + + + + + + + + + + + Templates/TC3-AU08-IEC-IC/MachineTypeC/Links.xml + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/TC3_AV09-IEC-TG_Orders.xml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/TC3_AV09-IEC-TG_Orders.xml new file mode 100644 index 0000000..712ce7d --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/Data/TC3_AV09-IEC-TG_Orders.xml @@ -0,0 +1,216 @@ + + + + ConfigA + Beckhoff Automation GmbH + 2012-11-30 + 10001 + Test01 + Test01 + + + ConfigB + Beckhoff Automation GmbH + 2013-02-28 + 10051 + Test02 + Test01 + + + ConfigC + Beckhoff Automation GmbH + 2013-05-15 + 10077 + Test03 + Test01 + + + + + + + + + + + 2-Axes, PTP Motion, Servo Terminals included + + MachineTypeA + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/FB_Axis.xml + Templates/TC3-AV09-IEC_TG/MachineTypeA/POUs/MAIN.xml + > + + + + + Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis1.xml + Templates/TC3-AV09-IEC_TG/MachineTypeA/Axis2.xml + + + + + + + + + + + + + + + + + + + + + + Templates/TC3-AV09-IEC_TG/MachineTypeA/Links.xml + + + + + + + + + 4-Axes, NCI, Servo Terminals included + + MachineTypeB + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_NCI + Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_Commands.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_NCI_CTRL_STATE.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/Datatypes/E_States.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/GVLs/GlobalVariables.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciChannel.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/FB_NciSequence.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/POUs/MAIN.xml + + + + + + Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis1.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis2.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis3.xml + Templates/TC3-AV09-IEC_TG/MachineTypeB/Axis4.xml + + + + + + + + + + + + + + + + + + + + + + Templates/TC3-AV09-IEC_TG/MachineTypeB/Links.xml + + + + + + + + + 3-Axes, PTP Motion, Servo Terminals included + + MachineTypeC + + + Tc2_Standard + Tc2_System + Tc3_Interfaces + Tc3_Module + Tc2_MC2 + Tc2_MC2_Drive + Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_AxisState.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/Datatypes/E_MoveCmd.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/FB_Table.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/MAIN.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_AX5000Axis.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/FB_NcAxis.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/POUs/Axis/IAxis.xml + + + + + + Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisX.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisY.xml + Templates/TC3-AV09-IEC_TG/MachineTypeC/AxisZ.xml + + + + + + + + + + + + + + + + + + + + + + Templates/TC3-AV09-IEC_TG/MachineTypeC/Links.xml + + + + + + + diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/DataModel.cs b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/DataModel.cs new file mode 100644 index 0000000..a15c08d --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/DataModel.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml; +using System.ComponentModel; + +namespace CodeGenerationDemo +{ + /* =============================================================================================== + * This class reads machine configurations from Orders.xml and creates a new object representation of + * this configuration via classes ConfigurationInfo and OrderInfo from ScriptInfo.cs. + * =============================================================================================== */ + public class DataModel : INotifyPropertyChanged + { + public DataModel() {} + + public void Load() + { + XmlDocument doc = new XmlDocument(); + doc.Load(@".\Orders.xml"); + + XmlNodeList configurationNodes = doc.SelectNodes("Root/AvailableConfigurations/Configuration"); + + foreach (XmlElement configurationNode in configurationNodes) + { + _configurations.Add(new ConfigurationInfo(configurationNode)); + } + + XmlNodeList orderNodes = doc.SelectNodes("Root/MachineOrders/Order"); + + foreach (XmlElement orderNode in orderNodes) + { + _orders.Add(new OrderInfo(orderNode)); + } + + if (PropertyChanged != null) + { + OnPropertyChanged(new PropertyChangedEventArgs("Orders")); + } + } + + OrderCollection _orders = new OrderCollection(); + + public OrderCollection Orders + { + get { return _orders; } + } + + ConfigurationCollection _configurations = new ConfigurationCollection(); + + public ConfigurationCollection Configurations + { + get { return _configurations; } + } + + + #region INotifyPropertyChanged Members + + /// + /// Occurs when a property value changes. + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + + private void OnPropertyChanged(PropertyChangedEventArgs args) + { + if (PropertyChanged != null) + { + PropertyChanged(this, args); + } + } + } +} diff --git a/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/MainWindow.xaml b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/MainWindow.xaml new file mode 100644 index 0000000..9b73686 --- /dev/null +++ b/src/build-server/samples/CodeGenerationDemoSrc/CodeGenerationDemo/MainWindow.xaml @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + Customer: + + Configuration: + + Delivery: + + + + + + + + + + + + + + + + + + + + Order Details: + + Machine Configuration: + + Configuration Details: + + Customer: + + Delivery: + + Serial Number: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +