feat(plc): a CODESYS script that exports PLCopen XML for Prüfwerk (#165) (#829)
CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 5s
CI / Deploy Dashboard (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Docs (push) Successful in 1m10s
CI / Deploy Agent (push) Successful in 6m30s

This commit was merged in pull request #829.
This commit is contained in:
sharang committed 2026-11-04 11:10:09 +00:00
1 parent c16e91f981
commit e911e75c09
5 files changed
+273 -1

No files matched your search

+30
View File
@@ -100,6 +100,36 @@ project** artifact and pick its format:
Attach a **Git repository** artifact to the PLC/SPS target. Prüfwerk clones it and
runs the control-logic scan over the exported source in the repo.
## Exporting PLCopen XML automatically
Prüfwerk reads the control logic from the PLCopen XML export, never from the
binary `.project`. Instead of exporting by hand before every upload or commit,
let CODESYS do it with the script
[codesys-export-plcopen.py](/downloads/codesys-export-plcopen.py){target="_self" download} (CODESYS
Script Engine, no extra packages). It exports every object of the project into
one PLCopen XML file, ST as well as graphical FBD/LD/SFC/CFC POUs, and exits with
an error if the export holds no POU.
- **In CODESYS:** open the project, then *Tools → Scripting → Execute Script
File* and pick the script. The export is written next to the project as
`<project>.plcopen.xml`.
- **Without a window**, for example in a build pipeline before the commit or
upload:
```bat
"C:\Program Files\CODESYS 3.5.19.50\CODESYS\Common\CODESYS.exe" ^
--profile="CODESYS V3.5 SP19 Patch 5" --noUI ^
--runscript="C:\tools\codesys-export-plcopen.py" ^
--scriptargs:"C:\src\Line.project C:\src\export\Line.plcopen.xml"
```
Use the path and profile name of your CODESYS installation. The first script
argument is the project, the second the export file (optional).
A `.projectarchive` has to be extracted first (*File → Project Archive →
Extract Archive*). Commit or upload the export next to the `.projectarchive`:
the export carries the control logic, the archive the library SBOM.
## Best-case git repository layout
Because the binary `.project` does not diff or merge in git, commit **textual
+1 -1
View File
@@ -168,7 +168,7 @@ as a clean result: the CRA requirements it checks show as **Nicht geprüft**.
| **Abhängigkeiten (SBOM)** | *(manifest)* ohne Lockfile: Die Versionen der Abhängigkeiten und ihre CVEs sind nicht bekannt. | Commit the lockfile (see below). |
| e.g. **Firmware-Binäranalyse**, **Container-Analyse**, **Mobile-App-Analyse** | e.g. Firmware-Images werden noch nicht entpackt … | Nothing analyses these files yet; scan the source code instead. |
| **SPS-Bibliotheken (SBOM)** | *(file)* ist kein lesbares CODESYS-Projektarchiv. | Export the archive again with *File → Project Archive*, with the referenced libraries ticked. |
| **SPS-Projekt (natives Format)** | CODESYS-Projekt im nativen Format, Steuerungslogik nicht geprüft: *(files)* … | Export the POUs as PLCopen XML (*Project → Export PLCopenXML*) and add the export to the target; see [PLC / SPS](/guide/plc). |
| **SPS-Projekt (natives Format)** | CODESYS-Projekt im nativen Format, Steuerungslogik nicht geprüft: *(files)* … | Export the POUs as PLCopen XML (*Project → Export PLCopenXML*) and add the export to the target; see [PLC / SPS](/guide/plc), which also has a script that exports it automatically. |
| **Einlesen der Dateien** | *(file)* konnte nicht gelesen werden. | Check the file and upload it again under **Bearbeiten**. |
| **Archiv-Passwort fehlt (beim Prüfobjekt unter „Bearbeiten“ eingeben)** | *(file)* ist passwortgeschützt. | Enter the password under **Bearbeiten**. |
| **Archiv-Passwort falsch (beim Prüfobjekt unter „Bearbeiten“ ändern)** | Das gespeicherte Passwort öffnet *(file)* nicht. | Change the password under **Bearbeiten**. |