Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0de9f47
generic_modbus sources add in buidling procedure
dtsecon Jun 24, 2021
239ea53
initial commit of generic_modbus beta version source files
dtsecon Jun 24, 2021
97744a6
remove unnecessary stuff
dtsecon Jun 24, 2021
64e112f
minor changes and tidying up
dtsecon Jun 24, 2021
81536c7
time_ellapsed fixed
dtsecon Jun 25, 2021
ca163a7
removing unnecessary code
dtsecon Jun 25, 2021
b552eb3
variable ctx changed to mbctx
dtsecon Jun 28, 2021
f4e9f17
minor changes to comply with nut development guidelines
dtsecon Jun 28, 2021
2a085ee
Merge branch 'master' into master
dtsecon Jul 5, 2021
2194116
just one space less
dtsecon Jul 6, 2021
7ea36a5
generic_modbus.h added to Makefile.am
dtsecon Jul 6, 2021
a0d18f2
Merge branch 'master' of https://github.com/dtsecon/nut
dtsecon Jul 6, 2021
2e1a387
fix 'for' loop initial declarations for compatibility out of C99 mode
dtsecon Jul 6, 2021
070d7f3
fix serial options in modbus_open
dtsecon Jul 6, 2021
a26a0e8
man page text created, added in build procedure
dtsecon Jul 16, 2021
8d95c4c
improve man page
dtsecon Jul 16, 2021
f4e8c45
fix man pages broken build process
dtsecon Jul 19, 2021
cb6ea97
shutdown configurable repetition with increasing time interval added
dtsecon Jul 21, 2021
0036eda
Merge branch 'master' into master
dtsecon Aug 8, 2021
b853f9e
Merge branch 'master' into master
dtsecon Sep 2, 2021
f9090eb
Merge branch 'master' into master
dtsecon Sep 14, 2021
c096564
update nut.dic
dtsecon Sep 14, 2021
df37702
update nut.dict
dtsecon Sep 14, 2021
e129613
Merge branch 'master' into master
dtsecon Sep 15, 2021
544a4b8
fix forward declarations of enum occurances
dtsecon Sep 16, 2021
e6d0733
change ulon to uint_32
dtsecon Sep 16, 2021
987f3d7
Merge branch 'master' into master
dtsecon Sep 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ dnl not fail if we have no tools to generate it (so add to SKIP list).
AC_MSG_CHECKING([if we can build ${nut_doc_build_target_base}])
can_build_doc_man=no
if test "${nut_have_asciidoc}" = yes ; then
( cd "$DOCTESTDIR" && ${A2X} --format manpage --destination-dir=. --xsltproc-opts "--nonet" "${abs_srcdir}"/docs/man/snmp-ups.txt && test -s snmp-ups.8 ) && can_build_doc_man=yes
( cd "$DOCTESTDIR" && ${A2X} --format manpage --destination-dir=. --xsltproc-opts="--nonet" "${abs_srcdir}"/docs/man/snmp-ups.txt && test -s snmp-ups.8 ) && can_build_doc_man=yes
rm -f "${DOCTESTDIR}"/snmp-ups.8
fi
if test "${can_build_doc_man}" = yes ; then
Expand Down
8 changes: 4 additions & 4 deletions docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ solaris-usb.html solaris-usb.chunked solaris-usb.pdf: solaris-usb.txt asciidoc.c
# variable ASCIIDOC_VERBOSE to "-v", ie:
# $ ASCIIDOC_VERBOSE=-v make
A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) --attribute icons \
--xsltproc-opts "--nonet" \
--xsltproc-opts "--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d`\"" \
--xsltproc-opts "--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S`\"" \
--xsltproc-opts "--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \
--xsltproc-opts="--nonet" \
--xsltproc-opts="--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d`\"" \
--xsltproc-opts="--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S`\"" \
--xsltproc-opts="--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \
--attribute iconsdir=$(srcdir)/images \
--attribute=badges \
--attribute=external_title \
Expand Down
11 changes: 7 additions & 4 deletions docs/man/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,19 @@ endif

HTML_MACOSX_MANS = macosx-ups.html

SRC_MODBUS_PAGES = phoenixcontact_modbus.txt
SRC_MODBUS_PAGES = phoenixcontact_modbus.txt \
generic_modbus.txt
if WITH_MANS
MAN_MODBUS_PAGES = phoenixcontact_modbus.8
MAN_MODBUS_PAGES = phoenixcontact_modbus.8 \
generic_modbus.8
endif

if WITH_MODBUS
man8_MANS += $(MAN_MODBUS_PAGES)
endif

HTML_MODBUS_MANS = phoenixcontact_modbus.html
HTML_MODBUS_MANS = phoenixcontact_modbus.html \
generic_modbus.html

