\documentclass[10pt,a4paper]{report}
\usepackage[top=3cm, bottom=2.5cm, left=3cm, right=2.5cm] {geometry}
\usepackage {bsymb,b2latex}
\usepackage{fancyhdr,lastpage,color}
\usepackage{graphicx}
\lhead{\rm An Event-B Specification of a powered window using UML-B State-machines}
\rhead {\rm Page \thepage~of \pageref{LastPage}}
\lfoot{}\cfoot{}\rfoot{}
\pagestyle{fancy}
%---------------------------------------------------------
\begin{document}
\thispagestyle{empty}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{description}
\BTitle{Machine pw0}{13 Dec 2011}{11:10:16 PM}

\includegraphics[width=0.3\textwidth]{statemachines/pw0_rrm0}


\MACHINE{Machine  pw0}
\VARIABLES
	\begin{description}
		\Item{ ENVIRONMENT }
		\Item{ CONTROLLING }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typeof\_ENVIRONMENT }{ ENVIRONMENT \in  BOOL }
		\nItemX{ typeof\_CONTROLLING }{ CONTROLLING \in  BOOL }
		\nItemX{ distinct\_states\_in\_rrm01 }{ partition(\{ TRUE\} , \{ ENVIRONMENT\}  \binter  \{ TRUE\} , \{ CONTROLLING\}  \binter  \{ TRUE\} ) }
	\end{description}
\EVENTS
	\INITIALISATION
		\begin{description}
		\BeginAct
			\begin{description}
			\nItemX{ init\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ init\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Controller}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_CONTROLLING }{ CONTROLLING = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {PE}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_ENVIRONMENT }{ ENVIRONMENT = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_CONTROLLING }{ CONTROLLING :=  TRUE }
			\nItemX{ leave\_ENVIRONMENT }{ ENVIRONMENT :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{description}
\BTitle{Machine  pw1}{13 Dec 2011}{11:10:19 PM}

\includegraphics[width=0.4\textwidth]{statemachines/pw1_rrm0}

\MACHINE{pw1}
\REFINES{pw0}
\VARIABLES
	\begin{description}
		\Item{ ENVIRONMENT }
		\Item{ CONTROLLING }
		\Item{ VALIDATED }
		\Item{ PRIORITIZED }
		\Item{ sel\_comm }
		\bcmt{ Comment }
		\Item{ up\_out }
		\bcmt{ Comment }
		\Item{ down\_out }
		\bcmt{ Comment }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typeof\_VALIDATED }{ VALIDATED \in  BOOL }
		\nItemX{ typeof\_PRIORITIZED }{ PRIORITIZED \in  BOOL }
		\nItemX{ distinct\_states\_in\_rrm01 }{ (CONTROLLING = TRUE) \limp  partition(\{ TRUE\} , \{ VALIDATED\}  \binter  \{ TRUE\} , \{ PRIORITIZED\}  \binter  \{ TRUE\} ) }
		\nItemX{ VALIDATED\_substateof\_CONTROLLING }{ (VALIDATED = TRUE) \limp  (CONTROLLING = TRUE) }
		\nItemX{ PRIORITIZED\_substateof\_CONTROLLING }{ (PRIORITIZED = TRUE) \limp  (CONTROLLING = TRUE) }
		\nItemX{ sel\_comm\_type }{ sel\_comm \in  - 1\upto 1 }
		\cmt{ Comment }
		\nItemX{ up\_out\_type }{ up\_out \in  0\upto 1 }
		\cmt{ Comment }
		\nItemX{ down\_out\_type }{ down\_out \in  0\upto 1 }
		\cmt{ Comment }
	\end{description}
