Can you wait for two inputs within the same state

MEDState Notation Repository Forums Coding Help Archive Can you wait for two inputs within the same state

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13249
    Med_Support
    Moderator
    gdillon
    S1,
    #R1: SET T=0-->SX
    1": ADD T-->SX
    #R2: IF T<=30 THEN {@Chained; @Unchained}
    @Chain: ADD C; SHOW 3, Chain, C-->S1
    @Unchained: ADD U; SHOW 4, Unchained, U-->S1
    

    What I am trying to do here is:
    Wait for an input to 1, then start a counter that measures the time in from input 1 untill input 2. If input 2 happens <=30Sec after input 1 then it is counted as a chained response.

    Does this work?
    Thanks
    Greg “The worst programmer in the world”

    #13250
    Med_Support
    Moderator
    Gary Bamberger

    i Greg,

    Your code is close except I think that you need to add a counter for input 1.  Also you will want to move the time input statement to be last:

    S1,
    #R1: ADD R; SET T = 0 ---> SX
    #R2: IF (T >= 30) AND (R >= 1) [@Chained, @Unchained]
    @Chained:   ADD C; SHOW 3,Chained,C;   SET R = 0, T = 0 ---> S1
    @Unchained: ADD U; SHOW 4,Unchained,U; SET R = 0, T = 0 ---> S1
    1": ADD T ---> SX
    

    The R counter is needed because what if a response happens on input 2 and T >= 0, but a response never happened on input 1.  The time statement needs to be last because if a response on input 2 happens at exactly the same time as the 1″ timer, then the input 2 response would be missed.

    #13253
    Med_Support
    Moderator
    gdillon

    Ahhhh, I see
    That does make sense.
    Thanks for the tip.
    Greg

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.