January 2009EPICS Seminar in Indore1 Introduction to State Notation Language (SNL) Tatsuro KEK January 2009.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Introduction to C Systems Programming Concepts. Introduction to C A simple C Program A simple C Program –Variable Declarations –printf ( ) Compiling and.
IT 325 OPERATING SYSTEM C programming language. Why use C instead of Java Intermediate-level language:  Low-level features like bit operations  High-level.
January 2009EPICS Seminar in Indore1 Practice EPICS Start up and MEDM Tatsuro KEK January 2009.
Experimental Physics and Industrial Control System (EPICS) Sequencer and State Notation Language Tutorial Slides Bob Dalesio, Deb Kerstiens, Rozelle Wright.
Air Force Institute of Technology Electrical and Computer Engineering
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Introduction to Perl. How to run perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Your program/script.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Basic Elements of C++ Chapter 2.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
ORNL is managed by UT-Battelle for the US Department of Energy EPICS State Notation Language (SNL), “Sequencer” Kay Kasemir, SNS/ORNL Many slides from.
SNL and Sequencer 1 Controls EPICS Training Class EPICS Collaboration Meeting SLAC State Notation Language (SNL) and Sequencer April 23, 2012 Kukhee.
1 1999/Ph 514: State Notation Language EPICS State Notation Language (SNL) Ned D. Arnold APS.
1 2001: Beijing State Notation Language EPICS State Notation Language (SNL) Ned D. Arnold APS (Ron Chestnut SLAC)
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Introduction to Computer Systems and the Java Programming Language.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
A U.S. Department of Energy Office of Science Laboratory Operated by The University of Chicago Argonne National Laboratory Office of Science U.S. Department.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
January 2009EPICS Seminar in Indore1 Practice SNL and Sequencer Tatsuro KEK January 2009.
These notes were originally developed for CpSc 210 (C version) by Dr. Mike Westall in the Department of Computer Science at Clemson.
Conditions CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Managed by UT-Battelle for the Department of Energy EPICS Sequencer Kay Kasemir, SNS/ORNL Many slides from Andrew Johnson, APS/ANL Feb
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
A first program 1. #include 2. using namespace std; 3. int main() { 4. cout
EPICS sequencer update Greg White / William Lupton / EPICS ‘99 SLAC, May 27, 1999.
Stanford Linear Accelerator Center New SNL Ideas Possible Next Steps Ron Chestnut – PSI, May, 2001 With ideas from B. Dalesio and M. Clausen.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6: Transition to Java Programming with Alice and Java First Edition.
Variables and Functions ROBOTC Software © 2012 Project Lead The Way, Inc.Principles of Engineering.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
 Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. 
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Sudeshna Sarkar, IIT Kharagpur 1 Programming and Data Structure Sudeshna Sarkar Lecture 3.
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
Basic Data Types อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา Chapter 4.
State Notation Language and the Sequencer Andrew Johnson APS Engineering Support Division October 2008 INFN EPICS Training.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
Chapter 1.2 Introduction to C++ Programming
Chapter Topics The Basics of a C++ Program Data Types
Chapter 1.2 Introduction to C++ Programming
The Machine Model Memory
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Introduction to the C Language
ECE Application Programming
Basic Elements of C++.
Basic Elements of C++ Chapter 2.
State Notation Language (SNL) and Sequencer
An Introduction to Java – Part I, language basics
Introduction to Primitive Data types
C Programming Getting started Variables Basic C operators Conditionals
Writing a Channel Access Client in EPICS
Variables and Constants
Introduction to Primitive Data types
Presentation transcript:

January 2009EPICS Seminar in Indore1 Introduction to State Notation Language (SNL) Tatsuro KEK January 2009

EPICS Seminar in Indore2 Outline 1.Introduction 2.Basic Feature 3.Additional Feature

January 2009EPICS Seminar in Indore3 1. Introduction SNL and Sequencer SNL (State Notation Language) –A programming language like C –Based on the State Transition Diagram –SNC : State Notation Compiler Sequencer –Programs produced by the SNL are executed within the framework of the run-time sequencer.

January 2009EPICS Seminar in Indore4 State Transition Diagram State A State B State C

January 2009EPICS Seminar in Indore5 Where Sequencer runs ? Typical usage --- runs in IOC –Sequencer is a software component of IOC. process database Sequencer CA IOC OPI process database CA network

January 2009EPICS Seminar in Indore6 Another usage --- runs in OPI –Sequencer (Ver. 2.0 or later) can run as a stand-alone program in workstation. process database Sequencer CA IOC OPI process database CA Sequencer network

January 2009EPICS Seminar in Indore7 Documents EPICS Sequencer Page – sequencer/ sequencer/ Manual is available. Tutorial Slides –

January 2009EPICS Seminar in Indore8 2. Basic Feature State Transition Diagram Start Light is off Light is on v > 60 Turn light on v < 50 Turn light off event action state state transition

January 2009EPICS Seminar in Indore9 First Step of SNL Code Skeleton of the SNL code state light_off { when (v > 60.0) { /* turn light on */ } state light_on } state light_on { when (v < 50.0) { /* turn light off */ } state light_off } Start Light is off Light is on v > 60 Turn light on v < 50 Turn light off

January 2009EPICS Seminar in Indore10 Variables assigned to a Channel short light; assign light to "sample:IndicatorLight"; /* turn light on */ light = TRUE; pvPut(light); /* turn light off */ light = FALSE; pvPut(light);

