State Notation Language Overview

Ned Arnold
May 1996


Table of Contents


State Notation Complier and Sequencer


EPICS Architecture and Tools


Uses


Advantages


Definitions


Basics


A Complete State Program (with 2 state sets)

-------------------------------------------------------------------------------------------
program level_check        ss volt_check {             ss generate_voltage {                 
                             state light_off {           state init {                        
float  v;                      when (v > 5.0) {         when () {                         
assign  v to "ts1:ai1";          /* turn light on */         vout = 0.0;                     
monitor  v;                      light = TRUE;               pvPut(vout);                    
short  light;                    pvPut(light);               delta = 0.2;                    
assign  light to               ) state light_on;           } state ramp                      

"Indicator_light";          }                           }                                   
                                                                                             
float  vout;                 state light_on {            state ramp {                        
float  delta;                  when (v < 5.0) {         when (delay (0.1)) {              
assign vout to "ts1:ai1";        /* turn light off */        if ((delta > 0.0 &&  
                                 light = FALSE;                vout >= 11.0) ||           
                                 pvPut (light);                (delta < 0.0 &&    
                               } state light_off;              vout <= -11.0))            
                             }                                 /*change direction*/          
                           }                                   delta = -delta;               
                                                             vout += delta;                  
                                                             pvPut(vout);                    
                                                           } state ramp;                     
                                                         }                                   
                                                       }                                     
-------------------------------------------------------------------------------------------

More Basics ...


Example of Multiple "whens"

state checks {
  when (interlockChasPwrBi == 0) {
    sprintf(seqMsg1, "Electron Gun Not Ready...");
    pvPut(seqMsg1);
    sprintf(seqMesg2, "Gun Interlock Chassis off");
    pvPut(seqMsg2);
  } state initialChecks
  when (gunLocal) {
    sprintf(seqMsg1, "Electron Gun Not Ready...");
    pvPut(seqMsg1);
    sprintf(seqMesg2, "Egun in local control");
    pvPut(seqMsg2);
  } state initialChecks
  when (gunInterlocksRdyCC == 0) {
    sprintf(seqMsg1, "Electron Gun Not Ready...");
    pvPut(seqMsg1);
    sprintf(seqMesg2, "Interlocks not OK");
    pvPut(seqMsg2);
  } state initialChecks
  when (interlockChasPwrBI && (gunLocal == 0) && gunInterlocksRdyCC) {
    gunAutoStart = 0;
    pvPut(gunAutoStart);
    gunAutoStop = 0;
    pvPut(gunAutoStop);
    sprintf(seqMsg1, "Push Auto-Start to begin autostart...");
    pvPut(seqMsg1);
    sprintf(seqMesg2, "Push Auto-Stop to begin autostop...");
    pvPut(seqMsg2);
%%    taskDelay(60);
  } state waitForRequest
}
state initialChecks {
  when (delay(2.0)) {
    sprintf(seqMsg1, "Initial Checks");
    pvPut(SeqMsg1);
    sprintf(seqMesg2, "");
    pvPut(seqMsg2);
%%    taskDelay(60);
  } state checks
}

Other Features


Debugging


Examples