SRC_LINUX_I2C_PAGES = asem.txt pijuice.txt
if WITH_MANS
Expand Down Expand Up @@ -814,7 +817,7 @@ if HAVE_ASCIIDOC
### Prior to Asciidoc ~8.6.8, the --destination-dir flag didn't seem to affect the location of the intermediate .xml file.
### This parameter is currently required; see docs/Makefile.am for more detail.
A2X_MANPAGE_OPTS = --doctype manpage --format manpage \
--xsltproc-opts "--nonet" \
--xsltproc-opts="--nonet" \
--attribute mansource="Network UPS Tools" \
--attribute manversion="@PACKAGE_VERSION@" \
--attribute manmanual="NUT Manual" \
Expand Down
222 changes: 222 additions & 0 deletions docs/man/generic_modbus.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
GENERIC_MODBUS(8)
=================

NAME
----

generic_modbus - Driver for contact (direct) signal UPS devices connected via modbus remote I/O gateways

SYNOPSIS
--------

*generic_modbus* -h

*generic_modbus* -a 'DEVICE_NAME' ['OPTIONS']

NOTE: This man page only documents the specific features of the *generic_modbus* driver. For information about the core driver, see linkman:nutupsdrv[8].

SUPPORTED HARDWARE
------------------

This is a generic modbus driver expected to work with contact (direct) signal UPS devices, connected via modbus RIO (remote I/O) either serial or TCP/IP. The driver has been tested against PULS UPS (model UB40.241) via MOXA ioLogikR1212 (RS485) and ioLogikE1212 (TCP/IP).

More information about this UPS can be found here::
https://products.pulspower.com/ca/ubc10-241-n1.html

More information about Moxa ioLogik R1212, E1212 can be found here::
https://www.moxa.com/en/products/industrial-edge-connectivity/controllers-and-ios

The PULS UPS UB40.241 supports the following signals:

[source, conf]
----
Ready contact (DO) <--> HB
Buffering contact (DO) <--> OL | OB
Battery-low (DO) <--> LB
Replace Battery (DO) <--> RB
Inhibit (DI) <--> FSD
----

Digital port direction (DI/DO) assumes the device perspective

The driver's concept is to map the UPS states (as defined in nut) onto UPS contacts' states. The driver has an extended configuration interface implemented using variables defined in ups.conf.

HARDWARE INTERCONNECTION
------------------------

The commission of modbus remote I/O server as well as UPS device is carried out following the corresponding instruction manuals. The following figure depicts the anticipated communication path and hardware interconnection:

[source, conf]
----
+------+ +----------------+ +------------+ +------------+
| UPSD | <---> | GENERIC_MODBUS | <---> | MODBUS RIO | <---> | UPS DEVICE |
+------+ (1) +----------------+ (2) +------------+ (3) +------------+
| |
+-------------------+
HOST CONTROLLER

(1) Unix IPC
(2) RS232 | TCP/IP
(3) contacts
----

EXTRA ARGUMENTS
---------------

This driver supports the following optional settings in the linkman:ups.conf[5] file:

Generic:
~~~~~~~

*device_mfr*='value'::
A string specifying the manufacturer of the UPS device (default UNKNOWN).

*device_model*='value'::
A string specifying the model of the UPS device (default UNKNOWN).

Serial:
~~~~~~

*ser_baud_rate*='value'::
A integer specifying the serial port baud rate (default 9600).

*ser_data_bit*='value'::
A integer specifying the serial port data bit (default 8).

*ser_parity*='value'::
A character specifying the serial port parity (default N).

*ser_stop_bit*='value'::
An integer specifying the serial port stop bit (default 1).

Modbus:
~~~~~~

*rio_slave_id*='value'::
An integer specifying the RIO modbus slave ID (default 1).

States (X = OL, OB, LB, HB, RB, CHRG, DISCHRG, FSD)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*<X>_addr*='value'::
A number specifying the modbus address for the X state.

*<X>_regtype*='value'::
A number specifying the modbus register type for the X state
Default values:::
+
[source, conf]
----
1 for X = OL, OB, LB ,HB, RB, CHRG, DISCHRG
0 for X = FSD
----
Valid values:::
+
[source, conf]
----
0:COIL, 1:INPUT_B, 2:INPUT_R, 3:HOLDING
----

*<X>_noro*='value'::
A number specifying the contact configuration for the X state (default 1).
Valid values:::
+
[source, conf]
----
0:NC, 1:NO
----
+
NOTE: NO stands for normally open and NC for normally closed contact

Shutdown
~~~~~~~~

*FSD_pulse_duration*='value'::
A number specifying the duration in ms for the inhibit pulse. If it's not defined, signal has only one transition depending on FSD_noro configuration.
+
Examples for FSD signal configuration:
[source, conf]
----
FSD_noro = 1
FSD_pulse_duration = 150

+-----+
| |
inhibit pulse >-----+ +------------------>
<--->
150ms


FSD_noro = 0

inhibit pulse >-----+
|
+------------------------>

----

CONFIGURATION
-------------

