plcdiff 0.1.0__tar.gz

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,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ .coverage
@@ -0,0 +1,18 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
+ [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.1.0] - 2026-11-22
10
+
11
+ ### Added
12
+
13
+ - Parsers for Rockwell `.L5X` and PLCopen TC6 XML exports into a stable, line-oriented view.
14
+ - `plcdiff textconv` git driver and `plcdiff install` to set it up.
15
+ - `plcdiff diff`: semantic diff with rung renumbering handled, instruction-level deltas,
16
+ tag values, and text / Markdown / JSON output.
17
+ - `plcdiff git`: diff every PLC export changed in a revision range.
18
+ - Composite GitHub Action that writes the report to the job summary.
plcdiff-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dan Shinde
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
plcdiff-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.5
2
+ Name: plcdiff
3
+ Version: 0.1.0
4
+ Summary: Readable git diffs for PLC program exports (Rockwell L5X, PLCopen XML): rung by rung, tag by tag
5
+ Project-URL: Homepage, https://github.com/DanShinde/plcdiff
6
+ Project-URL: Documentation, https://github.com/DanShinde/plcdiff#readme
7
+ Project-URL: Issues, https://github.com/DanShinde/plcdiff/issues
8
+ Project-URL: Changelog, https://github.com/DanShinde/plcdiff/blob/main/CHANGELOG.md
9
+ Author: Dan Shinde
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: automation,codesys,diff,git,iec-61131-3,industrial,l5x,ladder-logic,logix,plc,plcopen,rslogix,structured-text,studio-5000,textconv,twincat,version-control
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Manufacturing
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Programming Language :: Python :: 3.14
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Classifier: Topic :: Software Development :: Version Control :: Git
27
+ Classifier: Topic :: Utilities
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+
32
+ # plcdiff
33
+
34
+ [![PyPI](https://img.shields.io/pypi/v/plcdiff.svg)](https://pypi.org/project/plcdiff/)
35
+ [![CI](https://github.com/DanShinde/plcdiff/actions/workflows/ci.yml/badge.svg)](https://github.com/DanShinde/plcdiff/actions/workflows/ci.yml)
36
+ [![Python](https://img.shields.io/pypi/pyversions/plcdiff.svg)](https://pypi.org/project/plcdiff/)
37
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
38
+
39
+ **Readable git diffs for PLC program exports.** Rockwell Studio 5000 `.L5X` and PLCopen XML
40
+ (CODESYS, TwinCAT, Beremiz, Machine Expert, ...) shown rung by rung, tag by tag, line by line,
41
+ instead of as a wall of XML.
42
+
43
+ ![git diff of an L5X export next to plcdiff output](https://raw.githubusercontent.com/DanShinde/plcdiff/main/docs/demo.png)
44
+
45
+ PLC teams are moving their projects into git, but an export changes in a hundred places when
46
+ someone edits one rung: export timestamps, reflowed attributes, CDATA blocks, layout
47
+ coordinates. `plcdiff` turns the export into a stable, line-oriented view and compares *that*,
48
+ so a review shows what an engineer actually changed:
49
+
50
+ - **Rungs** compared as ladder text, with the instructions that were added or removed
51
+ (`~ Rung 0 +XIO(EStop)`). Inserting a rung does not renumber every rung below it.
52
+ - **Structured Text** compared line by line, indentation kept.
53
+ - **Tags, UDT members, AOI parameters, POU variables** compared by name, so reordering is
54
+ not a change, plus **tag values** (timer presets, setpoints, recipe arrays) flattened to
55
+ `JamDelay.PRE = 5000`.
56
+ - **Comments and descriptions** diffed separately from the logic.
57
+ - **Layout noise ignored**: export dates, LD/FBD box positions, hidden UDT backing members.
58
+
59
+ Pure Python standard library, no dependencies. Python 3.10+ on Linux, Windows and macOS.
60
+
61
+ ## Install
62
+
63
+ ```console
64
+ pip install plcdiff # or: pipx install plcdiff / uv tool install plcdiff
65
+ ```
66
+
67
+ ## Use it with git (one-time setup)
68
+
69
+ Inside your PLC repository:
70
+
71
+ ```console
72
+ $ plcdiff install
73
+ git config diff.plcdiff.textconv "plcdiff textconv"
74
+ added to /work/line1/.gitattributes: *.L5X diff=plcdiff; *.l5x diff=plcdiff
75
+ Done. `git diff` and `git log -p` now show PLC exports rung by rung.
76
+ ```
77
+
78
+ From then on `git diff`, `git log -p`, `git show` and GUI clients that honour textconv show the
79
+ readable view. Commit `.gitattributes` so the whole team gets the mapping (each person runs
80
+ `plcdiff install` once, or `plcdiff install --global` for every repository).
81
+
82
+ PLCopen exports usually end in `.xml`, so map them explicitly:
83
+
84
+ ```console
85
+ plcdiff install --pattern "plc/*.xml"
86
+ ```
87
+
88
+ Files that are not PLC exports pass through untouched, so a broad pattern never breaks a diff.
89
+
90
+ ## Semantic diff of two files
91
+
92
+ ```console
93
+ plcdiff diff Line1_old.L5X Line1_new.L5X
94
+ plcdiff diff old.xml new.xml --format markdown # for a pull request comment
95
+ plcdiff diff old.xml new.xml --format json # for scripts
96
+ plcdiff diff a.L5X b.L5X --no-values --exit-code # ignore tag values; exit 1 on changes
97
+ ```
98
+
99
+ Works as a git difftool too: `git difftool -y -x "plcdiff diff" HEAD~1 -- Line1.L5X`.
100
+
101
+ ## Everything that changed in a commit range
102
+
103
+ ```console
104
+ plcdiff git # working tree vs HEAD
105
+ plcdiff git main..feature # between two revisions (renames followed)
106
+ plcdiff git v1.4 plc/ # since a tag, limited to a folder
107
+ ```
108
+
109
+ ## GitHub Action
110
+
111
+ Put a rung-by-rung summary of every PLC change into the job summary of each pull request:
112
+
113
+ ```yaml
114
+ on: pull_request
115
+ jobs:
116
+ plcdiff:
117
+ runs-on: ubuntu-latest
118
+ steps:
119
+ - uses: actions/checkout@v4
120
+ with:
121
+ fetch-depth: 0
122
+ - uses: DanShinde/plcdiff@v0.1.0
123
+ id: plcdiff
124
+ # Optional: post it as a PR comment
125
+ - if: steps.plcdiff.outputs.changed == 'true'
126
+ run: gh pr comment ${{ github.event.number }} --body-file ${{ steps.plcdiff.outputs.report }}
127
+ env:
128
+ GH_TOKEN: ${{ github.token }}
129
+ ```
130
+
131
+ Inputs: `base`, `head`, `paths`, `no-values`, `working-directory`, `python-version`.
132
+ Outputs: `changed` (`"true"`/`"false"`) and `report` (path of the Markdown file).
133
+
134
+ ## What is covered
135
+
136
+ | Format | Covered |
137
+ | --- | --- |
138
+ | Rockwell `.L5X` (Studio 5000 / RSLogix 5000), full project or partial export | controller properties, UDTs, modules (catalog, revision, IP address, inhibit), AOIs (parameters, local tags, routines), controller and program tags with values, aliases, produced/consumed, programs, tasks, ladder (RLL) rungs and comments, Structured Text; FBD and SFC routines as one line per element; source-protected routines reported as such |
139
+ | PLCopen TC6 XML (`tc6_0200`, `tc6_0201`) | data types (struct, enum, array, subrange, pointer, string), POU interfaces with initial values, ST and IL bodies, actions, transitions, CODESYS methods and global variable lists, configurations, resources, tasks, global variables; LD, FBD and SFC as one line per element with layout removed |
140
+
141
+ Known limits in this release, all good first contributions:
142
+
143
+ - LD/FBD **wiring** (which contact connects to which coil) is not compared yet, only the
144
+ elements and their variables.
145
+ - Siemens TIA Portal (SimaticML / Openness XML) and Rockwell `.L5K` are not supported yet.
146
+ - The sample exports in `examples/` are hand-written to match the published schemas. Real-world
147
+ exports vary between versions; if something parses oddly, please open an issue with a
148
+ (sanitized) file.
149
+
150
+ ## Python API
151
+
152
+ ```python
153
+ from plcdiff import load, diff_documents, render
154
+
155
+ old, new = load("v1.L5X"), load("v2.L5X")
156
+ for block in diff_documents(old, new):
157
+ for change in block.changes:
158
+ print(block.title, change.op, change.name)
159
+
160
+ print(render(new)) # the textconv view
161
+ ```
162
+
163
+ ## Related tools
164
+
165
+ `plcdiff` is part of a small set of open-source tools for automation engineers:
166
+
167
+ - [fakeplc](https://github.com/DanShinde/fakeplc): a fake PLC (OPC UA + Modbus TCP) for tests and demos
168
+ - [tagscope](https://github.com/DanShinde/tagscope): log OPC UA tags to a database, with a dashboard
169
+ - [tagbridge](https://github.com/DanShinde/tagbridge): Modbus / OPC UA to MQTT Sparkplug B gateway
170
+
171
+ ## Contributing
172
+
173
+ Issues and pull requests are welcome, see [CONTRIBUTING.md](CONTRIBUTING.md).
174
+
175
+ Not affiliated with Rockwell Automation or PLCopen. Studio 5000 and RSLogix are trademarks of
176
+ Rockwell Automation, Inc.
177
+
178
+ ## License
179
+
180
+ MIT
@@ -0,0 +1,149 @@
1
+ # plcdiff
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/plcdiff.svg)](https://pypi.org/project/plcdiff/)
4
+ [![CI](https://github.com/DanShinde/plcdiff/actions/workflows/ci.yml/badge.svg)](https://github.com/DanShinde/plcdiff/actions/workflows/ci.yml)
5
+ [![Python](https://img.shields.io/pypi/pyversions/plcdiff.svg)](https://pypi.org/project/plcdiff/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ **Readable git diffs for PLC program exports.** Rockwell Studio 5000 `.L5X` and PLCopen XML
9
+ (CODESYS, TwinCAT, Beremiz, Machine Expert, ...) shown rung by rung, tag by tag, line by line,
10
+ instead of as a wall of XML.
11
+
12
+ ![git diff of an L5X export next to plcdiff output](https://raw.githubusercontent.com/DanShinde/plcdiff/main/docs/demo.png)
13
+
14
+ PLC teams are moving their projects into git, but an export changes in a hundred places when
15
+ someone edits one rung: export timestamps, reflowed attributes, CDATA blocks, layout
16
+ coordinates. `plcdiff` turns the export into a stable, line-oriented view and compares *that*,
17
+ so a review shows what an engineer actually changed:
18
+
19
+ - **Rungs** compared as ladder text, with the instructions that were added or removed
20
+ (`~ Rung 0 +XIO(EStop)`). Inserting a rung does not renumber every rung below it.
21
+ - **Structured Text** compared line by line, indentation kept.
22
+ - **Tags, UDT members, AOI parameters, POU variables** compared by name, so reordering is
23
+ not a change, plus **tag values** (timer presets, setpoints, recipe arrays) flattened to
24
+ `JamDelay.PRE = 5000`.
25
+ - **Comments and descriptions** diffed separately from the logic.
26
+ - **Layout noise ignored**: export dates, LD/FBD box positions, hidden UDT backing members.
27
+
28
+ Pure Python standard library, no dependencies. Python 3.10+ on Linux, Windows and macOS.
29
+
30
+ ## Install
31
+
32
+ ```console
33
+ pip install plcdiff # or: pipx install plcdiff / uv tool install plcdiff
34
+ ```
35
+
36
+ ## Use it with git (one-time setup)
37
+
38
+ Inside your PLC repository:
39
+
40
+ ```console
41
+ $ plcdiff install
42
+ git config diff.plcdiff.textconv "plcdiff textconv"
43
+ added to /work/line1/.gitattributes: *.L5X diff=plcdiff; *.l5x diff=plcdiff
44
+ Done. `git diff` and `git log -p` now show PLC exports rung by rung.
45
+ ```
46
+
47
+ From then on `git diff`, `git log -p`, `git show` and GUI clients that honour textconv show the
48
+ readable view. Commit `.gitattributes` so the whole team gets the mapping (each person runs
49
+ `plcdiff install` once, or `plcdiff install --global` for every repository).
50
+
51
+ PLCopen exports usually end in `.xml`, so map them explicitly:
52
+
53
+ ```console
54
+ plcdiff install --pattern "plc/*.xml"
55
+ ```
56
+
57
+ Files that are not PLC exports pass through untouched, so a broad pattern never breaks a diff.
58
+
59
+ ## Semantic diff of two files
60
+
61
+ ```console
62
+ plcdiff diff Line1_old.L5X Line1_new.L5X
63
+ plcdiff diff old.xml new.xml --format markdown # for a pull request comment
64
+ plcdiff diff old.xml new.xml --format json # for scripts
65
+ plcdiff diff a.L5X b.L5X --no-values --exit-code # ignore tag values; exit 1 on changes
66
+ ```
67
+
68
+ Works as a git difftool too: `git difftool -y -x "plcdiff diff" HEAD~1 -- Line1.L5X`.
69
+
70
+ ## Everything that changed in a commit range
71
+
72
+ ```console
73
+ plcdiff git # working tree vs HEAD
74
+ plcdiff git main..feature # between two revisions (renames followed)
75
+ plcdiff git v1.4 plc/ # since a tag, limited to a folder
76
+ ```
77
+
78
+ ## GitHub Action
79
+
80
+ Put a rung-by-rung summary of every PLC change into the job summary of each pull request:
81
+
82
+ ```yaml
83
+ on: pull_request
84
+ jobs:
85
+ plcdiff:
86
+ runs-on: ubuntu-latest
87
+ steps:
88
+ - uses: actions/checkout@v4
89
+ with:
90
+ fetch-depth: 0
91
+ - uses: DanShinde/plcdiff@v0.1.0
92
+ id: plcdiff
93
+ # Optional: post it as a PR comment
94
+ - if: steps.plcdiff.outputs.changed == 'true'
95
+ run: gh pr comment ${{ github.event.number }} --body-file ${{ steps.plcdiff.outputs.report }}
96
+ env:
97
+ GH_TOKEN: ${{ github.token }}
98
+ ```
99
+
100
+ Inputs: `base`, `head`, `paths`, `no-values`, `working-directory`, `python-version`.
101
+ Outputs: `changed` (`"true"`/`"false"`) and `report` (path of the Markdown file).
102
+
103
+ ## What is covered
104
+
105
+ | Format | Covered |
106
+ | --- | --- |
107
+ | Rockwell `.L5X` (Studio 5000 / RSLogix 5000), full project or partial export | controller properties, UDTs, modules (catalog, revision, IP address, inhibit), AOIs (parameters, local tags, routines), controller and program tags with values, aliases, produced/consumed, programs, tasks, ladder (RLL) rungs and comments, Structured Text; FBD and SFC routines as one line per element; source-protected routines reported as such |
108
+ | PLCopen TC6 XML (`tc6_0200`, `tc6_0201`) | data types (struct, enum, array, subrange, pointer, string), POU interfaces with initial values, ST and IL bodies, actions, transitions, CODESYS methods and global variable lists, configurations, resources, tasks, global variables; LD, FBD and SFC as one line per element with layout removed |
109
+
110
+ Known limits in this release, all good first contributions:
111
+
112
+ - LD/FBD **wiring** (which contact connects to which coil) is not compared yet, only the
113
+ elements and their variables.
114
+ - Siemens TIA Portal (SimaticML / Openness XML) and Rockwell `.L5K` are not supported yet.
115
+ - The sample exports in `examples/` are hand-written to match the published schemas. Real-world
116
+ exports vary between versions; if something parses oddly, please open an issue with a
117
+ (sanitized) file.
118
+
119
+ ## Python API
120
+
121
+ ```python
122
+ from plcdiff import load, diff_documents, render
123
+
124
+ old, new = load("v1.L5X"), load("v2.L5X")
125
+ for block in diff_documents(old, new):
126
+ for change in block.changes:
127
+ print(block.title, change.op, change.name)
128
+
129
+ print(render(new)) # the textconv view
130
+ ```
131
+
132
+ ## Related tools
133
+
134
+ `plcdiff` is part of a small set of open-source tools for automation engineers:
135
+
136
+ - [fakeplc](https://github.com/DanShinde/fakeplc): a fake PLC (OPC UA + Modbus TCP) for tests and demos
137
+ - [tagscope](https://github.com/DanShinde/tagscope): log OPC UA tags to a database, with a dashboard
138
+ - [tagbridge](https://github.com/DanShinde/tagbridge): Modbus / OPC UA to MQTT Sparkplug B gateway
139
+
140
+ ## Contributing
141
+
142
+ Issues and pull requests are welcome, see [CONTRIBUTING.md](CONTRIBUTING.md).
143
+
144
+ Not affiliated with Rockwell Automation or PLCopen. Studio 5000 and RSLogix are trademarks of
145
+ Rockwell Automation, Inc.
146
+
147
+ ## License
148
+
149
+ MIT
@@ -0,0 +1,189 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <RSLogix5000Content SchemaRevision="1.0" SoftwareRevision="33.01" TargetName="Conveyor_Line1" TargetType="Controller" ContainsContext="false" ExportDate="Mon Nov 16 09:12:44 2026" ExportOptions="NoRawData L5KData DecoratedData ForceProtectedEncoding AllProjDocTrans">
3
+ <Controller Use="Target" Name="Conveyor_Line1" ProcessorType="1769-L33ER" MajorRev="33" MinorRev="11" TimeSlice="20" ShareUnusedTimeSlice="1" ProjectCreationDate="Mon Nov 02 08:00:00 2026" LastModifiedDate="Mon Nov 16 09:12:01 2026" SFCExecutionControl="CurrentActive" SFCRestartPosition="MostRecent" SFCLastScan="DontScan" ProjectSN="16#0000_0000" MatchProjectToController="false" CanUseRPIFromProducer="false" InhibitAutomaticFirmwareUpdate="0" PassThroughConfiguration="EnabledWithAppend" DownloadProjectDocumentationAndExtendedProperties="true" DownloadProjectCustomProperties="true" ReportMinorOverflow="false">
4
+ <Description>
5
+ <![CDATA[Packaging hall, conveyor line 1]]>
6
+ </Description>
7
+ <RedundancyInfo Enabled="false" KeepTestEditsOnSwitchOver="false" IOMemoryPadPercentage="90" DataTablePadPercentage="50"/>
8
+ <Security Code="0" ChangesToDetect="16#ffff_ffff_ffff_ffff"/>
9
+ <SafetyInfo/>
10
+ <DataTypes>
11
+ <DataType Name="Motor_UDT" Family="NoFamily" Class="User">
12
+ <Description>
13
+ <![CDATA[Standard motor interface]]>
14
+ </Description>
15
+ <Members>
16
+ <Member Name="ZZZZZZZZZZMotor_UDT0" DataType="SINT" Dimension="0" Radix="Decimal" Hidden="true" ExternalAccess="Read/Write"/>
17
+ <Member Name="Run" DataType="BIT" Dimension="0" Radix="Decimal" Hidden="false" Target="ZZZZZZZZZZMotor_UDT0" BitNumber="0" ExternalAccess="Read/Write">
18
+ <Description>
19
+ <![CDATA[Run command to starter]]>
20
+ </Description>
21
+ </Member>
22
+ <Member Name="Fault" DataType="BIT" Dimension="0" Radix="Decimal" Hidden="false" Target="ZZZZZZZZZZMotor_UDT0" BitNumber="1" ExternalAccess="Read/Write"/>
23
+ <Member Name="Speed" DataType="REAL" Dimension="0" Radix="Float" Hidden="false" ExternalAccess="Read/Write">
24
+ <Description>
25
+ <![CDATA[Speed setpoint, m/min]]>
26
+ </Description>
27
+ </Member>
28
+ </Members>
29
+ </DataType>
30
+ </DataTypes>
31
+ <Modules>
32
+ <Module Name="Local" CatalogNumber="1769-L33ER" Vendor="1" ProductType="14" ProductCode="153" Major="33" Minor="11" ParentModule="Local" ParentModPortId="1" Inhibited="false" MajorFault="true">
33
+ <EKey State="ExactMatch"/>
34
+ <Ports>
35
+ <Port Id="1" Address="0" Type="Compact" Upstream="false">
36
+ <Bus Size="31"/>
37
+ </Port>
38
+ <Port Id="2" Type="Ethernet" Upstream="false">
39
+ <Bus/>
40
+ </Port>
41
+ </Ports>
42
+ </Module>
43
+ <Module Name="VFD_Conveyor1" CatalogNumber="PowerFlex 525-EENET" Vendor="1" ProductType="143" ProductCode="9" Major="5" Minor="1" ParentModule="Local" ParentModPortId="2" Inhibited="false" MajorFault="false">
44
+ <EKey State="CompatibleModule"/>
45
+ <Ports>
46
+ <Port Id="2" Address="192.168.1.21" Type="Ethernet" Upstream="true"/>
47
+ </Ports>
48
+ </Module>
49
+ </Modules>
50
+ <AddOnInstructionDefinitions/>
51
+ <Tags>
52
+ <Tag Name="Conveyor1" TagType="Base" DataType="Motor_UDT" Constant="false" ExternalAccess="Read/Write">
53
+ <Description>
54
+ <![CDATA[Infeed conveyor]]>
55
+ </Description>
56
+ <Data Format="L5K">
57
+ <![CDATA[[0,1.20000000e+001]]]>
58
+ </Data>
59
+ <Data Format="Decorated">
60
+ <Structure DataType="Motor_UDT">
61
+ <DataValueMember Name="Run" DataType="BOOL" Value="0"/>
62
+ <DataValueMember Name="Fault" DataType="BOOL" Value="0"/>
63
+ <DataValueMember Name="Speed" DataType="REAL" Radix="Float" Value="12.0"/>
64
+ </Structure>
65
+ </Data>
66
+ </Tag>
67
+ <Tag Name="StartPB" TagType="Base" DataType="BOOL" Radix="Decimal" Constant="false" ExternalAccess="Read/Write">
68
+ <Description>
69
+ <![CDATA[Start pushbutton, panel P1]]>
70
+ </Description>
71
+ <Data Format="L5K">
72
+ <![CDATA[0]]>
73
+ </Data>
74
+ <Data Format="Decorated">
75
+ <DataValue DataType="BOOL" Radix="Decimal" Value="0"/>
76
+ </Data>
77
+ </Tag>
78
+ <Tag Name="StopPB" TagType="Base" DataType="BOOL" Radix="Decimal" Constant="false" ExternalAccess="Read/Write">
79
+ <Description>
80
+ <![CDATA[Stop pushbutton (NC), panel P1]]>
81
+ </Description>
82
+ <Data Format="Decorated">
83
+ <DataValue DataType="BOOL" Radix="Decimal" Value="1"/>
84
+ </Data>
85
+ </Tag>
86
+ <Tag Name="JamDelay" TagType="Base" DataType="TIMER" Constant="false" ExternalAccess="Read/Write">
87
+ <Data Format="Decorated">
88
+ <Structure DataType="TIMER">
89
+ <DataValueMember Name="PRE" DataType="DINT" Radix="Decimal" Value="3000"/>
90
+ <DataValueMember Name="ACC" DataType="DINT" Radix="Decimal" Value="0"/>
91
+ <DataValueMember Name="EN" DataType="BOOL" Value="0"/>
92
+ <DataValueMember Name="TT" DataType="BOOL" Value="0"/>
93
+ <DataValueMember Name="DN" DataType="BOOL" Value="0"/>
94
+ </Structure>
95
+ </Data>
96
+ </Tag>
97
+ <Tag Name="PhotoEye" TagType="Alias" Radix="Decimal" AliasFor="Local:1:I.Data.4" ExternalAccess="Read/Write">
98
+ <Description>
99
+ <![CDATA[Jam photo eye at transfer]]>
100
+ </Description>
101
+ </Tag>
102
+ </Tags>
103
+ <Programs>
104
+ <Program Name="MainProgram" TestEdits="false" MainRoutineName="MainRoutine" Disabled="false" UseAsFolder="false">
105
+ <Tags>
106
+ <Tag Name="Running" TagType="Base" DataType="BOOL" Radix="Decimal" Constant="false" ExternalAccess="Read/Write">
107
+ <Data Format="Decorated">
108
+ <DataValue DataType="BOOL" Radix="Decimal" Value="0"/>
109
+ </Data>
110
+ </Tag>
111
+ </Tags>
112
+ <Routines>
113
+ <Routine Name="MainRoutine" Type="RLL">
114
+ <RLLContent>
115
+ <Rung Number="0" Type="N">
116
+ <Comment>
117
+ <![CDATA[Start/stop seal-in for the infeed conveyor]]>
118
+ </Comment>
119
+ <Text>
120
+ <![CDATA[[XIC(StartPB) ,XIC(Running) ]XIC(StopPB)OTE(Running);]]>
121
+ </Text>
122
+ </Rung>
123
+ <Rung Number="1" Type="N">
124
+ <Text>
125
+ <![CDATA[XIC(Running)OTE(Conveyor1.Run);]]>
126
+ </Text>
127
+ </Rung>
128
+ <Rung Number="2" Type="N">
129
+ <Comment>
130
+ <![CDATA[Jam detection: photo eye blocked for 3 s]]>
131
+ </Comment>
132
+ <Text>
133
+ <![CDATA[XIC(Running)XIC(PhotoEye)TON(JamDelay,?,?);]]>
134
+ </Text>
135
+ </Rung>
136
+ <Rung Number="3" Type="N">
137
+ <Text>
138
+ <![CDATA[XIC(JamDelay.DN)OTL(Conveyor1.Fault);]]>
139
+ </Text>
140
+ </Rung>
141
+ <Rung Number="4" Type="N">
142
+ <Text>
143
+ <![CDATA[JSR(SpeedCalc,0);]]>
144
+ </Text>
145
+ </Rung>
146
+ </RLLContent>
147
+ </Routine>
148
+ <Routine Name="SpeedCalc" Type="ST">
149
+ <STContent>
150
+ <Line Number="0">
151
+ <![CDATA[// Ramp the conveyor speed setpoint]]>
152
+ </Line>
153
+ <Line Number="1">
154
+ <![CDATA[IF Running THEN]]>
155
+ </Line>
156
+ <Line Number="2">
157
+ <![CDATA[ Conveyor1.Speed := 12.0;]]>
158
+ </Line>
159
+ <Line Number="3">
160
+ <![CDATA[ELSE]]>
161
+ </Line>
162
+ <Line Number="4">
163
+ <![CDATA[ Conveyor1.Speed := 0.0;]]>
164
+ </Line>
165
+ <Line Number="5">
166
+ <![CDATA[END_IF;]]>
167
+ </Line>
168
+ </STContent>
169
+ </Routine>
170
+ </Routines>
171
+ </Program>
172
+ </Programs>
173
+ <Tasks>
174
+ <Task Name="MainTask" Type="CONTINUOUS" Priority="10" Watchdog="500" DisableUpdateOutputs="false" InhibitTask="false">
175
+ <ScheduledPrograms>
176
+ <ScheduledProgram Name="MainProgram"/>
177
+ </ScheduledPrograms>
178
+ </Task>
179
+ </Tasks>
180
+ <CST MasterID="0"/>
181
+ <WallClockTime LocalTimeAdjustment="0" TimeZone="0"/>
182
+ <Trends/>
183
+ <DataLogs/>
184
+ <TimeSynchronize Priority1="128" Priority2="128" PTPEnable="false"/>
185
+ <EthernetPorts>
186
+ <EthernetPort Port="1" Label="1" PortEnabled="true"/>
187
+ </EthernetPorts>
188
+ </Controller>
189
+ </RSLogix5000Content>