EPICS State Notation Language and Sequencer Limitations Whats New - - PowerPoint PPT Presentation

epics state notation language and sequencer
SMART_READER_LITE
LIVE PREVIEW

EPICS State Notation Language and Sequencer Limitations Whats New - - PowerPoint PPT Presentation

Sequencer 2.1 Ben Franksen Introduction SNL in a Nutshell EPICS State Notation Language and Sequencer Limitations Whats New Version 2.1 Overview Scoped Variables Safe Mode Problem Ben Franksen Solution Next Steps Summary


slide-1
SLIDE 1

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

EPICS State Notation Language and Sequencer

Version 2.1 Ben Franksen

Helmholtz-Zentrum Berlin f¨ ur Materialien und Energie (HZB) (Wilhelm-Conrad-R¨

  • ntgen Campus / BESSY II)

EPICS Meeting 2011 @ PSI, 2011

slide-2
SLIDE 2

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Prologue: A Small Glossary

SNL State Notation Language PV Process Variable CA Channel Access Sequencer The SNL runtime library Sequencer The project that implements SNL

slide-3
SLIDE 3

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Prologue: A Small Glossary

SNL State Notation Language PV Process Variable CA Channel Access Sequencer The SNL runtime library Sequencer The project that implements SNL

slide-4
SLIDE 4

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Prologue: A Small Glossary

SNL State Notation Language PV Process Variable CA Channel Access Sequencer The SNL runtime library Sequencer The project that implements SNL

slide-5
SLIDE 5

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Prologue: A Small Glossary

SNL State Notation Language PV Process Variable CA Channel Access Sequencer The SNL runtime library Sequencer The project that implements SNL

slide-6
SLIDE 6

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Prologue: A Small Glossary

SNL State Notation Language PV Process Variable CA Channel Access Sequencer The SNL runtime library Sequencer The project that implements SNL

slide-7
SLIDE 7

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction

2

What’s New

3

Next Steps

4

Summary

slide-8
SLIDE 8

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction

2

What’s New

3

Next Steps

4

Summary

slide-9
SLIDE 9

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction

2

What’s New

3

Next Steps

4

Summary

slide-10
SLIDE 10

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction

2

What’s New

3

Next Steps

4

Summary

slide-11
SLIDE 11

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction SNL in a Nutshell Limitations

2

What’s New Overview Scoped Variables Safe Mode

3

Next Steps

4

Summary

slide-12
SLIDE 12

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-13
SLIDE 13

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-14
SLIDE 14

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-15
SLIDE 15

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-16
SLIDE 16

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-17
SLIDE 17

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-18
SLIDE 18

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-19
SLIDE 19

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-20
SLIDE 20

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-21
SLIDE 21

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-22
SLIDE 22

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What is SNL?

a domain specific language for programming control applications in co-operation with an EPICS database typically used when control flow gets more complex than can be easily achieved with records and links a (small) subset of the C language, plus features for

specifying finite state machines (state sets, keyword ss) binding program variables to PVs (assign) 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

slide-23
SLIDE 23

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

skip animation

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-24
SLIDE 24

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-25
SLIDE 25

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-26
SLIDE 26

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-27
SLIDE 27

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-28
SLIDE 28

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-29
SLIDE 29

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-30
SLIDE 30

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-31
SLIDE 31

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-32
SLIDE 32

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-33
SLIDE 33

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-34
SLIDE 34

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-35
SLIDE 35

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Example

program level check float v; assign v to "Input voltage"; monitor v; short light; assign light to "Indicator light"; ss volt check { state light off { when (v > 5.0) { /* turn light on */ light = 1; pvPut(light); } state light on } state light on { when (v < 5.0) { /* turn light off */ light = 0; pvPut(light); } state light off } }

declare variables connect them to EPICS PV names automatically update v to the PV’s value define a state set if in this state ... and this condition holds ... then execute these actions ... and switch to new state

