Home AMX User Forum NetLinx Studio

Advice on Master 2 Master communication

Hey,

So I have 3 Masters in 3 rooms in a building. All on the same ethernet network.
One is connected via ICSNET to a netModule shell with com2 card and then via RS232 to a biamp system which controls audio for just 2 rooms.
On the same network is a Cbus interface that controls lighting for all 3 rooms.

As far as the biamp goes
What I am currently doing is using IP_CLIENT/SERVER_OPEN/CLOSE and sending strings from the remote master to the master that has biamp connected. This allows me to setup a queue on the biamp master which incorporates messages from the remote master. I'm setting both client and server on DEFINE_START to open, but it's not very robust. If a master goes offline, then it won't try to reconnect. And when I add in reconnect code on offline events it will reconnect, but not if a master is offline for more than about a minute, because then it closes both client and server.

As I understand it (haven't tried) if I use the URL list, I should be able to send the string straight to the com2 card connected to biamp from either master. And can someone confirm if I can monitor the string data events that come back on both masters also? I need this for feedback. And then if all is going well thus far, how should I handle queuing as both masters could try and send a code at the same time?

Right... so if thats all solved on to Cbus. To get all 3 masters communicating their room respective codes to the cbus interface can I set up the module on one master and then using url lists have the other 2 masters control the virtual device for the module directly?

I've been at this for ages, but just don't have the time and money to keep trying new things over and over. Would love some advice because it honestly can't be this hard!

Thanks!

Comments

  • ericmedleyericmedley Posts: 4,177
    Yes,
    I'd pick one of the masters to be the main one and make it's system number 1. Then set up the other systems to some othercsystem numbers, say 2 and 3 for example. Now in the URL settings for the sub-masters (2 and 3) point it at the IP address of the main master. It should eventually say connected.

    Now in code you just have to make sure your device declarations have the proper system number.

    Example:

    dv_serial_room_1 = 5001:01:1
    dv_serial_room_2 = 5001:01:2

    Any commands/strings sent to dv_serial_room_2 will be sent to the serial port on the second master. You can put your entire code in one master. Or you can split it up and do some of the code on all three. I've always put it in one and have never found it necessary to split it up. Hope that helps
  • I just want to give a note that it is recommended to create a minimum program to the "slave" units, simply which has a DEFINE_DEVICE section with its own local devices.
    // let's say our slaves are both NI2100.
    DEFINE_DEVICE
    dvCom1 = 5001:1:0
    dvCom2 = 5001:2:0
    dvCom3 = 5001:3:0
    dvRel = 5001:4:0
    dvIR1 = 5001:5:0
    dvIR2 = 5001:6:0
    dvIR3 = 5001:7:0
    dvIR4 = 5001:8:0
    dvIO = 5001:59:0
    // that's all, more code not required
    
    This can be now used in both units.
  • kbeattyAMXkbeattyAMX Posts: 358
    I just want to give a note that it is recommended to create a minimum program to the "slave" units, simply which has a DEFINE_DEVICE section with its own local devices.
    // let's say our slaves are both NI2100.
    DEFINE_DEVICE
    dvCom1 = 5001:1:0
    dvCom2 = 5001:2:0
    dvCom3 = 5001:3:0
    dvRel = 5001:4:0
    dvIR1 = 5001:5:0
    dvIR2 = 5001:6:0
    dvIR3 = 5001:7:0
    dvIR4 = 5001:8:0
    dvIO = 5001:59:0
    // that's all, more code not required
    
    This can be now used in both units.

    Oops? dvIO on port 59?
  • There are differences in technique, and several ways to do this but I usually create a virtual device and a module.

    Depending on the specific needs of the project you can design the module to capture all Touchpanel presses from any panel in the system, process them, queue them, and send the commands to the real device in an orderly fashion and the feedback to the panels. I usually put the module on the master connected to the real device.

    If the complexity warrants it, you can also break the module into a _UI portion and a _comm portion. The _comm portion could reside on the master where the physical device is connected, and the _UIs could reside on that master or the remote masters. All of the _UI modules would take panel presses, process them, and send commands to the virtual device and the _comm module would process the commands sent to the virtual device, queue them, and send them to the real device.

    --John
  • Joe HebertJoe Hebert Posts: 2,159
    kbeattyAMX wrote: »
    Oops? dvIO on port 59?
    It's an obvious typo. He meant 9 not 59.
  • kbeattyAMXkbeattyAMX Posts: 358
    Joe Hebert wrote: »
    It's an obvious typo. He meant 9 not 59.

    Of course!
  • kbeattyAMX wrote: »
    Of course!
    Ups... ;)
  • Joe HebertJoe Hebert Posts: 2,159
    I just want to give a note that it is recommended to create a minimum program to the "slave" units, simply which has a DEFINE_DEVICE section with its own local devices.
    // let's say our slaves are both NI2100.
    DEFINE_DEVICE
    dvCom1 = 5001:1:0
    dvCom2 = 5001:2:0
    dvCom3 = 5001:3:0
    dvRel = 5001:4:0
    dvIR1 = 5001:5:0
    dvIR2 = 5001:6:0
    dvIR3 = 5001:7:0
    dvIR4 = 5001:8:0
    dvIO = 5001:9:0
    // that's all, more code not required
    
    This can be now used in both units.
    Marc,

    I didn?t know that was recommended procedure. I?ve always loaded a completely blank program into any slave master.
    PROGRAM_NAME='blank'
    

    And that?s it.

    Is there an advantage to defining the devices in the slaves? Does it assist notifications? Does it help avoid some sort of master-to-master commm issues?

    TIA.
  • Spire_JeffSpire_Jeff Posts: 1,917
    I know that with virtual devices, the masters will not track channel/level states if the device is not declared. I believe you also have to do a SET_VIRTUAL_PORTS, etc. on both masters if you exceed the defaults on either processor. I experienced this problem when trying to communicate with a virtual on a remote master, but the virtual was not defined on the processor. (I was using dev variables in a structure). I had the virtual defined on the remote master, but not on the calling master and I did not receive the channel pushes on the remote master.

    That doesn't really address the main issue that you are talking about, but it is along the same line. I doubt that declaring the physical devices will change anything if you are currently not having problems, but it might optimize some communication.

    Jeff
  • jcereckejcerecke Posts: 40
    There are differences in technique, and several ways to do this but I usually create a virtual device and a module.

    Depending on the specific needs of the project you can design the module to capture all Touchpanel presses from any panel in the system, process them, queue them, and send the commands to the real device in an orderly fashion and the feedback to the panels. I usually put the module on the master connected to the real device.

    If the complexity warrants it, you can also break the module into a _UI portion and a _comm portion. The _comm portion could reside on the master where the physical device is connected, and the _UIs could reside on that master or the remote masters. All of the _UI modules would take panel presses, process them, and send commands to the virtual device and the _comm module would process the commands sent to the virtual device, queue them, and send them to the real device.

    --John

    Ok this sounds good. And my next question is can someone point me to some solid info on the basics of creating a module? All I guess I need to know is how it recieves commands from the main program and passes back data to the main program.
  • kbeattyAMXkbeattyAMX Posts: 358
    jcerecke wrote: »
    Ok this sounds good. And my next question is can someone point me to some solid info on the basics of creating a module? All I guess I need to know is how it recieves commands from the main program and passes back data to the main program.

    I think all John is getting at...

    Process string handling of a device locally and expose resources of the device through channels/levels/send commands and send string through the virtual device.

    So if a device says its on, turn on channel 9 of the virtual device for feedback and send a string to the virtual device saying POWER=ON. All of the actual string processing is in the local system (or the system that is connected directly to the device) You could use a module to do this if its code that you plan to use over and over again.

    In this way, just defining the virtual device in a remote system will give you the resources that you programmed for a device instead of running redundant code in the remote system.
  • jcereckejcerecke Posts: 40
    Things aren't working as I think they should...

    The masters are communicating fine with url lists fine. But with the whole queuing thing for biamp, I still need all commands to get processed by one master before going out the port.

    I tried to create a virtual device on the local maste, and then I sent commands or strings to it from the remote master, and then tried to do the queuing on a string/command event for the virtual device on the local master. But it didn't work, and I figured that was because the string/command event happens when the device sends something back to the master, which it's never doing, it's just getting sent stuff.

    So I'm still stuck!
Sign In or Register to comment.