Skip to content

feat: OpenPLC v4 tank simulation demo with OPC-UA#48

Closed
mfaferek93 wants to merge 1 commit intomainfrom
feat/openplc-tank-demo
Closed

feat: OpenPLC v4 tank simulation demo with OPC-UA#48
mfaferek93 wants to merge 1 commit intomainfrom
feat/openplc-tank-demo

Conversation

@mfaferek93
Copy link
Copy Markdown

Summary

Docker-based OpenPLC v4 tank simulation with OPC-UA server for PLC diagnostics demo.

What works (verified)

  • OpenPLC v4 Docker build from Autonomy-Logic source (MIT license)
  • IEC 61131-3 ST program compiled by matiec at build time
  • PLC runtime executes at 100ms cycle
  • OPC-UA server on port 4840 with 5 tank variables
  • Read values via OPC-UA client (asyncua Python)
  • Write setpoints (PumpSpeed, ValvePosition) via OPC-UA
  • Tank simulation dynamics: pump fills, valve drains, temperature changes

Tank variables (OPC-UA)

Variable Type Range R/W Description
TankLevel REAL 0-1000 mm RW Tank fill level
TankTemperature REAL 0-120 C RW Process temperature
TankPressure REAL 0-10 bar R Computed from level+temp
PumpSpeed REAL 0-100% RW Fill pump setpoint
ValvePosition REAL 0-100% RW Drain valve setpoint

Not yet integrated

  • ros2_medkit gateway + OPC-UA plugin (gateway Dockerfile exists but plugin not tested)
  • Alarm-to-fault mapping (BOOL alarm variables in PLC but not in OPC-UA config yet)
  • Integration test script (written but needs gateway+plugin)
  • sovd_web_ui

Working Docker container with OpenPLC v4 runtime running an IEC 61131-3
Structured Text tank simulation with OPC-UA server.

Verified end-to-end:
- PLC compiles tank_demo.st (matiec -> C -> .so) at container startup
- PLC runtime executes simulation (100ms cycle)
- OPC-UA server exposes 5 variables (TankLevel, TankTemperature,
  TankPressure, PumpSpeed, ValvePosition)
- Read values via OPC-UA client: TankLevel=500, Temp rises from 25C
- Write PumpSpeed=50 via OPC-UA: TankLevel increases to 1000 (pump fills)
- Anonymous read/write permissions for demo use

Components:
- tank_demo.st: IEC 61131-3 program with LOCATED vars (AT %MD/MX)
- glueVars_tank.c: OpenPLC runtime glue with all required symbols
- opcua_config.json: OPC-UA address space with 5 REAL variables
- Dockerfile: multi-stage (matiec builder + OpenPLC runtime)

Note: gateway/ Dockerfile and docker-compose.yml reference OPC-UA
plugin which is not yet integrated. OpenPLC + OPC-UA standalone works.
@mfaferek93 mfaferek93 closed this Mar 22, 2026
@mfaferek93 mfaferek93 deleted the feat/openplc-tank-demo branch March 22, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant