Home AMX User Forum AMX General Discussion

System 'snappiness'

I am nearing completion of a decent sized project with an NI4100 that is completely loaded, every comm port, IR port, card slot, couple of card shells etc. There are 13 RS-232 devices in total, 11 Moderos, 8 R4s and 3 DMSs. All Moderos have whole house control of all systems. There are many data intensive modules running, including HVAC, Lutron, Kaleidescapes, iPort, Security, Intellitouch, 2 Autopatch modules, B&K rcvr etc. With my previous employer using their modules/paradigm, I always noticed that jobs of this size made the feedback a little slow, and the system response always seemed 50-100 ms behind the user, not bad but enough to notice. This was always a disappointment to me since this expensive AMX system responded slower than the $20 IR remote. I had assumed it an unavoidable symptom of projects this size.

For this job, I made sure that no module communicates with a touch panel unless it has to, and no code resides in define_program and all feedback is lazy in that no feedback is done unless someone is looking at the page. I have found that I have been rewarded with system 'snappiness' that is much higher than the similar jobs with my previous employer. I have a page that has twenty or so text fields on it that get filled when the page flip happens. I had figured this would be slow enough to notice, but it has not turned out to be the case as it is almost instantaneous. The security system that updates faulted zones to the touch panel is as close to instantaneous as possible. As well, I have a page with 5 IP cameras on it and it appears instantaneously as well, with no delay as opposed to previous projects where they would take a few seconds to show up.

I know many don't agree with me that define_program doesn't slow things down but after this project I am convinced that a carefully programmed system with a goal to keep CPU and memory resource use at a minimum is really worthwhile in the end and results in a much faster responding system. Anyone else experienced this as well?

I wouldn't mention it except that the responsiveness is so noticeable that it bears mentioning. Even VNCing into the panels from 1000 miles away over the internet, the TP responsiveness is noticeably better than jobs I had done with my previous employer with the panel in front of me so I will do all my projects this way from now on. I am just surprised how much difference it made considering others always say writing code in define_program doesn't slow down processing.
Paul

