Alpago
Hello,
 
I have 2 openplc runtime configured for a simulation project, the issue is, i can't get them to communicate, here's an example of some tags of the project (first PLC, DCS that sends value to L1 on %QX113.6 / 7 and get values for L1 on %QX13.4 / 5)[203128%2F9231314%2Fmceclip0]
 
L1 (should get TRUE state from DCS on %QX13.6 / 7 ):
[203128%2F9231319%2Fmceclip0]
 
and here is my configuration for slaves and master on DCS Side :
[203128%2F9231324%2Fmceclip0]
[203128%2F9231326%2Fmceclip0]
 
and on L1 side (there is an other device on L0, but it is not connected for now) :
[203128%2F9231328%2Fmceclip0]
[203128%2F9231329%2Fmceclip0]
 
They are running and connected to each other, so i don't know exactly what i am missing here, is it coming from the addressing or the communication between the devices ?
 
I'm a bit confused, what should i do ?
Reply 0 0
thiagoralves
You can't add two runtimes as slaves of each other the way you've done. This makes them overwrite each other constantly, and it won't work. You must define who is the master and who is the slave, and that's it. The slave is added to the master, and they both exchange data from master to slave. If you need to read things from the slave, you use %IX %IW locations on the master program. If you need to read things from the master, you use %QX %QW locations on the slave program.
Reply 0 0
fg71
To be able to make a communication between 2 Modbus Server you need a Client. Its the Client that read the state from the first Server and write its state to second Server. In other words you couldn't make a communication between 2 Modbus TCP server. You could think about how a Gateway or Bridge is working there you could use different protocol to setup your communication. In any Client/Server approach you make a request to a Server, and the Server listen to request. If the request from Client is accepted only then you could get a respond else you get error respond.
Reply 0 0
Alpago
I'm asking because I may have made the same mistake for an other project that works the same way :
 
Here's the DCS view :
[203128%2F9232167%2Fmceclip0]
[203128%2F9232168%2Fmceclip0]
 
and the L1 view :
[203128%2F9232165%2Fmceclip0]
[203128%2F9232162%2Fmceclip0]
[203128%2F9232166%2Fmceclip0]
 
 
and here the addressing: DCS side :
[203128%2F9232170%2Fmceclip0]
 
[203128%2F9232175%2Fmceclip0]
 
 
And on L1 side :
[203128%2F9232176%2Fmceclip0]
[203128%2F9232177%2Fmceclip0]
 
It is working this way, so now i'm wondering how ...
Reply 0 0
thiagoralves
Your slave addresses don’t start from 0 on the project that works. This offset gives you some wiggle room for the mapped variables. Still a bad idea. Things can go wrong in hard ways to debug
Reply 0 0
Alpago
OK, so i deleted the double slave configurations, so now, DCS is the master and L1 is the slave as follows and L1 does not have any slave configured : [203128%2F9232525%2Fmceclip0]
 
and now, they are communicating, but it "blinks". Every 10 or 12 seconds, L1 get data from DCS, and keep it for maybe a second before going back to its value :
[203128%2F9232528%2Fmceclip0]
 
-->
[203128%2F9232529%2Fmceclip0]
Reply 0 0
thiagoralves
That's up to how your program is doing things on each one of the devices. For this project to work properly, I believe it would be a good idea to create an address map so you can clearly understand what is going where. Mapping addresses out of random may or may not work. Define the exact addresses you need to be mapped for both the master and slave. For example, I see you're mapping the same holding registers for both reading and writing. That's not good.
 
When you need to write something to a slave, you must use %QX and %QW mapped variables from the master, and then the data will be on %QX and %QW variables on the slave. Don't try to write to those variables on the slave program, as that will conflict with what the master is trying to do - that's probably why you see the flickering. Leave the %QX and %QW variables the master is controlling for the master to control.
 
When you need to read something from a slave, you need to use %IX / %IW variables on the master. That's where the slave data will be read to. By default, %IX and %IW are mapped to input status and input registers on the slave. Depending on the hardware layer driver you are using, you might not be able to write to all %IX and %IW locations from the slave as those locations are tied to hardware. If you're using the blank hardware layer then you should be fine, otherwise you will have to use locations that are outside of your driver reach. This will make your slave PLC program a little funny, as you will be putting %IX location in coils to write to them, and %QX locations in contacts to read from them.
Reply 0 0
Alpago
Should it look like this ? this way, Master is writing on %QX13.6 / 7 on slave and Getting data from Slave on %IW.
[203128%2F9232646%2Fmceclip0]
Reply 0 0
thiagoralves
No. Slave addresses on the master are always mapped to the beginning of %IW100, %QWX100, etc. If you're not using addresses %IW100 to %IW180, there is no reason to map them. So your mapping should look something like that:
 
L1_DCS_BOW_300LT1051 on %IW81 -> Master DCS_300LT1051 on %IW100 (to make it happen, use start address 81 on the input register when you're mapping your slave)
...rinse and repeat for the other variables.
Reply 0 0
Alpago
I refactored my project and it's working perfectly now, thanks a lot for your kind help and explanations, now i understand how modbus address articulates 🙂
Reply 0 0
Reply