slide-36
SLIDE 36

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction SNL in a Nutshell Limitations

2

What’s New Overview Scoped Variables Safe Mode

3

Next Steps

4

Summary

slide-37
SLIDE 37

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Traditional Limitations of SNL

No type definitions No procedures or other abstraction facilities Only global variables, no initialization Restricted set of data types, roughly corresponding to EPICS field types:

char, short, int, long (and unsigned versions) float, double string (synonym for char[MAX STRING SIZE])

  • ne or two dimensional arrays of above

Escape to C code often used as work-around

slide-38
SLIDE 38

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Traditional Limitations of SNL

No type definitions No procedures or other abstraction facilities Only global variables, no initialization Restricted set of data types, roughly corresponding to EPICS field types:

char, short, int, long (and unsigned versions) float, double string (synonym for char[MAX STRING SIZE])

  • ne or two dimensional arrays of above

Escape to C code often used as work-around

slide-39
SLIDE 39

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Traditional Limitations of SNL

No type definitions No procedures or other abstraction facilities Only global variables, no initialization Restricted set of data types, roughly corresponding to EPICS field types:

char, short, int, long (and unsigned versions) float, double string (synonym for char[MAX STRING SIZE])

  • ne or two dimensional arrays of above

Escape to C code often used as work-around

slide-40
SLIDE 40

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Traditional Limitations of SNL

No type definitions No procedures or other abstraction facilities Only global variables, no initialization Restricted set of data types, roughly corresponding to EPICS field types:

char, short, int, long (and unsigned versions) float, double string (synonym for char[MAX STRING SIZE])

  • ne or two dimensional arrays of above

Escape to C code often used as work-around

slide-41
SLIDE 41

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Traditional Limitations of SNL

No type definitions No procedures or other abstraction facilities Only global variables, no initialization Restricted set of data types, roughly corresponding to EPICS field types:

char, short, int, long (and unsigned versions) float, double string (synonym for char[MAX STRING SIZE])

  • ne or two dimensional arrays of above

Escape to C code often used as work-around

slide-42
SLIDE 42

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Traditional Limitations of SNL

No type definitions No procedures or other abstraction facilities Only global variables, no initialization Restricted set of data types, roughly corresponding to EPICS field types:

char, short, int, long (and unsigned versions) float, double string (synonym for char[MAX STRING SIZE])

  • ne or two dimensional arrays of above

Escape to C code often used as work-around

slide-43
SLIDE 43

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction SNL in a Nutshell Limitations

2

What’s New Overview Scoped Variables Safe Mode

3

Next Steps

4

Summary

slide-44
SLIDE 44

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe Mode: avoid race conditions for global variables 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)

slide-45
SLIDE 45

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe Mode: avoid race conditions for global variables 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)

slide-46
SLIDE 46

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe ModeTM: avoid race conditions for global variables 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)

slide-47
SLIDE 47

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe Mode: avoid race conditions for global variables 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)

slide-48
SLIDE 48

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe Mode: avoid race conditions for global variables 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)

slide-49
SLIDE 49

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe Mode: avoid race conditions for global variables 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)

slide-50
SLIDE 50

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

What’s new in 2.1?

Syntactic restrictions lifted

allow local variables in all blocks support more variable types declarations with multiple variables and initialization

Additions: you can now

jump to a new state from action code: state new state; exit program instead of transition to a new state: when(...) {...} exit avoid ”used but not defined” warnings by declaring foreign identifiers (variables, macros, whatever)

Safe Mode: avoid race conditions for global variables 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)

slide-51
SLIDE 51

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction SNL in a Nutshell Limitations

2

What’s New Overview Scoped Variables Safe Mode

3

Next Steps

4

Summary

slide-52
SLIDE 52

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-53
SLIDE 53

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-54
SLIDE 54

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-55
SLIDE 55

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-56
SLIDE 56

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-57
SLIDE 57

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-58
SLIDE 58

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-59
SLIDE 59

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-60
SLIDE 60

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-61
SLIDE 61

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Scoped Variables

Variables can be declared on all levels They come in two variants

nested anywhere inside action blocks (state transition, entry, exit)

temporary, like local (auto) variables in C no assign to PVs allowed

at the start of states and state set blocks

persistent until program ends, like C static variables but reentrant (if option +r is active) and statically scoped, i.e. invisible to code outside the block can be assigned, monitored, etc. like globals

slide-62
SLIDE 62

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction SNL in a Nutshell Limitations

2

What’s New Overview Scoped Variables Safe Mode

3

Next Steps

4

Summary

slide-63
SLIDE 63

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Motivation

From the SNL mission statement: The state notation language allows programming sequential operations that interact with EPICS process variables without the usual complexity involved with task scheduling, semaphores, event handling, and I/O programming. [...]

slide-64
SLIDE 64

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Motivation

From the SNL mission statement: The state notation language allows programming sequential operations that interact with EPICS process variables without the usual complexity involved with task scheduling, semaphores, event handling, and I/O programming. [...]

slide-65
SLIDE 65

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Motivation

From the SNL mission statement: The state notation language allows programming sequential operations that interact with EPICS process variables without the usual complexity involved with task scheduling, semaphores, event handling, and I/O programming. [...] Unfortunately this is not the case.

slide-66
SLIDE 66

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-67
SLIDE 67

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-68
SLIDE 68

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-69
SLIDE 69

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-70
SLIDE 70

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-71
SLIDE 71

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-72
SLIDE 72

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-73
SLIDE 73

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-74
SLIDE 74

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

The Problem

SNL variables are not protected from concurrent access Threads involved

  • ne or more state sets that access a variable

the CA callback thread, performing the variable updates (monitor, get completion)

Variables can become corrupted if access is non-atomic Resulting failures are extremely difficult to debug 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?

slide-75
SLIDE 75

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-76
SLIDE 76

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-77
SLIDE 77

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-78
SLIDE 78

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-79
SLIDE 79

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-80
SLIDE 80

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-81
SLIDE 81

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-82
SLIDE 82

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Solution

Each state set operates on its own copy of each variable Aynchronous CA updates operate on yet another copy State sets are completely isolated from each other and from asynchronous variable updates Synchronization (exchange of data) happens only outside user visible (SNL) code:

for monitored variables: immediately before when-conditions are checked for all assigned variables: inside pvGet / pvPut and related built-in functions (but only the synchronous 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.

slide-83
SLIDE 83

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-84
SLIDE 84

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-85
SLIDE 85

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVsTM Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-86
SLIDE 86

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-87
SLIDE 87

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-88
SLIDE 88

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-89
SLIDE 89

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-90
SLIDE 90

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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)

slide-91
SLIDE 91

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Anonymous Pvs

Safe mode prevents state sets from communicating via global variables Event flags work but can communicate only booleans For other data types: use Anonymous PVs Syntax: global variable assigned to "", short form:

assign x; (scalars) assign x {}; (arrays)

Use pvPut, pvGet, and monitor like with normal (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

slide-92
SLIDE 92

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Outline

1

Introduction SNL in a Nutshell Limitations

2

What’s New Overview Scoped Variables Safe Mode

3

Next Steps

4

Summary

slide-93
SLIDE 93

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Next Steps

Integrate code from DESY to support redundant IOCs Add more regression tests Remove stuff that is ugly and obsolete

PV layer (a C++ wrapper around CA or other protocols) devSequencer (device support for monitoring seq’s internal state)

Lift further restrictions

allow foreign (C) types to be used in declarations define data types (e.g. struct) in SNL?

New notation for assign, monitor, sync, etc.

all extra attributes of a variable in one place

  • bviate 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

slide-94
SLIDE 94

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Next Steps

Integrate code from DESY to support redundant IOCs Add more regression tests Remove stuff that is ugly and obsolete

PV layer (a C++ wrapper around CA or other protocols) devSequencer (device support for monitoring seq’s internal state)

Lift further restrictions

allow foreign (C) types to be used in declarations define data types (e.g. struct) in SNL?

New notation for assign, monitor, sync, etc.

all extra attributes of a variable in one place

  • bviate 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

slide-95
SLIDE 95

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Next Steps

Integrate code from DESY to support redundant IOCs Add more regression tests Remove stuff that is ugly and obsolete

PV layer (a C++ wrapper around CA or other protocols) devSequencer (device support for monitoring seq’s internal state)

Lift further restrictions

allow foreign (C) types to be used in declarations define data types (e.g. struct) in SNL?

New notation for assign, monitor, sync, etc.

all extra attributes of a variable in one place

  • bviate 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

slide-96
SLIDE 96

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Next Steps

Integrate code from DESY to support redundant IOCs Add more regression tests Remove stuff that is ugly and obsolete

PV layer (a C++ wrapper around CA or other protocols) devSequencer (device support for monitoring seq’s internal state)

Lift further restrictions

allow foreign (C) types to be used in declarations define data types (e.g. struct) in SNL?

New notation for assign, monitor, sync, etc.

all extra attributes of a variable in one place

  • bviate 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

slide-97
SLIDE 97

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Next Steps

Integrate code from DESY to support redundant IOCs Add more regression tests Remove stuff that is ugly and obsolete

PV layer (a C++ wrapper around CA or other protocols) devSequencer (device support for monitoring seq’s internal state)

Lift further restrictions

allow foreign (C) types to be used in declarations define data types (e.g. struct) in SNL?

New notation for assign, monitor, sync, etc.

all extra attributes of a variable in one place

  • bviate 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

slide-98
SLIDE 98

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Next Steps

Integrate code from DESY to support redundant IOCs Add more regression tests Remove stuff that is ugly and obsolete

PV layer (a C++ wrapper around CA or other protocols) devSequencer (device support for monitoring seq’s internal state)

Lift further restrictions

allow foreign (C) types to be used in declarations define data types (e.g. struct) in SNL?

New notation for assign, monitor, sync, etc.

all extra attributes of a variable in one place

  • bviate 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

slide-99
SLIDE 99

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Summary

For a long time the Sequencer suffered from neglect. This has changed, it is again actively maintained, new features are being added, bugs are getting fixed, even deep and difficult ones. The 2.1.x releases prove that many of the traditional limitations and restrictions in SNL can be overcome with reasonable effort by suitable re-engineering. Expect further improvements in version 2.2.

slide-100
SLIDE 100

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Summary

For a long time the Sequencer suffered from neglect. This has changed, it is again actively maintained, new features are being added, bugs are getting fixed, even deep and difficult ones. The 2.1.x releases prove that many of the traditional limitations and restrictions in SNL can be overcome with reasonable effort by suitable re-engineering. Expect further improvements in version 2.2.

slide-101
SLIDE 101

Sequencer 2.1 Ben Franksen Introduction

SNL in a Nutshell Limitations

What’s New

Overview Scoped Variables Safe Mode Problem Solution

Next Steps Summary

Further Reading

http://www-csr.bessy.de/control/SoftDist/sequencer/

slide-102
SLIDE 102

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

5

Appendix Types and Declarations Declaration Example Rationale for Safe Mode Procedures

slide-103
SLIDE 103

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Outline

5

Appendix Types and Declarations Declaration Example Rationale for Safe Mode Procedures

slide-104
SLIDE 104

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-105
SLIDE 105

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-106
SLIDE 106

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-107
SLIDE 107

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-108
SLIDE 108

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-109
SLIDE 109

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-110
SLIDE 110

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Types and Declarations

Type expressions

any combination of pointer + array + base types (e.g. string (*a4ps[4])[5]) fixed size integral types as defined in C99: int8 t, int16 t, int32 t, uint8 t, uint16 t, uint32 t

Declaration Syntax

Multiple variables in one declaration Initialization, including aggregate (array) initializers

All this should work as in C

slide-111
SLIDE 111

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Outline

5

Appendix Types and Declarations Declaration Example Rationale for Safe Mode Procedures

slide-112
SLIDE 112

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

A Real-World Example

ss AICresponsibleStates { state st process { int resp[MAXSEG][MAXERR] = { /* Segment * ERROR: blTs, blW, idTs, idW, d1ts, d1w, d2ts, d2w, landau, vacuum */ /*******************************************************************************/ /* seg[1] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[2] */ { 2, 2, 2, 1, 1, 1, 1, 2, 1, 1}, /* seg[3] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[4] */ { 2, 2, 2, 1, 1, 1, 1, 1, 1, 1}, /* seg[5] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[6] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, }; when(delay(1)) { int isE = 0, isM = 0; int s, e; for( s = 0; s < MAXSEG; s++ ) { if( seg[s] == 1 ) { /* segments: 0=ok */ for( e = 0; e < MAXERR; e++ ) { if( err[e] == 0 ) { /* errors: 1=ok */ if( resp[s][e] == 1 ) { isM = 1; } if( resp[s][e] == 2 ) { isE = 2; } } } } } AICresponsible = isE + isM; pvPut(AICresponsible); } state st process } }

declaration local to state (multi-variable) declarations local to transition scalar initializers array initializer

slide-113
SLIDE 113

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

A Real-World Example

ss AICresponsibleStates { state st process { int resp[MAXSEG][MAXERR] = { /* Segment * ERROR: blTs, blW, idTs, idW, d1ts, d1w, d2ts, d2w, landau, vacuum */ /*******************************************************************************/ /* seg[1] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[2] */ { 2, 2, 2, 1, 1, 1, 1, 2, 1, 1}, /* seg[3] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[4] */ { 2, 2, 2, 1, 1, 1, 1, 1, 1, 1}, /* seg[5] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[6] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, }; when(delay(1)) { int isE = 0, isM = 0; int s, e; for( s = 0; s < MAXSEG; s++ ) { if( seg[s] == 1 ) { /* segments: 0=ok */ for( e = 0; e < MAXERR; e++ ) { if( err[e] == 0 ) { /* errors: 1=ok */ if( resp[s][e] == 1 ) { isM = 1; } if( resp[s][e] == 2 ) { isE = 2; } } } } } AICresponsible = isE + isM; pvPut(AICresponsible); } state st process } }

declaration local to state (multi-variable) declarations local to transition scalar initializers array initializer

slide-114
SLIDE 114

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

A Real-World Example

ss AICresponsibleStates { state st process { int resp[MAXSEG][MAXERR] = { /* Segment * ERROR: blTs, blW, idTs, idW, d1ts, d1w, d2ts, d2w, landau, vacuum */ /*******************************************************************************/ /* seg[1] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[2] */ { 2, 2, 2, 1, 1, 1, 1, 2, 1, 1}, /* seg[3] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[4] */ { 2, 2, 2, 1, 1, 1, 1, 1, 1, 1}, /* seg[5] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[6] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, }; when(delay(1)) { int isE = 0, isM = 0; int s, e; for( s = 0; s < MAXSEG; s++ ) { if( seg[s] == 1 ) { /* segments: 0=ok */ for( e = 0; e < MAXERR; e++ ) { if( err[e] == 0 ) { /* errors: 1=ok */ if( resp[s][e] == 1 ) { isM = 1; } if( resp[s][e] == 2 ) { isE = 2; } } } } } AICresponsible = isE + isM; pvPut(AICresponsible); } state st process } }

declaration local to state (multi-variable) declarations local to transition scalar initializers array initializer

slide-115
SLIDE 115

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

A Real-World Example

