SIS XMLDSL Tutorial Jakub Wozniak BECODA 13022014 SIS
SIS XML/DSL Tutorial Jakub Wozniak BE-CO-DA 13/02/2014 SIS Tutorial 1
Agenda � What is SIS? � Architecture (short) � Configuration � Eclipse development � Documentation SIS Tutorial 2
Software Interlock System? � Software framework for data processing & action-taking � Helps protecting machines › Surveys states of devices / other systems › Abnormal situation beam cut � Protects against repetitive faulty conditions › limits radiation, extends equipment life-time, makes machine debug easier, etc SIS Tutorial 3
What SIS is NOT! � Not a hard RT system � Not a nanosecond reaction time � No Safety Integrity Level [X] (SIL-1. . 4) � Not there for human safety � As any software it might fail… � …although it was rarely the case! SIS Tutorial 4
SIS Instances � LHC-SIS (2665 subs , 5193 / 809 / 8 conditions) � SPS-SIS (974, 1163 / 193 / 17) � LHC-BIGSISTER (661, 749 / 66 / 36) – announcer � SPS-BIGSISTER ( 10 , 34 / 0 / 1 ) – beam quality, elogbook � LINAC 2 -WATCHDOG-SIS (56, 47 / 4 / 3) – beam conditions � ISO-SIS (35, 31 / 5 / 1) – alarms, status for Isolde vistar � PSB-SIS (24, 10 / 2) – Isolde comparator � CPS-SIS (27, 18 / 1 / 7) –TFID presence � CTF-SIS – various comparators � CTF-FEEDBACK-SIS – slow feedback system � LN 4 -SIS (under dev) - BI device, comparators SIS Tutorial 5
Architecture Export Action sis-core Timing event Tail-clipper Timing Alarms Logbook Boolean expression over channels: Permit =(A or B) and (D or (not C)) Data Processing Data buffer japc-monitoring Data Acquisition japc Acquisition Subscription channels Controls middleware Front-end A Middleware Front-end B Front-end C Front-end D Any Fesa Device + Any Japc Data. Source External Logs Systems Java
Permit Tree Example Permit channel Trigger Export BEAM_OK Timing / BIC … OR Logical Software Interlock Channels (LSICs) C 1_C 2 AND C 2_C 3 AND Individual Software C 1(P 1>100) C 2 B C 3 C C 4 Interlock Channels (ISICs) DEVICES INPUT P 1=DEV 1/Acquisition, P 2=DEV 2/Acquisition, etc SIS Tutorial 7
Configuration (What? ) � Subscriptions (parameters) � Tree logic (permits, channels) › ISIC -> value based conditions › LSIC -> boolean logic based conditions › Permit -> LSIC, tree root � Evaluation trigger � Exporters (actions on external systems) › › Timing Dumps BIC Logbook SIS Tutorial 8
Configuration (How? ) � DSL (Domain Specific Language) › Groovy based (Java like & compatible) › One language only › Compiler help, syntax highlighting & autocompletion in Eclipse � XML with › Velocity for text generation › Groovy for scriptlets (simple code) › Java for complex conditions SIS Tutorial 9
Permit Tree Example Permit channel Eval on ENDC of LHC Export BEAM_OK LX. TCL/Disable OR Logical Software Interlock Channels (LSICs) C 1_C 2 AND C 2_C 3 AND Individual Software C 1(P 1>100) C 2 B C 3 C C 4 Interlock Channels (ISICs) DEVICES INPUT P 1=DEV 1/Acquisition, P 2=DEV 2/Acquisition, etc SIS Tutorial 10
Parameters. jmon (Subs) config { parameter(id: ”P 1”, name: ”DEV 1/Acquisition”…) { module(“SIS”) selector(“SPS. USER. ALL”) } parameter(id: ”P 2”, name: ”DEV 2/Acquisition”…) { module(“SIS”) selector(“SPS. USER. ALL”) } parameter(id: ”P 3”, name: ”DEV 3/Acquisition”…) { module(“SIS”) selector(“SPS. USER. ALL”) } //same for P 4 parameter(id: ”end. Cycle”, name: ”tgm: //SPS. TGM/USER. ENDC”, …) { module(“Update. Event”) selector(“SPS. USER. ALL”) } } SIS Tutorial 11
Permits. sis (Logic Trees) config { isic(id: ”C 1”, desc: ”my cond for P 1”) { value. Condition { //true if value > 100 $(“P 1”) > 100 } } isic(id: ”C 2”, desc: ”my cond for P 2”) { value. Condition { $(“P 2#current”) < 20 } } // same for C 3, C 4, … lsic(id: ”C 1_C 2”) { logical. Condition { //AND condition channel(“C 1”) & channel(“C 2”) } } lsic(id: ”C 3_C 4”) { logical. Condition { channel(“C 3”) & channel(“C 4”) } } } SIS Tutorial 12
Permits. sis (Logic Trees) permit(id: ”BEAM_OK”, …) { logical. Condition { //OR condition channel(“C 1_C 2”) | channel(“C 3_C 4”) } exporter { trigger(ON_EVAL_FALSE) action { setter = new Japc. Parameter. Setter. Impl(“LX. TCL/Disable”, true) setter. set. Selector. Str(”SPS. USER. LHC”) setter. set. Int(“value”, 1) setter. execute() } } update. Event(type: "TRIGGER_WITH_SCRIPT") { String user =it. trigger. Value(). get. Header(). get. Selector(). get. Id() if(user. equals(”SPS. USER. LHC”)) { return true } else { return false } } 13 SIS Tutorial
Permits. sis (Includes) config { load("classpath: cern/sps/sis/config/file. A. sis") load("classpath: cern/sps/sis/config/file. B. sis") … } SIS Tutorial 14
Better Language Usage � Define parameter collections � Refer to them in configuration � Use IF/ELSE or FOR loops � DRY principle – don’t repeat yourself SIS Tutorial 15
Parameters. jmon config { parameter(id: ”P 1”, name: ”DEV 1/Acquisition”…) { module(“SIS”) selector(“SPS. USER. ALL”) } parameter(id: ”P 2”, name: ”DEV 2/Acquisition”…) { module(“SIS”) selector(“SPS. USER. ALL”) } parameter(id: ”P 3”, name: ”DEV 3/Acquisition”…) { module(“SIS”) selector(“SPS. USER. ALL”) } //same for P 4 parameter(id: ”end. Cycle”, name: ”tgm: //SPS. TGM/USER. ENDC”, …) { module(“Update. Event”) selector(“SPS. USER. ALL”) } } SIS Tutorial 16
Parameters. jmon def params = [“DEV 1/Acquisition”, ”DEV 2/Acquisition”, …] config { module(“SIS”) selector(“SPS. USER. ALL”) for(index = 0; index <= params. length; ++index) { parameter(id: ”P” + index, name: params[index]) } parameter(id: ”end. Cycle”, name: ”tgm: //SPS. TGM/USER. ENDC”, …) { module(“Update. Event”) } } SIS Tutorial 17
XML Configuration � XML for subscriptions & logic trees � Velocity to generate XML › #parse - includes › #for / #if / #else / #set � Value. Conditions › XML (value to constant comparison) › Groovy scriptlets (for simple conditions) › Java class/bean (for more complex) SIS Tutorial 18
Parameters. xml <Parameters> <Parameter id=”P 1” name=”DEV 1/Acquisition”> <Module id=“SIS”/> <Selector id=“SPS. USER. ALL”/> </Parameter> <Parameter id=”P 2” name=”DEV 2/Acquisition” /> <Module id=“SIS”/> <Selector id=“SPS. USER. ALL” /> </Parameter> <Parameter id=“P 3” name=”DEV 3/Acquisition”/> <Module id=“SIS”/> <Selector id=“SPS. USER. ALL”/> </Parameter> //same for P 4 <Parameter id=”end. Cycle” name=”tgm: //SPS. TGM/USER. ENDC”/> <Module id=“Update. Event” /> <Selector id=“SPS. USER. ALL”/> </Parameters> SIS Tutorial 19
Permits. xml (Logic Trees) <sis: Sis. Config xmlns: sis="http: //cern. ch/sis"> <Isic id=”C 1” desc=”my cond for P 1”> <Value. Condition type=“SCRIPT” script. Lang=“Groovy”> <![CDATA[ $P 1 > 100 ]]> </Value. Condition> </Isic> <Isic id=”C 2” desc=”my cond for P 2”) { <Value. Condition type=“SCRIPT” script. Lang=“Groovy”> <![CDATA[ $P 2#current < 20 ]]> <Value. Condition> </Isic> // same for C 3, C 4, … <Lsic id=”C 1_C 2” > <Logical. Condition operator=“AND”> <Test refid=“C 1”/> <Test refid=“C 2”/> </Logical. Condition> </Lsic> <Lsic id=”C 3_C 4”> <Logical. Condition operator=“AND”> <Test refid= “C 3”/> <Test refid=“C 4”/> </Logical. Condition> </Lsic> </sis: Sis. Config> SIS Tutorial 20
Permits. sis (Logic Trees) <Permit id=”BEAM_OK”> <Logical. Condition operator=“OR”> //OR condition <Test refid=“C 1_C 2”/> <Test refid=“C 3_C 4”/> </Logical. Condition> <Exporters> <Exporter bean. Name=”japc. Set. Bean" class. Name=“my. Exporter”> <Trigger event="ON_EVAL_FALSE"/> </Exporters> <Update. Event type="TRIGGER_WITH_SCRIPT” > <![CDATA[ String user =it. trigger. Value(). get. Header(). get. Selector(). get. Id() if(user. equals(”SPS. USER. LHC”)) { return true } else { return false } ]]> </Update. Event> </Permit> SIS Tutorial 21
Permits. xml (Inclusions) <sis: Sis. Config xmlns: sis="http: //cern. ch/sis"> <Permit. Structure> #parse("cern/sps/sis/config/file. A. xml") #parse("cern/sps/sis/config/file. B. xml") </Permit. Structure> </sis: Sis. Config> SIS Tutorial 22
Permits. xml (Logic Trees) <sis: Sis. Config xmlns: sis="http: //cern. ch/sis"> <Isic id=”C 1” desc=”my cond for P 1”> <Value. Condition type=“SCRIPT” script. Lang=“Groovy”> <![CDATA[ $P 1 > 100 ]]> </Value. Condition> </Isic> <Isic id=”C 2” desc=”my cond for P 2”) { <Value. Condition type=“SCRIPT” script. Lang=“Groovy”> <![CDATA[ $P 2#current < 20 ]]> <Value. Condition> </Isic> // same for C 3, C 4, … <Lsic id=”C 1_C 2” > <Logical. Condition operator=“AND”> <Test refid=“C 1”/> <Test refid=“C 2”/> </Logical. Condition> </Lsic> <Lsic id=”C 3_C 4”> <Logical. Condition operator=“AND”> <Test refid= “C 3”/> <Test refid=“C 4”/> </Logical. Condition> </Lsic> </sis: Sis. Config> SIS Tutorial 23
Permits. sis (Logic Trees) config { isic(id: ”C 1”, desc: ”my cond for P 1”) { value. Condition { //true if value > 100 $(“P 1”) > 100 } } isic(id: ”C 2”, desc: ”my cond for P 2”) { value. Condition { $(“P 2#current”) < 20 } } // same for C 3, C 4, … lsic(id: ”C 1_C 2”) { logical. Condition { //AND condition channel(“C 1”) & channel(“C 2”) } } lsic(id: ”C 3_C 4”) { logical. Condition { channel(“C 3”) & channel(“C 4”) } } } SIS Tutorial 24
Mode Based Conditions Only if Mode == STABLE_BEAMS � Logical condition based on OR: › ! Mode | ( Conditions ) › Mode != STABLE_BEAMS| ( C 1 & C 2 & C 3…) � Update Event: permit(id: ”BEAM_OK”, …) { … update. Event(type: "TRIGGER_WITH_SCRIPT") { if($(“mode. Value”)==“STABLE_BEAMS”) { return true } else { return false } } } SIS Tutorial 25
Mode Based Conditions Only if Mode == STABLE_BEAMS � Exporter: lsic(id: ”MODE_BASED”, …) { exporter { trigger(ON_EVAL) action { if($(“mode. Value”). equals(“STABLE_BEAMS”)) { //do the export (japc set) } } SIS Tutorial 26
Development in Eclipse � Server class in src/test/*/Sis. Core. Dev. Main › Safe to run if all Exporters are blocked › System. set. Property("cern. sps. sis. exporter. timing. disable", "true"); � GUI class in src/test/*/Sis. Gui. Dev. Main � Configs are in *. config. * package SIS Tutorial 27
SIS Tutorial 28
Advanced Configuration Masking / Latching / Counters / RBAC � Alarms configuration � Value converters / aggregators � Value selection in Value. Conditions � › PPM/non. PPM › Acquisition/Setting › Time windows (age of values) Dynamic thresholds (Virtual LSA Settings) � Advanced DSL language features � Spring beans XML configuration � Diagnostics � SIS Tutorial 29
Documentation � https: //wikis/display/SIS/User+Manual � https: //wikis/display/SIS+DSL+Configura tion › Step-by-step tutorial with examples SIS Tutorial 30
- Slides: 30