dupline modbus MBLogic

E

Thread Starter

Espen

Hello.
I'm a newbie to this so please take it slow...

I have installed a smarthouse solution from carlo gavazzi. It's called "smarthouse". It use the dupline bus to communicate from the master to the light switches, temp sensors, smoke detector etc...

On the Master I can communicate by modbus. And my challenges is to get the master to communicate via modbus to my linux computer running MBLogic.

I selected MBLogic for its free license and web opportunities. Don't now if it's the best. But I found it;)

I have been trying to get something up. Installed Mblogic just fine. Every thing up. But I don't understand how to set it up to talk to the dupline master.

I have found som background info.
Dupline Mastergenerator via Modbus Driver
http://80.203.81.121/dupline/G3-DUPLINE.pdf

Dupline Mastergenerator
http://80.203.81.121/dupline/bh8_ctrlzx_man.pdf

Modbus Application Protocol
http://80.203.81.121/dupline/Modbus_Application_Protocol_V1_1b.pdf

Master Module G34960005 Dupline Mapping
http://80.203.81.121/dupline/Master Module G34960005 Dupline Mapping.xls

Modbus interface module
http://80.203.81.121/dupline/GTI50.pdf

In the dupline system I use A1 to P8 to program different things.
From what I understand from modbus I can set A1 to high/low with som hex code.

Please help me understand more.
Espen
 
T

Tallak tveide

Looks quite straightforward to me:)

You need to set up a serial link between your module and your mblogic machine. Set up mblogic to use modbus rtu (modbus ethernet will be something completely different), and match baud rate and parity and such. I am not sure mblogic can do this, but i would guess so

Each of the function codes map to different address spaces. Most common is to use the coils and registers to read booleans an 16bit ints respectively
 
>Looks quite straightforward to me:)

Well, yes I thought so...

But I can't get any response. I get response when I use the "smart-house Tool 0123" and are connected to com1 on the master. But when I try connecting to com2 on the master I get nothing.

I have tried different modbus programs for linux and windows.

Qmodbus:
I have tried different com setting but I think this is the right one
9600,8,1,none

As I under stand it my Master is slave ID 1. can't find much info about it.
Function code 0x05 (write single coil)
start address 254
Data 1

HEX 01 05 00 fe

When I send it I get:
I/O error did not receive any data from slave

So I don't get it. Is it something obviously I'm doing wrong?

Espen

I'm going to worry about MBLogic after I can get some kind of communication.. ;)
 
Yes, and I forgot to say.

The Input I'm trying here is B4. programed to be a digital input.
B4=Reg. 257 Bit 12

Set It high
Espen
 
