Jameson Rollins August 26, 2013 LIGO-G1300872-v1 Outline 1 - - PowerPoint PPT Presentation

jameson rollins
SMART_READER_LITE
LIVE PREVIEW

Jameson Rollins August 26, 2013 LIGO-G1300872-v1 Outline 1 - - PowerPoint PPT Presentation

Advanced LIGO Guardian Review Jameson Rollins August 26, 2013 LIGO-G1300872-v1 Outline 1 Introduction 2 System description and behavior 3 Case study: IMC 4 Technical Issues and open questions 5 Status and Plans 6 Appendices Guardian scripts


slide-1
SLIDE 1

Advanced LIGO Guardian Review

Jameson Rollins

August 26, 2013

LIGO-G1300872-v1

slide-2
SLIDE 2

Outline

1 Introduction 2 System description and behavior 3 Case study: IMC 4 Technical Issues and open questions 5 Status and Plans 6 Appendices

Guardian scripts System description directory The guardian program Links

LIGO-G1300872-v1 2/ 70

slide-3
SLIDE 3

Introduction

slide-4
SLIDE 4

Introduction

Guardian is the Advanced LIGO automation system. It will control the global state of the interferometer by coordinating the states of all interferometer subsystems. In Initial LIGO, automation was handled by a handful of “autolocker” scripts. These scripts were slow, monolithic, and

  • unreliable. In the face of the significantly increased complexity
  • f aLIGO this model fails to scale.

aLIGO needed a unified way to manage states and automate the control of all the various interferometer subsystems... = ⇒ Guardian.

LIGO-G1300872-v1 4/ 70

slide-5
SLIDE 5

Design concept

The original aLIGO Guardian design was proposed by Sam Waldman and Matt Evans: Distributed Guardian supervisor processes oversee specific sub-domains of the interferometer, or systems, i.e., subsets of EPICS channels corresponding to discrete domains of control of the IFO. Guardian understands states for systems. The supervisors handle moving their systems between states upon request,

  • r based on state changes of the underlying physical

system. A hierarchy of Guardians control the full IFO, with top level manager systems controlling sets of lower-levels systems, down to lowest level module systems that talk directly to the front-ends.

LIGO-G1300872-v1 5/ 70

slide-6
SLIDE 6

Overview

Top level managers control lower level subordinates, down to the lowest level modules that talk directly to the RCG front-ends and Beckhoff. Strict hierarchy is enforced by appending domain-specific channel prefix to all system channel access calls. This ensures that no two guardians compete for control of the same domain.

RCG model RCG model

Beckhoff

IOP IOP RCG model

IFO

PSL SUS SEI ISC

RCG model RCG model IOP

SUS SEI physical plant IO realtime control Guardian (EPICS)

EtherCat PCIe

ITM ETM LIGO-G1300872-v1 6/ 70

slide-7
SLIDE 7

Issues

Other than stalled development, there were issues with the

  • riginal design and implementation that needed to be addressed:

Too dependent on guard scripts reporting their own state/status. This is extremely fragile, and required scripts to have a lot of boiler plate. Lack of structure was confusing, potentially leading to non-deterministic behavior. It was unfinished. Important behavior was undefined, and lots of needed functionality was missing (particularly in regard to the critical system supervisor). Perl was an unfortunate language choice (pass´ e, difficult syntax, missing or unsupported libraries, etc.)

LIGO-G1300872-v1 7/ 70

slide-8
SLIDE 8

Recent work

Recently, Guardian has been under heavy development: Move to Python: more modern, very intuitive syntax, more useful libraries, better EPICS bindings, well documented, etc. New Guardian python “interpreter” executes python scripts with pre-loaded Guardian environment. Much-needed structure added to system and state descriptions. System graphs are now fundamental objects describing system behavior.

LIGO-G1300872-v1 8/ 70

slide-9
SLIDE 9

Recent work

