Version 1.9 of this manual described version 1.9 of the sequencer and was written by Andy Kozubal, the original author of this software. This version of the manual describes version 2.0, for which the changes have been implemented by William Lupton of W. M. Keck Observatory and Greg White of Stanford Linear Accelerator Center (SLAC).
Version 2.0 differs from version 1.9 mainly in that sequencer run-time code can run under any operating system for which an EPICS OSI (Operating System Independent) layer is available, and message systems other than channel access can be used. It is dependent on libraries which will be generally available only with EPICS R3.14.
An interim version 1.9.4 was made available to the EPICS community; all new developments apart from major bug fixes will be based on version 2.0.
The state notation language (SNL) provides a simple yet powerful tool for programming sequential operations in a real-time control system. Based on the familiar state transition diagram concepts, programs can be written without the usual complexity involved with task scheduling, event handling, and input/output programming.
Programs produced by the state notation language are executed within the framework of the run-time sequencer. The sequencer drives the program to states based on events, and establishes interfaces to the program that enable it to perform real-time control in a multi-tasking environment. The sequencer also provides services to the program such as establishing connections to control system variables and handling asynchronous events.
The state notation language and sequencer are components of the Experimental Physics and Industrial Controls System (EPICS). EPICS is a system of interactive applications development tools (toolkit) and a common run-time environment (CORE) that allows users to build and execute real-time control and data acquisition systems for experimental facilities, such as particle accelerators, free electron lasers and telescopes. EPICS is a product of the Accelerator Automation and Controls Group (AOT-8), which is within the Accelerator Operations and Technology (AOT) Division at the Los Alamos National Laboratory. The sequencer interfaces to the underlying control system through a generic PV (process variable) API that supports, among other message systems, the channel access facility of EPICS.
This users manual describes how to use the state notation language to program real-time applications. The user is first introduced to the state notation language concepts through the state transition diagram. Through a series of examples, the user gains an understanding of most of the SNL language elements. Next, the manual explains procedures for compiling and executing programs that are generated by the SNL. Testing and debugging techniques are presented. Then, we present a complete description of the SNL syntax and the sequencer options. Finally, we describe the PV layer, give some examples of working sequences, and describe how to build, test and work with the sequencer installation.
This software was produced under U.S. Government contract at Los Alamos National Laboratory and at Argonne National Laboratory. The EPICS software is copyright by the Regents of the University of California and the University of Chicago. This document may be reproduced and distributed without restrictions, provided it is reproduced in its entirety, including the cover page.
New version 1.9 features have been moved to See Notes on v1.9 Release. This section gives brief notes on version 2.0 changes.
Version 2.0 of the sequencer and state notation compiler is available for EPICS release R3.14 and later. We have added several enhancements to the language and to the run-time sequencer. State programs must be compiled under the new state notation compiler to execute properly with the new sequencer. However, under most circumstances no source-level changes to existing programs are required.
These changes allow state programs to run unchanged on hosts and IOCs.
All VxWorks routines have been replaced with the appropriate OSI (Operating System Independent) routines. State programs can run in any environment for which there is an OSI implementation.
All CA calls have been replaced with equivalent calls to a new PV (process variable) API which can be layered on top of not just CA but also other message systems. See See The PV (Process Variable) API.
The new +m (main) option generates a C main program whose single argument is a list of macro assignments.
When this option is enabled, the main thread reads from standard input and can execute seqShow , seqChanShow etc. on demand. End of file causes the sequencer to exit.
A one-off entry handler can be supplied ( c.f. the existing exit handler). This is called once, at sequencer start-up, in the context of the first state set, before the remaining state set threads have been created. See See entry_handler.
The entry block of a state is executed each time the state is entered; the exit block is executed each time the state is left. Note that these blocks are aassociated with a state and are not the same as the one-off entry and exit handlers. See See entry_action and See exit_action.
-t , -e and -x are now recognized options within the scope of a state. -t inhibits the "timer reset" on re-entry to a state from itself; -e (for "entry") is used with the new entry block, and forces the entry statements to be executed on all entries to a state, even if from the same state; -x (for "exit") is complementary to -e , but for the new exit block. See See state_option_stmt.
Monitor messages can be queued and then dequeued at leisure. This means that monitor messages are not lost, even when posted rapidly in succession. This feature is supported by new syncQ , pvGetQ and pvFreeQ language elements, and a new seqQueueShow routine. When SNL arrays are used, a single queue is shared by the control system variables associated with the elements of the array, which can be useful for parallel control. See See Queuing Monitors and See syncq_stmt.
An device support module has been added. This allows EPICS records to refererence sequencer internals. At present this is very basic and can only return state-set names. See See Verifying the installation for a well-hidden example (look for " caget ss0 ").
SNL does not support the declaration of local variables. However, the C code generated for a when clause is now placed within an extra level of braces and the C escape mechanism can be used to declare a local variable. See See Variable Extent.
In previous versions, some functions, e.g. pvPut , have acquired a resource lock and others, e.g. efTestAndClear , have not. Those that didn't were intended for use in action code and those that did not were intended for use in when clauses. This was confusing and dangerous. All such functions now acquire a mutex (that can be taken recursively).
pvPut can now put process variables asynchronously by using an extra ASYNC argument. Completion can be tested using the new pvPutComplete . Arrays are supported (so pvPutComplete can be used to test whether a set of puts has completed). See See Asynchronous Use of pvPut() and See pvPutComplete.
pvGet and pvPut both accept an optional SYNC or ASYNC argument that, for pvGet , overrides the default as set using the -a option and, for pvPut , overrides the default synchronous behavior. See See pvPut and See pvGet.
Sequencer deletion has been completely re-written. You can no longer delete a sequencer by deleting one of its tasks. Instead you must use the new seqStop routine. See See Stopping the State Program Tasks.
Clearing an event flag can now wake up state sets that reference the event flag in when tests.
The " to " in assign , sync and syncQ statements is now optional.
Compound expressions such as i=1,j=2 (often used in for loops) are now permitted.
Variables can now be initialized in declarations such as int i=2; .
Pre-processor " # " lines are now permitted between state sets and states (relaxes restrictions on using #include to include code).
" ~ " (complement) and " ^ " (exclusive or) operators are permitted.
ANSI string concatenation, e.g. "xxx" "yyy" is the same as "xxxyyy" , is supported.
Full exponential representation is supported for numbers (previously couldn't use " E " format).
Several items remain unsupported or only partially supported. Users are encouraged to provide feedback on this list or on other desired items.
This is partially supported. See See Device support.
These are partially supported. See See Local variables.
This would remove some undesirable library dependencies. See See Overview.
With this version (v1.9), we have incorporated many extensions to the state notation language. Some of these changes offer significant advantages for programs and systems with a large number of control system variables.
The previous restriction on the number of control system variables that could be defined no longer applies. Only the amount of memory on the target processor limits the number of variables.
Individual elements of an array may be assigned to control system variables. This feature simplifies many codes that contain groups of similar variables. Furthermore, double-subscripted arrays allow arrays of array-valued variables.
Control system variables may now be dynamically assigned or re-assigned within the language at run time.
Hexadecimal numbers are now permitted within the language syntax. Previously, these had to be defined in escaped C code.
The programmer now has access to the time stamp associated with a control system variable.
We enhanced the seqShow command to present more relevant information about the running state programs.
The seqChanShow command now allows specification of a search string on the variable name, permits forward and backward stepping or skipping through the variable list, and optionally displays only variables that are or are not connected.
The syntax for displaying only variables that are not connected is
seqChanShow "<seq_program_name>", "-"