ss AICresponsibleStates { state st process { int resp[MAXSEG][MAXERR] = { /* Segment * ERROR: blTs, blW, idTs, idW, d1ts, d1w, d2ts, d2w, landau, vacuum */ /*******************************************************************************/ /* seg[1] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[2] */ { 2, 2, 2, 1, 1, 1, 1, 2, 1, 1}, /* seg[3] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[4] */ { 2, 2, 2, 1, 1, 1, 1, 1, 1, 1}, /* seg[5] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[6] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, }; when(delay(1)) { int isE = 0, isM = 0; int s, e; for( s = 0; s < MAXSEG; s++ ) { if( seg[s] == 1 ) { /* segments: 0=ok */ for( e = 0; e < MAXERR; e++ ) { if( err[e] == 0 ) { /* errors: 1=ok */ if( resp[s][e] == 1 ) { isM = 1; } if( resp[s][e] == 2 ) { isE = 2; } } } } } AICresponsible = isE + isM; pvPut(AICresponsible); } state st process } }

declaration local to state (multi-variable) declarations local to transition scalar initializers array initializer

slide-116
SLIDE 116

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

A Real-World Example

ss AICresponsibleStates { state st process { int resp[MAXSEG][MAXERR] = { /* Segment * ERROR: blTs, blW, idTs, idW, d1ts, d1w, d2ts, d2w, landau, vacuum */ /*******************************************************************************/ /* seg[1] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[2] */ { 2, 2, 2, 1, 1, 1, 1, 2, 1, 1}, /* seg[3] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[4] */ { 2, 2, 2, 1, 1, 1, 1, 1, 1, 1}, /* seg[5] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, /* seg[6] */ { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1}, }; when(delay(1)) { int isE = 0, isM = 0; int s, e; for( s = 0; s < MAXSEG; s++ ) { if( seg[s] == 1 ) { /* segments: 0=ok */ for( e = 0; e < MAXERR; e++ ) { if( err[e] == 0 ) { /* errors: 1=ok */ if( resp[s][e] == 1 ) { isM = 1; } if( resp[s][e] == 2 ) { isE = 2; } } } } } AICresponsible = isE + isM; pvPut(AICresponsible); } state st process } }

declaration local to state (multi-variable) declarations local to transition scalar initializers array initializer

slide-117
SLIDE 117

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Outline

5

Appendix Types and Declarations Declaration Example Rationale for Safe Mode Procedures

slide-118
SLIDE 118

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-119
SLIDE 119

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-120
SLIDE 120

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-121
SLIDE 121

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-122
SLIDE 122

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-123
SLIDE 123

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-124
SLIDE 124

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-125
SLIDE 125

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Safe Mode: Rationale

Why not simply lock variables? No programmer intervention should be needed Simultaneously lock all variables used in an action block during the execution of that block What if action code calls epicsThreadSleep? Locking would prevent

  • ther state sets that use these variables from proceeding

the CA callback thread from proceeding Note: there is only one CA callback thread for all SNL programs on the same IOC

return to main talk

slide-126
SLIDE 126

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Outline

5

Appendix Types and Declarations Declaration Example Rationale for Safe Mode Procedures

slide-127
SLIDE 127

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk

slide-128
SLIDE 128

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk

slide-129
SLIDE 129

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk

slide-130
SLIDE 130

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk

slide-131
SLIDE 131

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk

slide-132
SLIDE 132

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk

slide-133
SLIDE 133

Sequencer 2.1 Ben Franksen Appendix

Types and Declarations Declaration Example Rationale for Safe Mode Procedures

Procedures: Parameterizable State Sets

Rationale

add abstraction to SNL avoid repetition, reduce cut and paste

  • bviate the need for escape to C code

Design

syntactically like a state set with parameters but runtime behavior is rather like a procedure call, i.e. synchronous calling a procedure

call procedure name(arg1, arg2, ...);

returning from a procedure

when(...) {...} return

Implementation

not easy, needs deep refactoring don’t hold your breath

return to main talk