The most work has gone in to the system supervisor program, which is really the core of Guardian. It has been completely

  • verhauled and now:

completely handles control and reporting of system state acts as its own channel access server, providing its own EPICS control and status records loads system descriptions in a highly structured way that is better able to identify bugs in system descriptions uses system graphs to calculate state sequences executes scripts with the new interpreter, in a tightly managed environment better process management better user interface

LIGO-G1300872-v1 9/ 70

slide-10
SLIDE 10

Recent work

Recently we attempted to put the LHO input mode cleaner (IMC) and all of its subsystems under “new” Guardian control. We didn’t quite get there, but the effort proved to be very useful and informative. During the experiment, the Guardian structure was overhauled to behaves much more like a true state machine. This was strongly informed by the needs of ISC, particularly in regards to cavity locking and lock monitoring, and good recent discussions with commissioners.

LIGO-G1300872-v1 10/ 70

slide-11
SLIDE 11

System description and behavior

slide-12
SLIDE 12

Systems

Each Guardian supervisor process oversees a

  • system. Each system represents a domain
  • f control of the IFO.

At the manager level, the domain is the set

  • f subordinate guardians.

At the module level, the domain is the set of EPICS records with a particular channel prefix (e.g. H1:SUS-ITMX_). IFO

RCG model RCG model IOP

SUS SEI ITM SUS

IFO

ITM

RCG model

LIGO-G1300872-v1 12/ 70

slide-13
SLIDE 13

System states and graphs

Systems are composed of states, connected together to form directed graphs. States are nodes, and directed edges point to adjacent states that can be reached directly. These graphs fundamentally describe the system and determine its behavior.

LOCKED DOWN BOOST WFSON LOWNOISE+WFS ACQUIRE LOWNOISE UP WFSOFF

IMC system graph

LIGO-G1300872-v1 13/ 70

slide-14
SLIDE 14

System states and graphs

Standard graph analysis has already proven very useful for designing systems, understanding their behavior, debugging, etc. The supervisor currently uses standard “shortest path” algorithms for determining the next target state given a higher-level requested state (state sequences). To the right is an auto-generated graph of the ISC IMC system.

LOCKED DOWN BOOST WFSON LOWNOISE+WFS ACQUIRE LOWNOISE UP WFSOFF

IMC system graph

LIGO-G1300872-v1 14/ 70

slide-15
SLIDE 15

Inheritance

Inheritance allows systems to inherit from a base system description. SUS is using this extensively, defining a base system for all suspensions...

MISALIGNED SAFE WDWATCH DAMPED ALIGNED

SUS “common”

LIGO-G1300872-v1 15/ 70

slide-16
SLIDE 16

Inheritance

Inheritance allows systems to inherit from a base system description. SUS is using this extensively, defining a base system for all suspensions... ...that is extended for optics that need additional ISC control states.

MISALIGNED SAFE WDWATCH DAMPED ALIGNED PRELOCK ACQUIRE LOWNOISE

SUS-MC2

LIGO-G1300872-v1 16/ 70

slide-17
SLIDE 17

State behavior

LIGO-G1300872-v1 17/ 70 snap

state= target? CONTINUE N running? Y manual? script status

run

Y N Y N RETURN FAIL new target? N

ERROR

Y

Above is the basic state flow control in the supervisor. Upon entering state: EPICS snap shot applied (if specified) state run script launched (if specified)

slide-18
SLIDE 18

State behavior

LIGO-G1300872-v1 18/ 70 snap

state= target? CONTINUE N running? Y manual? script status

run

Y N Y N RETURN FAIL new target? N

ERROR

Y

Scripts are executed in the background in separate, tightly monitored processes via the Guardian interpreter. Supervisor waits for script processes to complete, but can terminate them as needed (currently not reflected in diagram above).

slide-19
SLIDE 19

State behavior

LIGO-G1300872-v1 19/ 70 snap

state= target? CONTINUE N running? Y manual? script status

run

Y N Y N RETURN FAIL new target? N