\EVENTS
	\INITIALISATION
		\\\textit{extended}
		\begin{description}
		\BeginAct
			\begin{description}
			\nItem{ init\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ init\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ init\_up\_out }{ up\_out :=  0 }
			\nItemX{ init\_down\_out }{ down\_out :=  0 }
			\nItemX{ init\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ init\_sel\_comm }{ sel\_comm :=  0 }
			\nItemX{ init\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {PE}
	\EXTD {PE}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_ENVIRONMENT }{ ENVIRONMENT = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_CONTROLLING }{ CONTROLLING :=  TRUE }
			\nItem{ leave\_ENVIRONMENT }{ ENVIRONMENT :=  FALSE }
			\nItemX{ enter\_VALIDATED }{ VALIDATED :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Ex\_Comm}
	\REF {Controller}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ dwn }
			\bcmt{ Comment }
			\ItemX{ up }
			\bcmt{ Comment }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ dwn\_type }{ dwn \in  0\upto 1 }
			\cmt{ Comment }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ up\_type }{ up \in  0\upto 1 }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ up\_out\_set }{ up\_out :=  up }
			\cmt{ Comment }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ down\_out\_set }{ down\_out :=  dwn }
			\cmt{ Comment }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {SelCommand}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ cc }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ isin\_VALIDATED }{ VALIDATED = TRUE }
			\nItemX{ cc\_type }{ cc \in  - 1\upto 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItemX{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\nItemX{ sel\_comm\_set }{ sel\_comm :=  cc }
			\cmt{ Comment }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{description}
\BTitle{Machine  pw2}{13 Dec 2011}{11:10:22 PM}

\includegraphics[width=0.8\textwidth]{statemachines/pw2_rrm0}

\MACHINE{pw2}
\REFINES{pw1}
\VARIABLES
	\begin{description}
		\Item{ ENVIRONMENT }
		\Item{ CONTROLLING }
		\Item{ VALIDATED }
		\Item{ VALIDATEDNOTCOMPLETE }
		\Item{ VALIDATEDCOMPLETE }
		\Item{ PRIORITIZED }
		\Item{ sel\_comm }
		\bcmt{ Comment }
		\Item{ up\_out }
		\bcmt{ Comment }
		\Item{ down\_out }
		\bcmt{ Comment }
		\Item{ v\_dri }
		\Item{ v\_pass }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typeof\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE \in  BOOL }
		\nItemX{ typeof\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE \in  BOOL }
		\nItemX{ distinct\_states\_in\_rrm01 }{ (VALIDATED = TRUE) \limp  partition(\{ TRUE\} , \{ VALIDATEDNOTCOMPLETE\}  \binter  \{ TRUE\} , \{ VALIDATEDCOMPLETE\}  \binter  \{ TRUE\} ) }
		\nItemX{ VALIDATEDNOTCOMPLETE\_substateof\_VALIDATED }{ (VALIDATEDNOTCOMPLETE = TRUE) \limp  (VALIDATED = TRUE) }
		\nItemX{ VALIDATEDCOMPLETE\_substateof\_VALIDATED }{ (VALIDATEDCOMPLETE = TRUE) \limp  (VALIDATED = TRUE) }
		\nItemX{ v\_driátype }{ v\_dri \in  0\upto 1 }
		\nItemX{ v\_passátype }{ v\_pass \in  0\upto 1 }
	\end{description}
\EVENTS
	\INITIALISATION
		\\\textit{extended}
		\begin{description}
		\BeginAct
			\begin{description}
			\nItem{ init\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ init\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ init\_up\_out }{ up\_out :=  0 }
			\nItem{ init\_down\_out }{ down\_out :=  0 }
			\nItem{ init\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ init\_sel\_comm }{ sel\_comm :=  0 }
			\nItem{ init\_VALIDATED }{ VALIDATED :=  FALSE }
			\nItemX{ init\_v\_dri }{ v\_dri :=  0 }
			\nItemX{ init\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItemX{ init\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItemX{ init\_v\_pass }{ v\_pass :=  0 }
			\end{description}
		\EndAct
		\end{description}
	\EVT {PE}
	\EXTD {PE}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_ENVIRONMENT }{ ENVIRONMENT = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_CONTROLLING }{ CONTROLLING :=  TRUE }
			\nItem{ leave\_ENVIRONMENT }{ ENVIRONMENT :=  FALSE }
			\nItem{ enter\_VALIDATED }{ VALIDATED :=  TRUE }
			\nItemX{ enter\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Ex\_Comm}
	\EXTD {Ex\_Comm}
		\begin{description}
		\AnyPrm
			\begin{description}
			\Item{ dwn }
			\bcmt{ Comment }
			\Item{ up }
			\bcmt{ Comment }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItem{ dwn\_type }{ dwn \in  0\upto 1 }
			\cmt{ Comment }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ up\_type }{ up \in  0\upto 1 }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  up }
			\cmt{ Comment }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  dwn }
			\cmt{ Comment }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {ValidateCom}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ pp }
			\ItemX{ dd }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ isin\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE = TRUE }
			\nItemX{ ppType }{ pp \in  0\upto 1 }
			\nItemX{ ddType }{ dd \in  0\upto 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  TRUE }
			\nItemX{ set\_v\_dri }{ v\_dri :=  dd }
			\nItemX{ leave\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItemX{ set\_v\_pass }{ v\_pass :=  pp }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectPass}
	\REF {SelCommand}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ v\_dri\_notactive }{ v\_dri = 0 }
			\nItemX{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ cc }{ cc=v\_pass }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItemX{ sel\_comm\_set }{ sel\_comm :=  v\_pass }
			\cmt{ Comment }
			\nItemX{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItemX{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectDri}
	\REF {SelCommand}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\nItemX{ v\_dri\_active }{ v\_dri \neq  0 }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ cc }{ cc=v\_dri }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItemX{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItemX{ sel\_comm\_set }{ sel\_comm :=  v\_dri }
			\cmt{ Comment }
			\nItemX{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{description}
\BTitle{Machine pw3}{13 Dec 2011}{11:10:26 PM}

\includegraphics[width=1.0\textwidth]{statemachines/pw3_rrm0}

\includegraphics[width=0.5\textwidth]{statemachines/pw3_ex_comm_sm}

\MACHINE{pw3}
\REFINES{pw2}
\SEES{cx3}
\VARIABLES
	\begin{description}
		\Item{ ENVIRONMENT }
		\Item{ CONTROLLING }
		\Item{ VALIDATED }
		\Item{ VALIDATEDNOTCOMPLETE }
		\Item{ ENDSTOPNOTCOMPLETE }
		\Item{ ENDSTOPCOMPLETE }
		\Item{ VALIDATEDCOMPLETE }
		\Item{ PRIORITIZED }
		\Item{ OBSMODE }
		\Item{ NORMALMODE }
		\Item{ sel\_comm }
		\bcmt{ Comment }
		\Item{ up\_out }
		\bcmt{ Comment }
		\Item{ down\_out }
		\bcmt{ Comment }
		\Item{ v\_dri }
		\Item{ v\_pass }
		\Item{ obs }
		\Item{ timer\_o }
		\Item{ endstop }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typeof\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE \in  BOOL }
		\nItemX{ typeof\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE \in  BOOL }
		\nItemX{ distinct\_states\_in\_rrm01 }{ (VALIDATEDNOTCOMPLETE = TRUE) \limp  partition(\{ TRUE\} , \{ ENDSTOPNOTCOMPLETE\}  \binter  \{ TRUE\} , \{ ENDSTOPCOMPLETE\}  \binter  \{ TRUE\} ) }
		\nItemX{ ENDSTOPNOTCOMPLETE\_substateof\_VALIDATEDNOTCOMPLETE }{ (ENDSTOPNOTCOMPLETE = TRUE) \limp  (VALIDATEDNOTCOMPLETE = TRUE) }
		\nItemX{ ENDSTOPCOMPLETE\_substateof\_VALIDATEDNOTCOMPLETE }{ (ENDSTOPCOMPLETE = TRUE) \limp  (VALIDATEDNOTCOMPLETE = TRUE) }
		\nItemX{ typeof\_OBSMODE }{ OBSMODE \in  BOOL }
		\nItemX{ typeof\_NORMALMODE }{ NORMALMODE \in  BOOL }
		\nItemX{ distinct\_states\_in\_ex\_comm\_sm1 }{ partition(\{ TRUE\} , \{ OBSMODE\}  \binter  \{ TRUE\} , \{ NORMALMODE\}  \binter  \{ TRUE\} ) }
		\nItemX{ obs\_down\_inv }{ (OBSMODE = TRUE) \limp  (down\_out = 1) }
		\nItemX{ obsModeTimerInv }{ (OBSMODE = TRUE) \limp  (timer\_o <  time\_out) }
		\nItemX{ obsátype }{ obs \in  BOOL }
		\nItemX{ timer\_o.type }{ timer\_o \in  \nat  }
		\nItemX{ endstop.type }{ endstop \in  BOOL }
	\end{description}
\EVENTS
	\INITIALISATION
		\\\textit{extended}
		\begin{description}
		\BeginAct
			\begin{description}
			\nItem{ init\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ init\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ init\_up\_out }{ up\_out :=  0 }
			\nItem{ init\_down\_out }{ down\_out :=  0 }
			\nItem{ init\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ init\_sel\_comm }{ sel\_comm :=  0 }
			\nItem{ init\_VALIDATED }{ VALIDATED :=  FALSE }
			\nItem{ init\_v\_dri }{ v\_dri :=  0 }
			\nItem{ init\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ init\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItem{ init\_v\_pass }{ v\_pass :=  0 }
			\nItemX{ init\_OBSMODE }{ OBSMODE :=  FALSE }
			\nItemX{ init\_endstop }{ endstop :=  FALSE }
			\nItemX{ init\_NORMALMODE }{ NORMALMODE :=  TRUE }
			\nItemX{ init\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  FALSE }
			\nItemX{ init\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  FALSE }
			\nItemX{ init\_obs }{ obs :=  FALSE }
			\nItemX{ init\_timer\_o }{ timer\_o :=  0 }
			\end{description}
		\EndAct
		\end{description}
	\EVT {PE}
	\EXTD {PE}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_ENVIRONMENT }{ ENVIRONMENT = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_CONTROLLING }{ CONTROLLING :=  TRUE }
			\nItem{ leave\_ENVIRONMENT }{ ENVIRONMENT :=  FALSE }
			\nItem{ enter\_VALIDATED }{ VALIDATED :=  TRUE }
			\nItem{ enter\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  TRUE }
			\nItemX{ set\_obs }{ obs :\in  BOOL }
			\cmt{ Comment }
			\nItemX{ enter\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {ValidateCom}
	\EXTD {ValidateCom}
		\begin{description}
		\AnyPrm
			\begin{description}
			\Item{ pp }
			\Item{ dd }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItem{ isin\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE = TRUE }
			\nItem{ ppType }{ pp \in  0\upto 1 }
			\nItem{ ddType }{ dd \in  0\upto 1 }
			\nItemX{ isin\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  TRUE }
			\nItem{ set\_v\_dri }{ v\_dri :=  dd }
			\nItem{ leave\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItem{ set\_v\_pass }{ v\_pass :=  pp }
			\nItemX{ leave\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectPass}
	\EXTD {selectPass}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ v\_dri\_notactive }{ v\_dri = 0 }
			\nItem{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItem{ sel\_comm\_set }{ sel\_comm :=  v\_pass }
			\cmt{ Comment }
			\nItem{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectDri}
	\EXTD {selectDri}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\nItem{ v\_dri\_active }{ v\_dri \neq  0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItem{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ sel\_comm\_set }{ sel\_comm :=  v\_dri }
			\cmt{ Comment }
			\nItem{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {no\_obs}
	\REF {Ex\_Comm}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ dwn }
			\bcmt{ Comment }
			\ItemX{ up }
			\bcmt{ Comment }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ noObstacle }{ obs = FALSE }
			\cmt{ Comment }
			\nItemX{ up\_type }{ up \in  0\upto 1 }
			\cmt{ Comment }
			\nItemX{ dwn\_type }{ dwn \in  0\upto 1 }
			\cmt{ Comment }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ up\_out\_set }{ up\_out :=  up }
			\cmt{ Comment }
			\nItemX{ down\_out\_set }{ down\_out :=  dwn }
			\cmt{ Comment }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_on}
	\REF {Ex\_Comm}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ noTimeout }{ timer\_o+step <  time\_out }
			\cmt{ user entered }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ noEndstop }{ endstop = FALSE }
			\cmt{ user entered }
			\nItemX{ isin\_OBSMODE }{ OBSMODE = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\cmt{ user entered }
			\nItem{ dwn }{ dwn = 1 }
			\cmt{ user entered }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ incTimer\_o }{ timer\_o :=  timer\_o + step }
			\cmt{ user entered }
			\nItemX{ notUp }{ up\_out :=  0 }
			\cmt{ user entered }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ goDown }{ down\_out :=  1 }
			\cmt{ user entered }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_detect}
	\REF {Ex\_Comm}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ obstaclePresent }{ obs = TRUE }
			\cmt{ Comment }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\cmt{ Comment }
			\nItem{ dwn }{ dwn = 1 }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ leave\_NORMALMODE }{ NORMALMODE :=  FALSE }
			\nItemX{ resetTimer\_o }{ timer\_o :=  0 }
			\cmt{ Comment }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ notUp }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ goDown }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ enter\_OBSMODE }{ OBSMODE :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_over}
	\REF {Ex\_Comm}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_OBSMODE }{ OBSMODE = TRUE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ timeoutORendstop }{ timer\_o+step \geq  time\_out \lor  endstop = TRUE }
			\cmt{ Comment }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\cmt{ Comment }
			\nItem{ dwn }{ dwn = 0 }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ leave\_OBSMODE }{ OBSMODE :=  FALSE }
			\nItemX{ enter\_NORMALMODE }{ NORMALMODE :=  TRUE }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ notUp }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ notDown }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {getEStop}
		\begin{description}
		\AnyPrm
			\begin{description}
			\ItemX{ es }
			\bcmt{ Comment }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItemX{ esátype }{ es \in  BOOL }
			\cmt{ Comment }
			\nItemX{ isin\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ set\_endstop }{ endstop :=  es }
			\cmt{ Comment }
			\nItemX{ enter\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  TRUE }
			\nItemX{ leave\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{description}
\BTitle{Context cx3}{13 Dec 2011}{11:10:09 PM}
\CONTEXT{cx3}
\CONSTANTS
	\begin{description}
		\Item{ time\_out }
		\Item{ step }
	\end{description}
\AXIOMS
	\begin{description}
		\nItemX{ time\_outátype }{ time\_out \in  \nat_1  }
		\nItemX{ stepátype }{ step \in  \nat_1  }
	\end{description}
\END
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{description}
\BTitle{Machine  pw4}{13 Dec 2011}{11:10:29 PM}

\includegraphics[width=1.0\textwidth]{statemachines/pw4_ex_comm_sm}

\MACHINE{pw4}
\REFINES{pw3}
\SEES{cx3}
\VARIABLES
	\begin{description}
		\Item{ NORMALMODE }
		\Item{ Neutral }
		\Item{ Going\_Up }
		\Item{ Going\_Down }
		\Item{ OBSMODE }
		\Item{ ENVIRONMENT }
		\Item{ CONTROLLING }
		\Item{ VALIDATED }
		\Item{ VALIDATEDNOTCOMPLETE }
		\Item{ ENDSTOPNOTCOMPLETE }
		\Item{ ENDSTOPCOMPLETE }
		\Item{ VALIDATEDCOMPLETE }
		\Item{ PRIORITIZED }
		\Item{ sel\_comm }
		\bcmt{ Comment }
		\Item{ up\_out }
		\bcmt{ Comment }
		\Item{ down\_out }
		\bcmt{ Comment }
		\Item{ v\_dri }
		\Item{ v\_pass }
		\Item{ obs }
		\Item{ timer\_o }
		\Item{ endstop }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typeof\_Neutral }{ Neutral \in  BOOL }
		\nItemX{ typeof\_Going\_Up }{ Going\_Up \in  BOOL }
		\nItemX{ typeof\_Going\_Down }{ Going\_Down \in  BOOL }
		\nItemX{ distinct\_states\_in\_ex\_comm\_sm1 }{ (NORMALMODE = TRUE) \limp  partition(\{ TRUE\} , \{ Neutral\}  \binter  \{ TRUE\} , \{ Going\_Up\}  \binter  \{ TRUE\} , \{ Going\_Down\}  \binter  \{ TRUE\} ) }
		\nItemX{ Neutral\_substateof\_NORMALMODE }{ (Neutral = TRUE) \limp  (NORMALMODE = TRUE) }
		\nItemX{ Going\_Up\_substateof\_NORMALMODE }{ (Going\_Up = TRUE) \limp  (NORMALMODE = TRUE) }
		\nItemX{ Going\_Down\_substateof\_NORMALMODE }{ (Going\_Down = TRUE) \limp  (NORMALMODE = TRUE) }
		\nItemX{ NeutralInv }{ (Neutral = TRUE) \limp  (up\_out = 0 \land  down\_out = 0) }
		\nItemX{ UpInv }{ (Going\_Up = TRUE) \limp  (up\_out = 1 \land  down\_out = 0) }
		\nItemX{ DownInv }{ (Going\_Down = TRUE) \limp  (up\_out = 0 \land  down\_out = 1) }
	\end{description}
