Skip to content

v1.0.0

Latest

Choose a tag to compare

@s2288156 s2288156 released this 13 Jul 07:50

ADS to Modbus Gateway v1.0.0

A Python-based gateway service that bridges Beckhoff/TwinCAT PLC (ADS protocol) with Modbus TCP, enabling real-time bidirectional data synchronization.

What's New

Core Features

  • Bidirectional data sync — ADS→Modbus periodic polling with Modbus→ADS immediate write-back
  • Auto-reconnect with exponential backoff — Heartbeat monitoring (configurable interval/failures); Modbus service remains available during reconnection
  • ADS index_group/index_offset addressing — Direct PLC memory access by index, replacing variable-name-based access for better performance
  • Flexible mapping config — YAML-based field-level mapping supporting bool, int8/16/32, uint8/16/32, float, and string data types
  • All Modbus register types — coils, discrete inputs, holding registers, input_registers

Reliability

  • Fallback routing — Automatic fallback to route_ip when primary AMS Net ID connection fails
  • Configurable ADS timeout — Per-operation timeout control with error handling
  • Graceful shutdown — SIGTERM/SIGINT handling with orderly cleanup of Modbus server, data sync, and ADS connection

Operations

  • Structured logging — Configurable log rotation (size-based splitting, day retention, total size cap)
  • Docker deployment — Dockerfile + docker-compose.yml with host networking for direct Modbus port access
  • Local AMS Net ID logging — Startup diagnostic output for debugging connection issues

Diagnostics

  • ADS read diagnostics script (diagnose_ads.py) — Troubleshoot ADS connectivity and data reads
  • AMS Net ID discovery script (discover_ams_netid.py) — Find local AMS Net ID automatically

Quick Start

# Docker
TAG=1.0.0 docker compose build
docker compose up -d

# Direct
pip install -r requirements.txt
python main.py --config config/mapping.yaml

Configuration

See Deployment Guide (English) or 部署指南 (中文) for full configuration reference.

Requirements

  • Python 3.11+
  • Beckhoff PLC with TwinCAT 3 and ADS port open (default: 48898)
  • Dependencies: pyads>=3.6.0, pymodbus>=3.0.0, pyyaml>=6.0