Home AMX User Forum NetLinx Studio

1 "Master Master" and 116 "Sub-Masters." Need help please.

This is BY FAR the largest project I have ever done. I asked this in another thread, but felt the potential topic drift warranted its own thread.

In my building, there is one Master Master that all of the sub masters talk to. The Master Master controls a Pesa Cheetah 512 x 512 video matrix. Each sub master has an 8 x 8 Pesa video matrix in their rooms. I need to pass vairables from the Master Master to the sub-masters when they need it. For example, the 512 x 512 matrix has a DSS head end as poart of its inputs. So, if Room 1 wants to watch CNN here's what happens:

Room 1 asks for CNN.
Each room has multiple outputs from the 512 matrix, so the user is also asked what tie line they want to use for CNN.
For room 1, we'll say inputs 1 - 4 on the local matrix are tied to outputs 40 - 43 of the 512 x 512 matrix.
Once the user selects a tie line, room 1 sends a command to a virtual device.
SEND_COMMAND vdvDEVICE, 'ROUTE=DSS 1 PORT x' (Port x equals the input of the local matrix)
Room 1 sends a command to a virtual device on the Master Master that represents room 1.
The Master Master uses a DATA_EVENT to parse the data rx'd on the vdvDEVICE:
DATA_EVENT[vdvDEVICE]
{
	           COMMAND:
	           {
	                  STACK_VAR INTEGER nRoom
	                  STACK_VAR INTEGER nIndex, nIndex2, nRoomIN, nRoomOUT
	                  STACK_VAR INTEGER nIn, nOut
	                  STACK_VAR INTEGER nRoomIndex
	                  nRoom = GET_LAST(vdvDEVICE)
	                  SELECT
	                  {
	                         ACTIVE(FIND_STRING(DATA.TEXT,"'ROUTE='",1)):
	                         {
	                                  REMOVE_STRING(DATA.TEXT,"'ROUTE='",1)
	                                  SELECT
	                                  {
	                                             ACTIVE(LEFT_STRING(DATA.TEXT,3) = 'DSS'):
	                                             {
	                                                       REMOVE_STRING(DATA.TEXT,"'DSS'",1)
	                                                       nIn = ATOI(DATA.TEXT)
	                                             } 
	                                  }
	                                  REMOVE_STRING(DATA.TEXT, ',' ,1)
	                                  SELECT
	                                  {
	                                          ACTIVE(FIND_STRING(DATA.TEXT,"'PORT'",1)):
	                                          {
	                                                  REMOVE_STRING(DATA.TEXT,"'PORT'",1)
	                                                  nINDEX2 = ATOI(DATA.TEXT)
	                                                  nOUT = nRoomOutputs[nRoom][nIndex2]
	                                          }
	                                  }
	                                  fnDoRoute(nIn,nOut,BOTH)
	                         }
	                  }
	           }
	}


Now the Master Master knows which room asked for CNN and which port they are using. The fnDoRoute builds the string to send to the 512 x 512 matrix and now, room 1 is watching CNN.

I want to pass the feedback from the 512 x 512 matrix to the sub-master. The sub-master, via direct feedback, would then place the CNN logo on the appropriate button on the TP and that's what I am not quite sure how to do. If Room 1 has 4 outputs from the 512 x 512 matrix, I was thinking on the sub-master I need to create an array with each index representing individual tie lines. If the user wanted CNN on tie line 3, then everywhere they sent tie line 3, the CNN logo would display. How can I populate that array? Once I get the array populated, I'm good from there. I just need a push in the right direction. There are over 100 sub-masters communicating with the Master Master, so I was thinking each room's array needs to be updated only when that room makes a change vice all of the sub-masters trying to talk to the Master Master at once. Thanks.