Comments

  • viningvining Posts: 4,368
    I've just gotten to the point where I'm starting to make all my new module's feedback TP page dependent. With offiline, online & page tracking to determine what TPs if any warrant feedback. This makes perfect sense to me and quite a few members have already been doing this for years.

    The first goal in programming is to get things to work and when you're comfortably at that then you can take the time to make things work better. I think that's where I'm at now and managing feedback is a must and this point. The idea of sending channel or text feedback to an array of TPs none of which are being used or on the page for which the feedback is being sent is in no way effecient or proper use of the processor resources but that's what I and most of us have been doing and what anyone using an AMX module is doing. Unforntunately that means I have to go backwards and re-write some modules. At least when taking two steps forward for each step backward I'm still heading in the right direction. I think?
  • a_riot42a_riot42 Posts: 1,624
    vining wrote: »
    I've just gotten to the point where I'm starting to make all my new module's feedback TP page dependent. With offiline, online & page tracking to determine what TPs if any warrant feedback.

    I thought of using page tracking but I found it too complicated since the strings coming from the panel aren't formatted in a way I would like, and it uses actual page/popup names so it isn't very portable. Have you had good luck with it? I used a different method that uses integers rather than strings and no page or popup names. It really requires very little modification of a module, and is much more efficient so its worth it to me.
    Paul
  • viningvining Posts: 4,368
    a_riot42 wrote:
    I thought of using page tracking but I found it too complicated since the strings coming from the panel aren't formatted in a way I would like.
    I didn't actually mean "page tracking" page tracking but on the button push that opens a page I'll set the divices TrackingArray index postion for that TP to = 1 which coincides with the devices TP Array index position. On the button push that exits the page or Offline_Event I'll set that position to = 0. The TrackingArray is volatile so on system reboot everything resets to 0 and on my main TP array online_event I''l do a PPX and page flip to my main page. I use an overall feedback flag to determine if any feedback will run at all and then further direct feedback to only those TP's that are active w/ a for loop that checks the TrackingArray index for the TPs and if set sends the feedback to the devices TPArray index positon. Button feedback is in a 200ms time_line and text feedback is when ever it changes, or a panel flips to the devices page which is only sent to the TP that flipped to the devices page.

    I'm still working on figuring the best way to handle all of this but this is what I'm doing presently. I did try Dave's Combine/Un-combine function but I had problems with the virtual device. I'm sure it was just the way I was using it since I believe Dave has been using it fine for years and I have problems just getting dressed in the morning, socks don't match, shirt inside out....
  • a_riot42a_riot42 Posts: 1,624
    vining wrote: »
    a_riot42 wrote:

    I didn't actually mean "page tracking" page tracking but on the button push that opens a page I'll set the divices TrackingArray index postion for that TP to = 1 which coincides with the devices TP Array index position. On the button push that exits the page or Offline_Event I'll set that position to = 0. The TrackingArray is volatile so on system reboot everything resets to 0 and on my main TP array online_event I''l do a PPX and page flip to my main page. I use an overall feedback flag to determine if any feedback will run at all and then further direct feedback to only those TP's that are active w/ a for loop that checks the TrackingArray index for the TPs and if set sends the feedback to the devices TPArray index positon. Button feedback is in a 200ms time_line and text feedback is when ever it changes, or a panel flips to the devices page which is only sent to the TP that flipped to the devices page.

    Yes I understand, I had thought that you meant you were using the page track command. I do somethign very similar without the timeline event and it seems to work well. I never use the combine/uncombine functionality although I have a feeling that if we looked at the code, its probably just a for loop tracking an array :)
    Paul
  • GSLogicGSLogic Posts: 562
    Paul
    Sounds like a great project, great to hear it's running smooth.
    I've been preaching for years. :)

    http://www.amxforums.com/showpost.php?p=26348&postcount=34
  • a_riot42a_riot42 Posts: 1,624
    GSLogic wrote: »
    Paul
    Sounds like a great project, great to hear it's running smooth.
    I've been preaching for years. :)

    http://www.amxforums.com/showpost.php?p=26348&postcount=34

    I never saw that post originally, thanks. I use the Kaleidescape module and I think its ok, but it has the slowest button feedback, even though it only provides feedback for panels that are controlling it. Here is the code. I do not like the way this is done and its no surprise its slow.
    define_program
    {
        local_var chan 
        stack_var TP_ref, KPlayer_ref
        
        chan++		//on each run through mainline, handle the next feedback channel
        if(chan > 90) 
          chan = 1
        
        for(TP_ref = 1; TP_ref <= length_array(KTouch_Panels); TP_ref++)
        {
          KPlayer_ref = controlled_Kplayer[TP_ref]    //determine which player this panel is controlling
          if(KPlayer_ref)
           [KTouch_Panels[TP_ref],chan] = [Kplayer[Kplayer_ref],chan+1000]
        }
    } 
    
    They make the mistake of calling length_array every single time in the for loop as well...tsk tsk. I will change this around and see if it helps feedback. Having a for loop inside define_program constantly running is bad style in my opinion. How much of the total time is spent hitting button that require feedback? 0.1% of the time, yet it checks constantly.
    Paul
  • viningvining Posts: 4,368
    a_riot42 wrote:
    Having a for loop inside define_program constantly running is bad style in my opinion.
    If left in Define_Program putting this code behind a simple "wait 2" or 4 (whatever) would make it much less of a strain on system resources considering everything else they is running too.
  • TonyAngeloTonyAngelo Posts: 315
    Or even adding an IF, so that it will only fire when the Kscape page is active.
  • yuriyuri Posts: 861
    or, create a timeline that will only run when you are on the KScape page :p
    You can even create multiple timelines with different instance ids, and tie those ids to different pages that automagically trigger the corresponding timeline for feedback :)
Sign In or Register to comment.