simaticml-decoder 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.4
2
+ Name: simaticml-decoder
3
+ Version: 0.1.0
4
+ Summary: Translate exported SimaticML LAD/FBD blocks (TIA V21) into readable SCL plus a JSON metadata sidecar.
5
+ Project-URL: Homepage, https://github.com/Czarnak/simaticml-decoder
6
+ Project-URL: Issues, https://github.com/Czarnak/simaticml-decoder/issues
7
+ Project-URL: Repository, https://github.com/Czarnak/simaticml-decoder
8
+ Author: Czarnak
9
+ Keywords: plc,scl,simatic,simaticml,tia-portal
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Manufacturing
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Text Processing
19
+ Classifier: Topic :: Utilities
20
+ Requires-Python: >=3.11
21
+ Provides-Extra: dev
22
+ Requires-Dist: build; extra == 'dev'
23
+ Requires-Dist: pytest; extra == 'dev'
24
+ Requires-Dist: pytest-cov; extra == 'dev'
25
+ Requires-Dist: ruff; extra == 'dev'
26
+ Requires-Dist: twine; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # simaticml-decoder
30
+
31
+ Translate exported **SimaticML LAD/FBD** blocks (Siemens TIA Portal **V21**) into
32
+ readability-first **SCL** plus a **JSON metadata sidecar**.
33
+
34
+ ## Why
35
+
36
+ A SimaticML export stores ladder logic as a `FlgNet` — a flat netlist of parts
37
+ and wires, not line-shaped rungs. Reading that graph by hand (or by eye, from the
38
+ editor) is token-heavy and error-prone: it is easy to connect the wrong variable
39
+ in a large block, and a single contact's negation is one diagonal slash. This tool
40
+ decodes the netlist deterministically, so what you analyse is folded logic with
41
+ explicit negation and an exact write/read cross-reference — not a graph you have to
42
+ trace yourself.
43
+
44
+ ## How it works
45
+
46
+ Three cleanly separated, independently testable phases:
47
+
48
+ | Phase | Module | Input → Output |
49
+ |-------|--------|----------------|
50
+ | 1. Parse | `parse.py` → `model.py` | XML → faithful syntactic mirror |
51
+ | 2. Fold | `fold.py` → `ir.py` | model → boolean tree + assignments |
52
+ | 3. Emit | `emit.py` | IR → SCL text + JSON sidecar |
53
+
54
+ Supporting modules: `instructions.py` (the part catalog — data, not logic),
55
+ `operand.py` (Access → display string), `scl_reconstruct.py` (SCL networks, which
56
+ are reconstructed from their tokenised AST rather than folded).
57
+
58
+ Two commitments run through the design: every IR node keeps the source `UId` it
59
+ came from (so any rendered claim is traceable to a net), and anything the folder
60
+ cannot interpret is surfaced **loudly** rather than dropped — a silent omission in
61
+ authoritative-looking SCL is the worst possible failure.
62
+
63
+ ## Scope
64
+
65
+ Covered: FC/FB blocks; LAD/FBD folding (series→AND, `O`→OR, fan-out, `Negated`→NOT,
66
+ daisy-chained coils, structural latch detection); SCL network reconstruction;
67
+ ground-truth interface types; cross-reference table; the instruction set seen in
68
+ real V21 samples (Contact, Coil/SCoil/RCoil, `O`, Move/Add/Inc, comparisons,
69
+ Rs/Sr, P/N edges, TON family, user FC/FB calls).
70
+
71
+ Deferred (parsed losslessly, rendering flagged): GRAPH/SFC and STL networks;
72
+ absolute-addressing / array / `Operation`-template rendering. Output is
73
+ readability-first, **not** recompilable. Live TIA Openness integration is out of
74
+ scope — the tool operates on already-exported XML.
75
+
76
+ ## Install
77
+
78
+ ```bash
79
+ pip install simaticml-decoder
80
+ ```
81
+
82
+ For local development:
83
+
84
+ ```bash
85
+ pip install -e ".[dev]"
86
+ ```
87
+
88
+ Runtime dependencies: none (standard-library `xml.etree.ElementTree`). The `dev`
89
+ extra pulls lint, test, coverage, build, and package-validation tools.
90
+
91
+ ## Usage
92
+
93
+ ```bash
94
+ simaticml-decode BLOCK.xml --format both
95
+ # one file at a time; --format {scl,json,both}; -o OUTDIR for output location
96
+ ```
97
+
98
+ ## Layout
99
+
100
+ ```
101
+ src/simaticml_decoder/ parse · model · fold · ir · instructions · operand
102
+ scl_reconstruct · emit · cli
103
+ tests/ authored separately; run by CI
104
+ .github/workflows/ci.yml ruff + pytest on push / PR
105
+ ```
106
+
107
+ ## Release
108
+
109
+ Publishing is handled by GitHub Actions and PyPI Trusted Publishing. A package is
110
+ published only when a `vX.Y.Z` tag is pushed and the release workflow passes
111
+ lint, tests, coverage, version checks, package build, and `twine check`.
112
+
113
+ ## Future
114
+
115
+ Support for new YAML-like S7 PLCs export formats.
116
+
117
+ ---
118
+ *Created with Claude AI*
@@ -0,0 +1,14 @@
1
+ simaticml_decoder/__init__.py,sha256=j38Ncpx_cdZfljzkj_XTpPTHHWpkr30qv3u4MV8jP2U,529
2
+ simaticml_decoder/cli.py,sha256=-2RIQzJ6NgXnnLjuo5RIjXxW3vHoE_t6jHx1c9XJHIE,4130
3
+ simaticml_decoder/emit.py,sha256=giCmYVhGXKAQ2BlQ39LIMA-P3hmNXPyf8oMBdhQGx0I,13867
4
+ simaticml_decoder/fold.py,sha256=adUyxLvx3BtzGYBI0eiZal1U-dCOf1zpR6F3_GUBM8k,26342
5
+ simaticml_decoder/instructions.py,sha256=WaKC1tzA5yyoBwsG2eXNVcpcJsklDc49QGWIWkw5PLk,4850
6
+ simaticml_decoder/ir.py,sha256=-n5ULWc2IzPco5_nTAot5Lm_ndyQyrh95TJcG7R7XDY,5856
7
+ simaticml_decoder/model.py,sha256=yBH-oWgudS3ebZDaZKiuja2GQJOLDqWBU0UaQO8SMvE,9246
8
+ simaticml_decoder/operand.py,sha256=-ERD8PHFNhEdqZiRuzQYq01CgtbQsxsz0swuu7EG5Is,5316
9
+ simaticml_decoder/parse.py,sha256=nRwMCleJX5YhstGpfm5xmndP1d0JVfVoWr43L8yThOE,20555
10
+ simaticml_decoder/scl_reconstruct.py,sha256=IY5zHlQ2odUU0d7WsgXjEzGzoe5EK3TJHd-c7UqJ6g0,2656
11
+ simaticml_decoder-0.1.0.dist-info/METADATA,sha256=qFUi5AQKEbVn-dwIxquBkSewOCR9WEiXUaMnLiyi1DU,4429
12
+ simaticml_decoder-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
13
+ simaticml_decoder-0.1.0.dist-info/entry_points.txt,sha256=7maZCkNU6nBe4wMePfwu82j4TBVOsQ4mvaPZV6ayL7M,64
14
+ simaticml_decoder-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ simaticml-decode = simaticml_decoder.cli:main