Skip to content

Commit f670b66

Browse files
authored
Merge pull request #33 from elkoDev/develop
Merge develop into main
2 parents ab52f24 + 9cf6c35 commit f670b66

4 files changed

Lines changed: 177 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## 1 Prerequisites
66

7-
- Windows with TcXaeShell Version 15.0 or higher
7+
- Windows with TcXaeShell Version 15.0 (other versions have not been tested)
88

99
## 2 Installation
1010

TcAutomation/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 1 Prerequisites
44

55
- [Inno Setup](https://jrsoftware.org/isinfo.php)
6+
- TwinCAT XAE Shell 15.0 properly installed and configured (see [TwinCAT Setup Guide](TWINCAT_SETUP.md))
67

78
## 2 Build Project
89

@@ -15,3 +16,38 @@ msbuild /p:Configuration=Release TcAutomation.csproj
1516
- Open the [TcAutomationInstaller.iss](TcAutomationInstaller.iss) file within the Inno Setup.
1617
- Click the "Build/Compile" button (or press Ctrl+F9)."
1718
- The installer will be created in the [output](output) folder.
19+
20+
## 4 CLI Usage
21+
22+
**Note:** You typically don't call `TcAutomation.exe` directly. Instead, use the BCS Engineering DSL CLI tool:
23+
24+
```bash
25+
bcs-engineering-cli beckhoff deploy <file>
26+
```
27+
28+
The `deploy` command internally invokes `TcAutomation.exe` with the appropriate parameters. However, if you need to call it manually, the following options are available:
29+
30+
### Command Line Options
31+
32+
| Option | Required | Default | Description |
33+
| ----------------- | -------- | ------------------------------------------------------------------- | -------------------------------------------------- |
34+
| `--workspace` | Yes | - | Path to your project root (where generated/ lives) |
35+
| `--solution-name` | No | `MyGeneratedSolution` | Name of the TwinCAT solution |
36+
| `--project-name` | No | `MyTwinCATProject` | Name of the Visual Studio project |
37+
| `--plc-name` | No | `MyPlcProject` | PLC project name |
38+
| `--template-path` | No | `C:\TwinCAT\3.1\Components\Base\PrjTemplate\TwinCAT Project.tsproj` | Path to your .tsproj template |
39+
| `--prog-id` | No | `TcXaeShell.DTE.15.0` | ProgID to use when launching TwinCAT |
40+
| `--ads-username` | No | `Administrator` | ADS username for remote connection |
41+
| `--ads-password` | No | `1` | ADS password for remote connection |
42+
43+
**Note:** If you're using a different TwinCAT version, you need to adjust the `--prog-id` parameter accordingly.
44+
45+
### Example Usage
46+
47+
```bash
48+
TcAutomation.exe --workspace "C:\Projects\MyProject"
49+
```
50+
51+
```bash
52+
TcAutomation.exe --workspace "C:\Projects\MyProject" --solution-name "MySolution" --plc-name "MainPLC"
53+
```

TcAutomation/TWINCAT_SETUP.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# TwinCAT Setup Guide
2+
3+
This guide covers the prerequisites and setup steps for working with TwinCAT XAE Shell 15.0.
4+
5+
## 1 Prerequisites
6+
7+
- Windows 10/11
8+
- TwinCAT XAE Shell Version 15.0 (compatibility with other versions has not been tested)
9+
- **Tested Version**: TcXaeShell 15.0.34829.251 D15.9
10+
- **Edition**: Express
11+
- **Framework**: Microsoft .NET Framework 4.8.09221
12+
- 7-day trial license (or full license)
13+
14+
## 2 TwinCAT Installation
15+
16+
1. Download and install TwinCAT XAE Shell 15.0 from [Beckhoff's website](https://www.beckhoff.com/en-en/support/download-finder/software-and-tools/)
17+
2. Follow the installation wizard
18+
3. Verify the installation by checking the version (Help → About in TwinCAT XAE)
19+
20+
### 2.1 Verified Components
21+
22+
The framework has been tested with the following TwinCAT components:
23+
24+
- **TwinCAT XAE Base**: 3.1.0.0
25+
- **TcXaeShell**: 1.15.0
26+
- **TcXaeHelper**: 4024.65.0.0
27+
- **TcXaeModules**: 4024.65.0.0 (TMC Editor, TMC Code Generator)
28+
- **TwinCAT Measurement**: 4.48.45.0
29+
- **TwinCAT Scope**: 4.48.92.0
30+
31+
## 3 License Setup
32+
33+
TwinCAT requires a valid license to run. For development and testing purposes, you can obtain a 7-day trial license:
34+
35+
1. Create a new TwinCAT XAE project (File → New → Project → TwinCAT XAE Project)
36+
2. Add a PLC project to your solution
37+
3. Try to activate the configuration or switch to Run Mode
38+
4. A license popup will appear automatically, offering a 7-day trial license
39+
5. Follow the prompts to request and activate the trial license
40+
41+
**Note:** The 7-day trial license needs to be renewed after expiration. You can renew it by repeating the process above.
42+
43+
## 4 Hyper-V Compatibility Issue
44+
45+
TwinCAT requires direct hardware access and **does not work with Hyper-V enabled**. If you're running Windows with Hyper-V or WSL2, you need to disable it.
46+
47+
### 4.1 Disable Windows Core Isolation (Memory Integrity)
48+
49+
Windows Core Isolation with Memory Integrity can interfere with TwinCAT. You need to disable it:
50+
51+
1. Open Windows Security (Windows Defender)
52+
2. Go to **Device Security****Core Isolation Details**
53+
3. Turn off **Memory Integrity**
54+
4. Restart your computer
55+
56+
57+
### 4.2 Solution: Dual Boot Configuration
58+
59+
Instead of permanently disabling Hyper-V, you can create a dual boot option that allows you to choose whether to boot Windows with or without Hyper-V.
60+
61+
#### 4.2.1 Create Boot Entry (PowerShell Script)
62+
63+
Run the following PowerShell script **as Administrator**:
64+
65+
```powershell
66+
# Get GUID of current Windows boot entry
67+
$sourceGuid = "{current-boot-entry-guid}" # Replace with your actual GUID
68+
$description = "Windows 11 - No Hyper-V (TwinCAT)"
69+
70+
# Create new boot entry
71+
$bcdCopyOutput = bcdedit /copy $sourceGuid /d $description
72+
73+
# Extract GUID
74+
if ($bcdCopyOutput -match "\{[0-9a-fA-F\-]+\}") {
75+
$newGuid = $matches[0]
76+
77+
# Disable Hyper-V for this boot entry
78+
bcdedit /set $newGuid hypervisorlaunchtype off
79+
80+
# Set boot timeout (optional)
81+
bcdedit /timeout 5
82+
83+
# Display result
84+
Write-Host "`n New boot entry successfully created:"
85+
Write-Host " Description: $description"
86+
Write-Host " GUID: $newGuid"
87+
Write-Host "`n Select '$description' on next boot for TwinCAT without Hyper-V."
88+
} else {
89+
Write-Host " Error: Could not extract GUID."
90+
}
91+
```
92+
93+
#### 4.2.2 Find Your Current Boot GUID
94+
95+
To find your current Windows boot entry GUID, run the following command as Administrator in PowerShell:
96+
97+
```powershell
98+
bcdedit /enum
99+
```
100+
101+
Look for the entry marked as `{current}` and note its GUID.
102+
103+
#### 4.2.3 Result
104+
105+
After running the script, you'll have two boot options:
106+
107+
- **Windows 11** - Normal boot with Hyper-V enabled (for WSL2, Docker, etc.)
108+
- **Windows 11 - No Hyper-V (TwinCAT)** - Boot without Hyper-V for TwinCAT development
109+
110+
Simply select the appropriate option when starting your computer.
111+
112+
## 5 Verify Installation
113+
114+
After setup, verify that TwinCAT is correctly installed:
115+
116+
1. Open TwinCAT XAE (Visual Studio Shell)
117+
2. Check that TwinCAT system tray icon appears (orange/blue)
118+
3. Switch to Config Mode and then Run Mode to verify functionality

language/README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,37 @@ or link the local version
4949
npm link
5050
```
5151

52-
## 3 Usage
52+
## 3 Usage (Beckhoff)
5353

5454
### 3.1 Generate Code
5555

5656
```bash
57-
bcs-engineering-cli beckhoff generate <path-to-bcsctrl-file>
57+
bcs-engineering-cli beckhoff generate <path-to-bcsctrl-file> [options]
5858
```
5959

60+
**Options:**
61+
62+
- `-d, --destination <dir>` - Output directory for generated files
63+
- `-q, --quiet` - Suppress output (default: false)
64+
6065
### 3.2 Generate Code and Deploy
6166

6267
```bash
63-
bcs-engineering-cli beckhoff deploy <path-to-bcsctrl-file>
68+
bcs-engineering-cli beckhoff deploy <path-to-bcsctrl-file> [options]
6469
```
6570

71+
**Options:**
72+
73+
- `--template-path <path>` - TwinCAT template path
74+
- `--solution-name <name>` - Solution name (default: `MyGeneratedSolution`)
75+
- `--project-name <name>` - Project name (default: `MyTwinCATProject`)
76+
- `--plc-name <name>` - PLC project name (default: `MyPlcProject`)
77+
- `--tc-exe <path>` - Path to TcAutomation executable (default: `TcAutomation.exe`, resolved from PATH)
78+
- `--ads-username <username>` - ADS username for remote connection (default: `Administrator`)
79+
- `--ads-password <password>` - ADS password for remote connection (default: `1`)
80+
- `-d, --destination <dir>` - Output directory for generated files
81+
- `-q, --quiet` - Suppress output (default: false)
82+
6683
**NOTE:** The working directory will be set to the root of the provided file. This means that the .bcsctrl file can contain cross-references to other files in the same directory.
6784

6885
### 3.3 Supported Target Platforms
@@ -76,6 +93,7 @@ In addition to the standard libraries provided by Beckhoff, the following librar
7693
- `Tc3_DALI`: Please note that this library integration is not fully tested.
7794

7895
## 4 Future Work
96+
7997
- Add support for more target platforms (e.g., Siemens, Codesys)
8098
- Add and test support for more bus systems (e.g., EtherCAT, Profinet)
8199
- Add a more sophisticated module system (e.g., support multiple files, packages, imports, etc.)
@@ -86,4 +104,4 @@ In addition to the standard libraries provided by Beckhoff, the following librar
86104
- Support UseStmt within FB logic
87105
- Look into debugging DSLs
88106
- Look into moving the framework to a web-based solution (both the DSL and the deployment tool)
89-
- Look into graphical modeling
107+
- Look into graphical modeling

0 commit comments

Comments
 (0)