Files

1438 lines
39 KiB
JavaScript

var commandsTemplate = {
gpsLTLoop: {
text: [
"set temperature tempVal tempTol tempTime 1 100 120",
"wait temperature inrange tempTOut",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "300:50:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 2,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parValue: false,
parLabel: "Use custom title",
numCols: 1,
parUnit: ""
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1,
parUnit: ""
}
}
},
gpsHTLoop: {
text: [
"set flow flow flowVal",
"set temperature tempVal tempTol tempTime tempVal tempTol tempTime",
"wait temperature inrange tempTOut",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "300:50:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 2,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parValue: false,
parLabel: "Use custom title",
numCols: 1,
parUnit: ""
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1,
parUnit: ""
},
flowVal: {
parType: "input",
parClass: "prompPar adjustPar",
parValue: "",
parLabel: "",
numCols: 1,
parUnit: "",
visibility: "hidden",
adjustFunc : "GPSFlow"
}
}
},
cryoLoop : {
text: [
"set cryostat tempVal tempTol tempTime tempVal tempTol tempTime 1 1 AP",
"wait cryostat inrange tempTOut",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "300:50:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 1,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parValue: false,
parLabel: "Use custom title",
numCols: 1,
parUnit: ""
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1,
parUnit: ""
}
}
},
gpsTempHT : {
text: [
"set flow flow flowVal",
"set temperature tempVal tempTol tempTime tempVal tempTol tempTime"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "100",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
flowVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Flow (optional)",
numCols: 1,
parUnit: "sec"
}
}
},
setCryo : {
text: [
"set cryostat tempVal tempTol tempTime tempVal tempTol tempTime 1 1 AP"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "100",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
}
}
},
gpsTempLT : {
text: [
"set temperature tempVal tempTol tempTime 1.0 100 120"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "1.5",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
}
}
},
gpsField : {
text: [
"set magnet selMag fieldVal fieldTime"
],
html: {
fieldVal: {
parType: "input",
parClass: "prompPar",
parValue: "100",
parLabel: "Field",
numCols: 1,
parUnit: "G"
},
fieldTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
selMag: {
parType: "select",
parClass: "prompPar",
parOptions: ["WEP", "WED", "WEDL"],
parLabel: "Select Magnet",
numCols: 1,
parUnit: ""
}
}
},
setODB : {
text: [
"define odbPath odbVal"
],
html: {
odbPath: {
parType: "input",
parClass: "prompPar",
parValue: "Equipment/dg5350/Variables/Output[0]",
parLabel: "ODB Path",
numCols: 1,
parUnit: ""
},
odbVal: {
parType: "input",
parClass: "prompPar",
parValue: "0",
parLabel: "Set Value",
numCols: 1,
parUnit: ""
}
}
},
setTitle : {
text: [
"TITLE c=titleVal"
],
html: {
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "This is a title",
parLabel: "Title",
numCols: 1,
parUnit: ""
}
}
},
gpsFlow : {
text: [
"set flow flow flowVal"
],
html: {
flowVal: {
parType: "input",
parClass: "prompPar",
parValue: "5",
parLabel: "Flow",
numCols: 1,
parUnit: "sec",
min: "0.5",
max: "20"
}
}
},
startRun : {
text: [
"start histogram iHist stats"
],
html: {
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1
}
}
},
helioxLoop : {
text: [
"set heliox tempVal tempTol tempTime 1 2 120 0",
"set heliox -1 -1 -1 -1 -1 -1 -1 pressVal",
"wait heliox inrange tempTOut",
"wait tempTime",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "0.3:0.1:1.2",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 1,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parLabel: "Use custom title",
numCols: 1
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.02",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "900",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
pressVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Pressure (AP for automatic)",
numCols: 1,
parUnit: "mbar"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1
}
}
},
varioxLTLoop : {
text: [
"set variox tempVal tempTol tempTime 1 10 120 pressureVal",
"wait variox inrange tempTOut",
"wait 120",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "1:1:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 1,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parLabel: "Use custom title",
numCols: 1
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
pressureVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Pressure (AP for automatic)",
numCols: 1,
parUnit: "mbar"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1
}
}
},
varioxHTLoop : {
text: [
"set variox tempVal tempTol tempTime tempVal tempTol tempTime pressureVal",
"wait variox inrange tempTOut",
"wait 120",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "10:50:300",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 1,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parLabel: "Use custom title",
numCols: 1
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
pressureVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Pressure (AP for automatic)",
numCols: 1,
parUnit: "mbar"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1
}
}
},
dollyField : {
text: [
"set magnet selMag fieldVal fieldTime"
],
html: {
fieldVal: {
parType: "input",
parClass: "prompPar",
parValue: "100",
parLabel: "Field",
numCols: 1,
parUnit: "G"
},
fieldTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
selMag: {
parType: "select",
parClass: "prompPar",
parOptions: ["WEU", "WEUL", "WEV"],
parLabel: "Select Magnet",
numCols: 1
}
}
},
dollyBLoop : {
text: [
"set magnet selMag fieldVal fieldTime",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
fieldVal: {
parType: "input",
parClass: "prompPar",
parValue: "10:10:100",
parLabel: "Field list (comma separated or from:step:to)",
numCols: 1,
parUnit: "G"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parLabel: "Use custom title",
numCols: 1
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "B Scan, B=fieldVal G",
parLabel: "Custom Title",
numCols: 2
},
fieldTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
selMag: {
parType: "select",
parClass: "prompPar",
parOptions: ["WEU", "WEUL", "WEV"],
parLabel: "Select Magnet",
numCols: 1
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1
}
}
},
varioxTemp : {
text: [
"set variox tempVal tempTol tempTime tempVal tempTol tempTime 1 1 pressureVal",
"wait variox inrange tempTOut"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "100",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
pressureVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Pressure (AP for automatic)",
numCols: 1,
parUnit: "mbar"
}
}
},
helioxTemp : {
text: [
"heliox tempVal tempTol tempTime 1 2 120 0",
"set heliox -1 -1 -1 -1 -1 -1 -1 pressVal",
"wait heliox inrange tempTOut"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "0.4",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.02",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "3000",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
pressVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Pressure (optional)",
numCols: 1,
parUnit: "mbar"
}
}
},
halField : {
text: [
"WAIT Magnet 4KOPSREADY",
"SET Magnet fieldVal",
"WAIT Magnet ATFIELD",
"WAIT 300"
],
html: {
fieldVal: {
parType: "input",
parClass: "prompPar",
parValue: "7.0",
parLabel: "Field target",
numCols: 1,
parUnit: "T"
}
}
},
halSlits : {
text: [
"MULTISET FS71 slitVal",
"WAIT 5",
"MULTISET FS72 slitVal",
"WAIT 60"
],
html: {
slitVal: {
parType: "input",
parClass: "prompPar",
parValue: "50.0",
parLabel: "Slits",
numCols: 1,
parUnit: "mm"
}
}
},
halJanisLoop : {
text: [
'set gfcflowc0 "BH Flow Setpoint" flowJanisVal 300',
"set Temperature_Janis tempVal tempTol tempTime tempVal tempTol tempTime",
"set mcu2000 FLC posJanisVal 120",
"wait Temperature_Janis inrange tempTOut",
"wait 300",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "300:50:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 1,
parUnit: "K"
},
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parLabel: "Use custom title",
numCols: 1
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "3000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "3",
parLabel: "On Histogram #",
numCols: 1
},
flowJanisVal: {
parType: "input",
parClass: "prompPar adjustPar",
parValue: "",
parLabel: "Flow (optional)",
numCols: 1,
parUnit: "l/min",
adjustFunc : "HALJanisFlow"
},
posJanisVal: {
parType: "input",
parClass: "prompPar adjustPar",
parValue: "",
parLabel: "Position (optional)",
numCols: 1,
parUnit: "mm",
adjustFunc : "HALJanisPos"
},
}
},
halJanisTemp : {
text: [
'set gfcflowc0 "BH Flow Setpoint" flowJanisVal 300',
"set Temperature_Janis tempVal tempTol tempTime tempVal tempTol tempTime",
"set mcu2000 FLC posJanisVal 120",
"wait Temperature_Janis inrange tempTOut"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "300:50:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "120",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "300",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
flowJanisVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Flow (optional)",
numCols: 1,
parUnit: "l/min"
},
posJanisVal: {
parType: "input",
parClass: "prompPar",
parValue: "",
parLabel: "Position (optional)",
numCols: 1,
parUnit: "mm"
}
}
},
flameTWLLT : {
text: [
"set flamesam0 SAM_ts_tolerance tempTol",
"set flamesam0 SAM_ts_settling_time tempTime",
"set flamesam0 SAM_ts_timeout tempTOut",
"set flamesam0 SAM_ts_target tempVal",
"wait flamesam0 SAM_ts_status <= 100 tempTOut"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "0.1",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.05",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "180",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "1800",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
}
},
flameWLLTLoop : {
text: [
"set flamesam0 SAM_ts_tolerance tempTol",
"set flamesam0 SAM_ts_settling_time tempTime",
"set flamesam0 SAM_ts_timeout tempTOut",
"set flamesam0 SAM_ts_target tempVal",
"wait flamesam0 SAM_ts_status <= 100 tempTOut",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parValue: false,
parLabel: "Use custom title",
numCols: 1,
parUnit: ""
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2,
parUnit: "K"
},
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "0.1:0.1:1",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 2,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.05",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "180",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "1800",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "5000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "2",
parLabel: "On Histogram #",
numCols: 1,
parUnit: ""
},
},
},
flameTWLHT : {
text: [
"set flamesam0 SAM_ts_tolerance tempTol",
"set flamesam0 SAM_ts_settling_time tempTime",
"set flamesam0 SAM_ts_timeout tempTOut",
"set cryostat tempVal tempTol tempTime 1 300 120 1 0 MP 4.5",
"set flamesam0 SAM_ts_target tempVal",
"wait cryostat inrange tempTOut",
"WAIT flamesam0 SAM_ts_status <= 100 tempTOut"
],
html: {
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "15",
parLabel: "Temperature",
numCols: 1,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.5",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "180",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "1800",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
}
},
flameWLHTLoop : {
text: [
"set flamesam0 SAM_ts_tolerance tempTol",
"set flamesam0 SAM_ts_settling_time tempTime",
"set flamesam0 SAM_ts_timeout tempTOut",
"set cryostat tempVal tempTol tempTime 1 300 120 1 0 MP 4.5",
"set flamesam0 SAM_ts_target tempVal",
"wait cryostat inrange tempTOut",
"WAIT flamesam0 SAM_ts_status <= 100 tempTOut",
"TITLE c=titleVal",
"start histogram iHist stats"
],
html: {
titleCheck: {
parType: "checkbox",
parClass: "prompPar",
parValue: false,
parLabel: "Use custom title",
numCols: 1,
parUnit: ""
},
titleVal: {
parType: "input",
parClass: "prompPar",
parValue: "T Scan, Tset=tempVal K",
parLabel: "Custom Title",
numCols: 2,
parUnit: "K"
},
tempVal: {
parType: "input",
parClass: "prompPar",
parValue: "2.5:0.5:10",
parLabel: "Temperature list (comma separated or from:step:to)",
numCols: 2,
parUnit: "K"
},
tempTol: {
parType: "input",
parClass: "prompPar",
parValue: "0.2",
parLabel: "Tolerance",
numCols: 1,
parUnit: "K"
},
tempTime: {
parType: "input",
parClass: "prompPar",
parValue: "180",
parLabel: "Stability Time",
numCols: 1,
parUnit: "sec"
},
tempTOut: {
parType: "input",
parClass: "prompPar",
parValue: "1800",
parLabel: "Time Out",
numCols: 1,
parUnit: "sec"
},
stats: {
parType: "input",
parClass: "prompPar",
parValue: "5000000",
parLabel: "Stats",
numCols: 1,
parUnit: "Events"
},
iHist: {
parType: "input",
parClass: "prompPar",
parValue: "2",
parLabel: "On Histogram #",
numCols: 1,
parUnit: ""
},
},
},
flameLT2HT : {
text: [
"set flamedil0 DIL_dil_action_target 3",
"WAIT 120",
"set flamedil0 DIL_htr_sorb_target 350000",
"WAIT 120",
"set cryostat 20 0.3 120 1 100 120 1 0 MP 4.5",
"WAIT cryostat inrange",
"WAIT flamedil0 DIL_p_still_value <= 0.01 1800"
],
html: {},
}
};
// Function to generate HTML form from a configuration object
function generateHTMLFromConfig(config) {
const html = [];
let objConfig = commandsTemplate[config];
for (const paramName in objConfig.html) {
const paramConfig = objConfig.html[paramName];
const inputType = paramConfig.parType;
const inputClass = paramConfig.parClass;
const inputValue = paramConfig.parValue;
const inputLabel = paramConfig.parLabel;
const numCols = paramConfig.numCols || 1;
const parUnit = paramConfig.parUnit || '';
const parOptions = paramConfig.parOptions || '';
let inputElement = '';
if (inputType === 'input') {
inputElement = `<input class="${inputClass}" type="text" value="${inputValue}" style="width:100%;" id="${paramName}">`;
} else if (inputType === 'checkbox') {
inputElement = `<input class="${inputClass}" type="checkbox" style="width:5em;" id="${paramName}">`;
} else if (inputType === 'select') {
inputElement = `<select class="${inputClass}" style="width:10em;" id="${paramName}">`;
for (let i = 0; i < parOptions.length; i++) {
inputElement += '<option>' + parOptions[i] + '</option>';
}
inputElement += '</select>';
}
let inputRow = `<tr><td>${inputLabel}</td><td>${inputElement}</td><td> ${parUnit}</td></tr>`;
if (numCols == 2) {
inputRow = `<tr><td colspan="2">${inputLabel}</td></tr><tr><td colspan="2">${inputElement}</td><td> ${parUnit}</td></tr>`;
}
html.push(inputRow);
}
return html.join('');
}
// Function to generate text command from a configuration object
function generateTextFromConfig(config) {
let objConfig = commandsTemplate[config];
return objConfig.text.join('\n');
}
function insertSeqBlock(element) {
let elId = element;
if (typeof element !== "string") {
elId = element.id;
}
const larEditor = document.getElementById("larEditor");
let enablePop = document.getElementById("enablePop").checked;
let html = generateHTMLFromConfig(elId);
let text = generateTextFromConfig(elId) + "\n";
if (html == "") enablePop = false;
html = "<div style='text-align: left;'><table class='guitable' style='width:90%;text-align: left;'>" + html + "</table><br><b>Block:</b><br><pre id='textBlock'>"+text+"</pre><button class='mbutton w3-display-bottommiddle' type='button' id='popButton'></button>"
let sel, range, newNode;
newNode = document.createElement("pre");
// Cursor in editing
larEditor.focus();
if (document.getSelection) {
sel = document.getSelection();
// If anything is selected
if (sel.getRangeAt && sel.rangeCount) {
// Only if cursor is in larEditor
if (larEditor.contains(sel.getRangeAt(0).startContainer)) {
range = sel.getRangeAt(0);
range.deleteContents();
range.insertNode(newNode);
} else {
alert("Cursor must be in the editing area!");
return(0);
}
} else {
alert("Cursor must be in the editing area!");
return(0);
}
}
newNode.innerHTML = "<div id='preparing'>preparing ....</div>";
if (enablePop) {
d = general_dialog(html,"popPrompt");
const button = document.getElementById("popButton");
console.log(button);
button.textContent = "Submit";
button.addEventListener("click",promptSeqParams);
button.addEventListener("click",closeModal);
button.addEventListener("click",checkSyntax);
} else {
// Use defaults
text = subSeqDefaults(text);
newNode.innerHTML = text+"<br>";
checkSyntax();
}
}