January 2009EPICS Seminar in Indore11 Monitor a Channel float v; assign v to "sample:Vout"; monitor v; when (v > 60.0) { …

January 2009EPICS Seminar in Indore12 A Complete State Program program seqtest float v; assign v to "sample:Vout"; monitor v; short light; assign light to "sample:IndicatorLight"; ss volt_check { state light_off { when (v > 60.0) { /* turn light on */ light = TRUE; pvPut(light); } state light_on } state light_on { when (v < 50.0) { /* turn light off */ light = FALSE; pvPut(light); } state light_off }

January 2009EPICS Seminar in Indore13 Structure of a State Program program seqtest float v; assign v to "sample:Vout"; monitor v; short light; assign light to "sample:IndicatorLight"; ss volt_check { state light_off { when (v > 60.0) { /* turn light on */ light = TRUE; pvPut(light); } state light_on } state light_on { when (v < 50.0) { /* turn light off */ light = FALSE; pvPut(light); } state light_off } Program Definition State Set

January 2009EPICS Seminar in Indore14 Structure of a State Set Event Action (State Transition) State State Set program seqtest float v; assign v to "sample:Vout"; monitor v; short light; assign light to "sample:IndicatorLight"; ss volt_check { state light_off { when (v > 60.0) { /* turn light on */ light = TRUE; pvPut(light); } state light_on } state light_on { when (v < 50.0) { /* turn light off */ light = FALSE; pvPut(light); } state light_off }

January 2009EPICS Seminar in Indore15 program seqtest2 … declaration … ss state_set_1 { state A { … } state B { … } ss state_set_2 { state C { … } state D { … } Multiple State Sets State C State D State_set_2 State A State B State_set_1 Each State Set runs concurrently.

January 2009EPICS Seminar in Indore16 Declaration (1) Variable int variable_name ; short variable_name ; long variable_name ; char variable_name ; float variable_name ; double variable_name ; string variable_name ; … fixed size char array

January 2009EPICS Seminar in Indore17 Declaration (2) Assign Monitor assign variable_name to " channel_name "; monitor variable_name ;

January 2009EPICS Seminar in Indore18 Declaration (3) Array of Variables –int, short, long, char, float, double variable can be array. (array of string is not available.) int variable_name [ array_length ]; int variable_name [ array_length ][ array_length ]; int Vin[4]; assign Vin to {"chan1", "chan2", "chan3"}; monitor Vin;

January 2009EPICS Seminar in Indore19 Events Typical expression : –Change in value of a variable –Time out The delay function returns a TRUE after a specified time interval from when the state was entered. It should be used only within when expression. Its argument must contain a decimal point. when (v > 60.0) when ( expression ) when (delay(10.0))

January 2009EPICS Seminar in Indore20 Actions (1) Most C statements are supported. expression ; if (…) … else … while (…) … for (…, …, …) … break;

January 2009EPICS Seminar in Indore21 Actions (2) C code may be escaped in the program. % escape one line of C code %{ escape any number of lines of C code }%

January 2009EPICS Seminar in Indore22 Actions (3) Built-in functions pvPut( variable_name ) pvGet( variable_name ) … –You can see many built-in functions in the manual. –In principle, the built-in functions cannot be directly used in escaped C code.

January 2009EPICS Seminar in Indore23 Build an SNL program “make” automates the following steps. CPP test.sttest.ctest.itest.o SNCCC test.stttest.ctest.o SNCCC

January 2009EPICS Seminar in Indore24 3. Additional Feature Variable Names using Macros assign vin to "{unit}:ai1"; assign vout to "{unit}:ao1"; –Macro value is given at run-time.

January 2009EPICS Seminar in Indore25 Dynamic Assignment floatXmotor; assign Xmotor to ""; … pvAssign(Xmotor, "Motor_1_4");

January 2009EPICS Seminar in Indore26 Status, Severity, Time stamp pvStatus(Xmotor) pvSeverity(Xmotor) pvTimeStamp(Xmotor)

January 2009EPICS Seminar in Indore27 Event Flag –Synchronizing State Sets using Event Flag evflag flag1; … efSet(flag1); efClear(flag1); … when (efTestAndClear(flag1)) { … }

January 2009EPICS Seminar in Indore28 Event Flag associated to a Channel –Event Flag is set whenever a monitor is delivered. double loLimit; assign loLimit to "demo:loLimit"; monitor loLimit; evflag loFlag; sync loLimit loFlag; … when (efTestAndClear(loFflag)) { … }

January 2009EPICS Seminar in Indore29 Connection Management when (pvConnectedCount()!=pvChannelCount()) { … } when (pvConnected(Xmotor)) { … } –SNC compiler option -c : don’t wait for channel connection +c : wait for channel connection (default)

January 2009EPICS Seminar in Indore30 Asynchronous pvGet(), pvPut() pvGet(vin, ASYNC) pvPut(vout, ASYNC) … pvGetComplete(vin) pvPutComplete(vout) –SNC compiler option -a : synchronous pvGet() (default) +a : asynchronous pvGet()

January 2009EPICS Seminar in Indore31 Reentrant Object Code –SNC compiler option -r : Run-time code is not reentrant, thus saving start-up time and memory (default) +r : Run-time code is reentrant. More than one instance of the state program can run on an IOC.

January 2009EPICS Seminar in Indore32 More features –Look at the tutorial slides at APS. –Read the manual.