ERROR

Y

Supervisor then loops depending on manual mode setting and script return status: CONTINUE: run script again FAIL: enter manual mode with error flag RETURN: move to state completion

slide-20
SLIDE 20

State behavior

LIGO-G1300872-v1 20/ 70 snap

state= target? Y N

snap

state= target? CONTINUE N running? Y manual? script status

run

Y N Y N RETURN FAIL new target? N

ERROR

Y

The supervisor constantly monitors its REQUEST channel and calculates new target states from the system graph if the request changes. Requests are accepted or denied based on the existence of paths from the current state to the requested state.

slide-21
SLIDE 21

State behavior

LIGO-G1300872-v1 21/ 70 snap

state= target? Y N

snap

state= target? CONTINUE N running? Y manual? script status

run

Y N Y N RETURN FAIL new target? N

ERROR

Y

Supervisor now functions more like a true finite state machines. In fact, the supervisor can be effectively treated as a programmable logic controller (PLC), and systems could be programmed as standard state logic controllers. This was the approach taken for the IMC Guardian.

slide-22
SLIDE 22

User interface

The supervisor is controlled by, and reports its status via, its own set of EPICS records. States are loaded as ENUM records: eases selection (improper states are rejected immediately) can be provided as drop-down lists in MEDM screens state records can be recorded in frames without modification

LIGO-G1300872-v1 22/ 70

slide-23
SLIDE 23

Case study: IMC

slide-24
SLIDE 24

Case study: IMC

IFO IMC SUS MC1 SUS MC3 SUS MC2 PSL ISC IMC HPI HAM2 ISI HAM2 IFO HAM2 HPI HAM3 ISI HAM3 IFO HAM3

Recently at Hanford we attempted to build out the input mode cleaner (IMC) Guardian as a proof of principle. The full IMC control might involve about 12 components.

LIGO-G1300872-v1 24/ 70

slide-25
SLIDE 25

Case study: IMC

IFO IMC SUS MC1 SUS MC3 SUS MC2 PSL ISC IMC HPI HAM2 ISI HAM2 IFO HAM2 HPI HAM3 ISI HAM3 IFO HAM3 IFO IMC SUS MC2 ISC IMC

Recently at Hanford we attempted to build out the input mode cleaner (IMC) Guardian as a proof of principle. The full IMC control might involve about 12 components. Ambitions were scaled back to implementing just the components involved in IMC cavity locking: IMC: H1:IMC- SUS-MC2: H1:SUS-MC2_ SYS-IMC: IMC manager

LIGO-G1300872-v1 25/ 70

slide-26
SLIDE 26

Useful types of state behavior

We implemented three different kinds of states for this test:

SINGLE

State run script is executed once only, then state completes.

WAIT

Run script executed in CONTINUE loop, waiting for condition (e.g. cavity trans power above threshold). Once condition is met, state completes.

WATCH

Run script executed in CONTINUE loop, watching for condition (power drops below threshold). Once condition is met, script specifies a GOTO for a new target state, then state completes.

LIGO-G1300872-v1 26/ 70

slide-27
SLIDE 27

IMC locking

LIGO-G1300872-v1 27/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE

We started by building out graphs and state code for the system components, SUS-MC2 and IMC, and manually put them through their paces.

slide-28
SLIDE 28

IMC locking

LIGO-G1300872-v1 28/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE

We then built the SYS-IMC manager to oversee SUS-MC2 and IMC.

slide-29
SLIDE 29

IMC locking

LIGO-G1300872-v1 29/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED

Walk through of a LOWNOISE SYS-IMC request...

slide-30
SLIDE 30

IMC locking

LIGO-G1300872-v1 30/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED

From initialization, where no state is defined, jump to DOWN goto

  • state. This requests ALIGNED from SUS-MC2 and DOWN from

IMC, and waits for them to reach those states.

slide-31
SLIDE 31

IMC locking

