Home AMX User Forum NetLinx Studio

Design Question

adysadys Junior MemberPosts: 395
Hi All

Our first room is finished :)

Its name is "System 1" and it is full of devices.

Now I have to decide how to do the next room - but all rooms must be able to control all devices at home.

This means that I have to run the code of each room on every system?
We have lots of GUI logic , not only devices code...

So if I add now system 2 it must run all the code that I written to system 1?

Thinking that I have 14 systems in this home, make me thing again...


How will you recommend to handle this ?

And in netlinx - I copied the system to a new system and use the shared file in both systems. I am going to have a huge project that contain 14 systems - the other option is to have one project to each system.

This is my first AMX project so any help will be appreciate.

Thanks,

Adys.

Comments

  • DHawthorneDHawthorne Old Timer Posts: 4,584
    No, you do not need to duplicate the code on every system. My rule-of-thumb is that the master that has the physical connection to the device runs it; then you use master-to-master so the other systems can provide events for that code.

    In a big house system, I will generally have a master in charge of the house systems, and seperate masters for local systems (like TV rooms, or a bedroom stereo). A panel in the local system will have a port (or ports, as needed) that are assigned to the local system, and ports assigned (and defined on) the "main" system. Then I'll use SEND_COMMANDs on a virtual device to hanel those times when a button press needs to do something on both the main and local systems (like turning on a local stereo to a zone of the multiroom system).
  • adysadys Junior Member Posts: 395
    Thanks Dave

    I can undestand about lighting system vs study room, and its ok.

    But when you have 3 rooms that need to be shared and control all from every TP?

    I remember asking about it before (Master to Master) and from what I undesrstand if I have devices on system 1 - I can forward all the events to system 2.

    But what will I do with system 2 events?

    If I will pass it to system 1 again it will create a loop?
  • DHawthorneDHawthorne Old Timer Posts: 4,584
    To establish master-to-master, one of the masters has to have the other in it's URL list. That's the first step. Do not put both in each other's, just the one.

    Now, system 1 can have a definition like this:

    dvTP2 = 10001: 1: 2

    And you can treat that panel just like it was a device on system 1, even though it is connected to system 2. No need to "forward" any commands anywhere unless you have a situation that specifically warrants it; but honestly, there are not many designs where it is absolutely essential. You can have button events for this panel now on both systems, doing different things on each one. So, let's say button one on that panel on system 2 turns on the local system and selects a shared tuner. The same button on system 1 can tell the audio switch to switch that tuner to that zone.
  • adysadys Junior Member Posts: 395
    But if I put only like you said, how system 2 can talk with device on system 1?



    And the problem is that I need to know how to go to each device screen from every TP and still do the same - but for different devices....


    Like if I have a CD in 5 systems, and I am using the same screen for all, how can I know what the user on TP X want to do only on CD Y in a simple way?

    I know how to get from what TP I got the event, but sometimes it will want to control CD x from TP X and sometimes CD Y from TP X and its from the same screen...
    and how to make only the relevant system to take the event and not all ? ( I mean in the code of the BUTTON_EVENT)

    I am a bit lost here....
  • adysadys Junior Member Posts: 395
    There is no solution to this problem?

    Anyone?
  • DHawthorneDHawthorne Old Timer Posts: 4,584
    There is, I just haven't more than a few minutes lately to spend browsing the forums, and it's going to take a bit to answer that one. I'm not sure when I'll get the slack time, but I'll try.
  • yuriyuri Junior Member Posts: 861
    adys, just link up all your frames and keep one frame as the master with all the code on it.
    Catch all the button_events on the same frame, and you are done :)
  • adysadys Junior Member Posts: 395
    I have about 100 serial devices, some of them have one second interval update...

    can one system can hold all the code and all events?

    its a good solution, but is it possible for a huge house?
  • adysadys Junior Member Posts: 395
    DHawthorne wrote:
    There is, I just haven't more than a few minutes lately to spend browsing the forums, and it's going to take a bit to answer that one. I'm not sure when I'll get the slack time, but I'll try.

    Thanks

    I will wait, this is the biggest issue I have in this job.

    thanks again

    Adys
  • NMarkRobertsNMarkRoberts Junior Member Posts: 455
    adys wrote:
    I have about 100 serial devices, some of them have one second interval update...

    can one system can hold all the code and all events?

    its a good solution, but is it possible for a huge house?

    I believe that you are asking "Can one NetLinx master control 100 devices?"

    Yes, I believe so.

    In the worst case, how many of those devices might be active? Maybe 10? That's not a significant load if your code is well written. (That might imply getting rid of all those one second updates. I usually find that frequent updating isn't necessary except very rarely for currently active devices eg displaying play duration timers on CD players.)

    However it depends on how you handle the startup of each module after a reboot. 100 different modules asking 100 devices what is their current status (or whatever) will certainly overload the system. My solution is to delay their startups and spread them out over a minute or two or ten.

    A system compile and download might take a while to run.

    But the better question is "Do I need to control all of them in one controller?"

    I don't think so.

    Communication between your modules will take place via virtual devices using pushes, send_commands or maybe send_strings. It makes no difference to coding or performance whether the modules are on one controller or on ten; it doesn't even matter whether the control module for a given device is on the controller that device is attached to.

    The only downside I can think of is that you will need more than one system build.
  • alexanboalexanbo Junior Member Posts: 282
    adys wrote:
    But if I put only like you said, how system 2 can talk with device on system 1?



    And the problem is that I need to know how to go to each device screen from every TP and still do the same - but for different devices....


    Like if I have a CD in 5 systems, and I am using the same screen for all, how can I know what the user on TP X want to do only on CD Y in a simple way?

    I know how to get from what TP I got the event, but sometimes it will want to control CD x from TP X and sometimes CD Y from TP X and its from the same screen...
    and how to make only the relevant system to take the event and not all ? ( I mean in the code of the BUTTON_EVENT)

    I am a bit lost here....


    Track which particular device a TP is controlling. This can be set when a source is selected. Then when a device control is hit, send the command to the device the TP is currently controlling.

    So if you have a variable called TP_X_Current_Device:
    Button_event[dvTP,btnSourceSelect]
    {
      Push:
      {
         switch(get_last(btnSourceSelect))
         case 1: 
             TP_X_Current_Device = dvCD_X
         case 2:
             TP_X_Current_Device = dvCD_Y
      }
    }
    
    Button_event[dvTP,btnPlay]
    {
      Push:
      {
         send_command TP_X_Current_Device,"'SP',1"
      }
    }
    
    

    You can use arrays and get_last to allow the code to work for multiple devices and touchpanels.
  • adysadys Junior Member Posts: 395
    Thanks guys for the answers

    Mark - I still don't get how to pass all messages to all controllers...

    Alex - if I need to controll it from more than one TP in the same time?
  • NMarkRobertsNMarkRoberts Junior Member Posts: 455
    adys wrote:
    Mark - I still don't get how to pass all messages to all controllers...

    See Tech Note 532 on amx.com.

    I've done this with NetLinx master and Axcent 3 slaves but not with master-to-master so if anyone can jump in here with corrections please do.

    First establish master-to-master communication by adding the IP address of one to the URL list of another and ensure that each controller has a different system number.

    Now every port on every controller is visible to every controller; just declare the devices with the appropriate system number:
    define_device
    
    dSystem1Serial1 = 5001:1:1
    dSystem2Serial1 = 5001:1:2
    

    However I would not recommend directly controlling a given box from two different masters - instead you should send commands to a single driver module which controls it for you.

    BTW would you believe that AMX have a patent on master-to-master communication?
  • adysadys Junior Member Posts: 395
    Thanks Mark

    Nice Patent :)

    I think that main point that I didn't understand it that if I am putting Y system in URL list of X system, X will get Y messages and Y will get X messages?

    if that is correct than my problems is solved.

    I thought its only the URL list direction...
  • Joe HebertJoe Hebert Junior Member Posts: 2,159
    adys wrote:
    I thought its only the URL list direction...
    There is no URL list direction?just a URL list. Whichever master initiated the master-to-master connection is transparent to the code.
  • yuriyuri Junior Member Posts: 861
    adys wrote:
    Thanks Mark

    Nice Patent :)

    I think that main point that I didn't understand it that if I am putting Y system in URL list of X system, X will get Y messages and Y will get X messages?

    if that is correct than my problems is solved.

    I thought its only the URL list direction...

    i still think you should put one system on system number 1 and the other system on system number 2 :)
  • NMarkRobertsNMarkRoberts Junior Member Posts: 455
    adys wrote:
    I think that main point that I didn't understand it that if I am putting Y system in URL list of X system, X will get Y messages and Y will get X messages?

    Like I said, and I might be wrong as I have never done this:

    "Now every port on every controller is visible to every controller"

    It would take about 5 minutes to find out.
  • adysadys Junior Member Posts: 395
    True


    I will test it soon as I finish the current room and will update my test.


    I am planing to do a central virtual device(or more than one) that will hold states for all house , and on every update of its states will notify to its dynamic "listeners" about the state change.

    My biggest problem was how to share the message if I want to use this architcture, if this is the way M2M works its simplify the work.

    thanks all for all the info,

    I will update this post as soon as I will have some answers.

    Adys
Sign In or Register to comment.