Experimental Physics and Industrial Control System
On Montag, 5. Oktober 2009, Zelazny, Michael Stanley wrote:
> With no delay's or event flags, isn't your SNL below compute bound?
My mistake. This state change
> when () {
> } state done
from state idle will loop. You can leave it out, or, if you want selective
responsiveness, it needs a condition
when (cmd != 0) {
} state done
Thus state idle is enetered only when cmd==0, and is left only if someone
else sets it to something different to 0. The program will block and not
consume cpu until cmd changes to something different from 0.
Cheers
Ben
> On Montag, 5. Oktober 2009, Benjamin Franksen wrote:
> On Montag, 5. Oktober 2009, Andrew Johnson wrote:
> > I suspect it would be a good idea to try and get the the SNL compiler
> > to issue a warning whenever it sees someone calling pvPut() on a
> > variable which has a monitor on it, since this is IMHO an unsafe
> > practice.
>
> It is not if you do it right. I have never observed any problems with it.
> You just have to make sure that the value your SNL program writes is
> different from what the outside writes. Typically I reserve some value
> (usually 0) for 'done' (a.k.a. 'idle'). The outside is not allowed to
> write this value (this can be enforced using yet another record). Then I
> have some SNL code like
>
> int cmd;
> assign cmd to "whatever";
> monitor cmd;
>
> state idle {
> when (cmd==DO_SOMETHING) {
> setup_execution();
> } state first_intermediate_state
> ...
> when () {
> } state done
> }
> ...intermediate states...
> state done {
> when ... {
> cmd = 0;
> pvPut(cmd);
> } state idle
> }
>
> The advantage is that I don't need event flags which I always found to be
> unreliable.
- References:
- state notation code flags Patrick Thomas
- Re: state notation code flags Andrew Johnson
- Re: state notation code flags Benjamin Franksen
- Navigate by Date:
- Prev:
RE: Channel access dynamic array subscription update element count Jeff Hill
- Next:
javaIOC Marty Kraimer
- 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:
Re: state notation code flags Benjamin Franksen
- Next:
propagating value upward at init Emmanuel Mayssat
- 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