LIGO-G1300872-v1 31/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED PRELOCK ACQUIRE

LOCKED

LOCKED ACQUIRE UP

Once subordinates reach requested states, SYS-IMC proceeds to

  • LOCKED. IMC waits in ACQUIRE for the cavity to lock, and

proceeds immediately to LOCKED once it catches.

slide-32
SLIDE 32

IMC locking

LIGO-G1300872-v1 32/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED PRELOCK ACQUIRE

LOCKED

LOCKED ACQUIRE UP BOOST LOWNOISE

BOOST

LOWNOISE

Once IMC reaches LOCKED, SYS-IMC proceeds immediately to BOOST, which requests the LOWNOISE configurations from SUS-MC2 and IMC.

slide-33
SLIDE 33

IMC locking

LIGO-G1300872-v1 33/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED PRELOCK ACQUIRE

LOCKED

LOCKED ACQUIRE UP BOOST LOWNOISE

BOOST

LOWNOISE

Finally, SYS-IMC reaches the requested LOWNOISE state where it sits and watches its subordinate states. IMC LOWNOISE is likewise watching the cavity transmitted power.

slide-34
SLIDE 34

IMC locking

LIGO-G1300872-v1 34/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED PRELOCK ACQUIRE

LOCKED

LOCKED ACQUIRE UP BOOST LOWNOISE

BOOST

LOWNOISE

If the cavity drops lock, IMC immediately drops to DOWN. SYS-IMC notices the IMC state change and drops to LOCKED, which requests SUS-MC2 → ACQUIRE, IMC → LOCKED.

slide-35
SLIDE 35

IMC locking

LIGO-G1300872-v1 35/ 70

LOCKED

LOCKED ACQUIRE UP WFSON WFSOFF BOOST LOWNOISE

BOOST

LOWNOISE+WFS

LOWNOISE+WFS WFSON WFSOFF

SUS-MC2 SYS-IMC IMC

WATCH SINGLE WAIT

DOWN

DOWN

LOWNOISE

SAFE MISALIGNED ALIGNED WDWATCH DAMPED PRELOCK ACQUIRE LOWNOISE ALIGNED DOWN

DOWN LOWNOISE

SAFE WDWATCH DAMPED PRELOCK ACQUIRE

LOCKED

LOCKED ACQUIRE UP BOOST LOWNOISE

BOOST

LOWNOISE

Note the SUS-MC2 path from LOWNOISE → PRELOCK, which helps get the suspension back into the ACQUIRE state quickly.

slide-36
SLIDE 36

Results

While we weren’t able to accomplish everything we set out to, the experiment was nonetheless very successful. Worked closely with SUS team to write much of the base SUS code and system descriptions. Old IMC autolocker was completely translated to new Guardian structure. Successfully demonstrated the supervisor running on real systems: worked very well (quick response, fine-grained control). Clearly demonstrated usefulness for commissioning. Successfully demonstrated manager Guardians controlling subordinate systems. Developed useful development and commissioning tools. Weren’t quite able to get it to the point of leaving it running on its own, but very close.

LIGO-G1300872-v1 36/ 70

slide-37
SLIDE 37

Technical Issues and open questions

slide-38
SLIDE 38

State verification and alarm handling

Biggest open question: How do we want to handle state verification and alarming? Current implementation has no special alarm handling: states can be programmed to check and respond to channels or alarms as needed (e.g. WATCH states as described above.) This doesn’t work for long running state run scripts. But are long running scripts really necessary? Can we instead program systems with PLC-like state logic, with short-running scripts executed in loops? What else is needed to accomplish this? Do we need alarms to trigger termination of long-running scripts at the supervisor level?

LIGO-G1300872-v1 38/ 70

slide-39
SLIDE 39

State verification and alarm handling

