Experimental Physics and Industrial Control System
Jay,
The timer starts when the state containing the when clause is entered. There are some flags which determine if it restarts when the state loops back to itself or not.
So the order of elements in the when expression is irrelevant.
If you want some specific ordering, you need to use more states.
Ron
On Aug 10, 2011, at 9:01 AM, Jay Steele wrote:
Hi EPICS folks,
For the state notation language, the when statement is mostly straightforward in that the code following the when statement occurs when the logical expression inside the when statement is true. However, I'm a little confused by the delay function in a when statement because something needs to start and monitor the timer for the delay. I need to understand this delay logic better for a EPICS robot control application I'm working on. When does the timer start and how is it monitored for the delay? For example, if I use the following when statement for a state transition,
when(A==1 && delay(1.0) && B==1),
does the timer for the delay only start and continue after the A==1 logical condition is met and, after the delay is done, then it checks the B==1 logical condition? Thus, does the order of logical conditions in the when statement make a difference so that when(delay(1.0) && A==1 && B==1) behaves differently? Here is one possible interpretation of when(A==1 && delay(1.0) && B==1):
time A B transition
----- --- --- ----------
0 0 0 none
1 0 0 none
2 1 0 none
2.5 1 1 none
3 1 0 none
4 1 1 yes
Or, does the timer for the delay only start and continue after both the A==1 and B==1 conditions are satisfied? In which case, we get the following result for when(A==1 && delay(1.0) && B==1):
time A B transition
----- --- --- ----------
0 0 0 none
1 0 0 none
2 1 0 none
2.5 1 1 none
3 1 0 none
4 1 1 none
5 1 1 yes
Or does the timer for the delay start as soon as the state containing the when statement becomes active and just continue? In this case, the results would be as follows for when(A==1 && delay(1.0) && B==1).
time A B transition
----- --- --- ----------
0 0 0 none
1 0 0 none
2 1 0 none
2.5 1 1 yes
I will test these different situations out, but I wanted to understand the underlying logic intent so that my SNL implementation will not break with future software versions.
Cheers,
Jay Steele
Xradia Corporation
________________________________
The information in this email, including any attachments, is confidential and intended only for the recipient(s) listed. Any use of this email for any other purpose is prohibited. If you have received this email in error, please notify me immediately by reply email, delete this email, and do not disclose its contents to anyone.
- Replies:
- Re: question about state notation language logic for when() with delay Benjamin Franksen
- References:
- question about state notation language logic for when() with delay Jay Steele
- Navigate by Date:
- Prev:
question about state notation language logic for when() with delay Jay Steele
- Next:
Re: question about state notation language logic for when() with delay Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
question about state notation language logic for when() with delay Jay Steele
- Next:
Re: question about state notation language logic for when() with delay Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024