\EVENTS
	\INITIALISATION
		\\\textit{extended}
		\begin{description}
		\BeginAct
			\begin{description}
			\nItem{ init\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ init\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ init\_up\_out }{ up\_out :=  0 }
			\nItem{ init\_down\_out }{ down\_out :=  0 }
			\nItem{ init\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ init\_sel\_comm }{ sel\_comm :=  0 }
			\nItem{ init\_VALIDATED }{ VALIDATED :=  FALSE }
			\nItem{ init\_v\_dri }{ v\_dri :=  0 }
			\nItem{ init\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ init\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItem{ init\_v\_pass }{ v\_pass :=  0 }
			\nItem{ init\_OBSMODE }{ OBSMODE :=  FALSE }
			\nItem{ init\_endstop }{ endstop :=  FALSE }
			\nItem{ init\_NORMALMODE }{ NORMALMODE :=  TRUE }
			\nItem{ init\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  FALSE }
			\nItem{ init\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  FALSE }
			\nItem{ init\_obs }{ obs :=  FALSE }
			\nItem{ init\_timer\_o }{ timer\_o :=  0 }
			\nItemX{ init\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItemX{ init\_Neutral }{ Neutral :=  TRUE }
			\nItemX{ init\_Going\_Up }{ Going\_Up :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {PE}
	\EXTD {PE}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_ENVIRONMENT }{ ENVIRONMENT = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_CONTROLLING }{ CONTROLLING :=  TRUE }
			\nItem{ leave\_ENVIRONMENT }{ ENVIRONMENT :=  FALSE }
			\nItem{ enter\_VALIDATED }{ VALIDATED :=  TRUE }
			\nItem{ enter\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  TRUE }
			\nItem{ set\_obs }{ obs :\in  BOOL }
			\cmt{ Comment }
			\nItem{ enter\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {ValidateCom}
	\EXTD {ValidateCom}
		\begin{description}
		\AnyPrm
			\begin{description}
			\Item{ pp }
			\Item{ dd }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItem{ isin\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE = TRUE }
			\nItem{ ppType }{ pp \in  0\upto 1 }
			\nItem{ ddType }{ dd \in  0\upto 1 }
			\nItem{ isin\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  TRUE }
			\nItem{ set\_v\_dri }{ v\_dri :=  dd }
			\nItem{ leave\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItem{ set\_v\_pass }{ v\_pass :=  pp }
			\nItem{ leave\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectPass}
	\EXTD {selectPass}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ v\_dri\_notactive }{ v\_dri = 0 }
			\nItem{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItem{ sel\_comm\_set }{ sel\_comm :=  v\_pass }
			\cmt{ Comment }
			\nItem{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectDri}
	\EXTD {selectDri}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\nItem{ v\_dri\_active }{ v\_dri \neq  0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItem{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ sel\_comm\_set }{ sel\_comm :=  v\_dri }
			\cmt{ Comment }
			\nItem{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_on}
	\EXTD {obs\_on}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ noTimeout }{ timer\_o+step <  time\_out }
			\cmt{ user entered }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ noEndstop }{ endstop = FALSE }
			\cmt{ user entered }
			\nItem{ isin\_OBSMODE }{ OBSMODE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ incTimer\_o }{ timer\_o :=  timer\_o + step }
			\cmt{ user entered }
			\nItem{ notUp }{ up\_out :=  0 }
			\cmt{ user entered }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ goDown }{ down\_out :=  1 }
			\cmt{ user entered }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_detect}
	\EXTD {obs\_detect}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ obstaclePresent }{ obs = TRUE }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_NORMALMODE }{ NORMALMODE :=  FALSE }
			\nItem{ resetTimer\_o }{ timer\_o :=  0 }
			\cmt{ Comment }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ notUp }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ goDown }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_OBSMODE }{ OBSMODE :=  TRUE }
			\nItemX{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItemX{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItemX{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_over}
	\EXTD {obs\_over}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_OBSMODE }{ OBSMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ timeoutORendstop }{ timer\_o+step \geq  time\_out \lor  endstop = TRUE }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_OBSMODE }{ OBSMODE :=  FALSE }
			\nItem{ enter\_NORMALMODE }{ NORMALMODE :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ notUp }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ notDown }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ enter\_Neutral }{ Neutral :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {getEStop}
	\EXTD {getEStop}
		\begin{description}
		\AnyPrm
			\begin{description}
			\Item{ es }
			\bcmt{ Comment }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItem{ esátype }{ es \in  BOOL }
			\cmt{ Comment }
			\nItem{ isin\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ set\_endstop }{ endstop :=  es }
			\cmt{ Comment }
			\nItem{ enter\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  TRUE }
			\nItem{ leave\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_UpNeutral2}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ grd1 }{ endstop = FALSE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItemX{ grd2 }{ obs = FALSE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 1 }
			\nItem{ dwn }{ dwn = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToUp}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ grd3 }{ sel\_comm = 1 }
			\nItemX{ grd1 }{ endstop = FALSE }
			\nItemX{ grd2 }{ obs = FALSE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 1 }
			\nItem{ dwn }{ dwn = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ enter\_Going\_Up }{ Going\_Up :=  TRUE }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItemX{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToDown}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ grd3 }{ sel\_comm = - 1 }
			\nItemX{ grd1 }{ endstop = FALSE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd2 }{ obs = FALSE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\nItem{ dwn }{ dwn = 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItemX{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ enter\_Going\_Down }{ Going\_Down :=  TRUE }
			\nItemX{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_DownNeutral2}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItemX{ grd2 }{ obs = FALSE }
			\nItemX{ grd1 }{ endstop = FALSE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\nItem{ dwn }{ dwn = 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_NeutralNeutral}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ noObstacle }{ obs = FALSE }
			\cmt{ Comment }
			\nItemX{ grd1 }{ sel\_comm = 0 }
			\nItemX{ isin\_Neutral }{ Neutral = TRUE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\nItem{ dwn }{ dwn = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_UpNeutral1}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd2 }{ endstop = FALSE }
			\nItemX{ grd1 }{ obs = FALSE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 0 }
			\nItemX{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\nItem{ dwn }{ dwn = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ enter\_Neutral }{ Neutral :=  TRUE }
			\nItemX{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_EndStop}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ grd2 }{ endstop = TRUE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd1 }{ obs = FALSE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\nItem{ dwn }{ dwn = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ enter\_Neutral }{ Neutral :=  TRUE }
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_DownNeutral1}
	\REF {no\_obs}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItemX{ grd1 }{ obs = FALSE }
			\nItemX{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 0 }
			\nItemX{ grd2 }{ endstop = FALSE }
			\nItemX{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\end{description}
		\Witnesses
			\begin{description}
			\nItem{ up }{ up = 0 }
			\nItem{ dwn }{ dwn = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItemX{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ enter\_Neutral }{ Neutral :=  TRUE }
			\nItemX{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItemX{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItemX{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{description}
\BTitle{Context cx4}{13 Dec 2011}{11:10:14 PM}
\CONTEXT{cx4}
\EXTENDS{cx3}
\CONSTANTS
	\begin{description}
		\Item{ Timeout\_dn }
		\Item{ Timeout\_up }
	\end{description}
\AXIOMS
	\begin{description}
		\nItemX{ Timeout\_dn\_axiom }{ Timeout\_dn \in  \nat_1  }
		\nItemX{ Timeout\_up\_axiom }{ Timeout\_up \in  \nat_1 }
	\end{description}
\END
\end{description}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{description}
\BTitle{Machine pw5}{13 Dec 2011}{11:10:32 PM}

\includegraphics[width=1.2\textwidth]{statemachines/pw5_ex_comm_sm}

\MACHINE{pw5}
\REFINES{pw4}
\SEES{cx4}
\VARIABLES
	\begin{description}
		\Item{ NORMALMODE }
		\Item{ Neutral }
		\Item{ Going\_Up }
		\Item{ Up\_Entry }
		\Item{ Up\_Auto }
		\Item{ Up\_Stepwise }
		\Item{ Going\_Down }
		\Item{ Dn\_Entry }
		\Item{ Dn\_Auto }
		\Item{ Dn\_Stepwise }
		\Item{ OBSMODE }
		\Item{ ENVIRONMENT }
		\Item{ CONTROLLING }
		\Item{ VALIDATED }
		\Item{ VALIDATEDNOTCOMPLETE }
		\Item{ ENDSTOPNOTCOMPLETE }
		\Item{ ENDSTOPCOMPLETE }
		\Item{ VALIDATEDCOMPLETE }
		\Item{ PRIORITIZED }
		\Item{ sel\_comm }
		\bcmt{ Comment }
		\Item{ up\_out }
		\bcmt{ Comment }
		\Item{ down\_out }
		\bcmt{ Comment }
		\Item{ v\_dri }
		\Item{ v\_pass }
		\Item{ obs }
		\Item{ timer\_o }
		\Item{ endstop }
		\Item{ timer\_auto\_dn }
		\Item{ timer\_auto\_up }
	\end{description}
\INVARIANTS
	\begin{description}
		\nItemX{ typeof\_Up\_Entry }{ Up\_Entry \in  BOOL }
		\nItemX{ typeof\_Up\_Auto }{ Up\_Auto \in  BOOL }
		\nItemX{ typeof\_Up\_Stepwise }{ Up\_Stepwise \in  BOOL }
		\nItemX{ typeof\_Dn\_Entry }{ Dn\_Entry \in  BOOL }
		\nItemX{ typeof\_Dn\_Auto }{ Dn\_Auto \in  BOOL }
		\nItemX{ typeof\_Dn\_Stepwise }{ Dn\_Stepwise \in  BOOL }
		\nItemX{ distinct\_states\_in\_ex\_comm\_sm1 }{ (Going\_Up = TRUE) \limp  partition(\{ TRUE\} , \{ Up\_Entry\}  \binter  \{ TRUE\} , \{ Up\_Auto\}  \binter  \{ TRUE\} , \{ Up\_Stepwise\}  \binter  \{ TRUE\} ) }
		\nItemX{ distinct\_states\_in\_ex\_comm\_sm2 }{ (Going\_Down = TRUE) \limp  partition(\{ TRUE\} , \{ Dn\_Entry\}  \binter  \{ TRUE\} , \{ Dn\_Auto\}  \binter  \{ TRUE\} , \{ Dn\_Stepwise\}  \binter  \{ TRUE\} ) }
		\nItemX{ Up\_Entry\_substateof\_Going\_Up }{ (Up\_Entry = TRUE) \limp  (Going\_Up = TRUE) }
		\nItemX{ Up\_Auto\_substateof\_Going\_Up }{ (Up\_Auto = TRUE) \limp  (Going\_Up = TRUE) }
		\nItemX{ Up\_Stepwise\_substateof\_Going\_Up }{ (Up\_Stepwise = TRUE) \limp  (Going\_Up = TRUE) }
		\nItemX{ Dn\_Entry\_substateof\_Going\_Down }{ (Dn\_Entry = TRUE) \limp  (Going\_Down = TRUE) }
		\nItemX{ Dn\_Auto\_substateof\_Going\_Down }{ (Dn\_Auto = TRUE) \limp  (Going\_Down = TRUE) }
		\nItemX{ Dn\_Stepwise\_substateof\_Going\_Down }{ (Dn\_Stepwise = TRUE) \limp  (Going\_Down = TRUE) }
		\nItemX{ inv1 }{ timer\_auto\_dn \in  \nat  }
		\nItemX{ inv2 }{ timer\_auto\_up \in  \nat  }
	\end{description}
\EVENTS
	\INITIALISATION
		\\\textit{extended}
		\begin{description}
		\BeginAct
			\begin{description}
			\nItem{ init\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ init\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ init\_up\_out }{ up\_out :=  0 }
			\nItem{ init\_down\_out }{ down\_out :=  0 }
			\nItem{ init\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ init\_sel\_comm }{ sel\_comm :=  0 }
			\nItem{ init\_VALIDATED }{ VALIDATED :=  FALSE }
			\nItem{ init\_v\_dri }{ v\_dri :=  0 }
			\nItem{ init\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ init\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItem{ init\_v\_pass }{ v\_pass :=  0 }
			\nItem{ init\_OBSMODE }{ OBSMODE :=  FALSE }
			\nItem{ init\_endstop }{ endstop :=  FALSE }
			\nItem{ init\_NORMALMODE }{ NORMALMODE :=  TRUE }
			\nItem{ init\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  FALSE }
			\nItem{ init\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  FALSE }
			\nItem{ init\_obs }{ obs :=  FALSE }
			\nItem{ init\_timer\_o }{ timer\_o :=  0 }
			\nItem{ init\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItem{ init\_Neutral }{ Neutral :=  TRUE }
			\nItem{ init\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItemX{ init\_Up\_Stepwise }{ Up\_Stepwise :=  FALSE }
			\nItemX{ init\_Dn\_Auto }{ Dn\_Auto :=  FALSE }
			\nItemX{ init\_Up\_Entry }{ Up\_Entry :=  FALSE }
			\nItemX{ act2 }{ timer\_auto\_up :=  0 }
			\nItemX{ init\_Dn\_Entry }{ Dn\_Entry :=  FALSE }
			\nItemX{ init\_Dn\_Stepwise }{ Dn\_Stepwise :=  FALSE }
			\nItemX{ act1 }{ timer\_auto\_dn :=  0 }
			\nItemX{ init\_Up\_Auto }{ Up\_Auto :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {PE}
	\EXTD {PE}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_ENVIRONMENT }{ ENVIRONMENT = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_CONTROLLING }{ CONTROLLING :=  TRUE }
			\nItem{ leave\_ENVIRONMENT }{ ENVIRONMENT :=  FALSE }
			\nItem{ enter\_VALIDATED }{ VALIDATED :=  TRUE }
			\nItem{ enter\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  TRUE }
			\nItem{ set\_obs }{ obs :\in  BOOL }
			\cmt{ Comment }
			\nItem{ enter\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {ValidateCom}
	\EXTD {ValidateCom}
		\begin{description}
		\AnyPrm
			\begin{description}
			\Item{ pp }
			\Item{ dd }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItem{ isin\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE = TRUE }
			\nItem{ ppType }{ pp \in  0\upto 1 }
			\nItem{ ddType }{ dd \in  0\upto 1 }
			\nItem{ isin\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  TRUE }
			\nItem{ set\_v\_dri }{ v\_dri :=  dd }
			\nItem{ leave\_VALIDATEDNOTCOMPLETE }{ VALIDATEDNOTCOMPLETE :=  FALSE }
			\nItem{ set\_v\_pass }{ v\_pass :=  pp }
			\nItem{ leave\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectPass}
	\EXTD {selectPass}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ v\_dri\_notactive }{ v\_dri = 0 }
			\nItem{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItem{ sel\_comm\_set }{ sel\_comm :=  v\_pass }
			\cmt{ Comment }
			\nItem{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {selectDri}
	\EXTD {selectDri}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE = TRUE }
			\nItem{ v\_dri\_active }{ v\_dri \neq  0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_PRIORITIZED }{ PRIORITIZED :=  TRUE }
			\nItem{ leave\_VALIDATEDCOMPLETE }{ VALIDATEDCOMPLETE :=  FALSE }
			\nItem{ sel\_comm\_set }{ sel\_comm :=  v\_dri }
			\cmt{ Comment }
			\nItem{ leave\_VALIDATED }{ VALIDATED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_on}
	\EXTD {obs\_on}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ noTimeout }{ timer\_o+step <  time\_out }
			\cmt{ user entered }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ noEndstop }{ endstop = FALSE }
			\cmt{ user entered }
			\nItem{ isin\_OBSMODE }{ OBSMODE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ incTimer\_o }{ timer\_o :=  timer\_o + step }
			\cmt{ user entered }
			\nItem{ notUp }{ up\_out :=  0 }
			\cmt{ user entered }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ goDown }{ down\_out :=  1 }
			\cmt{ user entered }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_detect}
	\EXTD {obs\_detect}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ obstaclePresent }{ obs = TRUE }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_NORMALMODE }{ NORMALMODE :=  FALSE }
			\nItem{ resetTimer\_o }{ timer\_o :=  0 }
			\cmt{ Comment }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ notUp }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ goDown }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_OBSMODE }{ OBSMODE :=  TRUE }
			\nItem{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItem{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItem{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItemX{ leave\_Up\_Entry }{ Up\_Entry :=  FALSE }
			\nItemX{ leave\_Up\_Auto }{ Up\_Auto :=  FALSE }
			\nItemX{ leave\_Dn\_Auto }{ Dn\_Auto :=  FALSE }
			\nItemX{ leave\_Dn\_Entry }{ Dn\_Entry :=  FALSE }
			\nItemX{ leave\_Up\_Stepwise }{ Up\_Stepwise :=  FALSE }
			\nItemX{ leave\_Dn\_Stepwise }{ Dn\_Stepwise :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {obs\_over}
	\EXTD {obs\_over}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_OBSMODE }{ OBSMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ timeoutORendstop }{ timer\_o+step \geq  time\_out \lor  endstop = TRUE }
			\cmt{ Comment }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_OBSMODE }{ OBSMODE :=  FALSE }
			\nItem{ enter\_NORMALMODE }{ NORMALMODE :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ notUp }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ notDown }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_Neutral }{ Neutral :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {getEStop}
	\EXTD {getEStop}
		\begin{description}
		\AnyPrm
			\begin{description}
			\Item{ es }
			\bcmt{ Comment }
			\end{description}
		\WhereGrd
			\begin{description}
			\nItem{ esátype }{ es \in  BOOL }
			\cmt{ Comment }
			\nItem{ isin\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ set\_endstop }{ endstop :=  es }
			\cmt{ Comment }
			\nItem{ enter\_ENDSTOPCOMPLETE }{ ENDSTOPCOMPLETE :=  TRUE }
			\nItem{ leave\_ENDSTOPNOTCOMPLETE }{ ENDSTOPNOTCOMPLETE :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToUp}
	\EXTD {Normal\_ToUp}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd3 }{ sel\_comm = 1 }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_Neutral }{ Neutral = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ enter\_Going\_Up }{ Going\_Up :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItem{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItemX{ act1 }{ timer\_auto\_up :=  0 }
			\nItemX{ enter\_Up\_Entry }{ Up\_Entry :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToDown}
	\EXTD {Normal\_ToDown}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd3 }{ sel\_comm = - 1 }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_Neutral }{ Neutral = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_Going\_Down }{ Going\_Down :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ act7 }{ timer\_auto\_dn :=  0 }
			\nItemX{ enter\_Dn\_Entry }{ Dn\_Entry :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_NeutralNeutral}
	\EXTD {Normal\_NeutralNeutral}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ noObstacle }{ obs = FALSE }
			\cmt{ Comment }
			\nItem{ grd1 }{ sel\_comm = 0 }
			\nItem{ isin\_Neutral }{ Neutral = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_UpNeutral1}
	\EXTD {Normal\_UpNeutral1}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ grd2 }{ endstop = FALSE }
			\nItem{ grd1 }{ obs = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ grd3 }{ sel\_comm = 0 }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItemX{ isin\_Up\_Stepwise }{ Up\_Stepwise = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ enter\_Neutral }{ Neutral :=  TRUE }
			\nItem{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItemX{ leave\_Up\_Stepwise }{ Up\_Stepwise :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_EndStop}
	\EXTD {Normal\_EndStop}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ grd2 }{ endstop = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ grd1 }{ obs = FALSE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_Neutral }{ Neutral :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItemX{ leave\_Up\_Entry }{ Up\_Entry :=  FALSE }
			\nItemX{ leave\_Up\_Auto }{ Up\_Auto :=  FALSE }
			\nItemX{ leave\_Dn\_Stepwise }{ Dn\_Stepwise :=  FALSE }
			\nItemX{ leave\_Dn\_Auto }{ Dn\_Auto :=  FALSE }
			\nItemX{ leave\_Up\_Stepwise }{ Up\_Stepwise :=  FALSE }
			\nItemX{ leave\_Dn\_Entry }{ Dn\_Entry :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_DownNeutral1}
	\EXTD {Normal\_DownNeutral1}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ grd3 }{ sel\_comm = 0 }
			\nItem{ grd2 }{ endstop = FALSE }
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItemX{ isin\_Dn\_Stepwise }{ Dn\_Stepwise = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_Neutral }{ Neutral :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_Dn\_Stepwise }{ Dn\_Stepwise :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToDown\_LoopAtEntry}
	\EXTD {Normal\_DownNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Dn\_Entry }{ Dn\_Entry = TRUE }
			\nItemX{ grd4 }{ timer\_auto\_dn <  Timeout\_dn }
			\nItemX{ grd3 }{ sel\_comm = - 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ act1 }{ timer\_auto\_up :=  timer\_auto\_up + step }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToUp\_LoopAtEntry}
	\EXTD {Normal\_UpNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Up\_Entry }{ Up\_Entry = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 1 }
			\nItemX{ grd4 }{ timer\_auto\_up <  Timeout\_up }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ act1 }{ timer\_auto\_up :=  timer\_auto\_up + step }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_EntryToDownAuto}
	\EXTD {Normal\_DownNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Dn\_Entry }{ Dn\_Entry = TRUE }
			\nItemX{ grd4 }{ sel\_comm = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ enter\_Dn\_Auto }{ Dn\_Auto :=  TRUE }
			\nItemX{ leave\_Dn\_Entry }{ Dn\_Entry :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_EntryToUpAuto}
	\EXTD {Normal\_UpNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Up\_Entry }{ Up\_Entry = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ enter\_Up\_Auto }{ Up\_Auto :=  TRUE }
			\nItemX{ leave\_Up\_Entry }{ Up\_Entry :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_EntryToDownStepwise}
	\EXTD {Normal\_DownNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Dn\_Entry }{ Dn\_Entry = TRUE }
			\nItemX{ grd3 }{ timer\_auto\_dn \geq  Timeout\_dn }
			\nItemX{ grd4 }{ sel\_comm = - 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ enter\_Dn\_Stepwise }{ Dn\_Stepwise :=  TRUE }
			\nItemX{ leave\_Dn\_Entry }{ Dn\_Entry :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_EntryToUpStepwise}
	\EXTD {Normal\_UpNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd3 }{ timer\_auto\_up \geq  Timeout\_up }
			\nItemX{ grd4 }{ sel\_comm=1 }
			\nItemX{ isin\_Up\_Entry }{ Up\_Entry = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ leave\_Up\_Entry }{ Up\_Entry :=  FALSE }
			\nItemX{ enter\_Up\_Stepwise }{ Up\_Stepwise :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToDownContinue}
	\EXTD {Normal\_DownNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd3 }{ sel\_comm = - 1 }
			\nItemX{ isin\_Dn\_Auto }{ Dn\_Auto = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItemX{ enter\_Dn\_Stepwise }{ Dn\_Stepwise :=  TRUE }
			\nItemX{ leave\_Dn\_Auto }{ Dn\_Auto :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToUpContinue}
	\EXTD {Normal\_UpNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Up\_Auto }{ Up\_Auto = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItemX{ leave\_Up\_Auto }{ Up\_Auto :=  FALSE }
			\nItemX{ enter\_Up\_Stepwise }{ Up\_Stepwise :=  TRUE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToDownLoop}
	\EXTD {Normal\_DownNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 0 }
			\nItemX{ isin\_Dn\_Auto }{ Dn\_Auto = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToUpLoop}
	\EXTD {Normal\_UpNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Up\_Auto }{ Up\_Auto = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 0 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToDownStepwiseContinue}
	\EXTD {Normal\_DownNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ grd3 }{ sel\_comm = - 1 }
			\nItemX{ isin\_Dn\_Stepwise }{ Dn\_Stepwise = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\end{description}
		\EndAct
		\end{description}
	\EVT {Normal\_ToUpStepwiseContinue}
	\EXTD {Normal\_UpNeutral2}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItem{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItemX{ isin\_Up\_Stepwise }{ Up\_Stepwise = TRUE }
			\nItemX{ grd3 }{ sel\_comm = 1 }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\end{description}
		\EndAct
		\end{description}
	\EVT {UpToDown}
	\EXTD {Normal\_ToDown}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd3 }{ sel\_comm = - 1 }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_Going\_Up }{ Going\_Up = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ leave\_Going\_Up }{ Going\_Up :=  FALSE }
			\nItem{ down\_out\_set }{ down\_out :=  1 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ enter\_Going\_Down }{ Going\_Down :=  TRUE }
			\nItem{ up\_out\_set }{ up\_out :=  0 }
			\cmt{ Comment }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItemX{ leave\_Up\_Entry }{ Up\_Entry :=  FALSE }
			\nItemX{ leave\_Up\_Auto }{ Up\_Auto :=  FALSE }
			\nItemX{ leave\_Up\_Stepwise }{ Up\_Stepwise :=  FALSE }
			\nItemX{ enter\_Dn\_Entry }{ Dn\_Entry :=  TRUE }
			\nItemX{ act1 }{ timer\_auto\_dn :=  0 }
			\end{description}
		\EndAct
		\end{description}
	\EVT {DownToUp}
	\EXTD {Normal\_ToUp}
		\begin{description}
		\WhenGrd
			\begin{description}
			\nItem{ grd3 }{ sel\_comm = 1 }
			\nItem{ grd1 }{ endstop = FALSE }
			\nItem{ grd2 }{ obs = FALSE }
			\nItem{ isin\_PRIORITIZED }{ PRIORITIZED = TRUE }
			\nItem{ isin\_NORMALMODE }{ NORMALMODE = TRUE }
			\nItemX{ isin\_Going\_Down }{ Going\_Down = TRUE }
			\end{description}
		\ThenAct
			\begin{description}
			\nItem{ enter\_ENVIRONMENT }{ ENVIRONMENT :=  TRUE }
			\nItem{ enter\_Going\_Up }{ Going\_Up :=  TRUE }
			\nItem{ leave\_PRIORITIZED }{ PRIORITIZED :=  FALSE }
			\nItem{ down\_out\_set }{ down\_out :=  0 }
			\cmt{ Comment }
			\nItem{ up\_out\_set }{ up\_out :=  1 }
			\cmt{ Comment }
			\nItem{ leave\_CONTROLLING }{ CONTROLLING :=  FALSE }
			\nItem{ leave\_Neutral }{ Neutral :=  FALSE }
			\nItem{ leave\_Going\_Down }{ Going\_Down :=  FALSE }
			\nItemX{ leave\_Dn\_Entry }{ Dn\_Entry :=  FALSE }
			\nItemX{ leave\_Dn\_Stepwise }{ Dn\_Stepwise :=  FALSE }
			\nItemX{ leave\_Dn\_Auto }{ Dn\_Auto :=  FALSE }
			\nItemX{ enter\_Up\_Entry }{ Up\_Entry :=  TRUE }
			\nItemX{ act1 }{ timer\_auto\_up :=  0 }
			\end{description}
		\EndAct
		\end{description}
\END
\end{description}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\end{document}