Do we want comprehensive state snapshots that include all settings at alarm levels? Or do we want to separate settings from alarm levels? There is some worry that full state snap shots (settings & alarms) will be: fragile: susceptible to capturing unintended changes expensive: take too long to apply on state transitions However, without full state setting snap shots, we will have to keep track of all changes as we move to higher level states so that they can be effectively reverted when dropping back down.

LIGO-G1300872-v1 39/ 70

slide-40
SLIDE 40

System guardian → front-end mapping

Front end alarm status checksums and alarm counts are potentially very useful, but they are currently calculated only

  • n a per-front end model basis.

This means that they aren’t useful for systems that share a front end model, i.e. top-names. We either need to calculate the checksums and alarm counts on a per-top-name basis (requires RCG code changes), or break things with a single domain of control per front-end process (no top-names). (I think we should do both.) ISC is currently the main culprit: ASC and ALS control share the same front end models.

LIGO-G1300872-v1 40/ 70

slide-41
SLIDE 41

Timing

Timing, in the sense of coordinate synchronous control or multiple systems, is still an issue, even though the “party line” has been that it isn’t. Need more test and profiling to benchmark how fast channel access is in practice, and how fast state transitions can happen, particularly triggered state transitions of the managers.

LIGO-G1300872-v1 41/ 70

slide-42
SLIDE 42

“Kernal access”

RCG has in development the ability bypass EPICS entirely and simply write directly to shared memory on the front ends. precisely time stamped reads and writes more robust networking issues/latencies go away potentially much faster in applying large snapshots This would initially be applicable to module-level Guardians

  • nly.

Can imagine leveraging this with timed execution for even more PLC-like behavior on the front ends.

LIGO-G1300872-v1 42/ 70

slide-43
SLIDE 43

Channel pre-allocation

It may be desirable to require pre-defining all channel to be accessed in scripts (i.e. in a script header). This would allow for: pre-connecting to all channels before script execution, to catch channel errors before script even begins to execute more easily accounting for/auditing all channel access

LIGO-G1300872-v1 43/ 70

slide-44
SLIDE 44

Other considerations

Should we “codify” distinction between SINGLE/WAIT/WATCH state types? Could potentially clock execution of supervisor run loop by hooking into front end counter (ala front end IOCs). What else?...

LIGO-G1300872-v1 44/ 70

slide-45
SLIDE 45

Status and Plans

slide-46
SLIDE 46

Status

Guardian interpreter and shell are fully operational. Python system description class fully functional. Supervisor has been demonstrated controlling real systems. SEI and SUS teams have writen/converted all code to

  • Guardian. Code has been tested at Stanford and LHO.

LIGO-G1300872-v1 46/ 70

slide-47
SLIDE 47

Plans

Back to LHO to finish testing IMC Guardian. Fully integrate the rest of the IMC subsystems (PSL, SEI, HEPI, etc.). Build out and test supervisor management/control infrastructure. Move quickly to LLO to train commissioners and deploy infrastructure and subsystem Guardians. Flesh out all managers and lock acquisition code.

LIGO-G1300872-v1 47/ 70

slide-48
SLIDE 48

TODO

TEST SUITE (system library tests already in place) documentation fill out cdsutils (tds/ezca) library guardutil: more features

create/modify snapshots for states improve system graphs

guardctl: supervisor helper utility:

start/stop/restart supervisor processes on guard machine display logs

move script Continue loops inside interpreter for maintaining channel access connections across runs handle library paths for systems packaging/release ......

LIGO-G1300872-v1 48/ 70

slide-49
SLIDE 49

Appendices

slide-50
SLIDE 50

Guardian scripts

slide-51
SLIDE 51

Guardian scripts

Guardian scripts are basic Python, with a pre-loaded environment specific to our needs:

#!/usr/bin/env guardian # −∗− mode: python −∗− for dof in [’DARM’, ’CARM’, ’MICH’]: ezca.switch(dof, ’OUTPUT’, ’ON’) ...

Note: no boilerplate! First two comment lines are optional: shebang for running script directly from command line, and editor mode information.

