ACL An Introduction for Operators Brian Hendricks What

ACL An Introduction for Operators Brian Hendricks

What Does ACL Stand For, Anyway? • Originally, Accelerator Command Language • Also, ACNET Command Language • Sometimes, ACNET Control Language (not by me)

What is ACL? • “Simple” script language – borrows concepts from other languages • Interpreted, not compiled – runtime compilation available • Supports ACNET device notation (extended) • Implemented in ASCII text files and database text files (deprecated) • Leverages the power of CLIB and other libraries

What is ACL Used For? • Sequencer – eliminates the need for most new commands • Parameter page (also parameter window) – supports complex settings, custom displays, etc. • Synoptic displays – supports complex settings, creating data files, etc. • ACL Launch Service – supports launching scripts on accelerator events • Command line interface (general use) • Lex SA (original use)

How Can I Use ACL? • • • Command line interface (type in ‘acl’) Program tools IDE (‘ACL Edit/Run’) Sequencer command Parameter page and parameter window Web – https: //www-bd. fnal. gov/cgi-bin/acl. pl? acl={insert ACL code here} • Synoptic displays • Call it from your program using library interface • FSMDEV OAC

Language Components • • Commands (>200) Intrinsic functions (~1000) Device expressions Variables – expire when the current script ends – N-dimensional arrays • Symbols – expire when the calling program ends – N-dimensional arrays – names start with a dollar sign • Operators • Statement labels

ACL Commands • Device oriented – read, list, show, set, on, off, turn, reset, positive, negative, toggle, delta. Set , increment, decrement, compare, copy, download, restore, fill, ramp, enable, disable, bypass, activate, deactivate, search, logger. Get • Program control – loop, end. Loop, exit. Loop, while, end. While, continue, if, else. If, else, end. If, exit , on. Error, gosub, return, retry, break, on. Event, switch, end. Switch, case, end. Case • Special support – timer. Event, trigger, step. Motor, scope, bpm. Data, blm. Data, gpib, camac, timer 070

ACL Commands (2) • Input/output – print, output, input, host. Request • Script environment control – acl. Option, timeout, data. Event, ftd, data. Source • System information – setting. Log, alarm. Log, error. Log, event. Log, state. Log, audit. Log, node. Info, node, event. Info, mdat. Info, switch. Info, program. Info, user. Info, error. Text, downtime. Log, beam. Permit. Log, node. Audit. Log, console. Info

ACL Commands (3) • Variable control – declare, resize, redimension, import • run – runs other programs including other ACL scripts – can spawn off ACL scripts in a subprocess • wait – pauses the script for a period of time or until a clock event or state event occurs

ACL Commands (4) • Subroutines – gosub – begin with statement label – end with “return” command • Event handlers – on. Error – invoked when an error is detected • supports “retry” command – on. Event – invoked when a system event occurs – end with “return” command

ACL Commands (5) • Conditional compilation – parse. If, parse. Else, parse. Endif – determines which code is actually compiled – improves script efficiency – often used with creating device lists • can be used with the device. List /empty option for invalid parameter cases

ACL Operators • Arithmetic – +, -, *, /, ^, %, >>, <<, plus, minus, times • Logical – not, and, &&, or, ||, lxor • Comparison – <, >, <=, >=, =, ==, equals, !=, not equals • String – +, like, not like • Bitwise – &, |, xor

ACL Special Operators • is (is. Not) – device status – on, off, ready, tripped, remote, local, positive, negative, ramping, dc, good, alarming, enabled, disabled, bypassed, active, inactive, defined, undefined • has (doesnt. Have) – database attribute – reading, setting, status, control, analog. Alarm, digital. Alarm, reset. Control, on. Control, off. Control, positive. Control, negative. Control, on. Status, ready. Status, remote. Status, polarity. Status

