Modbus slave service

Provides Modbus slave context.

A Modbus master controller can be used later to pull the context and analyze its data (Modbus via the native bus is highly recommended).

Setup

Use the template EVA_DIR/share/svc-tpl/svc-tpl-modbus-slave.yml:

# Modbus slave context service
#
# Internal context variables
#
# type  reg  size   purpose
# INPUT 9000 16 bit EVA ICS version major
# INPUT 9001 16 bit ~ version minor
# INPUT 9002 16 bit ~ version micro
# INPUT 9003 64 bit ~ build
#
command: svc/eva-svc-modbus-slave
bus:
  path: var/bus.ipc
config:
  persistent: true # persistent context
  listen:
    - path: 127.0.0.1:5503
      unit: 1
      protocol: tcp
      timeout: 5 # override the default timeout
      keep_alive_timeout: 180 # for TCP only
    #- path: 127.0.0.1:5503
      #unit: 1
      #protocol: udp
      #timeout: 5 # OS UDP buffer timeout
    #- path: /dev/ttyS0:9600:8:N:1 # serial (rtu/ascii)
      #unit: 1
      #protocol: rtu # or ascii
      #timeout: 1
user: eva # do not set nobody for persistent context

Create the service using eva-shell:

eva svc create eva.svc.modbus1 /opt/eva4/share/svc-tpl/svc-tpl-modbus-slave.yml

or using the bus CLI client:

cd /opt/eva4
cat DEPLOY.yml | ./bin/yml2mp | \
    ./sbin/bus ./var/bus.ipc rpc call eva.core svc.deploy -

(see eva.core::svc.deploy for more info)

EAPI methods

See EAPI commons for the common information about the bus, types, errors and RPC calls.

MB

Description

([0x4D 0x42]) Executes Modbus method via the native bus

Parameters

Modbus request frame, RTU-encoded, unit ID must be 1

Returns

Modbus reply frame, RTU-encoded

save

Description

Stores Modbus context to disk (if persistent)

Parameters

none

Returns

nothing