LIGO-G1300872-v1 51/ 70

slide-52
SLIDE 52

Guardian script environment

The pre-loaded environment will provide useful variables and functions, channel access class, etc. Some useful system variables:

IFO = ’H1’ SUBSYS = ’SUS−MC2’

LIGO-G1300872-v1 52/ 70

slide-53
SLIDE 53

Built-in Guardian commands

Write to the system logger:

Log(’This is a log message’)

Terminate script with failure and message:

Fail(’Failed to lock.’)

Execute script again:

Continue()

Complete state:

Return()

Complete state, and specify new target state:

Goto(’STATE0’)

LIGO-G1300872-v1 53/ 70

slide-54
SLIDE 54

Channel access: PyEpics

Channel access is handled via the very nice PyEpics library:

import epics chan = epics.PV(’H1:LSC−DARM OUTPUT’) value = chan.get()

PyEpics provides a high-level PV (“process variable”) class, a Device class for channel name scoping, channel subscription and callbacks, etc. Good stuff.

LIGO-G1300872-v1 54/ 70

slide-55
SLIDE 55

Channel access: EZCA

However, an EZCA class, pre-loaded by guardian and initialized with the system prefix, should provide all CA methods we need:

ezca.switch(’DARM’, ’OUTPUT’, ’ON’) ezca.read(’DARM OFFSET’) ezca.write(’DARM OFFSET’, 10)

With IFO = ’H1’ and system = ’LSC’, the above would switch

  • n the H1:LSC-DARM filter bank output, and read/write

H1:LSC-DARM OFFSET. We can extend this class as needed (ezca.step(), ezca.demod(), etc.).

LIGO-G1300872-v1 55/ 70

slide-56
SLIDE 56

Dynamically loadable modules/libraries

Python, and therefore guardian, supports dynamically-loadable modules:

import math foo = ezca.read(’FOO’) bar = math.sin(foo ∗ math.pi)

