What is SNL? Sequencer 2.1 a domain specific language Ben Franksen for programming control applications Introduction SNL in a Nutshell in co-operation with an EPICS database Limitations What’s New typically used when control flow gets more complex than Overview Scoped Variables can be easily achieved with records and links Safe Mode Problem a (small) subset of the C language, plus features for Solution specifying finite state machines (state sets, keyword ss ) Next Steps binding program variables to PVs ( assign ) Summary specifying that such variables are to be automatically updated whenever the PV changes ( monitor ) explicit interaction with PVs ( pvPut , pvGet ) compiler translates SNL to C internally PVs are accessed via Channel Access
What is SNL? Sequencer 2.1 a domain specific language Ben Franksen for programming control applications Introduction SNL in a Nutshell in co-operation with an EPICS database Limitations What’s New typically used when control flow gets more complex than Overview Scoped Variables can be easily achieved with records and links Safe Mode Problem a (small) subset of the C language, plus features for Solution specifying finite state machines (state sets, keyword ss ) Next Steps binding program variables to PVs ( assign ) Summary specifying that such variables are to be automatically updated whenever the PV changes ( monitor ) explicit interaction with PVs ( pvPut , pvGet ) compiler translates SNL to C internally PVs are accessed via Channel Access
What is SNL? Sequencer 2.1 a domain specific language Ben Franksen for programming control applications Introduction SNL in a Nutshell in co-operation with an EPICS database Limitations What’s New typically used when control flow gets more complex than Overview Scoped Variables can be easily achieved with records and links Safe Mode Problem a (small) subset of the C language, plus features for Solution specifying finite state machines (state sets, keyword ss ) Next Steps binding program variables to PVs ( assign ) Summary specifying that such variables are to be automatically updated whenever the PV changes ( monitor ) explicit interaction with PVs ( pvPut , pvGet ) compiler translates SNL to C internally PVs are accessed via Channel Access
Example Sequencer 2.1 skip animation program level check Ben Franksen declare variables float v; assign v to "Input voltage"; Introduction connect them to monitor v; SNL in a Nutshell EPICS PV names Limitations short light; What’s New assign light to "Indicator light"; automatically Overview update v to the Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; Next Steps if in this state pvPut(light); Summary } state light on ... and this } condition holds state light on { when (v < 5.0) { ... then execute /* turn light off */ these actions light = 0; pvPut(light); ... and switch to } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Example Sequencer 2.1 program level check Ben Franksen declare variables float v; assign v to "Input voltage"; connect them to Introduction monitor v; EPICS PV names SNL in a Nutshell Limitations short light; automatically What’s New assign light to "Indicator light"; update v to the Overview Scoped Variables ss volt check { PV’s value Safe Mode state light off { Problem when (v > 5.0) { define a state set Solution /* turn light on */ light = 1; if in this state Next Steps pvPut(light); Summary } state light on ... and this } condition holds state light on { ... then execute when (v < 5.0) { these actions /* turn light off */ light = 0; ... and switch to pvPut(light); } state light off new state } }
Outline Sequencer 2.1 Ben Franksen Introduction 1 Introduction SNL in a Nutshell SNL in a Nutshell Limitations Limitations What’s New Overview What’s New Scoped Variables 2 Safe Mode Overview Problem Solution Scoped Variables Next Steps Safe Mode Summary Next Steps 3 Summary 4
Traditional Limitations of SNL Sequencer 2.1 Ben Franksen No type definitions Introduction SNL in a Nutshell No procedures or other abstraction facilities Limitations What’s New Only global variables, no initialization Overview Scoped Variables Restricted set of data types, roughly corresponding to Safe Mode Problem EPICS field types: Solution char , short , int , long (and unsigned versions) Next Steps float , double Summary string (synonym for char[MAX STRING SIZE] ) one or two dimensional arrays of above Escape to C code often used as work-around
Traditional Limitations of SNL Sequencer 2.1 Ben Franksen No type definitions Introduction SNL in a Nutshell No procedures or other abstraction facilities Limitations What’s New Only global variables, no initialization Overview Scoped Variables Restricted set of data types, roughly corresponding to Safe Mode Problem EPICS field types: Solution char , short , int , long (and unsigned versions) Next Steps float , double Summary string (synonym for char[MAX STRING SIZE] ) one or two dimensional arrays of above Escape to C code often used as work-around
Traditional Limitations of SNL Sequencer 2.1 Ben Franksen No type definitions Introduction SNL in a Nutshell No procedures or other abstraction facilities Limitations What’s New Only global variables, no initialization Overview Scoped Variables Restricted set of data types, roughly corresponding to Safe Mode Problem EPICS field types: Solution char , short , int , long (and unsigned versions) Next Steps float , double Summary string (synonym for char[MAX STRING SIZE] ) one or two dimensional arrays of above Escape to C code often used as work-around
Traditional Limitations of SNL Sequencer 2.1 Ben Franksen No type definitions Introduction SNL in a Nutshell No procedures or other abstraction facilities Limitations What’s New Only global variables, no initialization Overview Scoped Variables Restricted set of data types, roughly corresponding to Safe Mode Problem EPICS field types: Solution char , short , int , long (and unsigned versions) Next Steps float , double Summary string (synonym for char[MAX STRING SIZE] ) one or two dimensional arrays of above Escape to C code often used as work-around
Traditional Limitations of SNL Sequencer 2.1 Ben Franksen No type definitions Introduction SNL in a Nutshell No procedures or other abstraction facilities Limitations What’s New Only global variables, no initialization Overview Scoped Variables Restricted set of data types, roughly corresponding to Safe Mode Problem EPICS field types: Solution char , short , int , long (and unsigned versions) Next Steps float , double Summary string (synonym for char[MAX STRING SIZE] ) one or two dimensional arrays of above Escape to C code often used as work-around
Traditional Limitations of SNL Sequencer 2.1 Ben Franksen No type definitions Introduction SNL in a Nutshell No procedures or other abstraction facilities Limitations What’s New Only global variables, no initialization Overview Scoped Variables Restricted set of data types, roughly corresponding to Safe Mode Problem EPICS field types: Solution char , short , int , long (and unsigned versions) Next Steps float , double Summary string (synonym for char[MAX STRING SIZE] ) one or two dimensional arrays of above Escape to C code often used as work-around
Outline Sequencer 2.1 Ben Franksen Introduction 1 Introduction SNL in a Nutshell SNL in a Nutshell Limitations Limitations What’s New Overview What’s New Scoped Variables 2 Safe Mode Overview Problem Solution Scoped Variables Next Steps Safe Mode Summary Next Steps 3 Summary 4
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode: avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode: avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode TM : avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode: avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode: avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode: avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
What’s new in 2.1? Syntactic restrictions lifted Sequencer 2.1 allow local variables in all blocks Ben Franksen support more variable types Introduction declarations with multiple variables and initialization SNL in a Nutshell Additions: you can now Limitations What’s New jump to a new state from action code: state new state; Overview exit program instead of transition to a new state: Scoped Variables Safe Mode when(...) { ... } exit Problem avoid ”used but not defined” warnings by declaring Solution Next Steps foreign identifiers (variables, macros, whatever) Safe Mode: avoid race conditions for global variables Summary Improved documentation Started adding automated regression tests (no complete coverage yet) Many bugs fixed, general code cleanup Deep refactorings may have introduced new bugs (but hopefully only shallow ones)
Outline Sequencer 2.1 Ben Franksen Introduction 1 Introduction SNL in a Nutshell SNL in a Nutshell Limitations Limitations What’s New Overview What’s New Scoped Variables 2 Safe Mode Overview Problem Solution Scoped Variables Next Steps Safe Mode Summary Next Steps 3 Summary 4
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Scoped Variables Sequencer 2.1 Ben Franksen Variables can be declared on all levels Introduction SNL in a Nutshell They come in two variants Limitations nested anywhere inside action blocks (state transition, What’s New entry, exit) Overview Scoped Variables temporary, like local ( auto ) variables in C Safe Mode Problem no assign to PVs allowed Solution at the start of states and state set blocks Next Steps persistent until program ends, like C static variables Summary but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assign ed, monitor ed, etc. like globals
Outline Sequencer 2.1 Ben Franksen Introduction 1 Introduction SNL in a Nutshell SNL in a Nutshell Limitations Limitations What’s New Overview What’s New Scoped Variables 2 Safe Mode Overview Problem Solution Scoped Variables Next Steps Safe Mode Summary Next Steps 3 Summary 4
Motivation Sequencer 2.1 Ben Franksen Introduction SNL in a Nutshell From the SNL mission statement: Limitations What’s New The state notation language allows programming Overview Scoped Variables sequential operations that interact with EPICS Safe Mode process variables without the usual complexity Problem Solution involved with task scheduling, semaphores, event Next Steps handling, and I/O programming. [...] Summary
Motivation Sequencer 2.1 Ben Franksen Introduction SNL in a Nutshell From the SNL mission statement: Limitations What’s New The state notation language allows programming Overview Scoped Variables sequential operations that interact with EPICS Safe Mode process variables without the usual complexity Problem Solution involved with task scheduling, semaphores, event Next Steps handling, and I/O programming. [...] Summary
Motivation Sequencer 2.1 Ben Franksen Introduction SNL in a Nutshell From the SNL mission statement: Limitations What’s New The state notation language allows programming Overview Scoped Variables sequential operations that interact with EPICS Safe Mode process variables without the usual complexity Problem Solution involved with task scheduling, semaphores, event Next Steps handling, and I/O programming. [...] Summary Unfortunately this is not the case.
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
The Problem Sequencer 2.1 Ben Franksen SNL variables are not protected from concurrent access Introduction Threads involved SNL in a Nutshell Limitations one or more state sets that access a variable What’s New the CA callback thread, performing the variable updates Overview Scoped Variables (monitor, get completion) Safe Mode Problem Variables can become corrupted if access is non-atomic Solution Next Steps Resulting failures are extremely difficult to debug Summary There is no reliable work-around for the SNL programmer CA updates can intervene at any time A serious bug that has to be fixed But how?
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Solution Sequencer 2.1 Each state set operates on its own copy of each variable Ben Franksen Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and Introduction SNL in a Nutshell from asynchronous variable updates Limitations Synchronization (exchange of data) happens only outside What’s New Overview user visible (SNL) code: Scoped Variables Safe Mode for monitored variables: immediately before Problem when -conditions are checked Solution for all assigned variables: inside pvGet / pvPut and Next Steps related built-in functions (but only the synchronous Summary versions that actually access the variable) Nice side effect: conditions established in when(...) clauses are never invalidated except explicitly by the invoked action code Not completely backwards compatible, therefore must be enabled with an option +s . Implies re-entrant mode.
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs TM What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync )
Anonymous Pvs Sequencer 2.1 Safe mode prevents state sets from communicating via Ben Franksen global variables Introduction Event flags work but can communicate only booleans SNL in a Nutshell Limitations For other data types: use Anonymous PVs What’s New Overview Syntax: global variable assigned to "" , short form: Scoped Variables Safe Mode assign x; (scalars) Problem Solution assign x {} ; (arrays) Next Steps Use pvPut , pvGet , and monitor like with normal Summary (named) PVs Named and anononymous PVs can be freely exchanged, all built-in functions behave in the the same way event flag ≡ anonymous boolean PV (modulo sync ) Rationale
Outline Sequencer 2.1 Ben Franksen Introduction 1 Introduction SNL in a Nutshell SNL in a Nutshell Limitations Limitations What’s New Overview What’s New Scoped Variables 2 Safe Mode Overview Problem Solution Scoped Variables Next Steps Safe Mode Summary Next Steps 3 Summary 4
Next Steps Sequencer 2.1 Integrate code from DESY to support redundant IOCs Ben Franksen Add more regression tests Introduction Remove stuff that is ugly and obsolete SNL in a Nutshell Limitations PV layer (a C++ wrapper around CA or other protocols) What’s New devSequencer (device support for monitoring seq’s internal Overview state) Scoped Variables Safe Mode Lift further restrictions Problem Solution allow foreign (C) types to be used in declarations Next Steps define data types (e.g. struct ) in SNL? Summary New notation for assign , monitor , sync , etc. all extra attributes of a variable in one place obviate the need for user defined CPP macros need a good idea for the syntax Add some kind of abstraction facility parameterizable state sets (a.k.a. procedures) explain details
Next Steps Sequencer 2.1 Integrate code from DESY to support redundant IOCs Ben Franksen Add more regression tests Introduction Remove stuff that is ugly and obsolete SNL in a Nutshell Limitations PV layer (a C++ wrapper around CA or other protocols) What’s New devSequencer (device support for monitoring seq’s internal Overview state) Scoped Variables Safe Mode Lift further restrictions Problem Solution allow foreign (C) types to be used in declarations Next Steps define data types (e.g. struct ) in SNL? Summary New notation for assign , monitor , sync , etc. all extra attributes of a variable in one place obviate the need for user defined CPP macros need a good idea for the syntax Add some kind of abstraction facility parameterizable state sets (a.k.a. procedures) explain details
Next Steps Sequencer 2.1 Integrate code from DESY to support redundant IOCs Ben Franksen Add more regression tests Introduction Remove stuff that is ugly and obsolete SNL in a Nutshell Limitations PV layer (a C++ wrapper around CA or other protocols) What’s New devSequencer (device support for monitoring seq’s internal Overview state) Scoped Variables Safe Mode Lift further restrictions Problem Solution allow foreign (C) types to be used in declarations Next Steps define data types (e.g. struct ) in SNL? Summary New notation for assign , monitor , sync , etc. all extra attributes of a variable in one place obviate the need for user defined CPP macros need a good idea for the syntax Add some kind of abstraction facility parameterizable state sets (a.k.a. procedures) explain details
Next Steps Sequencer 2.1 Integrate code from DESY to support redundant IOCs Ben Franksen Add more regression tests Introduction Remove stuff that is ugly and obsolete SNL in a Nutshell Limitations PV layer (a C++ wrapper around CA or other protocols) What’s New devSequencer (device support for monitoring seq’s internal Overview state) Scoped Variables Safe Mode Lift further restrictions Problem Solution allow foreign (C) types to be used in declarations Next Steps define data types (e.g. struct ) in SNL? Summary New notation for assign , monitor , sync , etc. all extra attributes of a variable in one place obviate the need for user defined CPP macros need a good idea for the syntax Add some kind of abstraction facility parameterizable state sets (a.k.a. procedures) explain details
Next Steps Sequencer 2.1 Integrate code from DESY to support redundant IOCs Ben Franksen Add more regression tests Introduction Remove stuff that is ugly and obsolete SNL in a Nutshell Limitations PV layer (a C++ wrapper around CA or other protocols) What’s New devSequencer (device support for monitoring seq’s internal Overview state) Scoped Variables Safe Mode Lift further restrictions Problem Solution allow foreign (C) types to be used in declarations Next Steps define data types (e.g. struct ) in SNL? Summary New notation for assign , monitor , sync , etc. all extra attributes of a variable in one place obviate the need for user defined CPP macros need a good idea for the syntax Add some kind of abstraction facility parameterizable state sets (a.k.a. procedures) explain details
Next Steps Sequencer 2.1 Integrate code from DESY to support redundant IOCs Ben Franksen Add more regression tests Introduction Remove stuff that is ugly and obsolete SNL in a Nutshell Limitations PV layer (a C++ wrapper around CA or other protocols) What’s New devSequencer (device support for monitoring seq’s internal Overview state) Scoped Variables Safe Mode Lift further restrictions Problem Solution allow foreign (C) types to be used in declarations Next Steps define data types (e.g. struct ) in SNL? Summary New notation for assign , monitor , sync , etc. all extra attributes of a variable in one place obviate the need for user defined CPP macros need a good idea for the syntax Add some kind of abstraction facility parameterizable state sets (a.k.a. procedures) explain details
Summary Sequencer 2.1 Ben Franksen Introduction SNL in a Nutshell For a long time the Sequencer suffered from neglect. Limitations This has changed, it is again actively maintained, new What’s New Overview features are being added, bugs are getting fixed, even deep Scoped Variables Safe Mode and difficult ones. Problem Solution The 2.1.x releases prove that many of the traditional Next Steps limitations and restrictions in SNL can be overcome with Summary reasonable effort by suitable re-engineering. Expect further improvements in version 2.2.
Summary Sequencer 2.1 Ben Franksen Introduction SNL in a Nutshell For a long time the Sequencer suffered from neglect. Limitations This has changed, it is again actively maintained, new What’s New Overview features are being added, bugs are getting fixed, even deep Scoped Variables Safe Mode and difficult ones. Problem Solution The 2.1.x releases prove that many of the traditional Next Steps limitations and restrictions in SNL can be overcome with Summary reasonable effort by suitable re-engineering. Expect further improvements in version 2.2.
Recommend
More recommend