I installed the serial monitor. But did not get any answers from the master :(

I'm going to try a Carlo Gavazzi KW meter tomorrow and a swegon ventilation systems with a Linux Controller. So hopefully a better result tomorrow.

Espen
 
> I installed the serial monitor. But did
> not get any answers from the master :(

When I started det Program that followed with the system and monitored it I got eks:
01053009FFFF1378
and
010301400010442E

when pushing buttons.

I tried sending the same from windows but I did not find any program I could get the same string.

I tried from linux to with
echo -e "\x01\x03\x01\x40\x00\x10\x44\x2E" > /dev/ttyUSB0

Is these the right way to do it?
did not get any response from it.

>I'm going to try a Carlo Gavazzi KW
>meter tomorrow and a swegon ventilation
>systems with a Linux Controller. So
>hopefully a better result tomorrow.

Did not get the time to test it....:(

Espen
 
T

Tallak Tveide

I'm not sure how the echo command deals with baud rate and such. I believe the serial port monitor will have some info on this

A nice tool for testing serial comms would be A simple C program on Linux, or since you are considering mblogic, a python script. Then you can play with the settings until the response resembles what you need

A google search for either should give you an easy starting point

By now you should also be able to decode the modbus request and response by looking at the modbus rtu (serial) spec

I think you are not far away from getting mblogic talking to your device, after you achieve this, things will get more enjoyable
 
Da skjønner jeg mye mere:)
Hello
I have now gotten contact with my dupline master.
And can send hex commands from the console.<pre>
Setting the rigth speed on comport.
stty -F /dev/ttyUSB1 57600
Setter usbcomport 2 til 57600
stty -F /dev/ttyUSB0 19200
Setter comport 1 til 19200

Sending commands from linux console.
echo -e "\x01\x05\x30\x0B\x00\x01\x72\xC8" > /dev/ttyUSB1
Sets coil on/off. (A4 dupline)
echo -e "\x01\x05\x30\x09\x00\x01\xD3\x08" > /dev/ttyUSB1
Sets coil on/off. (B2 dupline)
Works on com 1 and 2. And works on RS485:)

Now, next step is the MBlogic
I have made a new modbus RTU under "Communications Clients Configuration" and under setup I have tride the following

Generic Client Parameters
Client Start:
Connection Name: MBRTUClient
Protocol: modbusrtu
Client File: mbrtuclient.py -d 1
Do Not Restart: X

Data Table Write:
Data Table Read Addresses:
Coil:10000
Length: 10
Discrete input: 10000
Length: 1
Holding Register: 10000
Length:10
Input Register:10000
Length:1

Data Table Write Addresses:
Coil:11000
Length:20
Discrete input:11000
Length:10
Holding Register:11000
Length:15
Input Register:11000
Length:20

Fault Addresses
Coil:12000
Discrete Input:12000
Holding Reg:12000
Input Reg:12000
Reset Coil:65296

Client Parameters
repeattime=2000
parity=None
baudrate=9600
retries=0
bytesize=8
serialport=/dev/ttyUSB0
statisticstable=20
stopbits=1
retrytime=1000
cmdtime=500

Commands
&readinput=action=poll, uid=1, function=1, remoteaddr=1284, qty=1, datatype=inp, dataoffset=0</pre>
This is what I have tried in MBlogic, but i cant get communication. I wounder what I should set up in "Data Table Read" "Data Table Write" and "Faults". And how I can read the information out of the manuals. Can somebody help me?

Do the Command look right to give a impulse on device 1, remote address 1284. Like the hex I sent from terminal.

Thanks for all help
 
Hi, did you succeed and now have a deeper understanding of it?

I have a Smart House G3800 0016800 master controller which I have connected to an embedded Linux device using RS485. I have written all the communication code myself in C and everything is working fine. I have implemented MODBUS functions 1,2,3,5,6 and 16. For now I only read the status of the A1..P8 addresses using function 2 (read input status).

I have tried writing using function 5 (force single coil) to address H5 in the Smart House configuration software:
http://therkelsen.info/temp/smart_house_sw_screens.jpg

H5 is the address of a light switch button mounted on the wall and a 230V relay output.

I could then turn light (H5) on and off from my code but unfortunately I have also broken the functionality I had programmed in the Smart House configuration software. I can no longer turn light on from my light switch on the wall. When I look in the configuration software everything looks normal. Perhaps I can undo it by writing something to address 0x313C (manual says: set or reset a Dupline channel) instead of 0x153C (manual says: statically activation of a Dupline channel).

I need a lot of basic PLC understanding of what the different memory areas are for and how the relate to A1...P8 in the user interface.

For instance which memory areas do I change when I set A1 to a "push button" in figure 1?

Which memory areas do I change when I alter "logic set-up" settings shown on figure 2?
How does the PLC know it should interpreted these as logic expressions (I assume it must have something to do with a special memory area)?

Do you (or anyone else) know some good documentation with examples for me to read?
 
Hello
Well, I sat the dupline on hold. I have been able to use modpoll to get data from the master, and send hex string to set a rele.

I have not understood the mblogic program. can't get it to talk with the dupline master. I have borrowed a Moxa E1212, it has 8 digital inpts and 8 digital outputs. And have modbus tcp. There I have goten the client setup to work in mblogic.<pre>
[moxa]
protocol = modbustcp
type = tcpclient
host = 192.168.0.3
port = 502
action = poll
cmdtime = 125
repeattime = 125
retrytime = 5000
fault_inp = 25
fault_coil = 9
fault_inpreg = 23
fault_holdingreg = 34
fault_reset = 274
&DI-0-7 = function=2, uid=1, memaddr=500, qty=8, remoteaddr=1
# Dont't work: &DO-0-7 = function=4, uid=1, memaddr=509, qty=16, remoteaddr=49
&setDO0 = function=1, uid=1, memaddr=501, qty=1, remoteaddr=1
&setDO1 = function=1, uid=1, memaddr=502, qty=1, remoteaddr=2
&setDO2 = function=1, uid=1, memaddr=503, qty=1, remoteaddr=3
&setDO3 = function=1, uid=1, memaddr=504, qty=1, remoteaddr=4
&setDO4 = function=1, uid=1, memaddr=505, qty=1, remoteaddr=5
&setDO5 = function=1, uid=1, memaddr=506, qty=1, remoteaddr=6
&setDO6 = function=1, uid=1, memaddr=507, qty=1, remoteaddr=7
# Don't work: &setDO7 = function=1, uid=1, memaddr=508, qty=1, remoteaddr=8

# Don't work
[dupline]
repeattime = 2000
parity = None
protocol = modbusrtu
bytesize = 8
fault_holdingreg = 26626
retrytime = 1000
serialport = /dev/ttyUSB0
datatype=inp, dataoffset=0
clientfile = mbrtuclient.py -d 1
stopbits = 1
datatype=inp, dataoffset=0
fault_reset = 26624
statisticstable = 448
type = genericclient
fault_inpreg = 26626
baudrate = 9600
restartonfail = yes
fault_coil = 26626
retries = 10
fault_inp = 26626
action = poll
cmdtime = 1000
&readinput = action=poll, uid=1, function=2, remoteaddr=1663, qty=1,
&writetable = coil=1280:1, inp=1536:1, inpreg=16:8, holdingreg=0:8
&readtable = coil=1280:1, inp=1536:1, inpreg=16:8, holdingreg=0:28
&writesinglecoil = action=poll, uid=1, function=5, remoteaddr=12364, qty=1,</pre>
The remoteaddr in mblogic i have not understood, and I can't get it working.

I have some info on the dupline master, and a exel doc with duplin mappings.
I can mail it to you If you will.
You can also look here for help.
http://smarthouse.freeforums.org
It's a dupline forum

Espen
 
Hello

I have been trying to setup MBLogic hmiserver but can't get it to work.
Trying to setup a step by step list like the one on:

http://mblogic.sourceforge.net/mbhmi/simpleexample/simpleexample.html

Please correct me where I have done wrong.

I have a Moxa E1212 8 (DI)digital inputs and 8(DO)digital outputs<pre>
No. Description Start Address Function Code R/W (DEC) Total Channels Data Type
1 DO Value 0001 01:COIL STATUS RW 00001 8 1 BIT
2 DO Pulse Status 0017 01:COIL STATUS RW 00017 8 1 BIT
3 DO V. All C.(Ch0-Ch7) 0033 03:HOLDING REGISTER RW 40033 1 1 WORD
4 DI Value 0001 02:INPUT STATUS R 10001 16 1 BIT
5 DI Count V. Double W. 0007 04:INPUT REGISTER R 30017 16 2 WORD
6 DI V. All C.(Ch0-Ch15) 0049 49:INPUT REGISTER R 30049 16 1 WORD
7 DI Counter Start/Stop 0257 01:COIL STATUS RW 00257 16 1 BIT
8 DI Counter Clear 0273 01:COIL STATUS RW 00273 16 1 BIT

I'm trying to get signal lamps to start when I get a digital input.
And to click on a button on the screen to open/close a digital output.

1. Unpack hmiserver_2011_03_19

2. Change hmiservermbc.sh
'vi hmiservermbc.sh' change the vaulus. http://mblogic.sourceforge.net/hmiserver/hmiserverstartparameters-en.html
./hmiserver/hmiservermbc.py -p 8082 -h 192.168.0.3 -r 502 -u 1 -t 5

3. edit mbhmi.config
# Tested with MBProbe. Two digital inputs and two digital outputs.
[clientversion]
ver=Ver 0.80 Demo

# Server ID.
[serverid]
id=HMIServer Espen
# Digital input
[DI0]
addrtype=discrete
memaddr=0
[DI1]
addrtype=discrete
memaddr=1
# Digital output
[DO0]
addrtype=coil
memaddr=0
[DO1]
addrtype=coil
memaddr=1
# [&events]
# [&alarms]

4. Copy from hmibuilder to hmiserver
caesar@mini-it:~/hmiserver/hmiserver/hmipages> ls -l
clientconfigdata.js
hmibuttons.css
hmi_template_1000x560.svg
hmitemplate.xhtml
messagetexts.js
pagebackground.png
pageicon.png
pagelayout.css
pagelayout_top1000.css
pagelogo.png
standardtexts.js

5. Open 'hmi_template_1000x560.svg' in Inkscape

6.Put in two 'Pilot_ligth' 'pl_round.svg' for digital input.
and two 'PB_Const1' 'pb_cons1_oblong_grey.svg' digital output.

7. Mark first object and open "Object Properties" from the pop-up menu.
change 'Id' to 'DI0', then 'DI1' one the next. And 'DO0' and 'DO1'
Save file

8. Copy svg "image" in to webpage.
Open *.svg file in editor and copy everything. But not: <?xml version="1.0" encoding="UTF-8" standalone="no"?>
inn to 'hmitemplate.xhtml' after <!-- Put main SVG content here -->

9.
// DO THIS: Application specific code goes here.

%(controlscripts)s
var DI0 = new MB_PilotLight(document, "DI0", "black", "green", "red");
var DI1 = new MB_PilotLight(document, "DI1", "black", "green", "red");

// I don't no wath to write on the digital outputs?
var DO0 = new MB_Pushbutton(document, "DO0", "black", "green", "red");
var DO1 = new MB_Pushbutton(document, "DO1", "black", "green", "red");
// Something like this?

// Add to the display list. ?????
MBHMIProtocol.AddToDisplayList(DI0, "DI0", "read");
MBHMIProtocol.AddToDisplayList(DI1, "DI1", "read");
MBHMIProtocol.AddToDisplayList(DO0, "DO0", "read");
MBHMIProtocol.AddToDisplayList(DO1, "DO1", "read");


10. Edit 'clientconfigdata.js'
MBT_ClientID = "HMI Demo";
MBT_ScanRate = 1500;
MBT_PageTitle = "Demo Page"
MBT_HeaderVisible = true;
// Read my digital input and out
MBT_ReadList = ["DI0"];
MBT_ReadList = ["DI1"];
MBT_ReadList = ["DO0"];
MBT_ReadList = ["DO1"];

MBT_AlarmZoneList = [];
MBT_EventZoneList = [];
MBT_SVGScreenTable = [];

10. Start
./hmiservermbc.sh
Bad MB-HMI config - base address missing or bad: &events
Bad MB-HMI config - base address missing or bad: &alarms
HMIServerMBC version: 17-Mar-2011
Started on Wed Feb 29 00:24:55 2012 with HMI port 8082

11. localhost:8082/hmitemplate.xhtml
The server loads.
I see two black pilot light, and two buttons.
Nothing happens, try to give digital input on the moxa. No change on hmi.
I can see the change on the webserver on the moxa.

12. http://localhost:8082/datamsgsfield.html
Request
tid: 308 uid: 1 func: 1 addr: 1 qty: 1 data:
Response
tid: 308 func: 1 data: 0000 0000
|
|
|
Request
tid: 357 uid: 1 func: 1 addr: 1 qty: 1 data:
Response
tid: 357 func: 1 data: 0000 0000</pre>
please help.
I'm doing something wrong here :(

Espen
 
More than one year without any post from Michael Griffin (the developer of MBLogic, and more). Does anyone have any news of him?

Regards
 
Top