Anonymised: plant, customer, people and file names are not published. Figures are from the actual engineering session.
The situation
The plant ventilates, cools and conditions stored produce in seven sections. Each section has phases — drying, curing, cooling and heating — and uses outside air, recirculation, a compressor and a defrost heater.
The program had grown over years. The manual of the original controller described the intended behaviour in detail; nobody had compared the two systematically. Testing on the live plant was not an option.
How the AI worked
All work happened on a copy of the project, loaded into S7-PLCSIM Advanced. The plant project was never changed.
Copy and read
Archived the project, opened a copy and exported the program as SCL sources for analysis.
Requirements from the manual
Extracted every rule for each phase — set-points, hysteresis, interlocks, alarms — and mapped it to blocks and DB variables.
Simulate
Downloaded the copy to a PLCSIM Advanced instance in deterministic mode: 100 ms of virtual time per cycle, so timers behave as on the real CPU.
Test every phase
Wrote tests that set inputs, run cycles and check outputs. Tests for real program behaviour must pass; tests marked per manual fail exactly where the program deviates.
Fix and re-verify
After the owner decided what to change, the AI fixed the copy, recompiled PLC and HMI, and re-ran the whole suite as a regression.
What was found
Eleven deviations, each confirmed by a failing test on the simulated PLC — not just by reading code.
| # | Deviation | Impact |
|---|---|---|
| 1 | Curing phase held no temperature: only recirculation, no outside-air or compressor cooling | Self-heating produce is not cooled |
| 2 | Dampers only 0 / 100 %, no regulation on channel temperature | Risk of under-cooling with cold outside air |
| 3 | Minimum thermostat and external stop only raised an alarm | Protective functions did not protect |
| 4 | Heating with outside air without demand check; limits hard-coded | Produce warmed beyond the final temperature |
| 5 | One final temperature shared by cooling and heating | Wrong heating set-point |
| 6 | Compressor and outside air ran at the same time | Against the either/or rule; wasted energy |
| 7 | No compressor feedback monitoring (watchdog declared, never called) | A failed compressor goes unnoticed |
| 8 | Fans ran permanently in all phases | Energy use and fan heat in the produce |
| 9 | Defrost by calendar time, in any phase, even on a stopped section | Unneeded heating of the evaporator |
| 10 | Product temperature alarm on the average, not per sensor | Local hot or cold spots missed |
| 11 | Drying: no hysteresis on minimum outside temperature; heater assist never called | Damper chatter; no heating support |
The fix
The owner chose which deviations to fix. The AI changed the copy in two small batches — 12 files, about 170 lines added — and documented every change in git: curing now cools with outside air or the compressor, dampers regulate the channel temperature step by step, a software minimum thermostat stops fans and compressor, and the compressor is monitored by its feedback signal, with a new run-hours counter.
A new alarm for a double channel-sensor failure was added for all seven sections, with matching HMI tags and messages. PLC and HMI compiled with no new warnings.
Results
| Stage | Tests | PASS | FAIL |
|---|---|---|---|
| First run: program vs. manual | 31 | 15 | 16 |
| After fixes, with new tests | 34 | 22 | 12 |
| Final regression | 36 | 28 | 8 |
The 8 remaining failures are deliberate: equipment the plant doesn't have (heater, external stop) or decisions the owner postponed. They stay in the suite as documented open points — all 15 originally passing tests still pass.
What it shows
- Tests, not opinions. Every finding is a reproducible test that fails on the simulated PLC.
- The plant project stayed untouched. All work on a copy in PLCSIM; the human decided what to change.
- Regression for free. The same suite re-runs after every change and becomes the basis of an acceptance report.
- Traceable. Every tool call is in the audit log; every code change is a git commit.
Reading the manual and testing every phase by hand would have taken days. Here the work was reviewing results and making decisions.