Home AMX User Forum AMX General Discussion

M2m

Hi all
I was wondering if AMX has any sample programs about setting up a M2M system and how to go about doing it? I've never done this before and am not sure where to get the info from. Any help would be appreciated.

Comments

  • Joe HebertJoe Hebert Posts: 2,159
    Hi Thomas,

    Try Tech Notes 532 (A Practical Explanation of Master-to-Master) and 401 (What is a URL List and what can it do for me)
  • Easy as 1,2,3,4,5

    Depending on your application it may be much easier than you think. To control a device on another master you don't really need to add a lot of code.

    1. Make sure the masters have different System numbers (eg 111,112)
    2. Make sure they are on the same network and have IPs that can access eachother, this can be through a gateway or on the same subnet (eg 192.168.1.111,192.168.1.112)
    3. Add the IP address of one of the masters to the other's URL list (eg Add 192.168.1.112 to system 111's URL list
    4. Define a device using the System number from the other master (eg 5001:3:112)
    5. Program it as you would any other device

    Of course there can be conflicts when having two programs trying to control a single device, so be careful how you write it. If one master is telling a relay to keep turning on each time through mainline and the other is telling it to turn off you will have problems. (I hope you do not have statements like that in your DEFINE_PROGRAM, but I wanted to use a simple example)

    If you really only have one running "System" and the second master is really for adding ports you do not even have to write a program for the second master. Define the system number and devices as I said above then program it the same way as you would a slaved Axcent 3 or a card frame.

    I believe there was another thread that discussed passing information back and forth between masters, I will find it and link it here.

    [thread=3419]Found it[/thread]
  • Thanks guys, I have everything working but the panel. I can't seem to get the second system's panel to respond when I send it a command. Basically I have 2 small classrooms that open up into one big room. It is at this point I want the second room panel to do a page flip to say something like panel locked out. I have the code for the panel set up same as the other equipment.
  • JeffJeff Posts: 374
    So you have something like this?
    define_device
    
    dvTPa	=	10001:1:1
    dvTPb	=	10001:1:2
    
    define_program
    
    if (nSystemsConnected)
    {
    	send_command dvTPb,"'@PPN-Panel Locked'"
    }
    

    I'm assuming you'd do your page flip somewhere that makes more sense than define_program, but this was the easy and quick

    Thats really all you should have to do to control that touchpanel. If that doesn't work, the problem isn't your code. Does the second room's touchpanel work in the second room?

    J
  • JeffJeff Posts: 374
    this is where device arrays come in wonderful
    define_device
    
    dvTPa		=	10001:1:1
    dvTPb		=	10001:1:2
    dvScreena	=	05001:9:1
    dvScreenb	=	05001:9:2
    
    define_variable
    
    non_volatile dev dvTP=
    {
    	dvTPa,
    	dvTPb
    }
    
    non_volatile dev dvScreen=
    {
    	dvScreena
    	dvScreenb
    }
    
    persistent integer nRoomCombined
    
    define_event
    
    button_event[dvTP,1] //Screen Up
    {
    	push:
    	{
    		if (nRoomCombined)
    		{
    			on[dvScreen,1]
    		}
    		else
    		{
    			on[dvScreen[get_last(dvTP)],1]
    		}
    	}
    }
    
    button_event[dvTP,1] //Screen Down
    {
    	push:
    	{
    		if (nRoomCombined)
    		{
    			on[dvScreen,2]
    		}
    		else
    		{
    			on[dvScreen[get_last(dvTP)],2]
    		}
    	}
    }
    

    Basically, just track the room status in nRoomCombined, and then send commands to the device array to control both if you want, or send them to part of the array when you dont. I'm using get_last here to determine which panel the command came from and only control the screen in the room that was doing that.

    J
  • dthorsondthorson Posts: 103
    Another approach

    Setup you system numbers and URL list as usual.

    I think there?s 2 ways to code a combinable 2 processor system.
    Option 1: Create one program that uses the secondary master just for it?s ports.
    Option 2: Create 2 smaller programs that work in unison. Using channel events on a virtual device to talk between systems. This way if one processor goes down your other room will still work.

    I've done it both ways and it just boils down to the complexity of the rooms. If you have a combinable room where each room is identical in control, the 2 program approach may be an option. This method also comes in handy where you have a massive network of Masters that all talk to each other. You wouldn?t want 1 master to control 75 master with on huge program.

    MAIN Room Code:
    dvTP1		      = 10001: 1:0    //NXD-700vi
                                      //VIRTUAL DEVICES
    vdvTP1             = 34001: 1:0   //VIRTUAL TOUCH PANEL DEVICE
    vdvRemote 		   = 33001: 1:0	  // USED TO CONTROL THE SLAVE ROOM
    
    
    BUTTON_EVENT[vdvTP1,BTNS_PAGE_SEL]
    {
      PUSH:
      {	
    	IF(iCombineStatus) PULSE[vdvRemote,BUTTON.INPUT.CHANNEL] //SEND DUPLICATE PUSH TO SECONDARY ROOM
    	SWITCH(BUTTON.INPUT.CHANNEL)
    	.
    	.
    	.
    	.
    	.
      }
    }
    
    CHANNEL_EVENT[dvINPUT,chLutronSense]
    {
      ON:
      {
    	iCombineStatus = 1
    	ON[vdvRemote,btnRoomCombine]						//Put system 2 into slave mode
      }
      OFF:
      {
    	iCombineStatus = 0
    	OFF[vdvRemote,btnRoomCombine]						//Put system 2 into standalone mode
      }
    


    SECONDARY Room Code:
    dvTP1		       = 10001: 1:0   //NXD-700vi
                                     //VIRTUAL DEVICES
    vdvTP1             = 34001: 1:0  //VIRTUAL TOUCH PANEL DEVICE
    vdvRemote 		   = 33001: 1:1	 //USED TO BE CONTROLED BY THE MASTER ROOM
    
    
    CHANNEL_EVENT[vdvRemote,btnRoomCombine]
    {
      ON:
      {
    	iCombineStatus = 1
      }
      OFF:
      {
    	iCombineStatus = 0
      }
    }
    
    CHANNEL_EVENT[vdvRemote,BTNS_PAGE_SEL]
    SWITCH(CHANNEL.CHANNEL)
    	{
    	  CASE ...:
    	  {
    	  }
    	}
    }
    
Sign In or Register to comment.