Home AMX User Forum NetLinx Studio
Options

Timer or Wait_Until

I have a lift and a projector. I want to shut down the projector if the lift is up for 30 minutes (also the countdown should be canceled once when lift is down within 30 minutes)

How can I achieve that? Thanks

Comments

  • Options
    adysadys Posts: 395
    I think the simplest way is:


    BUTTON_EVENT[tp, UP_BUTTON]
    {
    push:

    WAIT 'SHUT_DOWN_PROJECTOR' 18000
    {

    shutDownProjector()

    }

    }


    BUTTON_EVENT[tp, DOWN_BUTTON]
    {
    push:

    CANCEL_WAIT 'SHUT_DOWN_PROJECTOR'

    }

    you can also do it with Timeline.
  • Options
    SensivaSensiva Posts: 211
    Hmmmmm
    BUTTON_EVENT[TP,LIFTUP]
    {
      PUSH:
      {
        //LIFE UP COMMAND HERE
        WAIT 18000 'LIFTISUP'
        {
          //SHUTDOWN PROJECTOR COMMAND HERE
        }
      }
    }
    BUTTON_EVENT[TP,LIFTDOWN]
    {
      PUSH:
      {
        CANCEL_WAIT 'LIFTISUP' //THIS WILL CANCEL THE WAIT
        //LIFT DOWN COMMAND HERE
      }
    }
    
    [size=+1]Note:[/size]
    1st : I think you should tell us how your projector and its lift are controlled and if they have a good feedback facility like responses of the current state

    2nd : 30 minutes ON in the projector housing??!?.. if your projector is big enough, it will be burned for sure!!

    3rd : In the first place, why someone may pull up the lift, and intending to pull it down again in a 30 minutes??. In common logic , in a room with a projector , no one will pull it up unless he wants to end up the meeting. If you are trying to make some precautions if someone forgot to turn off the projector and pulled up the lift, you should make it in your code by turning off the projector immediatelly before pulling the lift up .. see bellow :
    BUTTON_EVENT[TP,LIFTUP]
    {
      PUSH:
      {
        //PROJECTOR SHUTDOWN COMMAND HERE
        WAIT COOLING_PERIOD 
        {
          //LIFT UP COMMAND HERE
        }
      }
    }
    

    One of the great things that my instructor taught me is :
    - try to use timelines instead of waits specially in sequenced system shutdown
    - Always think in terms of logic not in terms of code. In your case, you may burn the projector , and your client will call you sayin "your fabulous AMX burned my equipment", when in fact it is your fault, not AMX :D
    Another example is the Drapes Relays, a relay for each direction, one for UP and the other for DOWN, if you didn't define them in a mutually exclusive group and someone pushed UP while the other is ON the motor will be burned. :D
  • Options
    RajRaj Posts: 53
    use timeline

    hello friends,
    I'm a newbie to AMX programming . can you provide me an example by implementing the above situation using timeline.
  • Options
    DHawthorneDHawthorne Posts: 4,584
    I don't have a problem using WAITs for simple timer problems, but I would never use one for such a long time period. But I would also never allow the lift to be raised in the first place if the projector is on, period. My customers pay for automation, I'm not going to have separate lift, screen, and projector buttons, except as overrides for testing and setup (in which case, they are appropriately buried). I put the whole kabosh on the source selection buttons (which handle turning everything on and setting up the lift, screen, etc.,) and system off buttons. The timing and activation of all the ancillary devices is purely automatic ... and when you have multiple devices, a timeline is most elegant.
  • Options
    HedbergHedberg Posts: 671
    DHawthorne wrote: »
    I don't have a problem using WAITs for simple timer problems, but I would never use one for such a long time period. [...]

    Yeah, a 30 minute wait to turn off a projector looks dangerous to me. If the wait is interrupted, by a reboot or power glitch or whatever, the projector will stay on for a long time.

    Went on a service call recently to a law firm that had a system which had been installed by Big National Integration Company about three years ago. They couldn't get their projector to work -- a popup claiming it was in its cool-down cycle kept appearing. Prior to calling us, the law firm called Big National Integration Company and a technician came out and pronounced the projector in good working order. The code was on the master and when I looked at it I saw that when the projector was turned off, a parameter indicating cooling was set and would be reset at the expiration of a wait. Problem was that if the wait was interrupted, there was no method to reset the parameter. Worst part about it was that the projector is a Sanyo which has a very easy to understand and implement status query and response. No reason whatsoever to rely on a wait for cooling with one of these projectors.

    I don't know much about what projector lifts are available, pricing and the like. But, every projector lift that I have seen had some sort of facility to turn the projector off when the lift was raised. Perhaps this is some sort of feature associated with particular projectors, I don't know. Seems like a worthwhile feature, though.
  • Options
    mpullinmpullin Posts: 949
    I feel WAITS are kind of getting a bad rap in this thread. It's hard to discuss because we don't know the projector and/or what kind of feedback we can get from the projector. Assuming you can get state info from the lift and projector you can make the lift follow the projector with just a little code in your idle process, without the overhead of a timeline
    DEFINE_PROGRAM // idle
    WAIT 1200{ // renew wait_untils every couple minutes
         WAIT_UNTIL(nLIFT_STATE == nLIFT_STATE_DOWN && nPROJECTOR_STATE == nPROJECTOR_STATE_OFF) SEND_COMMAND vdvLIFT, 'GO UP'; // if proj is off and lift is down, go up.
         WAIT_UNTIL(nLIFT_STATE == nLIFT_STATE_UP && nPROJECTOR_STATE == nPROJECTOR_STATE_WARMING) SEND_COMMAND vdvLIFT, 'GO DOWN'; // if proj is warming and lift is up, go down.
    }
    
    And yes I do agree, leaving a projector on at all if the lift is up is a waste.
Sign In or Register to comment.