Device Specifications • Property specification – {char}: {name}. reading -> reading – {char}? {name}. reading -> reading – {char}_{name}. setting -> setting – {char}|{name}. status -> status – {char}&{name}. control -> control – {char}@{name}. analog. Alarm -> analog alarm – {char}${name}. digital. Alarm -> digital alarm
![Device Specifications (2) • Array notation [begin. Index: end. Index] – Z: ACLTST -> Device Specifications (2) • Array notation [begin. Index: end. Index] – Z: ACLTST ->](http://slidetodoc.com/presentation_image_h2/318f1bc4689344761e1d5586aeaf3692/image-15.jpg)
Device Specifications (2) • Array notation [begin. Index: end. Index] – Z: ACLTST -> first element of the array – Z: ACLTST[2: 3] -> elements 2 through 3 – Z: ACLTST[] -> whole array • Length/offset notation {offset: length} – Z: ACLTST{0: 16} – Z: ACLTST{} -> whole array • data. Event={data event string} – @{data event string}

Device Modifiers • source – data source – accelerator (default) – db -> last database setting – sr: {file} -> save/restore file – dl: {date}: {node} -> data logger data – <-{data source} • scaling type – scaled (default), raw, primary

Device Field Specifiers • Only used for status and alarm properties • Normal dot notation • Examples – is. On, is. Ready, is. Positive, min, max, nominal, mask, limit. Data. Type, etc. – read M: OUTTMP. minimum

Device Display Types • ascii – display reading as ASCII text • state. Text – display as state text • bit. Status – display basic status with bit descriptions • node – display reading as an ACNET node value • acnet. Error – display reading as an ACNET error value

Device List Specifiers • name={string} (uses standard SQL wildcards) • node={node name} • type={device type string or number} • family={family device} • file={file name} • Many more…

Variables and Symbols • Data types – – – – – string -> character string double -> double precision floating point value integer -> 32 bit integer value long. Long -> 64 bit integer value logical -> boolean value date -> date in seconds milliseconds. Date -> date in milliseconds since the Epoch node -> ACNET node specification error -> ACNET error specification event -> TCLK event specification

Substitution Options • Substitute devices – G: DEVnnn – used anywhere a device expression can be used • Changeable devices – G: CDVnnn – used with change. Device command • Substitute strings – stringnnn or lstringnnn – literal string substitution

ACL’s Special Characters • Comment – ‘#’ and the dreaded ‘!’ – ‘!’ can also be used in ‘!=‘ and ‘!exists(variable)’ • in other cases use the “not” operator – comments text to end of line • End of line – ‘; ’ – allows multiple commands per line (command line) • Line continuation – ‘’ • Execute an ACL file – ‘@’

Intrinsic Symbols • • • $_value – last assigned value $_error_status – last error status $_error_device – last error device $_error_line – last error line $_error_count – count of the current error $_command_error – status of last command $_eof – indicates if an EOF has been reached $_num_device_args – number of device arguments $_num_string_args – number of string arguments

Example 1 Conditional Setting # Conditionally turn on a device if G: DEV 00 is off turn G: DEV 00 on end. If # check status of device # turn on the device

Example 2 Complex Setting # Turn Booster low level RF curves off turn B: BIAS 2 off turn B: BIASON off turn B: APGC off turn B: CIGC off negative B: VDFSM 1 # sends off command to old bias curve # sends off to the new DSP bias curve # sends off to the anode program curve # sends off to the cascode curve # switches polarity to (-) for DC operation # for the frequency curve on DSP VXI

Example 3 Process a List of Devices # Read a list of devices one at a time device. List/create devs name=M: OUT% # create a list of devices loop sizeof(device. List=devs) # loop over all devices read Q: DEVS # read the current device. List/increment devs # point to the next device in the list end. Loop

Example 4 Using an Error Handler on. Error my. Error. Handler # establish error handler read M: OUTTMP@’e, 2, e, 0’ # read device exit my. Error. Handler: # error handler if $_error_count < 2 and is. Retryable. Acnet. Error($_error_status) # retry this error print ‘Error accessing ‘ $_error_device ‘ at line ‘ $_error_line ‘ – ‘ $_error_status retry else # exit the script exit $_error_status end. If return

Example 5 Using a Device Status Handler on. Event handler ‘status, Z: ACLTST, on, =, 1, 0’ # establish event handler loop forever # infinite loop wait/msec 66 end. Loop handler: print ‘Device is on’ return # handle device on case

Sequencer Usage • ACL command – executes an ACL file – files are stored in the sequencer_acl MECCA project – supports script arguments • ACLCODE command – executes raw ACL code – supports multiple commands by using the “; ” operator • Pgm_Tools menu option allows running scripts from your area for debugging

Parameter Page Usage • Execute files or raw ACL code • Execution modes – – ACL> -> execute code and close interface ACL>+ -> execute code and leave display open ACL>> -> spawn off execution of code ACL># -> creates a real time ACL expression • Files are stored in the utility_acl MECCA project • Pgm_Tools menu option allows running scripts from your area for debugging

ACL Launch Service Usage • Supports executing ACL scripts on any accelerator data event • Supports persistent/daemon ACL scripts • Script execution is configured on page D 129 – specify data event – specify script file plus arguments • Data event parameters are passed to the script • Files are stored in the utility_acl MECCA project • Use D 132 to monitor scripts

Synoptic Usage • Test script from the command line • Commit script to utility_acl • Add ACL widget to display – flat file path is /usr/local/cbs_files/acl/utility/ • Connect ACL widget to a user input widget • Example - https: //wwwbd. fnal. gov/appix/start? p=60000393&a=/Work_in _progress/ACL_Example • Requires ACLDEV OAC and acld daemon

ACL Gotchas • Device lists – use /mutable option if you wish to use the list for different properties – can use conditional compilation to create only the lists you need (/empty option) – use Q: {list name} for individual access • Synonyms – very helpful but can result in name conflicts • Variables do not carry over in the command line interface

Best Practices • Keep operational scripts in the appropriate MECCA project (utility_acl or sequencer_acl) • Use incremental testing support before archiving • Use standard header comments • Use error handlers • Use simple expressions to place device readings in a variable rather than using read – “val = M: OUTTMP” vs “read/value=val M: OUTTMP”

Best Practices (contd) • Use the string concatenation operator (+) to combine strings • Use string functions rather than commands • Use named constants when appropriate • Use line continuation characters to manage long source lines • Use error handlers • Use device lists for greater efficiency • Use xxx_list commands for greater efficiency

Where Has It Been Used? • Machine control in the Sequencer – Dave Vander Meulen, Chip Edstrom et al • FAST support in Synoptic – Chip Edstrom • Machine studies – Chandra Bhat and Meghan Mc. Ateer • Machine monitor/control with ACL launch service – Brian Schupbach and Michael Wren

Where Has It Been Used (2) • Front end debugging/testing – Dennis Nicklaus, Jimmy You et al • Control system analysis/debugging – Me et al • Web-based utilities – Wally Kissel

Help for ACL • Web document – https: //www-bd. fnal. gov/issues/wiki/ACL – includes example scripts • Command line interface – ‘help’ for general help – ‘help {command}’ for command help – ‘help function {function name}’ for function help • Program Tools interface – ‘ACL Help’ for general help – ‘ACL Command Help’ for command help • Me

Other ACL Tools • View running ACL scripts (D 132) • spawned_acl – supports asynchronous execution of ACL scripts • acld – ACL script execution daemon – uses the ul_acld_protocol library • ACLDEV OAC – Java interface to acld • ACL database file editor (D 136) (deprecated) – place to edit scripts used in the parameter page and Lex SA – requires special permission to write files • ACL file launcher – supports launching a predefined ACL script (S 69)

Summary • Utilized in many environments – – – Sequencer Synoptic displays Parameter page ACL Launch Service testing (eg. front end debugging) examining the control system • Empowers end users – always feel free to suggest new features • Has grown to meet the needs of those users and will hopefully continue to grow







- Slides: 47