Comments

  • staticatticstaticattic Posts: 200
    Obviously, I don't have the juice to move responses from one thread to another, but here is Vining's reply to my original question:
    vining wrote: »
    I would use STRING_TO_VAR / VAR_TO_STRING to pass MD array and structures from one master's virtual dev to another master's virtual dev. I've never tried a MD array but I would expect it to work as it does with structures. Just use your DATA_EVENT sting/command event handler to ask for, send and receive the data you want. On one side convert your structure to a string, send the string to your requesting master and on the receiving master convert it back to a structure and away you go.

    Create a common inlcude file for the arrays or structures and pull it into every master so your arrays or structures are guaranteed idenctical across the entire system. If the file is ever changed you'll need to re-compile and update every master.
  • staticatticstaticattic Posts: 200
    I have created an integer array on the Master Master, nRouterMatrix[MAX_OUTS]. Everytime a change is made on the 512 x 512 matrix, nRouterMatrix[nOut] = nIn. The router is also asked a status, 1 port at a time, once a second, provided the router is not busy. I am thinking if I blast out that array to all 116 sub-masters at once every second, that would totally kill my network.

    Using my earlier example, if a room makes a change, I was thinking I could do something like:

    SEND_COMMAND vdvDevice[nRoom], "'Input', ITOA(nRouterMatrix[nOut]), 'to position', ITOA(nIndex2)"

    I could then parse that data however I see fit on the sub-master. Now I just need to be able to go the other way. If someone controlling the Master Master sends a feed to a particular room, the same process needs to happen. I think I can get something like this to work well enough unless someone makes a change to the 512 x 512 matrix via the front panel of the matrix. In that case, my data would be inaccurate.

    What if I created 2 nRouterMatrix arrays? For the first go round, array 1 could populate. The second go round, array 2 would populate. I could compare the two and if they were identical do nothing. If something changed, then take action only on that index of the array. This is by far the largest project I have ever done by miles, so I am feeling the pressure. Any ideas would be helpful. Thanks again.
  • John NagyJohn Nagy Posts: 1,742
    What's the problem with having the local units that ASK for CNN to manage putting the CNN bitmap in place as part of the request process, instead of going all around the horn? If you ask for CNN and don't GET CNN, somethings wrong anyway, and the bitmap is the least of your problems. Unnecessarily complex.... akin to not showing that you have selected the TIVO or offering its control page until you analyze the feedback from the switch you just told to change to the TIVO.
  • staticatticstaticattic Posts: 200
    Nothing is wrong with that. In fact, the first 3 rooms I have completed are doing that very thing. All of this started when someone upstairs that controls the Master Master complained that if a room was watching CNN and the master controller bumped the CNN feed and replaced it with an internal feed from the building, although they would now be watching the new feed the TP would still think they were watching CNN. One thing led to another and before I knew it, all of the "wise" decision makers decided they wanted positive feedback from the 512 x 512 matrix, that way they would have definite feedback concerning who was watching what. They asked if it could be done, I said I would look into it, but it is turning out to be more difficult than I thought.
  • John NagyJohn Nagy Posts: 1,742
    Heaven forbid they were watching Fox and couldn't tell...
  • the8thstthe8thst Posts: 470
    I would have the Master-Master create files on the CF card for each room and update the files with the correct 512x512 status whenever a switch is executed.

    It should be pretty easy to only update the pertinent rooms file for a switch by following the output number that the where the change occurred.

    The sub masters would then download or read the file to check for changes using a timeline to verify status as often as you see necessary.

    The other solution I that I would consider is to have a small computer running mySQL or your favorite database software to track all of the inputs/outputs and channels. You could either send the SQL commands directly from AMX or create a simple PHP file to handle the SQL commands via POST data in a standard HTML header request.
  • staticatticstaticattic Posts: 200
    John Nagy wrote: »
    Heaven forbid they were watching Fox and couldn't tell...

    Oh the humanity of it all...
    the8thst wrote: »
    I would have the Master-Master create files on the CF card for each room and update the files with the correct 512x512 status whenever a switch is executed.

    It should be pretty easy to only update the pertinent rooms file for a switch by following the output number that the where the change occurred.

    The sub masters would then download or read the file to check for changes using a timeline to verify status as often as you see necessary.

    The other solution I that I would consider is to have a small computer running mySQL or your favorite database software to track all of the inputs/outputs and channels. You could either send the SQL commands directly from AMX or create a simple PHP file to handle the SQL commands via POST data in a standard HTML header request.

    Now that you mention it, I remember doing that in Programmer III. That's something I would like to play with just for fun to see if I can get it working, but I think it is overkill for this project. I think what I am going to do is fake the feedback in the individual rooms, but on the TP of the Master-Master, I'll have that one update per the feedback from the 512 x 512 matrix.

    I'm not going to say I am in over my head on this project, but I am certainly treading in very deep water. As the lone "AMX Guy," when I was asked about this stuff, I made a typical rookie mistake and ended up getting myself Jeff Goldblumed. I knew better, but I guess I was blinded by the sheer size and scope of this project.

    As this project goes on, I am sure I am going to hit some stumbling blocks. This thread is going to stay pretty active. :)
  • AuserAuser Posts: 506
    I want to pass the feedback from the 512 x 512 matrix to the sub-master. The sub-master, via direct feedback, would then place the CNN logo on the appropriate button on the TP and that's what I am not quite sure how to do. If Room 1 has 4 outputs from the 512 x 512 matrix, I was thinking on the sub-master I need to create an array with each index representing individual tie lines. If the user wanted CNN on tie line 3, then everywhere they sent tie line 3, the CNN logo would display. How can I populate that array?

    That should be very easy.

    Have the "master master" parse feedback from the switcher. When an input is connected to an output, send a level to a virtual device on the associated submaster.

    Something like as follows should do the trick...


    On the "master master":
    DEFINE_DEVICE
    dvROUTER    = 5001:1:0
    
    vdvSYSTEM_1 = 33001:1:11
    vdvSYSTEM_2 = 33001:1:12
    [...]
    
    DEFINE_CONSTANT
    dev      vdvSYSTEMS[] =
    {
      vdvSYSTEM_1,
      vdvSYSTEM_2,
      [...]
    }
    
    char     SYSTEM_TIES_QUANTITY     = 4
    char     LEVEL_SYSTEM_TIE_1_INPUT = 1
    char     LEVEL_SYSTEM_TIE_2_INPUT = 2
    char     LEVEL_SYSTEM_TIE_3_INPUT = 3
    char     LEVEL_SYSTEM_TIE_4_INPUT = 4
    
    char     LEVEL_GROUP_SYSTEM_TIE_INPUTS[] =
    {
      LEVEL_SYSTEM_TIE_1_INPUT,
      LEVEL_SYSTEM_TIE_2_INPUT,
      LEVEL_SYSTEM_TIE_3_INPUT,
      LEVEL_SYSTEM_TIE_4_INPUT
    }
    
    integer  ROUTER_OUTPUTS_QTY       = 512
    integer  ROUTER_OP_SYSTEM_1_TIE_1 = 21
    integer  ROUTER_OP_SYSTEM_1_TIE_2 = 22
    integer  ROUTER_OP_SYSTEM_1_TIE_3 = 23
    integer  ROUTER_OP_SYSTEM_1_TIE_4 = 24
    integer  ROUTER_OP_SYSTEM_2_TIE_1 = 25
    integer  ROUTER_OP_SYSTEM_2_TIE_2 = 26
    integer  ROUTER_OP_SYSTEM_2_TIE_3 = 27
    integer  ROUTER_OP_SYSTEM_2_TIE_4 = 28
    [...]
    
    
    integer  nSystemTies[][] =
    {
      {ROUTER_OP_SYSTEM_1_TIE_1, ROUTER_OP_SYSTEM_1_TIE_2, ROUTER_OP_SYSTEM_1_TIE_3, ROUTER_OP_SYSTEM_1_TIE_4},
      {ROUTER_OP_SYSTEM_2_TIE_1, ROUTER_OP_SYSTEM_2_TIE_2, ROUTER_OP_SYSTEM_2_TIE_3, ROUTER_OP_SYSTEM_2_TIE_4},
      [...]
    }
    
    DEFINE_VARIABLE
    volatile   integer  nRouterConnections[ROUTER_OUTPUTS_QUANITTY]
    
    define_function UpdateSystemRoutingFeedback(integer _nInput, integer _nOUtput)
    {
      stack_var  integer  _nRoomIndex
      stack_var  integer  _nTieIndex
    
      nRouterConnections[_nOutput] = _nInput
    
      for(_nRoomIndex = 1; _nRoomIndex <= length_array(nSystemTies); _nRoomIndex++)
      {
        for(_nTieIndex= 1; _nTieIndex <= length_array(nSystemTies[_nRoomIndex]); _nTieIndex++)
        {
          if(nSystemTies[_nRoomIndex][_nTieIndex] = _nOutput)
          {
            send_level vdvSYSTEMS[_nRoomIndex], LEVEL_GROUP_SYSTEM_TIE_INPUTS[_nTieIndex], _nInput
            break
          }
        }
      }
    }
    
    define_function RefreshSystemFeedback(integer _nRoomIndex)
    {
      stack_var  integer  _nTieIndex
    
      for(_nTieIndex= 1; _nTieIndex <= length_array(nSystemTies[_nRoomIndex]); _nTieIndex++)
      {
        send_level vdvSYSTEMS[_nRoomIndex], LEVEL_GROUP_SYSTEM_TIE_INPUTS[_nTieIndex], nRouterConnections[nSystemTies[_nRoomIndex][_nTieIndex]]
      }
    }
    
    DEFINE_EVENT
    data_event[vdvSYSTEMS]
    {
      online:
      {
        stack_var  integer  _nRoomIndex
        _nRoomIndex = get_last(vdvSYSTEMS)
        RefreshSystemFeedback(_nRoomIndex)
      }
    }
    
    data_event[dvROUTER]
    {
      string:
      {
        stack_var  integer  _nInput
        stack_var  integer  _nOutput
    
        // !!! Parse feedback and update feedback for affected system here
        [...]
        UpdateSystemRoutingFeedback(_nInput, _nOutput)
      }
    }
    

    And on the sub masters:
    DEFINE_DEVICE
    vdvSYSTEM = 33001:1:0
    
    DEFINE_CONSTANT
    char     SYSTEM_TIES_QUANTITY     = 4
    char     LEVEL_SYSTEM_TIE_1_INPUT = 1
    char     LEVEL_SYSTEM_TIE_2_INPUT = 2
    char     LEVEL_SYSTEM_TIE_3_INPUT = 3
    char     LEVEL_SYSTEM_TIE_4_INPUT = 4
    
    char     LEVEL_GROUP_SYSTEM_TIE_INPUTS[] =
    {
      LEVEL_SYSTEM_TIE_1_INPUT,
      LEVEL_SYSTEM_TIE_2_INPUT,
      LEVEL_SYSTEM_TIE_3_INPUT,
      LEVEL_SYSTEM_TIE_4_INPUT
    }
    
    DEFINE_VARIABLE
    volatile   integer  nSystemTieInputs[SYSTEM_TIES_QUANTITY]
    
    DEFINE_EVENT
    level_event[vdvSYSTEMS, LEVEL_GROUP_SYSTEM_TIE_INPUTS]
    {
      online:
      {
        stack_var  integer  _nTieIndex
        _nTieIndex = get_last(LEVEL_GROUP_SYSTEM_TIE_INPUTS)
        nSystemTieInputs[_nTieIndex] = level.value
        
        // !!! Now handle the updated routing info and turn it into
        // local feedback on the user interface(s)
        [...]
      }
    }
    

    Note that the feedback sent to the sub systems by this code is physical input numbers on the switcher. This should probably be abstracted into virtual constants that identify individual sources so that if router connections change the code on all the submasters doesn't have to change. Likewise, the submasters should probably be requesting "sources" from the master master, not physical inputs on the main router.

    Also (without knowing the system you're working on), you'd likely to have to expand this to support multiple switching layers (so that audio and video switching feedback is sent to the room systems).

    As the constants relating to levels on the room virtual devices are common between the master master code and submaster code, they should probably be moved out to a common include file that is #included into both systems,
  • John NagyJohn Nagy Posts: 1,742
    I have to think this project would be easier and much cheaper to do with JUST ADD POWER all HDMI over regular ethernet.... too late now, wired and hardware in place...
  • This is BY FAR the largest project I have ever done. I asked this in another thread, but felt the potential topic drift warranted its own thread.

    In my building, there is one Master Master that all of the sub masters talk to. The Master Master controls a Pesa Cheetah 512 x 512 video matrix. Each sub master has an 8 x 8 Pesa video matrix in their rooms. I need to pass vairables from the Master Master to the sub-masters when they need it. For example, the 512 x 512 matrix has a DSS head end as poart of its inputs. So, if Room 1 wants to watch CNN here's what happens:

    Room 1 asks for CNN.
    Each room has multiple outputs from the 512 matrix, so the user is also asked what tie line they want to use for CNN.
    For room 1, we'll say inputs 1 - 4 on the local matrix are tied to outputs 40 - 43 of the 512 x 512 matrix.
    Once the user selects a tie line, room 1 sends a command to a virtual device.
    SEND_COMMAND vdvDEVICE, 'ROUTE=DSS 1 PORT x' (Port x equals the input of the local matrix)
    Room 1 sends a command to a virtual device on the Master Master that represents room 1.
    The Master Master uses a DATA_EVENT to parse the data rx'd on the vdvDEVICE:
    DATA_EVENT[vdvDEVICE]
    {
    	           COMMAND:
    	           {
    	                  STACK_VAR INTEGER nRoom
    	                  STACK_VAR INTEGER nIndex, nIndex2, nRoomIN, nRoomOUT
    	                  STACK_VAR INTEGER nIn, nOut
    	                  STACK_VAR INTEGER nRoomIndex
    	                  nRoom = GET_LAST(vdvDEVICE)
    	                  SELECT
    	                  {
    	                         ACTIVE(FIND_STRING(DATA.TEXT,"'ROUTE='",1)):
    	                         {
    	                                  REMOVE_STRING(DATA.TEXT,"'ROUTE='",1)
    	                                  SELECT
    	                                  {
    	                                             ACTIVE(LEFT_STRING(DATA.TEXT,3) = 'DSS'):
    	                                             {
    	                                                       REMOVE_STRING(DATA.TEXT,"'DSS'",1)
    	                                                       nIn = ATOI(DATA.TEXT)
    	                                             } 
    	                                  }
    	                                  REMOVE_STRING(DATA.TEXT, ',' ,1)
    	                                  SELECT
    	                                  {
    	                                          ACTIVE(FIND_STRING(DATA.TEXT,"'PORT'",1)):
    	                                          {
    	                                                  REMOVE_STRING(DATA.TEXT,"'PORT'",1)
    	                                                  nINDEX2 = ATOI(DATA.TEXT)
    	                                                  nOUT = nRoomOutputs[nRoom][nIndex2]
    	                                          }
    	                                  }
    	                                  fnDoRoute(nIn,nOut,BOTH)
    	                         }
    	                  }
    	           }
    	}
    
    

    Now the Master Master knows which room asked for CNN and which port they are using. The fnDoRoute builds the string to send to the 512 x 512 matrix and now, room 1 is watching CNN.

    I want to pass the feedback from the 512 x 512 matrix to the sub-master. The sub-master, via direct feedback, would then place the CNN logo on the appropriate button on the TP and that's what I am not quite sure how to do. If Room 1 has 4 outputs from the 512 x 512 matrix, I was thinking on the sub-master I need to create an array with each index representing individual tie lines. If the user wanted CNN on tie line 3, then everywhere they sent tie line 3, the CNN logo would display. How can I populate that array? Once I get the array populated, I'm good from there. I just need a push in the right direction. There are over 100 sub-masters communicating with the Master Master, so I was thinking each room's array needs to be updated only when that room makes a change vice all of the sub-masters trying to talk to the Master Master at once. Thanks.

    Jeff, I have to ask, is this for a government facility in the Southeast? ...as I was recently hired and thrown into a project that sounds almost identical... same routers and number of controllers.
    -Paul
  • viningvining Posts: 4,368
    John Nagy wrote: »
    Heaven forbid they were watching Fox and couldn't tell...

    That explains it, you must be one of those liberals. It all makes perfect sense to me now! ;)
  • DHawthorneDHawthorne Posts: 4,584
    If the main master is defined on all the submasters, you can assign a level to each output of the matrix. The value of the level would be the input it's on. Each submaster can then read the levels and adjust themselves accordingly. The level events being shared by the master would, I think, generate the least amount of inter-master traffic. You would have to make sure, however, to use SET_VIRTUAL_LEVEL_COUNT on each sub, or they will only see the first 8 or so. I'm not sure you can put all 512 levels on the same virtual device but you could make several.
Sign In or Register to comment.