(We can pre-load modules by default if desired (* from math, time.sleep, etc.) Subsystems can also define their own libraries as needed:

import isi isi.stop bouncing()

LIGO-G1300872-v1 56/ 70

slide-57
SLIDE 57

NDS

Real-time test point access is available via the very nice NDS2 client python bindings:

import nds2 conn = nds2.connection(’h1nds’, 31200) for buf in conn.iterate([’H1:LSC−DARM INPUT’]): do stuff(buf[0].data)

We will want to wrap this as well, to specify site-specific connection info and provide channel prefixing and convenience functions, i.e. TDS:

foo = tds.avg(’DARM INPUT’, 2)

LIGO-G1300872-v1 57/ 70

slide-58
SLIDE 58

System description directory

slide-59
SLIDE 59

System description directory

Systems are described by a system description directory The system “states” directory contains state description directories for each system state: <SYSTEM>/guard

/states/<STATE>/... /<STATE>/... /<STATE>/... /...

LIGO-G1300872-v1 59/ 70

slide-60
SLIDE 60

System state directories

Each state directory contains the following description structure: <STATE>/snap

/run /successors/<STATE> /... [/goto]

LIGO-G1300872-v1 60/ 70

slide-61
SLIDE 61

Anatomy of a state: snap

<STATE>/snap snap: EPICS values and alarm levels to be set immediately upon entering state.

LIGO-G1300872-v1 61/ 70

slide-62
SLIDE 62

Anatomy of a state: snap

<STATE>/run run: State run script. Executed as main function of state.

LIGO-G1300872-v1 62/ 70

slide-63
SLIDE 63

Anatomy of a state: successors

<STATE>/successors/<STATE>

/...

successors: directory of files that indicate directly reachable states from this state. State files are just indicators (empty files).

LIGO-G1300872-v1 63/ 70

slide-64
SLIDE 64

Anatomy of a state: goto

<STATE>/goto goto: flag (empty file) that indicates that the state is accessible from ANYWHERE. It this file is not present, and there are no transits to this state defined in other state transit directories, then the state will not be accessible by guardian.

LIGO-G1300872-v1 64/ 70

slide-65
SLIDE 65

System description Python class

A GuardSystem python class loads a system description into a python object from which all system data can be easily accessed: Full system graph Inheritance GuardState object for all system states Direct access to all scripts/files

LIGO-G1300872-v1 65/ 70

slide-66
SLIDE 66

The guardian program

slide-67
SLIDE 67

The Guardian program

The guardian program handles all the core functionality. It will have three modes of operation: script interpreter interactive shell system supervisor

LIGO-G1300872-v1 67/ 70

slide-68
SLIDE 68

The interpreter

Guardian scripts are executed by the guardian interpreter. When given a script as first argument and system name as second argument, guardian executes the script in the specially-prepped python environment: $ guardian /path/to/guard/script If the first line of the script is the guardian shebang line:

#!/usr/bin/env guardian

then it will be directly executable from the command line or MEDM, e.g.: $ /path/to/guard/script

LIGO-G1300872-v1 68/ 70

slide-69
SLIDE 69

The interactive shell

When called on its own, guardian will operate in interactive (shell) mode: $ guardian

aLIGO Guardian Shell system: H1 prefix: H1: In [1]: ezca.read(’LSC−DARM OFFSET ’) Out[1]: 3.0

This is just an interactive ipython shell pre-loaded with the standard guardian environment. The shell is directly compatible with scripts; all commands that work in the shell can be copy/pasted directly into guardian scripts (modulo subsystem specification).

LIGO-G1300872-v1 69/ 70

slide-70
SLIDE 70

The system supervisor

Finally, system supervisor mode is the main workhorse of the Guardian system. When given a system directory as first argument, a system name as second argument, guardian enters system supervisor mode: $ guardian /path/to/guard/system/dir/ In this mode, guardian becomes its own channel access server, listening for commands via EPICS, and monitoring system EPICS alarms.

LIGO-G1300872-v1 70/ 70

slide-71
SLIDE 71

The system supervisor

Run scripts are executed in separate worker process, to isolate them from the main supervisor thread. Script failures put the system into MANUAL mode with an ERROR flag. The supervisor logs all of its activity and status to stdout, and reports its status via GRD EPICS records. In production, unified management of the supervisor processes (on e.g. h1guardian0) will handle, start/stop/restart and all

  • logging. Process control and logging will be available from

anywhere in the control room.

LIGO-G1300872-v1 71/ 70

slide-72
SLIDE 72

Guard EPICS records

Each guardian supervisor instantiates its own set of EPICS records for its system: For control: <IFO>:GRD-<SYS> REQUEST (enum) requested state <IFO>:GRD-<SYS> MANUAL (int) MANUAL mode request For reporting system status: <IFO>:GRD-<SYS> STATE (enum) current state <IFO>:GRD-<SYS> TARGET (enum) target state <IFO>:GRD-<SYS> STATUS (enum) supervisor status <IFO>:GRD-<SYS> ERROR (bool) error flag <IFO>:GRD-<SYS> WORKER (enum) worker status <IFO>:GRD-<SYS> MESSAGE (string) log message

LIGO-G1300872-v1 72/ 70

slide-73
SLIDE 73

Links

slide-74
SLIDE 74

References

“Old” Guardian overviews: https://dcc.ligo.org/LIGO-T1000131 https://dcc.ligo.org/LIGO-D1101755 https://dcc.ligo.org/LIGO-G1101189 Old Guardian MC auto-locker: https://dcc.ligo.org/LIGO-T1300126 ISI blend filters: https://dcc.ligo.org/LIGO-T1200126 LSC lock acquisition: https://dcc.ligo.org/LIGO-T1000294 https://dcc.ligo.org/LIGO-G1300226 Automation front end idea: https://dcc.ligo.org/LIGO-G1200608

LIGO-G1300872-v1 74/ 70