Here is an example of generic_modbus driver configuration in *ups.conf* file:
[source, conf]
----
[generic_modbus]
driver = generic_modbus
port = /dev/ttyUSB0
desc = "generic ups driver"
# device info
device_mfr = "PULS"
device_model = "UB40.241"
# serial settings
ser_baud_rate = 9600
ser_parity = N
ser_data_bit = 8
ser_stop_bit = 1
# modbus slave id
rio_slave_id = 5
# UPS signal state attributes
OB_addr = 0x0
OB_regtype = 1
OB_noro = 0
LB_addr = 0x1
LB_regtype = 1
HB_addr = 0x2
HB_regtype = 1
RB_addr = 0x3
RB_regtype = 1
FSD_addr = 0x0
FSD_regtype = 0
FSD_pulse_duration = 150
----

INSTANT COMMANDS
----------------

This driver support the following instant commands:

load.off::
executes "instant poweroff"

INSTALLATION
------------

This driver is not built by default. You can build it by installing libmodbus and running `configure --with-modbus=yes`.

You also need to give proper permissions on the local serial device file (/dev/ttyUSB0 for example) to allow the NUT user to access it.

AUTHOR
------
Dimitris Economou <dimitris.s.economou@gmail.com>

SEE ALSO
--------
The core driver:
~~~~~~~~~~~~~~~~
linkman:nutupsdrv[8], linkman:ups.conf[5]

Internet resources:
~~~~~~~~~~~~~~~~~~~
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/

libmodbus home page: http://libmodbus.org
13 changes: 13 additions & 0 deletions docs/nut.dict
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ DiSplay
Diehl
Dietze
Digitus
Dimitris
Dly
Dmitry
DocBook
Expand All @@ -276,6 +277,7 @@ ESXi
ETIME
EUROCASE
EXtreme
Economou
Edlman
Edmundsson
Edscott
Expand Down Expand Up @@ -427,6 +429,7 @@ INV
INVOLT
IPAR
IPBX
IPC
IPs
IPv
IRIX
Expand Down Expand Up @@ -601,6 +604,8 @@ Monett
Morioka
Morozov
Moskovitch
Moxa
MOXA
Mozilla
Msg
Multiplug
Expand Down Expand Up @@ -754,6 +759,7 @@ PSKxn
PSSENTR
PSUs
PSX
PULS
PV
PWLv
PWR
Expand Down Expand Up @@ -1755,6 +1761,9 @@ inverterlog
inverterminutes
invertervolts
io
ioLogik
ioLogikE
ioLogikR
iostream
ip
ipE
Expand Down Expand Up @@ -2002,6 +2011,7 @@ nomdcvolts
nomfrequency
noout
norating
noro
noscanlangid
notAfter
notifyme
Expand Down Expand Up @@ -2185,6 +2195,7 @@ reentrancy
refactoring
referencenominal
regex
regtype
reposurgeon
repotec
req
Expand All @@ -2198,6 +2209,7 @@ rfc
rh
richcomm
riello
rio
rj
rk
rkm
Expand Down Expand Up @@ -2431,6 +2443,7 @@ tx
txt
typedef
uA
UB
uD
uM
ua
Expand Down
8 changes: 5 additions & 3 deletions drivers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SERIAL_USB_DRIVERLIST = \
nutdrv_qx
NEONXML_DRIVERLIST = netxml-ups
MACOSX_DRIVERLIST = macosx-ups
MODBUS_DRIVERLIST = phoenixcontact_modbus
MODBUS_DRIVERLIST = phoenixcontact_modbus generic_modbus
LINUX_I2C_DRIVERLIST = asem pijuice

# distribute all drivers, even ones that are not built by default
Expand Down Expand Up @@ -239,9 +239,11 @@ macosx_ups_LDADD = $(LDADD_DRIVERS)
macosx_ups_LDFLAGS = $(LDFLAGS) -framework IOKit -framework CoreFoundation
macosx_ups_SOURCES = macosx-ups.c

# Modbus driver
# Modbus drivers
phoenixcontact_modbus_SOURCES = phoenixcontact_modbus.c
phoenixcontact_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS)
generic_modbus_SOURCES = generic_modbus.c
generic_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS)

# Linux I2C drivers
asem_LDADD = $(LDADD_DRIVERS)
Expand Down Expand Up @@ -293,7 +295,7 @@ dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h bcmxcp_ser.h \
xppc-mib.h huawei-mib.h eaton-ats16-nmc-mib.h eaton-ats16-nm2-mib.h apc-ats-mib.h raritan-px2-mib.h eaton-ats30-mib.h \
apc-pdu-mib.h eaton-pdu-genesis2-mib.h eaton-pdu-marlin-mib.h \
eaton-pdu-pulizzi-mib.h eaton-pdu-revelation-mib.h emerson-avocent-pdu-mib.h \
hpe-pdu-mib.h powervar-hid.h delta_ups-hid.h
hpe-pdu-mib.h powervar-hid.h delta_ups-hid.h generic_modbus.h

# Define a dummy library so that Automake builds rules for the
# corresponding object files. This library is not actually built,
Expand Down
Loading