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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: SNL: state change statement in entry block |
From: | Eric Williams <[email protected]> |
To: | Benjamin Franksen <[email protected]> |
Cc: | EPICS tech-talk <[email protected]> |
Date: | Mon, 16 Mar 2015 10:05:34 -0700 |
Hi Andrew
Since version 2.1 the sequencer deviates from the Mealy Machine model, in that
you can say
state other_state;
in the middle of an action block. I called this a "state change statement"
(and it really is a statement, not an _expression_). It is only allowed inside
transitions, not in entry or exit blocks. This can be useful in situations
where determining the next state cannot be expressed as a closed formula in
SNL, for instance if it involves iteration.
Cheers
Ben
Am Samstag, 14. März 2015, 03:06:12 schrieb Johnson, Andrew N.:
> The SNL compiler implements a version of the well-known finite state machine
> (FSM) known as a Mealy Machine. Each SNL state set in a program corresponds
> to a single FSM, comprising a set of states connected by transitions, which
> are made up of input (when) conditions and output actions. An entry block
> just provides a set of actions (i.e. FSM outputs) to be executed whenever
> its state is entered. Action sequences cannot contain state changes, those
> are determined only by the transition conditions which trigger the actions.
>
> If you discover that an action sequence needs to change the transition it's
> implementing, you will usually have to add one or more states and
> transitions to properly model and code the result. The advantage of state
> programming is that (in theory) for any series of inputs you can determine
> exactly how the machine will respond. In practice state programs with lots
> of states can be complex beasts to follow; drawing up a corresponding state
> transition diagram can help in these circumstances, but I wouldn't try to
> detail all of the actions on the diagram.
>
> HTH,
>
> - Andrew
>
> > On Mar 13, 2015, at 7:36 PM, Eric Williams <[email protected]> wrote:
> >
> > I had put a state change statement in the entry block of one of my states
> > and the 2.2.1 compiler kicked it out. Evidently it only allowed them in
> > transition blocks. I re-arrange my code to get around the restriction
> > but I was curious: What is the problem with having a state change
> > statement in an entry block? --
> > Eric Williams
> > ALS Controls, LBL
--
"Make it so they have to reboot after every typo." ― Scott Adams
________________________________
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführung: Prof. Dr. Anke Rita Kaysser-Pyzalla, Thomas Frederking
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
http://www.helmholtz-berlin.de