Code Monkey home page Code Monkey logo

wago / pfc-modbus-server Goto Github PK

View Code? Open in Web Editor NEW
4.0 5.0 2.0 111 KB

Docker image containing Kbus Modbus server application "kbusmodbusserver" which acting like a Modbus-Coupler 750-352. It also acting as counter part for WAGO-IO-Check. The application "kbusmodbusserver" can be interessting for two reason: Direct access to KBus-IO-Modules for any third party process (Node-Red, Mono, Node.js, ...) who's able to send modbus requests.

Dockerfile 33.53% Shell 66.47%
modbus-slave pfc200 arm armv7 docker

pfc-modbus-server's Introduction

DockerHub stars DockerHub pulls

How to run pfc-modbus-server container

Prerequisites for tutorial

PFC Login

Start SSH Client e.g. Putty

login as `root`
password `wago`

Check docker installation

docker info
docker ps # to see all running container (no container should run)
docker images # to see all preinstalled images

Get prebuild pfc-modbus-server image

docker pull wagoautomation/pfc-modbus-server 

Setup PFC environment for execution of pfc-modbus-server container.

Before the pfc-modbus-server container can be started it is necessary to create a special environment on the PFC. There are two ways to achieve it:

  • automatically with the help of a script
  • manually

Automatically

  1. copy script setup_environment.sh to PFC.
  2. chmod x setup_environment.sh
  3. execute: ./setup_environment.sh

Restore original PFC environment.

To undo the environment created in the previous step, perform the following steps:

  1. copy script undo_environment.sh to PFC.
  2. chmod x undo_environment.sh
  3. execute: ./undo_environment.sh

Manually

  1. Start Wago PFC.
  2. Open WBM (Web Base Management) menu "General PLC Runtime Configuration"
  3. Set PLC runtime version to "None"
  4. Start container, with credentials: We need the root password to start kbus on the host and the IP address of the PLC controller.
  5. Set PFC onboard switch in 'running' state.

LED Signal U1 shows: RED=kbus init on host engaded, YELLOW=prepare kbus for container, GREEN=kbus is working from container.

Start pfc-modbus-server container

docker run -d \
--init \
--restart unless-stopped \
--privileged \
-p 502:502 \
--name=pfc-modbus-server \
-v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket \
wagoautomation/pfc-modbus-server 

Access PFC as a simple modbus server device.

EA mapping is like 750-362, watch Coupler documentation to learn how to get access to mapped digital and analog slots.

https://www.wago.com/de/io-systeme/feldbuskoppler-modbus-tcp/p/750-362

750-362

Onboard operating switch: START = modbusserver is running : STOP modbusserver is stopped.

If the kbus would not init: => stop container => activate runtime => deactivate runtime => start container
(This inits the kbus via runtime thread, watch kbus led: must be green)

How to test pfc-modbus-server container.

Any Modbus client can be used for testing see (e.g https://www.modbustools.com/download.html)

Or use Wago-Node-Red containers with Modbus nodes. At least one digital IO module should be connected to the PFC.

  1. Start Node-Red Container see https://hub.docker.com/r/wagoautomation/node-red-iot
  2. Copy and deploy Node-Red Flow.
[{"id":"66f5a666.891698","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"fbd298fc.c80688","type":"inject","z":"66f5a666.891698","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":100,"wires":[["60d4c8c.3084238"]]},{"id":"60d4c8c.3084238","type":"modbustcp-write","z":"66f5a666.891698","name":"","topic":"","dataType":"Coil","adr":"0","server":"5a5a3609.1c8758","x":370,"y":140,"wires":[]},{"id":"3251a3f3.57e6ac","type":"inject","z":"66f5a666.891698","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":160,"wires":[["60d4c8c.3084238"]]},{"id":"5a5a3609.1c8758","type":"modbustcp-server","z":"","name":"PFC","host":"127.0.0.1","port":"502","unit_id":"1","reconnecttimeout":""}]
  1. Press the button on the inject node, LED on the DIO should go on.

pfc-modbus-server's People

Contributors

dirkmeihoefer avatar ikkertsergei avatar thomas-brandt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

herobalancer

pfc-modbus-server's Issues

Illegal data address in read_input_bits

I get a Modbus exception from the server when I try to read digital inputs in read input bits (02) function code.
I use address 0 like a standard Modbus coupler.
I have just 750-430 & 750-530 modules.

Other FC work as expected.

Logs :

start init daemons
dip-switch not found in /sys/devices/
INFO: tty_rs232_485 is not available
start kbus-modbus-server damon
verbosity level is 7
Not running in background
kbusmodbusslave running...
ADI Device[0]: libpackbus
Found kbus device on: 0
Modbus: Wait for KBUS to be initialized
KBUS device open OK
KBUS set to application state: 1

      .KbusBitCount: 32
      .TerminalCount: 2
      .ErrorCode: 0
      .ErrorArg: 0
      .ErrorPos: 0
      .BitCountAnalogInput: 0
      .BitCountAnalogOutput: 0
      .BitCountDigitalInput: 8
      .BitCountDigitalOutput: 8

Offset: IN: 0 - OUT: 0

Pos:1: Type: 750-5XX / 8DO BitOffsetOut:0; BitSizeOut:8; BitOffsetIn:0; BitSizeIn:0; Channels:0; PiFormat:0;
Pos:2: Type: 750-4XX / 8DI BitOffsetOut:0; BitSizeOut:0; BitOffsetIn:0; BitSizeIn:8; Channels:0; PiFormat:0;
Set Priority: 60 successfully
-->Init
Modbus Debug enabled
Watchdog Init
Modbus config Init
Modbus Config MAC Init
Modbus KBUS Info Init
Modbus const Init
Modbus ShortDesctiption Init
Modbus-Init complete - Ready for take off
--> RUN
--> Application in RUN mode
KBUS set to application state: 1
New Modbus connection from 192.168.1.85:8665 on socket 14
Watchdog trigger
Function :2
Illegal data address 1 in read_input_bits
Watchdog trigger
Function :2
Illegal data address 1 in read_input_bits
Watchdog trigger
Function :2
Illegal data address 1 in read_input_bits
Watchdog trigger
Function :2
Illegal data address 1 in read_input_bits
Watchdog trigger
Function :2
Illegal data address 1 in read_input_bits
Watchdog trigger
Function :2
Illegal data address 1 in read_input_bits

Errors when starting docker container pfc-modbus-server

Hi all
I'm getting these errors in docker logs when running the container - container keeps trying to restart.
Does anybody know why?
Thank you
Best
Chris

PORT: 502
MAX CONNECTIONS: 5
OPERATION MODE: 0
MODBUS DELAY MS: 0
KBUS CYCLE TIME MS: 50
KBUS PRIORITY: 60

start init daemons
dip-switch not found in /sys/devices/
INFO: PROFIBUS DP device "UIO_DPC31_XINT" not available
start kbusmodbusslave
verbosity level is 7
Not running in background
kbusmodbusslave running...
ADI Device[0]: libpackbus
Found kbus device on: 0
Modbus: Wait for KBUS to be initialized
KBUS open device failure.
Failed to start KBUS thread!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.