diff --git a/axopen.template.simple/ax/apax-lock.json b/axopen.template.simple/ax/apax-lock.json index 9843c21..ac0b082 100644 --- a/axopen.template.simple/ax/apax-lock.json +++ b/axopen.template.simple/ax/apax-lock.json @@ -11,26 +11,28 @@ "@ix-ax/axopen.inspectors": "0.0.0-dev.0", "@ix-ax/axopen.components.elements": "0.0.0-dev.0", "@ix-ax/axopen.components.pneumatics": "0.0.0-dev.0", + "@ix-ax/axopen.timers": "0.0.0-dev.0", + "@ix-ax/axopen.components.drives": "0.0.0-dev.0", + "@ix-ax/axopen.components.rexroth.drives": "0.0.0-dev.0", + "@ix-ax/axopen.components.siemens.identification": "0.0.0-dev.0", "@ix-ax/axopen.simatic1500": "0.0.0-dev.0", "@ax/certificate-management": "^1.1.1", "@ax/opcua-server-config": "^1.0.0", - "@ax/hwc": "^2.0.49", - "@ax/hw-s7-1500": "^2.0.49", - "@ax/hwld": "^2.0.20" + "@ix-ax/ax.latest.packages": "0.0.0-dev.0" }, "devDependencies": { "@ix-ax/ax-sdk": "0.0.0-dev.0", - "@ax/sld": "^3.0.6-alpha", - "@ax/stc": "^7.1.81", + "@ax/sld": "^3.0.8", + "@ax/stc": "^8.0.17", "@ax/st-lang-contrib-library-toolbox": "^0.17.2" } }, "packages": { "@ax/sld": { "name": "@ax/sld", - "version": "3.0.6", - "integrity": "sha512-j90GJh1jMIpvB521EIxvTq6rhr8OO+6qqwsXn2Of7GxQrzwWi+NEXe9ss/ccFAKL0I7aEGD+SIW8jVHUgMAvow==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.6.tgz", + "version": "3.0.9", + "integrity": "sha512-9JijTgtQdxjJOwTScqCciAMMMXn59whSKfYWTtndbjKkDhmds+GnuPJz2w0lQdS4IcFm9odxNWWV5I5lfwrZ0Q==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/sld/-/sld-3.0.9.tgz", "cpu": [ "x64" ], @@ -38,12 +40,12 @@ }, "@ax/stc": { "name": "@ax/stc", - "version": "7.1.87", - "integrity": "sha512-u6vQH5zDdxJMZg6slXUXFjCvympdu0ssBVHt5eeq+683s+eumYoWJHunN40aOtUnsvdEWkYE6/vXT+0xW/l8Og==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc/-/stc-7.1.87.tgz", + "version": "8.0.17", + "integrity": "sha512-Ym2uWEmfrkhm2Z/ODujUwQOiAwQ2p0fv9hLTJGL+zwYMjAwja71JayMLSOO+cX0gv8VexrxISDa66jouT+XySA==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc/-/stc-8.0.17.tgz", "dependencies": { - "@ax/stc-win-x64": "7.1.87", - "@ax/stc-linux-x64": "7.1.87" + "@ax/stc-win-x64": "8.0.17", + "@ax/stc-linux-x64": "8.0.17" } }, "@ax/st-lang-contrib-library-toolbox": { @@ -73,33 +75,6 @@ "@ax/opcua-server-config-win-x64": "1.2.0" } }, - "@ax/hwc": { - "name": "@ax/hwc", - "version": "2.0.49", - "integrity": "sha512-RDjN2eiVaF+OxTCkEhCz/mXEphzh/mCUmMT+feGR/mUAkk43Sn8+3zK5Jkmses8dER0WDR2a0TXoKcJcqtsufw==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwc/-/hwc-2.0.49.tgz", - "dependencies": { - "@ax/hwc-win-x64": "2.0.49", - "@ax/hwc-linux-x64": "2.0.49" - } - }, - "@ax/hw-s7-1500": { - "name": "@ax/hw-s7-1500", - "version": "2.0.49", - "integrity": "sha512-UQT/UbSn6TPb2geqOqrExJOVfJopMYx9CAROtK8VENWR8WsdyfPgPRj0Gqyn9YAYRJRhYrS7pvPwgpTVy6ueXg==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/hw-s7-1500/-/hw-s7-1500-2.0.49.tgz", - "dependencies": {} - }, - "@ax/hwld": { - "name": "@ax/hwld", - "version": "2.0.20", - "integrity": "sha512-kGYV4xu0tbjWtNlTLb9kGy9lF9aNBMfXeF/SuGWBnPkFEgsgTkSskWfCrvQhwIOI27hRr/vXUXoEgME8NUCsyg==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwld/-/hwld-2.0.20.tgz", - "cpu": [ - "x64" - ], - "dependencies": {} - }, "@ax/sdk": { "name": "@ax/sdk", "version": "2405.2.0", @@ -129,9 +104,9 @@ }, "@ax/stc-win-x64": { "name": "@ax/stc-win-x64", - "version": "7.2.82", - "integrity": "sha512-xJjQP964URFk8TJuXmuzWnqyyudiHwZOP9qfG6X9BhPXy9K9y47t3zoirg1c5W/B4VK7NEuzae0gHgJZDtNfSA==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-win-x64/-/stc-win-x64-7.2.82.tgz", + "version": "8.0.17", + "integrity": "sha512-vOnWIY+dLfASN2s7exuy7pQU/KKTp9ej3uMn86vLTXtjF5YUECInNYOM9kY6hQdnJFJH6RirxzbiRJftjvLHuw==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-win-x64/-/stc-win-x64-8.0.17.tgz", "os": [ "win32" ], @@ -139,14 +114,14 @@ "x64" ], "dependencies": { - "@ax/st-docs": "7.2.82" + "@ax/st-docs": "8.0.17" } }, "@ax/stc-linux-x64": { "name": "@ax/stc-linux-x64", - "version": "7.2.82", - "integrity": "sha512-tcZotcXs7Zn5R+RaqtgJhtF0Zgie8d++LIDp2WaugaWLEwONlHgFXORF+zvhQ2XtwJdUobDzXvb8Ujd04CmSAQ==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-linux-x64/-/stc-linux-x64-7.2.82.tgz", + "version": "8.0.17", + "integrity": "sha512-BnpkLdkExZ6n6wyKHprrCPfQOu4FK6FTTt8ieVbrjOwABSJxez3ls9GBEpUOJKxqJa05epbR2nIHYoOO1pFKtQ==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/stc-linux-x64/-/stc-linux-x64-8.0.17.tgz", "os": [ "linux" ], @@ -154,7 +129,7 @@ "x64" ], "dependencies": { - "@ax/st-docs": "7.2.82" + "@ax/st-docs": "8.0.17" } }, "@ax/system-timer": { @@ -216,41 +191,19 @@ ], "dependencies": {} }, - "@ax/hwc-win-x64": { - "name": "@ax/hwc-win-x64", - "version": "2.0.49", - "integrity": "sha512-+8KoxbZA7AtEqt1jGE5+15BCsl1BTRXSB7AX9UsA+RV8WDZCdEU9ZOSQ5ZZfYgIWl/4+rhpzdAs6iwFPgQNqag==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwc-win-x64/-/hwc-win-x64-2.0.49.tgz", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "dependencies": {} - }, - "@ax/hwc-linux-x64": { - "name": "@ax/hwc-linux-x64", - "version": "2.0.49", - "integrity": "sha512-ARriigUmk8XyzpAT0f4afTAMgS62ye6O/3Y5DsJotD+wyhyS03BUf+un8tRnamgCbOOGg0WejhCYu9vm/20fJQ==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwc-linux-x64/-/hwc-linux-x64-2.0.49.tgz", - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], + "@ax/simatic-1500-clocks": { + "name": "@ax/simatic-1500-clocks", + "version": "7.0.4", + "integrity": "sha512-tJ9zlHOYpAsr9RYZEhpQojmSqw6Ja8aYPpZH94OCXaEggSdArpgQWr4Kyvw7w2NHx5TC3LnmED/BoBCilwCBaA==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/simatic-1500-clocks/-/simatic-1500-clocks-7.0.4.tgz", "dependencies": {} }, - "@ax/system-strings": { - "name": "@ax/system-strings", + "@ax/system-bitaccess": { + "name": "@ax/system-bitaccess", "version": "7.1.47", - "integrity": "sha512-ERClBkAtu1dabBJFMZvA7RUPNwnaXfQC3B81IbRFtWcBTKso6qIgqGe9uku9TdSBYqfrQgwDkxneJtJNDDm5Kg==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-strings/-/system-strings-7.1.47.tgz", - "dependencies": { - "@ax/system-math": "^7.1.47", - "@ax/system-datetime": "^7.1.47" - } + "integrity": "sha512-VRQLR5yVKn5ltQHCt5aKalAOo+6mXX9bToZivMEc8sZWoYjMFDEHIRIzsJH+qfToH+tQwKHW7xiO6r4WEN1fuA==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-bitaccess/-/system-bitaccess-7.1.47.tgz", + "dependencies": {} }, "@ax/system-math": { "name": "@ax/system-math", @@ -259,34 +212,6 @@ "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-math/-/system-math-7.1.47.tgz", "dependencies": {} }, - "@ax/system-datetime": { - "name": "@ax/system-datetime", - "version": "7.1.47", - "integrity": "sha512-yk8erRctiVKHjpe1nca9WUhatotm6S5lEkye4R2XBl7vU7CaPp84q7MzhkSCgQYn08LJqlFRBbxP+bpERiei8g==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-datetime/-/system-datetime-7.1.47.tgz", - "dependencies": {} - }, - "@ax/simatic-1500-distributedio": { - "name": "@ax/simatic-1500-distributedio", - "version": "7.0.1", - "integrity": "sha512-bhoaxLiOmox+oyD2JBiHGS5voYt+AxJmf0u3qlaSbbYN7O2LAAA0xYb/ijxGD8MT/qloFOVt/nxkSEFx1WdXnw==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/simatic-1500-distributedio/-/simatic-1500-distributedio-7.0.1.tgz", - "dependencies": {} - }, - "@ax/simatic-1500-diagnostics-hardware": { - "name": "@ax/simatic-1500-diagnostics-hardware", - "version": "7.0.1", - "integrity": "sha512-Ee+FdwLF1o0tqJLoXO5NtRfcDoahe4GS3uyKoLRR/9ON4LkrCuOa2RIOx+wUIJtzDmrGI/Z/TUgVgQsdPla7vA==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/simatic-1500-diagnostics-hardware/-/simatic-1500-diagnostics-hardware-7.0.1.tgz", - "dependencies": {} - }, - "@ax/simatic-1500-clocks": { - "name": "@ax/simatic-1500-clocks", - "version": "7.0.4", - "integrity": "sha512-tJ9zlHOYpAsr9RYZEhpQojmSqw6Ja8aYPpZH94OCXaEggSdArpgQWr4Kyvw7w2NHx5TC3LnmED/BoBCilwCBaA==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/simatic-1500-clocks/-/simatic-1500-clocks-7.0.4.tgz", - "dependencies": {} - }, "@ax/system-serde": { "name": "@ax/system-serde", "version": "7.1.47", @@ -296,11 +221,31 @@ "@ax/system-strings": "^7.1.47" } }, - "@ax/system-bitaccess": { - "name": "@ax/system-bitaccess", - "version": "7.1.47", - "integrity": "sha512-VRQLR5yVKn5ltQHCt5aKalAOo+6mXX9bToZivMEc8sZWoYjMFDEHIRIzsJH+qfToH+tQwKHW7xiO6r4WEN1fuA==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-bitaccess/-/system-bitaccess-7.1.47.tgz", + "@ax/hwc": { + "name": "@ax/hwc", + "version": "2.0.51", + "integrity": "sha512-ytgiBgktxgAwZdhcWvTDR3lACOzWtOmOBByicM7GPUk0b94zRCBJAFOCabItYkKTCV3Hn09VNP3VDbBD+0D35w==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwc/-/hwc-2.0.51.tgz", + "dependencies": { + "@ax/hwc-win-x64": "2.0.51", + "@ax/hwc-linux-x64": "2.0.51" + } + }, + "@ax/hw-s7-1500": { + "name": "@ax/hw-s7-1500", + "version": "2.0.51", + "integrity": "sha512-Rjo9VwKHQo6EuUadqV+lO/2xXEPSlx08M3X9Phv2PVCmjp/IRuH3zr9ut9iYZtp2OPC+AzGsHHwBv9WEL3PTJQ==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/hw-s7-1500/-/hw-s7-1500-2.0.51.tgz", + "dependencies": {} + }, + "@ax/hwld": { + "name": "@ax/hwld", + "version": "2.0.20", + "integrity": "sha512-kGYV4xu0tbjWtNlTLb9kGy9lF9aNBMfXeF/SuGWBnPkFEgsgTkSskWfCrvQhwIOI27hRr/vXUXoEgME8NUCsyg==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwld/-/hwld-2.0.20.tgz", + "cpu": [ + "x64" + ], "dependencies": {} }, "@ax/apax-build": { @@ -439,11 +384,42 @@ "@ax/trace-linux-x64": "2.8.0" } }, + "@ax/system-strings": { + "name": "@ax/system-strings", + "version": "7.1.47", + "integrity": "sha512-ERClBkAtu1dabBJFMZvA7RUPNwnaXfQC3B81IbRFtWcBTKso6qIgqGe9uku9TdSBYqfrQgwDkxneJtJNDDm5Kg==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-strings/-/system-strings-7.1.47.tgz", + "dependencies": { + "@ax/system-math": "^7.1.47", + "@ax/system-datetime": "^7.1.47" + } + }, + "@ax/simatic-1500-distributedio": { + "name": "@ax/simatic-1500-distributedio", + "version": "7.0.1", + "integrity": "sha512-bhoaxLiOmox+oyD2JBiHGS5voYt+AxJmf0u3qlaSbbYN7O2LAAA0xYb/ijxGD8MT/qloFOVt/nxkSEFx1WdXnw==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/simatic-1500-distributedio/-/simatic-1500-distributedio-7.0.1.tgz", + "dependencies": {} + }, + "@ax/simatic-1500-diagnostics-hardware": { + "name": "@ax/simatic-1500-diagnostics-hardware", + "version": "7.0.1", + "integrity": "sha512-Ee+FdwLF1o0tqJLoXO5NtRfcDoahe4GS3uyKoLRR/9ON4LkrCuOa2RIOx+wUIJtzDmrGI/Z/TUgVgQsdPla7vA==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/simatic-1500-diagnostics-hardware/-/simatic-1500-diagnostics-hardware-7.0.1.tgz", + "dependencies": {} + }, + "@ax/system-datetime": { + "name": "@ax/system-datetime", + "version": "7.1.47", + "integrity": "sha512-yk8erRctiVKHjpe1nca9WUhatotm6S5lEkye4R2XBl7vU7CaPp84q7MzhkSCgQYn08LJqlFRBbxP+bpERiei8g==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/system-datetime/-/system-datetime-7.1.47.tgz", + "dependencies": {} + }, "@ax/st-docs": { "name": "@ax/st-docs", - "version": "7.2.82", - "integrity": "sha512-cX1qBP68AKZJX2qBAsw5a0hf7ZsTMuNBeyaB2zOCfl1nS2pgG8SdP2C17baYPjbeyc1l3CLEmWtu7t9ylwRjkg==", - "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-7.2.82.tgz", + "version": "8.0.17", + "integrity": "sha512-bvMaT+GcSwF9ahzqI+wHBlCDfASqnJTDHwuBgVuR68u3R9cLaoOLnosw4HBoJRlBxWyooKB9bn+u++jRaekRNg==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/st-docs/-/st-docs-8.0.17.tgz", "dependencies": {} }, "@ax/simatic-package-tool": { @@ -522,6 +498,32 @@ ], "dependencies": {} }, + "@ax/hwc-win-x64": { + "name": "@ax/hwc-win-x64", + "version": "2.0.51", + "integrity": "sha512-emVfvD5DTA5Y5czaJuE+fQEU9eh3wG1oWoivFfX156+LG7olfjtyWoE5WxTs1D3lWcCfosWtUBqlq7zjiFiUIw==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwc-win-x64/-/hwc-win-x64-2.0.51.tgz", + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "dependencies": {} + }, + "@ax/hwc-linux-x64": { + "name": "@ax/hwc-linux-x64", + "version": "2.0.51", + "integrity": "sha512-ZDFDs9F/X873kT7SnBYIk6DAdrnpVRijbM+P0+ObjUuh/g8O5x8D0YFkWtQha/eQkmDJ/i0ApGrTYXHj9yTq8Q==", + "resolved": "https://registry.simatic-ax.siemens.io/@ax/hwc-linux-x64/-/hwc-linux-x64-2.0.51.tgz", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "dependencies": {} + }, "@ax/mod-win-x64": { "name": "@ax/mod-win-x64", "version": "1.2.2", @@ -845,6 +847,34 @@ "@ix-ax/axopen.components.abstractions": "0.0.0-dev.0" } }, + "@ix-ax/axopen.timers": { + "version": "0.0.0-dev.0", + "dir": "..\\..\\..\\axopen\\src\\timers\\ctrl", + "dependencies": { + "@ix-ax/axopen.abstractions": "0.0.0-dev.0" + } + }, + "@ix-ax/axopen.components.drives": { + "version": "0.0.0-dev.0", + "dir": "..\\..\\..\\axopen\\src\\components.drives\\ctrl", + "dependencies": { + "@ix-ax/axopen.io": "0.0.0-dev.0" + } + }, + "@ix-ax/axopen.components.rexroth.drives": { + "version": "0.0.0-dev.0", + "dir": "..\\..\\..\\axopen\\src\\components.rexroth.drives\\ctrl", + "dependencies": { + "@ix-ax/axopen.components.drives": "0.0.0-dev.0" + } + }, + "@ix-ax/axopen.components.siemens.identification": { + "version": "0.0.0-dev.0", + "dir": "..\\..\\..\\axopen\\src\\components.siemens.identification\\ctrl", + "dependencies": { + "@ix-ax/axopen.io": "0.0.0-dev.0" + } + }, "@ix-ax/axopen.simatic1500": { "version": "0.0.0-dev.0", "dir": "..\\..\\..\\axopen\\src\\simatic1500\\ctrl", @@ -854,6 +884,21 @@ "@ax/system-timer": "^7.0.17" } }, + "@ix-ax/ax.latest.packages": { + "version": "0.0.0-dev.0", + "dir": "..\\..\\..\\axopen\\src\\ax.latest.packages\\ctrl", + "dependencies": { + "@ax/simatic-1500-clocks": "^8.0.8", + "@ax/system-bitaccess": "^8.0.7", + "@ax/system-math": "^8.0.7", + "@ax/system-serde": "^8.0.7", + "@ax/hwc": "^2.0.51", + "@ax/hw-s7-1500": "^2.0.51", + "@ax/hwld": "^2.0.20", + "@ax/stc": "^8.0.17", + "@ax/sld": "^3.0.8" + } + }, "@ix-ax/axopen.core": { "version": "0.0.0-dev.0", "dir": "..\\..\\..\\axopen\\src\\core\\ctrl", @@ -875,6 +920,14 @@ "@ix-ax/ax.axopen.min": "0.0.0-dev.0" } }, + "@ix-ax/axopen.io": { + "version": "0.0.0-dev.0", + "dir": "..\\..\\..\\axopen\\src\\io\\ctrl", + "dependencies": { + "@ix-ax/axopen.components.abstractions": "0.0.0-dev.0", + "@ix-ax/ax.axopen.hwlibrary": "0.0.0-dev.0" + } + }, "@ix-ax/ax.axopen.hwlibrary": { "version": "0.0.0-dev.0", "dir": "..\\..\\..\\axopen\\src\\ax.axopen.hwlibrary\\ctrl", @@ -888,13 +941,6 @@ "@ax/system-bitaccess": "7.1.47" } }, - "@ix-ax/axopen.timers": { - "version": "0.0.0-dev.0", - "dir": "..\\..\\..\\axopen\\src\\timers\\ctrl", - "dependencies": { - "@ix-ax/axopen.abstractions": "0.0.0-dev.0" - } - }, "@ix-ax/ax.axopen.min": { "version": "0.0.0-dev.0", "dir": "..\\..\\..\\axopen\\src\\ax.axopen.min\\ctrl", diff --git a/axopen.template.simple/ax/apax.yml b/axopen.template.simple/ax/apax.yml index 6ed5e7b..4518fa2 100644 --- a/axopen.template.simple/ax/apax.yml +++ b/axopen.template.simple/ax/apax.yml @@ -52,12 +52,12 @@ variables: APAX_BUILD_ARGS: [ -d ] PLC_NAME: "plc_line" DEFAULT_NAMESPACE: "axosimple" - HWCONFIG: "HWC" AXTARGET: 10.222.6.1 AXTARGETPLATFORMINPUT: .\bin\1500\ AX_USERNAME: "adm" AX_TARGET_PWD: "123ABCDabcd$#!" - MY_VERY_STRONG_PASSWORD: $AX_TARGET_PWD + USE_PLC_SIM_ADVANCED: "true" + HWCONFIG: "HWC" COM_CERT_PATH: .\certs\Communication.cer scripts: push: @@ -171,7 +171,8 @@ scripts: if [[ "$HWCONFIG" == "TIA-NON-SECURE" ]]; then apax sld load --accept-security-disclaimer -t $AXTARGET -i $AXTARGETPLATFORMINPUT --mode delta fi - plcsim: ..\\scripts\\StartPlcSimAdvCli.exe #start PLCSIM + # plcsim: ..\\scripts\\StartPlcSimAdvCli.exe #start PLCSIM + plcsim: dotnet run --project ..\\tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools.csproj -- startplcsim -x $APAX_YML_NAME -n $PLC_NAME -t $AXTARGET r: ..\\scripts\\restart_PLC.sh $AXTARGET $PLC_NAME ixc: | # run ix builder dotnet tool restore @@ -187,65 +188,36 @@ scripts: apax clean apax install reset_plc: | #total reset of the PLC including IP and name - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\reset_plc.sh $AXTARGET - fi + ..\\scripts\\reset_plc.sh $AXTARGET clean_plc: | #total reset of the PLC excluding IP and name - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\clean_plc.sh $AXTARGET - fi + ..\\scripts\\clean_plc.sh $AXTARGET ssc: | # setup secure communication, create and import certificates, setup password for AX_USERNAME - if - [[ "$HWCONFIG" == "HWC" ]]; then ..\\scripts\\setup_secure_communication.sh $PLC_NAME $AX_USERNAME $AX_TARGET_PWD - fi + ..\\scripts\\setup_secure_communication.sh $PLC_NAME $AX_USERNAME $AX_TARGET_PWD gsd: | # copy and install all gsdml files from libraries - if - [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\copy_and_install_gsd.sh - fi + ..\\scripts\\copy_and_install_gsd.sh hwl: | # copy all templates from libraries - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\copy_hwl_templates.sh - fi + ..\\scripts\\copy_hwl_templates.sh hwcc: | # compile hardware configuration - if [[ "$HWCONFIG" == "HWC" ]]; then ..\\scripts\\hw_compile.sh - fi hwid: | # copy the generated HwIds from global constants into the type definition, matching the format as the TIA2AX tool creates - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\copy_hardware_ids.sh $DEFAULT_NAMESPACE $PLC_NAME - fi + ..\\scripts\\copy_hardware_ids.sh $DEFAULT_NAMESPACE $PLC_NAME hwadr: | # copy the generated IoAddresses - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\copy_io_addresses.sh $DEFAULT_NAMESPACE $PLC_NAME - fi + ..\\scripts\\copy_io_addresses.sh $DEFAULT_NAMESPACE $PLC_NAME hwfd: | # copy and install gsd, copy templates,compile, copy the HwIds, copy the IoAddresses, first download HW using password and upload certificate - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\hw_first_download.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AX_TARGET_PWD - fi + ..\\scripts\\hw_first_download.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AX_TARGET_PWD hwu: | # copy and install gsd, copy templates, compile, copy the HwIds, copy the IoAddresses, download HW using certificate - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\hw_update.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET - fi + ..\\scripts\\hw_update.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET swfd: | # software build and full download - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\sw_build_and_download_full.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT - fi + ..\\scripts\\sw_build_and_download_full.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT swdd: | # software build and delta download - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\sw_build_and_download_delta.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT - fi + ..\\scripts\\sw_build_and_download_delta.sh $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT alf: | #clear plc except ip and name and provide all actions for install all, build and initial download hw so as sw START=$(date +%s) - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\all_first.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD - fi + ..\\scripts\\all_first.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD $USE_PLC_SIM_ADVANCED echo $(date +%D)"-"$(date +%H)":"$(date +%M)":"$(date +%S) " - Finished in :" $(expr $(date +%s) - $START) "s" all: | #build and download hardware and software START=$(date +%s) - if [[ "$HWCONFIG" == "HWC" ]]; then - ..\\scripts\\all.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD - fi + ..\\scripts\\all.sh $DEFAULT_NAMESPACE $PLC_NAME $AXTARGET $AXTARGETPLATFORMINPUT $AX_USERNAME $AX_TARGET_PWD $USE_PLC_SIM_ADVANCED echo $(date +%D)"-"$(date +%H)":"$(date +%M)":"$(date +%S) " - Finished in :" $(expr $(date +%s) - $START) "s" publicKeys: "@ix-ax": 30c06ef7830b4dfd8f16e003508da1ac2d187714d0e1f38279a9332cbe4e4e17 diff --git a/axopen.template.simple/scripts/Siemens.Simatic.Simulation.Runtime.Api.x64.dll b/axopen.template.simple/scripts/Siemens.Simatic.Simulation.Runtime.Api.x64.dll deleted file mode 100644 index 54dd1d0..0000000 Binary files a/axopen.template.simple/scripts/Siemens.Simatic.Simulation.Runtime.Api.x64.dll and /dev/null differ diff --git a/axopen.template.simple/scripts/StartPlcSimAdvCli.deps.json b/axopen.template.simple/scripts/StartPlcSimAdvCli.deps.json deleted file mode 100644 index ed7404a..0000000 --- a/axopen.template.simple/scripts/StartPlcSimAdvCli.deps.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v6.0/win-x64", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v6.0": {}, - ".NETCoreApp,Version=v6.0/win-x64": { - "StartPlcSimAdvCli/1.0.0": { - "dependencies": { - "Siemens.Simatic.Simulation.Runtime.Api.x64": "50.35.3.0" - }, - "runtime": { - "StartPlcSimAdvCli.dll": {} - } - }, - "Siemens.Simatic.Simulation.Runtime.Api.x64/50.35.3.0": { - "runtime": { - "Siemens.Simatic.Simulation.Runtime.Api.x64.dll": { - "assemblyVersion": "50.35.3.0", - "fileVersion": "50.35.3.0" - } - } - } - } - }, - "libraries": { - "StartPlcSimAdvCli/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Siemens.Simatic.Simulation.Runtime.Api.x64/50.35.3.0": { - "type": "reference", - "serviceable": false, - "sha512": "" - } - } -} \ No newline at end of file diff --git a/axopen.template.simple/scripts/StartPlcSimAdvCli.dll b/axopen.template.simple/scripts/StartPlcSimAdvCli.dll deleted file mode 100644 index 58a200b..0000000 Binary files a/axopen.template.simple/scripts/StartPlcSimAdvCli.dll and /dev/null differ diff --git a/axopen.template.simple/scripts/StartPlcSimAdvCli.exe b/axopen.template.simple/scripts/StartPlcSimAdvCli.exe deleted file mode 100644 index 9ef64e9..0000000 Binary files a/axopen.template.simple/scripts/StartPlcSimAdvCli.exe and /dev/null differ diff --git a/axopen.template.simple/scripts/StartPlcSimAdvCli.runtimeconfig.json b/axopen.template.simple/scripts/StartPlcSimAdvCli.runtimeconfig.json deleted file mode 100644 index e7b3b03..0000000 --- a/axopen.template.simple/scripts/StartPlcSimAdvCli.runtimeconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net6.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "6.0.0" - }, - "configProperties": { - "System.Reflection.Metadata.MetadataUpdater.IsSupported": false - } - } -} \ No newline at end of file diff --git a/axopen.template.simple/scripts/all.sh b/axopen.template.simple/scripts/all.sh index 84f6922..8011bb9 100644 --- a/axopen.template.simple/scripts/all.sh +++ b/axopen.template.simple/scripts/all.sh @@ -2,8 +2,8 @@ export GREEN='\033[0;32m' export RED='\033[0;31m' export YELLOW='\033[0;33m' export NC='\033[0m\r\n' # No Color+CRLF -if [ "$#" -ne 6 ]; then - printf "${RED}Usage: $0 \r\n${NC}" +if [ "$#" -ne 7 ]; then + printf "${RED}Usage: $0 \r\n${NC}" exit 1 fi @@ -44,6 +44,27 @@ if [ -z $PASSWORD ]; then exit 1 fi +USE_PLC_SIM_ADVANCED=$7 +if [ -z $USE_PLC_SIM_ADVANCED ]; then + printf "${RED}The USE_PLC_SIM_ADVANCED could not be an empty string.\r\n${NC}" + exit 1 +fi + +PLCSIM=0 +case "$(echo "$USE_PLC_SIM_ADVANCED" | tr '[:upper:]' '[:lower:]')" in + "true") + PLCSIM=1 + printf "${YELLOW} USE_PLC_SIM_ADVANCED is true. ${NC}" + ;; + "false") + PLCSIM=0 + printf "${YELLOW} USE_PLC_SIM_ADVANCED is false. ${NC}" + ;; + *) + printf "${RED}USE_PLC_SIM_ADVANCED has an invalid or undefined value: '$USE_PLC_SIM_ADVANCED'.${NC}" + ;; +esac + certfile="./certs/$PLC_NAME/$PLC_NAME.cer" if ! [[ -e "$certfile" ]]; then printf "${RED}Certification file $certfile does not exist.\r\n${NC}" @@ -61,8 +82,10 @@ else exit 1 fi - plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsim.sh" - $plcsim_script + if [ "$PLCSIM" -eq 1 ]; then + plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsimadvanced.sh" + $plcsim_script $NAMESPACE $PLC_NAME $PLC_IP_ADDRESS + fi #apax run ci # clean and install dependencies apax clean diff --git a/axopen.template.simple/scripts/all_first.sh b/axopen.template.simple/scripts/all_first.sh index 1251255..22cb0d1 100644 --- a/axopen.template.simple/scripts/all_first.sh +++ b/axopen.template.simple/scripts/all_first.sh @@ -2,8 +2,8 @@ export GREEN='\033[0;32m' export RED='\033[0;31m' export YELLOW='\033[0;33m' export NC='\033[0m\r\n' # No Color+CRLF -if [ "$#" -ne 6 ]; then - printf "${RED}Usage: $0 \r\n${NC}" +if [ "$#" -ne 7 ]; then + printf "${RED}Usage: $0 \r\n${NC}" exit 1 fi @@ -44,6 +44,27 @@ if [ -z $PASSWORD ]; then exit 1 fi +USE_PLC_SIM_ADVANCED=$7 +if [ -z $USE_PLC_SIM_ADVANCED ]; then + printf "${RED}The USE_PLC_SIM_ADVANCED could not be an empty string.\r\n${NC}" + exit 1 +fi + +PLCSIM=0 +case "$(echo "$USE_PLC_SIM_ADVANCED" | tr '[:upper:]' '[:lower:]')" in + "true") + PLCSIM=1 + printf "${YELLOW} USE_PLC_SIM_ADVANCED is true. ${NC}" + ;; + "false") + PLCSIM=0 + printf "${YELLOW} USE_PLC_SIM_ADVANCED is false. ${NC}" + ;; + *) + printf "${RED}USE_PLC_SIM_ADVANCED has an invalid or undefined value: '$USE_PLC_SIM_ADVANCED'.${NC}" + ;; +esac + printf "${RED}This command will prompt during execution, so do not leave your PC. You can enjoy your coffee afterward.\r\n${NC}" check_requisites_apax_script=$( dirname ${BASH_SOURCE[0]})"\\check_requisites_apax.sh" @@ -56,8 +77,11 @@ if ! $check_requisites_nuget_script ; then exit 1 fi -plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsim.sh" -$plcsim_script +if [ "$PLCSIM" -eq 1 ]; then + dotnet run --project ..\\tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools\\AXOpen.Simple.Tools.csproj -- startplcsim -x $NAMESPACE -n $PLC_NAME -t $PLC_IP_ADDRESS + # plcsim_script=$( dirname ${BASH_SOURCE[0]})"\\plcsimadvanced.sh" + # $plcsim_script $NAMESPACE $PLC_NAME $PLC_IP_ADDRESS +fi #apax run ci # clean and install dependencies apax clean diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.sln b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.sln new file mode 100644 index 0000000..149ad63 --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35521.163 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AXOpen.Simple.Tools", "AXOpen.Simple.Tools\AXOpen.Simple.Tools.csproj", "{2085A8F9-6645-4BF6-AAC5-18D7DA651689}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlcSimAdvancedStarter", "PlcSimAdvancedStarter\PlcSimAdvancedStarter.csproj", "{24B14AC4-4623-41FB-94C7-5E0E67576940}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2085A8F9-6645-4BF6-AAC5-18D7DA651689}.Release|Any CPU.Build.0 = Release|Any CPU + {24B14AC4-4623-41FB-94C7-5E0E67576940}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24B14AC4-4623-41FB-94C7-5E0E67576940}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24B14AC4-4623-41FB-94C7-5E0E67576940}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24B14AC4-4623-41FB-94C7-5E0E67576940}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/.apax/.apax/dependencies.json b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/.apax/.apax/dependencies.json index ddf330e..f355d7a 100644 --- a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/.apax/.apax/dependencies.json +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/.apax/.apax/dependencies.json @@ -191,9 +191,6 @@ "docs/1_language/02_oop/2_interfaces.md", "docs/1_language/02_oop/3_copyfunctions.md", "docs/1_language/02_oop/index.md", - "docs/1_language/images/directive-syntax-highlighting.png", - "docs/1_language/images/partial-access-width.png", - "docs/1_language/images/stringstructure.jpg", "docs/1_language/diagrams/accessModifier.svg", "docs/1_language/diagrams/arrayTypeDeclaration.svg", "docs/1_language/diagrams/calls.svg", @@ -226,6 +223,9 @@ "docs/1_language/diagrams/taskConfig.svg", "docs/1_language/diagrams/varDeclarationSection.svg", "docs/1_language/diagrams/whileStatement.svg", + "docs/1_language/images/directive-syntax-highlighting.png", + "docs/1_language/images/partial-access-width.png", + "docs/1_language/images/stringstructure.jpg", "docs/1_language/_types/conversion-table.md", "docs/1_language/_types/conversion-table.png", "docs/1_language/_types/fullTable.png", diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.csproj b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.csproj index 578575a..5c47d17 100644 --- a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.csproj +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.csproj @@ -20,6 +20,10 @@ + + + + .apax\.apax\packages\@ax\stc-win-x64\bin\AX.ST.Compiler.PluginAbstractions.dll diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.sln b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.sln deleted file mode 100644 index a187527..0000000 --- a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.12.35521.163 d17.12 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AXOpen.Simple.Tools", "AXOpen.Simple.Tools.csproj", "{641CE0BA-816F-4930-9012-13305CAAC0BC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {641CE0BA-816F-4930-9012-13305CAAC0BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {641CE0BA-816F-4930-9012-13305CAAC0BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {641CE0BA-816F-4930-9012-13305CAAC0BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {641CE0BA-816F-4930-9012-13305CAAC0BC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/PlcSim/PlcSimInstallation.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/PlcSim/PlcSimInstallation.cs new file mode 100644 index 0000000..cd098d7 --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/PlcSim/PlcSimInstallation.cs @@ -0,0 +1,130 @@ +using Microsoft.VisualBasic; +using Microsoft.Win32; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Security.AccessControl; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; + + +namespace AXOpen.Simple.Tools.PlcSim +{ + public class PlcSimInstallation + { + public static bool Check(ref string dllPath, ref string exePath) + { + dllPath = ""; + exePath = ""; + using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64)) + { + using (RegistryKey? registryKey = baseKey.OpenSubKey("SOFTWARE\\WOW6432Node\\Siemens\\Shared Tools\\PLCSIMADV_SimRT", RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.ReadKey)) + { + string registryPathValue = registryKey?.GetValue("Path") as string; + string registryVersionValue = registryKey?.GetValue("Version") as string; + + if (string.IsNullOrWhiteSpace(registryPathValue) ) + { + Console.WriteLine("Unable to discover PLCSimAdvanced installation."); + return false; + } + + if (string.IsNullOrWhiteSpace(registryVersionValue)) + { + Console.WriteLine("Unable to discover the version of the PLCSimAdvanced."); + return false; + } + + try + { + Version libraryVersion = Version.Parse(registryVersionValue); + + if (libraryVersion < Setup.Constants.PlcSimAdvancedMinVersion) + { + Console.WriteLine($"PlcSimAdvanced version ({libraryVersion}) is lower then min supported version ({Setup.Constants.PlcSimAdvancedMinVersion})."); + return false; + } + + if (libraryVersion > Setup.Constants.PlcSimAdvancedMaxVersion) + { + Console.WriteLine($"PlcSimAdvanced version ({libraryVersion}) is higher then max supported version ({Setup.Constants.PlcSimAdvancedMaxVersion})."); + return false; + } + } + catch (FormatException) + { + Console.WriteLine("Invalid version format."); + return false; + } + + if (!Directory.Exists(registryPathValue)) + { + Console.WriteLine($"Directory {registryPathValue} does not exists, or is not accessible."); + return false; + } + + registryPathValue = Path.Combine(registryPathValue, "API"); + if (!Directory.Exists(registryPathValue)) + { + Console.WriteLine($"Directory {registryPathValue} does not exists, or is not accessible."); + return false; + } + + string[] registryVersionValueParts = registryVersionValue.Split('.'); + + registryPathValue = Path.Combine(registryPathValue, $"{registryVersionValueParts[0]}.{registryVersionValueParts[1]}"); + if (!Directory.Exists(registryPathValue)) + { + Console.WriteLine($"Directory {registryPathValue} does not exists, or is not accessible."); + return false; + } + + registryPathValue = Path.Combine(registryPathValue, "Siemens.Simatic.Simulation.Runtime.Api.x64.dll"); + if (!File.Exists(registryPathValue)) + { + Console.WriteLine($"Required file {registryPathValue} does not exists, or is not accessible."); + return false; + } + dllPath = registryPathValue; + } + + using (RegistryKey? registryKey = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Folders", RegistryKeyPermissionCheck.ReadSubTree, RegistryRights.ReadKey)) + { + string[] registryValues = registryKey?.GetValueNames(); + string plcSimInstallationFolder = ""; + foreach (string registryValue in registryValues) + { + if (registryValue.Contains("Siemens\\Automation\\PLCSIMADV\\bin\\")) + { + plcSimInstallationFolder = registryValue; + break; + } + } + + if (String.IsNullOrEmpty(plcSimInstallationFolder)) + { + return false; + } + + if (!Directory.Exists(plcSimInstallationFolder)) + { + Console.WriteLine($"Directory {plcSimInstallationFolder} does not exists, or is not accessible."); + return false; + } + + plcSimInstallationFolder = Path.Combine(plcSimInstallationFolder, "Siemens.Simatic.PlcSim.Advanced.UserInterface.exe"); + if (!File.Exists(plcSimInstallationFolder)) + { + Console.WriteLine($"File {plcSimInstallationFolder} does not exists, or is not accessible."); + return false; + } + exePath = plcSimInstallationFolder; + } + return true; + } + } + } +} diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/PlcSim/PlcSimInstance.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/PlcSim/PlcSimInstance.cs new file mode 100644 index 0000000..8a36d98 --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/PlcSim/PlcSimInstance.cs @@ -0,0 +1,46 @@ +using Cocona; +using System.Reflection; +using Microsoft.CodeAnalysis; +using System.Xml.Linq; +using System.Diagnostics; + + +namespace AXOpen.Simple.Tools.PlcSim +{ + public class PlcSim + { + [Command("startplcsim")] + public Task StartPlcSim( [Option('x',Description = "PlcSim instance name")] string PlcSimInstanceName, + [Option('n',Description = "Plc name.")] string PlcName, + [Option('t',Description = "Plc Ip address")] string PlcIpAddress) + { + string dllPath = ""; + string exePath = ""; + + if(PlcSimInstallation.Check(ref dllPath, ref exePath)) + { + // This is a workaround to get the local dll for the PlcSimAdvanced API + var entry = new FileInfo(Assembly.GetEntryAssembly().Location); + var folder = entry.Directory.FullName; + File.Copy(dllPath, Path.Combine(folder, "Siemens.Simatic.Simulation.Runtime.Api.x64.dll"), true); + + // Check if PlcSim is already running + if (Process.GetProcesses().Where(p => p.ProcessName.Equals("Siemens.Simatic.PlcSim.Advanced.UserInterface")).Count() > 0) + { + Console.WriteLine("PlcSimAdvanced already running."); + } + else + { + // Start PlcSim + Process.Start(new ProcessStartInfo(exePath)); + Console.WriteLine("PlcSimAdvanced started."); + } + + exePath = Path.Combine(folder, "PlcSimAdvancedStarter.exe"); + Process.Start(new ProcessStartInfo(exePath) { Arguments = $"-x {PlcSimInstanceName} -n {PlcName} -t {PlcIpAddress}" }); + } + + return Task.CompletedTask; + } + } +} diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Program.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Program.cs index 2658361..16a6d65 100644 --- a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Program.cs +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Program.cs @@ -1,6 +1,7 @@ using Cocona; using AXOpen.Simple.Tools.ControlledUnit; using System.Reflection; +using AXOpen.Simple.Tools.PlcSim; internal class Program { @@ -11,6 +12,7 @@ private static void Main(string[] args) var app = builder.Build(); app.AddCommands(); + app.AddCommands(); app.Run(); } diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Properties/launchSettings.json b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Properties/launchSettings.json index cd63bd0..ca5d8af 100644 --- a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Properties/launchSettings.json +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Properties/launchSettings.json @@ -4,8 +4,11 @@ "commandName": "Project", "workingDirectory": "D:\\_tmp\\abcd\\app\\", "commandLineArgs": "cuadd -x D:\\_tmp\\abcd\\app\\ax\\ -n Cu10 -d abcd.Context -p abcd.ProcessData -t abcd.TechnologyData" + }, + "startplcsim": { + "commandName": "Project", + "workingDirectory": "", + "commandLineArgs": "startplcsim -x abcd.efgh -n test_plc -t 10.10.20.1" } } } - - diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Setup/Constants.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Setup/Constants.cs new file mode 100644 index 0000000..87461c7 --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/AXOpen.Simple.Tools/Setup/Constants.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AXOpen.Simple.Tools.Setup +{ + public static class Constants + { + public static readonly Version PlcSimAdvancedMinVersion = new Version(7, 0, 0); + public static readonly Version PlcSimAdvancedMaxVersion = new Version(7, 9, 9); + + } +} diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/PlcSimAdvancedStarter.csproj b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/PlcSimAdvancedStarter.csproj new file mode 100644 index 0000000..ec17ae0 --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/PlcSimAdvancedStarter.csproj @@ -0,0 +1,28 @@ + + + + Exe + net9.0 + enable + enable + + + + + + + + + + + ..\..\..\third\Siemens.Simatic.Simulation.Runtime.Api.x64.dll + + + + + Never + + + + + diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/PlcSimInstance.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/PlcSimInstance.cs new file mode 100644 index 0000000..12bd5e1 --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/PlcSimInstance.cs @@ -0,0 +1,70 @@ +using System.Reflection; +using System.Xml.Linq; +using Siemens.Simatic.Simulation.Runtime; +using System.Diagnostics; + + +namespace PlcSimAdvancedStarter +{ + public static class PlcSimInstance + { + public static void StartPlcSim(Options options) + { + + SimulationRuntimeManager.NetworkMode = ENetworkMode.TCPIPSingleAdapter; + + // Check if PlcSimInstanceName is already registered + bool instanceAlreadyRegistered = false; + IInstance plcSimInstance = null; + SInstanceInfo[] instanceInfos = SimulationRuntimeManager.RegisteredInstanceInfo; + foreach (SInstanceInfo instanceInfo in instanceInfos) + { + if (instanceInfo.Name.Equals(options.PlcSimInstanceName)) + { + Console.WriteLine($"Instance {options.PlcSimInstanceName} already registered."); + plcSimInstance = SimulationRuntimeManager.CreateInterface(options.PlcSimInstanceName); + instanceAlreadyRegistered = true; + break; + } + } + + // Register PlcSimInstanceName + if (!instanceAlreadyRegistered) + { + plcSimInstance = SimulationRuntimeManager.RegisterInstance(options.PlcSimInstanceName); + Console.WriteLine($"Instance {options.PlcSimInstanceName} registered."); + } + + // Power On + if (plcSimInstance.OperatingState == EOperatingState.Off) + { + plcSimInstance.PowerOn(6000); + Console.WriteLine($"Instance {options.PlcSimInstanceName} powered on."); + } + else + { + Console.WriteLine($"Instance {options.PlcSimInstanceName} already powered."); + } + // Set Ip address + plcSimInstance.SetIPSuite(0, new SIPSuite4(options.PlcIpAddress, "255.255.255.0", "0.0.0.0"), true); + + // Run + if (plcSimInstance.OperatingState == EOperatingState.Stop) + { + try + { + plcSimInstance.Run(6000); + Console.WriteLine($"PLC set to RUN mode."); + } + catch (Exception ex) + { + Console.WriteLine($"Unable to set the PLC into the RUN mode. {ex.Message}"); + + } + + } + } + + + } +} diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Program.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Program.cs new file mode 100644 index 0000000..1c5e6ff --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Program.cs @@ -0,0 +1,52 @@ +using CommandLine; +using System; +using System.Resources; +using System.Reflection; + +namespace PlcSimAdvancedStarter +{ + public class Program + { + public static void Main(string[] args) + { + + Parser.Default.ParseArguments(args) + .WithParsed(o => + { + var recoverCurrentDirectory = Environment.CurrentDirectory; + try + { + PlcSimInstance.StartPlcSim(o); + Console.WriteLine("Done."); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } + finally + { + Environment.CurrentDirectory = recoverCurrentDirectory; + } + }); + } + } + + + public class Options + { + [Option('x', "PlcSimInstanceName", Required = true, HelpText = "PlcSim instance name")] + public string PlcSimInstanceName { get; set; } + + [Option('n', "PlcName", Required = true, + HelpText = "Plc name")] + public string PlcName { get; set; } + + [Option('t', "PlcIpAddress", Required = true, HelpText = "Plc Ip address")] + public string PlcIpAddress { get; set; } + + [Option('h', "hwid", Required = false, HelpText = "Export hardware identifiers")] + public bool HwId { get; set; } + + } +} diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Properties/launchSettings.json b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Properties/launchSettings.json new file mode 100644 index 0000000..0b387cf --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Properties/launchSettings.json @@ -0,0 +1,9 @@ +{ + "profiles": { + "plcsimstart": { + "commandName": "Project", + "workingDirectory": "", + "commandLineArgs": "startplcsim -x abcd -n test_plc -t 10.10.10.1" + } + } +} \ No newline at end of file diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Setup/Constants.cs b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Setup/Constants.cs new file mode 100644 index 0000000..ec4b47b --- /dev/null +++ b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/Setup/Constants.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace PlcSimAdvancedStarter.Setup +{ + public static class Constants + { + public static readonly Version PlcSimAdvancedMinVersion = new Version(7, 0, 0); + public static readonly Version PlcSimAdvancedMaxVersion = new Version(7, 9, 9); + + } +} diff --git a/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/third/Siemens.Simatic.Simulation.Runtime.Api.x64.dll b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/third/Siemens.Simatic.Simulation.Runtime.Api.x64.dll new file mode 100644 index 0000000..3fd0070 Binary files /dev/null and b/axopen.template.simple/tools/AXOpen.Simple.Tools/PlcSimAdvancedStarter/third/Siemens.Simatic.Simulation.Runtime.Api.x64.dll differ