The Online Database contains information that system and user wants to share. Basically all transactions for experiment setup and monitoring go through the ODB. It also contains some specific system information related to the "Midas client" currently involved in an experiment (/system).
Each ODB field or so called KEY is accessible by the user through either an interactive way (see odbedit task) or by C-programming (see functions db_xxx in Midas Code and Libraries).
The ODB information is stored in a "tree/branch" structure where each branch refers to a specific set of data. On the first invocation of the database (first Midas application) a minimal system record will be created. Later on each application will add its own set of parameters to the database depending on its requirement. For instance, starting the ODB for the first time, the tree /Runfinfo, /Experiment, /System will be created. The application mlogger task will add its own tree /Logger/...
As mentioned earlier, ODB is the main communication platform between any Midas application. As such, the content of the ODB is application dependent. Several "dormant" trees can be awaken by the user in order to provide extra flexibility of the system. Such "dormant" tree are Alias, Script, Edit on Start , Security, Run parameters .
[host:expt:Stopped]/>ls -r -l /system Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- System DIR Clients DIR 29580 DIR Name STRING 1 32 17h 0 R decay Host STRING 1 256 17h 0 R host1 Hardware type INT 1 4 17h 0 R 42 Server Port INT 1 4 17h 0 R 1227 Transition Mask DWORD 1 4 17h 0 R 329 Deferred Transition DWORD 1 4 17h 0 R 6 RPC DIR 16000 BOOL 1 4 17h 0 R y 16001 BOOL 1 4 17h 0 R y 29638 DIR Name STRING 1 32 17h 0 R MStatus Host STRING 1 256 17h 0 R host1 Hardware type INT 1 4 17h 0 R 42 Server Port INT 1 4 17h 0 R 1228 Transition Mask DWORD 1 4 17h 0 R 0 Deferred Transition DWORD 1 4 17h 0 R 0 29810 DIR Name STRING 1 32 17h 0 R Nova_029810 Host STRING 1 256 17h 0 R host Hardware type INT 1 4 17h 0 R 42 Server Port INT 1 4 17h 0 R 1235 Transition Mask DWORD 1 4 17h 0 R 0 29919 DIR Name STRING 1 32 17h 0 R Epics Host STRING 1 256 17h 0 R host Hardware type INT 1 4 17h 0 R 42 Server Port INT 1 4 17h 0 R 1237 Transition Mask DWORD 1 4 17h 0 R 329 Deferred Transition DWORD 1 4 17h 0 R 0 RPC DIR 16000 BOOL 1 4 17h 0 R y 16001 BOOL 1 4 17h 0 R y 12164 DIR Name STRING 1 32 6s 0 R ODBEdit Host STRING 1 256 6s 0 R host2 Hardware type INT 1 4 6s 0 R 42 Server Port INT 1 4 6s 0 R 4893 Transition Mask DWORD 1 4 6s 0 R 0 Deferred Transition DWORD 1 4 6s 0 R 0 Link timeout INT 1 4 6s 0 R 10000 Client Notify INT 1 4 6s 0 RWD 0 Prompt STRING 1 256 >99d 0 RWD [%h:%e:%S]%p> Tmp DIR
odbedit [local:midas:Stopped]/>cd /System/ [local:midas:Stopped]/System>ls Clients Tmp Client Notify 0 Prompt [%h:%e:%S]%p> [local:midas:Stopped]/System>set Prompt my_prompt> my_prompt>set Prompt [Host:%h-Expt:%e:State:%s]Path:%p> [Host:local-Expt:midas-State:S]Path:/System>set Prompt [Host:%h-Expt:%e-State:%S]Path:%p> [Host:local-Expt:midas-State:Stopped]Path:/System>
odb -e expt -h host [host:expt:Running]/>ls -r -l /runinfo Key name Type #Val Size Last Opn Mode Value ------------------------------------------------------------------------ Runinfo DIR State INT 1 4 2h 0 RWD 3 Online Mode INT 1 4 2h 0 RWD 1 Run number INT 1 4 2h 0 RWD 8521 Transition in progress INT 1 4 2h 0 RWD 0 Requested transition INT 1 4 2h 0 RWD 0 Start time STRING 1 32 2h 0 RWD Thu Mar 23 10:03:44 2000 Start time binary DWORD 1 4 2h 0 RWD 953834624 Stop time STRING 1 32 2h 0 RWD Thu Mar 23 10:03:33 2000 Stop time binary DWORD 1 4 2h 0 RWD 0
{ "DspecCheck", // equipment name ... , { "Scaler", // equipment name ... ,
Example:
Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- HistoCheck DIR DSpecCheck DIR HistoPoll DIR HistoEOR DIR DSpecEOR DIR Scaler DIR SuconMagnet DIR TempBridge DIR Cryostat DIR Meters DIR RFSource DIR DSPec DIR
The equipment tree is then split in several sections which by default the system creates.
[local:S]ls -l -r /equipment/scaler Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Scaler DIR Common DIR Event ID WORD 1 2 16h 0 RWD 1 Trigger mask WORD 1 2 16h 0 RWD 256 Buffer STRING 1 32 16h 0 RWD SYSTEM Type INT 1 4 16h 0 RWD 1 Source INT 1 4 16h 0 RWD 0 Format STRING 1 8 16h 0 RWD MIDAS Enabled BOOL 1 4 16h 0 RWD y Read on INT 1 4 16h 0 RWD 377 Period INT 1 4 16h 0 RWD 1000 Event limit DOUBLE 1 8 16h 0 RWD 0 Num subevents DWORD 1 4 16h 0 RWD 0 Log history INT 1 4 16h 0 RWD 0 Frontend host STRING 1 32 16h 0 RWD midtis03 Frontend name STRING 1 32 16h 0 RWD feLTNO Frontend file name STRING 1 256 16h 0 RWD C:\online\sc_ltno.c Variables DIR SCLR DWORD 6 4 1s 0 RWD [0] 0 [1] 0 [2] 0 [3] 0 [4] 0 [5] 0 RATE FLOAT 6 4 1s 0 RWD [0] 0 [1] 0 [2] 0 [3] 0 [4] 0 [5] 0 Statistics DIR Events sent DOUBLE 1 8 1s 0 RWDE 370 Events per sec. DOUBLE 1 8 1s 0 RWDE 0.789578 kBytes per sec. DOUBLE 1 8 1s 0 RWDE 0.0678543
Default settings are created automatically when the logger starts the first time:
Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Logger DIR Data dir STRING 1 256 4h 0 RWD /scr0/spring2000 Message file STRING 1 256 22h 0 RWD midas.log Write data BOOL 1 4 2h 0 RWD n ODB Dump BOOL 1 4 22h 0 RWD y ODB Dump File STRING 1 256 22h 0 RWD run%05d.odb Auto restart BOOL 1 4 22h 0 RWD y Tape message BOOL 1 4 15h 0 RWD y Channels DIR 0 DIR Settings DIR Active BOOL 1 4 1h 0 RWD y Type STRING 1 8 1h 0 RWD Disk Filename STRING 1 256 1h 0 RWD run%05d.ybs Format STRING 1 8 1h 0 RWD YBOS ODB Dump BOOL 1 4 1h 0 RWD y Log messages DWORD 1 4 1h 0 RWD 0 Buffer STRING 1 32 1h 0 RWD SYSTEM Event ID INT 1 4 1h 0 RWD -1 Trigger Mask INT 1 4 1h 0 RWD -1 Event limit DWORD 1 4 1h 0 RWD 0 Byte limit DOUBLE 1 8 1h 0 RWD 0 Tape capacity DOUBLE 1 8 1h 0 RWD 0 Subdir format STRING 1 32 7h 0 RWD %Y%m%d Current filenameSTRING 1 256 7h 0 RWD 20020605\run00078.mid Statistics DIR Events written DOUBLE 1 8 1h 0 RWD 0 Bytes written DOUBLE 1 8 1h 0 RWD 0 Bytes written toDOUBLE 1 8 1h 0 RWD 3.24316e+11 Files written INT 1 4 1h 0 RWD 334
From Midas version 1.9.5, the logger has the possibility to store information to a mySQL database. This option is an alternative to the runlog.txt update hanled by the analyzer. The two main advantages using the SQL are:
[local:midas:S]/Logger>ls -lr SQL Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- SQL DIR Create database BOOL 1 4 27s 0 RWD n Write data BOOL 1 4 27s 0 RWD n Hostname STRING 1 80 27s 0 RWD localhost Username STRING 1 80 27s 0 RWD root Password STRING 1 80 27s 0 RWD Database STRING 1 32 27s 0 RWD midas Table STRING 1 80 27s 0 RWD Runlog Links BOR DIR Run number LINK 1 20 58s 0 RWD /Runinfo/Run number Start time LINK 1 20 58s 0 RWD /Runinfo/Start time Links EOR DIR Stop time LINK 1 19 4m 0 RWD /Runinfo/Stop time
[local:Default:S]/Logger>ls Data dir \online\ Message file midas.log Auto restart n Write data y ODB Dump n ODB Dump File run%05d.odb Tape message y Channels [local:Default:S]/Logger>set OD ODB Dump ODB Dump File [local:Default:S]/Logger>set "ODB Dump File" "/mypath/run%06d.odb" [local:Default:S]/Logger>ls Data dir \online\ Message file midas.log Auto restart n Write data y ODB Dump n ODB Dump File /mypath/run%06d.odb Tape message y Channels
[loca]]Logger>cd channels [local]Channels>ls 0 [local]Channels>copy 0 1 [local]Channels>ls 0 1
<host name>, <port number>, <user name>, <password>, <directory>, <file name>
myhost.my.domain,21,john,password,/usr/users/data,run%05d.mid
C:\online>odbedit [local:Default:S]/>cd Experiment/ [local:Default:S]/Experiment>mkdir "Buffer Sizes" [local:Default:S]/Experiment>cd "Buffer Sizes/ [local:Default:S]Buffer Sizes>create DWORD SYSTEM [local:Default:S]Buffer Sizes>set SYSTEM 4000000
Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Experiment DIR Name STRING 1 32 22s 0 RWD chaos Run Parameter DIR Beam Polarity STRING 1 256 2h 0 R negative Beam Momentum FLOAT 1 4 2h 0 R 91 2LT: log file name? STRING 1 256 2h 0 R cni05 1LT: file name? STRING 1 256 2h 0 R files.cni.zero Comment STRING 1 256 2h 0 R ch2 target Target Angle FLOAT 1 4 2h 0 R 0 Target Material STRING 1 256 2h 0 R ch2 Edit on start DIR Beam Momentum FLOAT 1 4 2h 0 R 91 Beam Polarity STRING 1 256 2h 0 R negative Target Material STRING 1 256 2h 0 R ch2 Target Angle FLOAT 1 4 2h 0 R 0 1LT: file name? STRING 1 256 2h 0 R files.cni.zero Trigger 2 BOOL 1 4 2h 0 RWD n 2LT: log file name? STRING 1 256 2h 0 R cni05 Comment STRING 1 256 2h 0 R ch2 target Write data BOOL 1 4 2h 0 RWD y Lock when running DIR Run Parameter DIR Beam Polarity STRING 1 256 2h 0 R negative Beam Momentum FLOAT 1 4 2h 0 R 91 2LT: log file name? STRING 1 256 2h 0 R cni05 1LT: file name? STRING 1 256 2h 0 R files.cni.zero Comment STRING 1 256 2h 0 R ch2 target Target Angle FLOAT 1 4 2h 0 R 0 Target Material STRING 1 256 2h 0 R ch2 Security DIR Password STRING 1 32 16h 0 RWD #@D&%F56 Allowed hosts DIR host.sample.domain INT 1 4 >99d 0 RWD 0 pierre.triumf.ca INT 1 4 >99d 0 RWD 0 pcch02.triumf.ca INT 1 4 >99d 0 RWD 0 koslx1.triumf.ca INT 1 4 >99d 0 RWD 0 koslx2.triumf.ca INT 1 4 >99d 0 RWD 0 vwchaos.triumf.ca INT 1 4 >99d 0 RWD 0 koslx0.triumf.ca INT 1 4 >99d 0 RWD 0 Allowed programs DIR mstat INT 1 4 >99d 0 RWD 0 mhttpd INT 1 4 >99d 0 RWD 0 Web Password STRING 1 32 16h 0 RWD pon4@#@%SSDF2 Name STRING 1 32 4m 0 RWD Default Buffer Sizes DIR SYSTEM DWORD 1 4 4m 0 RWD 4000000
[local]/>create key "/Experiment/Run parameters"
[local]Run parameters>create int "Run mode" [local]Run parameters>create string Comment
[local]/>create key "Experiment/Edit on start" [local]/>cd "Experiment/Edit on start" [local]/>ln "/Experiment/Run parameters/Run mode" "Run mode"
[local]/>start Run mode [0]:1 Run number [3]:<return to accept> Are the above parameters correct? ([y]/n/q): <return to accept "y"> Starting run #2 Run #2 started
[local]/>cd "Experiment/Edit on start" [local]/>create BOOL "Edit run number"
[local]/>create key "Experiment/Lock when running" [local]/>cd "Experiment/Lock when running" [local]/>ln "/Experiment/Run parameters" "Run parameter" [local]/>ln "/Logger/Write Data" "Write Data?"
[local]/>passwd Password:<xxxx> Retype password:<xxxx>
[local]/>rm /Experiment/Security Are you sure to delete the key "/Experiment/Security" and all its subkeys? (y/[n]) y
[local]/>cd "/Experiment/Security/Allowed hosts" [local]rhosts>create int myhost.domain [local]rhosts>
[local]/>cd "/Experiment/Security/Allowed programs" [local]:S>create int mstat [local]:S>
[local:midas:S]/History>ls -l -r Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- History DIR Links DIR System DIR Trigger per sec. /Equipment/Trigger/Statistics/Events per sec. Trigger kB per sec. /Equipment/Trigger/Statistics/kBytes per sec. [local:midas:S]/>cd /History/Links/System/ [local:midas:S]System>ls -l Key name Type #Val Size Last Opn Mode Value ----------------------------------------------------------- Trigger per sec. LINK 1 46 >99d 0 RWD /Equipment/Trigger/Statistics/Events per sec. Trigger kB per sec. LINK 1 46 >99d 0 RWD /Equipment/Trigger/Statistics/kBytes per sec.
[local:midas:S]/History>ls -l -r Display Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Display DIR Default DIR Trigger rate DIR Variables STRING 2 32 36h 0 RWD [0] System:Trigger per sec. [1] System:Trigger kB per sec. Factor FLOAT 2 4 36h 0 RWD [0] 1 [1] 1 Timescale INT 1 4 36h 0 RWD 3600 Zero ylow BOOL 1 4 36h 0 RWD y
Where the 2 trigger fields are symbolic links to the given path. The sub-tree System defines a "virtual" equipment and get by the system assigned a particular "History Event ID".
odb -e expt -h host [host:expt:Stopped]/Alarms>ls -lr Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Alarms DIR Alarm system active BOOL 1 4 6h 0 RWD n Alarms DIR Test DIR Active BOOL 1 4 31h 0 RWD n Triggered INT 1 4 31h 0 RWD 0 Type INT 1 4 31h 0 RWD 3 Check interval INT 1 4 31h 0 RWD 60 Checked last DWORD 1 4 31h 0 RWD 0 Time triggered firstSTRING 1 32 31h 0 RWD Time triggered last STRING 1 32 31h 0 RWD Condition STRING 1 256 31h 0 RWD /Runinfo/Run number > 10 Alarm Class STRING 1 32 31h 0 RWD Alarm Alarm Message STRING 1 80 31h 0 RWD Run number became too large wc3_anode DIR Active BOOL 1 4 31h 0 RWD n Triggered INT 1 4 31h 0 RWD 0 Type INT 1 4 31h 0 RWD 3 Check interval INT 1 4 31h 0 RWD 10 Checked last DWORD 1 4 31h 0 RWD 958070825 Time triggered firstSTRING 1 32 31h 0 RWD Time triggered last STRING 1 32 31h 0 RWD Condition STRING 1 256 31h 0 RWD /equipment/chv/variables/chvv[6] < 900 Alarm Class STRING 1 32 31h 0 RWD Alarm Alarm Message STRING 1 80 31h 0 RWD WC3 Anode voltage is too low chaos DIR Active BOOL 1 4 31h 0 RWD n Triggered INT 1 4 31h 0 RWD 0 Type INT 1 4 31h 0 RWD 3 Check interval INT 1 4 31h 0 RWD 10 Checked last DWORD 1 4 31h 0 RWD 0 Time triggered firstSTRING 1 32 31h 0 RWD Time triggered last STRING 1 32 31h 0 RWD Condition STRING 1 256 31h 0 RWD /Equipment/B12Y/Variables/B12Y[2] < 3000 Alarm Class STRING 1 32 31h 0 RWD Alarm Alarm Message STRING 1 80 31h 0 RWD CHAOS magnet has tripped. Classes DIR Alarm DIR Write system messageBOOL 1 4 31h 0 RWD y Write Elog message BOOL 1 4 31h 0 RWD n System message interINT 1 4 31h 0 RWD 60 System message last DWORD 1 4 31h 0 RWD 0 Execute command STRING 1 256 31h 0 RWD Execute interval INT 1 4 31h 0 RWD 0 Execute last DWORD 1 4 31h 0 RWD 0 Stop run BOOL 1 4 31h 0 RWD n Warning DIR Write system messageBOOL 1 4 31h 0 RWD y Write Elog message BOOL 1 4 31h 0 RWD n System message interINT 1 4 31h 0 RWD 60 System message last DWORD 1 4 31h 0 RWD 0 Execute command STRING 1 256 31h 0 RWD Execute interval INT 1 4 31h 0 RWD 0 Execute last DWORD 1 4 31h 0 RWD 0 Stop run BOOL 1 4 31h 0 RWD n
[host::expt:Stopped]/Script>ls
BNMR Hold
Continue
Real
Test
Kill
[host:expt:Stopped]/Script>ls -lr Continue
Key name Type #Val Size Last Opn Mode Value
----------------------------------------------------------
Continue DIR
cmd STRING 1 128 39h 0 RWD /home/bnmr/perl/continue.pl
Name STRING 1 32 28s 0 RWD bnmr1
hold BOOL 1 4 31h 0 RWD n
odbedit ls create key Alias cd Alias ln /Equipment/Trigger/Common "Trig Setting" <-- New frame ln /Equipment/Trigger/Common "Trig Setting&" <-- Same frame
[local:midas:S]/Elog>ls -lr
Key name Type #Val Size Last Opn Mode Value
---------------------------------------------------------------------------
Elog DIR
Email STRING 1 64 25h 0 RWD midas@triumf.ca
Display run number BOOL 1 4 25h 0 RWD y
Allow delete BOOL 1 4 25h 0 RWD n
Types STRING 20 32 25h 0 RWD
[0] Routine
[1] Shift summary
[2] Minor error
[3] Severe error
[4] Fix
[5] Question
[6] Info
[7] Modification
[8] Reply
[9] Alarm
[10] Test
[11] Other
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
Systems STRING 20 32 25h 0 RWD
[0] General
[1] DAQ
[2] Detector
[3] Electronics
[4] Target
[5] Beamline
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
Buttons
8h
24h
3d
7d
Host name myhost.triumf.ca
SMTP host STRING 1 64 25h 0 RWD trmail.triumf.ca
Key name Type #Val Size Last Opn Mode Value
---------------------------------------------------------------------------
Programs DIR
EBuilder DIR
Required BOOL 1 4 0s 0 RWD y
Watchdog timeout INT 1 4 0s 0 RWD 10000
Check interval DWORD 1 4 0s 0 RWD 10000
Start command STRING 1 256 0s 0 RWD mevb -D
Auto start BOOL 1 4 0s 0 RWD n
Auto stop BOOL 1 4 0s 0 RWD n
Auto restart BOOL 1 4 0s 0 RWD n
Alarm class STRING 1 32 0s 0 RWD Alarm
First failed DWORD 1 4 0s 0 RWD 0
Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Lazy DIR Tape DIR Settings DIR Maintain free space(INT 1 4 23h 0 RWD 15 Stay behind INT 1 4 23h 0 RWD -1 Alarm Class STRING 1 32 23h 0 RWD Running condition STRING 1 128 23h 0 RWD ALWAYS Data dir STRING 1 256 23h 0 RWD /data_onl/current Data format STRING 1 8 23h 0 RWD YBOS Filename format STRING 1 128 23h 0 RWD run%05d.ybs Backup type STRING 1 8 23h 0 RWD Tape Execute after rewindSTRING 1 64 23h 0 RWD ask_for_tape.sh Path STRING 1 128 23h 0 RWD /dev/nst0 Capacity (Bytes) FLOAT 1 4 23h 0 RWD 4.8e+10 List label STRING 1 128 3h 0 RWD tw0078 Execute before writiSTRING 1 64 23h 0 RWD lazy_prewrite.csh Execute after writinSTRING 1 64 23h 0 RWD rundb_addrun.pl Statistics DIR Backup file STRING 1 128 3h 0 RWDE run05627.ybs File size [Bytes] FLOAT 1 4 3h 0 RWDE 2.00176e+09 KBytes copied FLOAT 1 4 3h 0 RWDE 2.00176e+09 Total Bytes copied FLOAT 1 4 3h 0 RWDE 2.00176e+09 Copy progress [%] FLOAT 1 4 3h 0 RWDE 100 Copy Rate [bytes perFLOAT 1 4 3h 0 RWDE 6.21462e+06 Backup status [%] FLOAT 1 4 3h 0 RWDE 4.17034 Number of Files INT 1 4 3h 0 RWDE 1 Current Lazy run INT 1 4 3h 0 RWDE 5627 List DIR TW0076 INT 15 4 3h 0 RWD [0] 5575 [1] 5576 [2] 5577
Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- EBuilder DIR Settings DIR Event ID WORD 1 2 65h 0 RWD 1 Trigger mask WORD 1 2 65h 0 RWD 1 Buffer STRING 1 32 65h 0 RWD SYSTEM Format STRING 1 32 65h 0 RWD YBOS Event mask DWORD 1 4 65h 0 RWD 3 hostname STRING 1 64 3h 0 RWD myhost Statistics DIR Events sent DOUBLE 1 8 3h 0 RWD 653423 Events per sec. DOUBLE 1 8 3h 0 RWD 1779.17 kBytes per sec. DOUBLE 1 8 3h 0 RWD 0 Channels DIR Frag1 DIR Settings DIR Event ID WORD 1 2 65h 0 RWD 1 Trigger mask WORD 1 2 65h 0 RWD 65535 Buffer STRING 1 32 65h 0 RWD YBUF1 Format STRING 1 32 65h 0 RWD YBOS Event mask DWORD 1 4 65h 0 RWD 1 Statistics DIR Events sent DOUBLE 1 8 3h 0 RWD 653423 Events per sec. DOUBLE 1 8 3h 0 RWD 1779.17 kBytes per sec. DOUBLE 1 8 3h 0 RWD 0 Frag2 DIR Settings DIR Event ID WORD 1 2 65h 0 RWD 5 Trigger mask WORD 1 2 65h 0 RWD 65535 Buffer STRING 1 32 65h 0 RWD YBUF2 Format STRING 1 32 65h 0 RWD YBOS Event mask DWORD 1 4 65h 0 RWD 2 Statistics DIR Events sent DOUBLE 1 8 3h 0 RWD 653423 Events per sec. DOUBLE 1 8 3h 0 RWD 1779.17 kBytes per sec. DOUBLE 1 8 3h 0 RWD 0
Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- WebLtno& STRING 1 2976 25h 0 RWD <multi-line> <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.76 [en] (Windows NT 5.0; U) [Netscape]"> <meta name="Author" content="Pierre-Andr?Amaudruz"> <title>Set value</title> </head> <body text="#000000" bgcolor="#FFFFCC" link="#FF0000" vlink="#800080" alink="#0000FF"> <form method="GET" action="http://myhost.triumf.ca:8081/CS/WebLtno&"> <input type=hidden name=exp value="ltno"> <center><table CELLSPACING=1 CELLPADDING=1 COLS=3 WIDTH="100%" BGCOLOR="#99FF99" > <caption><b><font face="Georgia"><font color="#000099"><font size=+2>LTNO Custom Web Page</font></font></font></b></caption> <tr BGCOLOR="#FFCC99"> <td><b><font color="#FF0000">Actions: </font></b> <input type=submit name=cmd value=Status> <input type=submit name=cmd value=Start> <input type=submit name=cmd value=Stop> ... <td BGCOLOR="#66FFFF"><b>Polarity section:</b> <br>Run#: <odb src="/runinfo/run number"> <br>Run#: <odb src="/runinfo/run number"> <br>Run#: <odb src="/runinfo/run number"> <br>Run#: <odb src="/runinfo/run number" edit=1></td> </tr> </table></center> <img src="http://myhost.triumf.ca:8081/HS/Meterdis.gif?exp=ltno&scale=12h&width=400"> <img src="http://myhost.triumf.ca:8081/HS/Bridge.gif?exp=ltno&scale=12h&width=400"> <b><i><font color="#000099"><a href="http://myhost.triumf.ca/ltno/index.html"> <br> LTNO help</a></font></i></b> </body> </html>
First the parameters have to be defined in the ODB under the Settings tree for the given equipment. Let's assume we have two discriminator levels belonging to the trigger electronics, which should be controllable. Following commands define these levels in the ODB:
[local]/>cd /Equipment/Trigger/ [local]Trigger>create key Settings [local]Trigger>cd Settings [local]Settings>create int level1 [local]Settings>create int level2 [local]Settings>ls
The frontend can now map a C structure to these settings. In order to simplify this process, ODBEdit can be requested to generate a header file containing this C structure. This file is usually called event.h. It can be generated in the current directory with the ODB command make which generates in the current directory the header file experim.h :
[local]Settings>make
Now this file can be copied to the frontend directory and included in the frontend source code. It contains a section with a C structure of the trigger settings and an ASCII representation:
typedef struct { INT level1; INT level2; TRIGGER_SETTINGS; #define TRIGGER_SETTINGS_STR(_name) char *_name[] = {\ "[.]",\ "level1 = INT : 0",\ "level2 = INT : 0",\ "",\ NULL
This definition can be used to define a C structure containing the parameters in frontend.c:
#include <experim.h> TRIGGER_SETTINGS trigger_settings;
A hot-link between the ODB values and the C structure is established in the frontend_init() routine:
INT frontend_init() { HNDLE hDB, hkey; TRIGGER_SETTINGS_STR(trigger_settings_str); cm_get_experiment_database(&hDB, NULL); db_create_record(hDB, 0, "/Equipment/Trigger/Settings", strcomb(trigger_settings_str)); db_find_key(hDB, 0, "/Equipment/Trigger/Settings", &hkey); if (db_open_record(hDB, hkey, &trigger_settings, sizeof(trigger_settings), MODE_READ, trigger_update) != DB_SUCCESS) { cm_msg(MERROR, "frontend_init", "Cannot open Trigger Settings in ODB"); return -1; return SUCCESS;
The db_create_record() function re-creates the settings sub-tree in the ODB from the ASCII representation in case it has been corrupted or deleted. The db_open_record() now establishes the hot-link between the settings in the ODB and the trigger_settings structure. Each time the ODB settings are modified, the changes are written to the trigger_settings structure and the callback routine trigger_update() is executed afterwards. This routine has the task to set the hardware according to the settings in the trigger_settings structure.
It may look like:
void trigger_update(INT hDB, INT hkey) { printf("New levels: %d %d", trigger_settings.level1, trigger_settings.level2);
Of course the printf() function should be replaced by a function which accesses the hardware properly. Modifying the trigger values with ODBEdit can test the whole scheme:
[local]/>cd /Equipment/Trigger/Settings [local]Settings>set level1 123 [local]Settings>set level2 456
[local]/>cd /Equipment/Trigger/Settings [local]Settings>save settings.odb [local]Settings>set level1 789 [local]Settings>load settings.odb
#include <midas.h> main() { HNDLE hDB; INT level; cm_connect_experiment("", "Sample", "Test", NULL); cm_get_experiment_database(&hDB, NULL); level = 321; db_set_value(hDB, 0, "/Equipment/Trigger/Settings/Level1", &level, sizeof(INT), 1, TID_INT); cm_disconnect_experiment();
To make sure a hot-link exists, one can use the ODBEdit command sor (show open records):
[local]Settings>cd / [local]/>sor /Equipment/Trigger/Settings open 1 times by ...
The history is working only if the logger is running, but it is not necessary to have any channel enabled.
The definition of the history event is done through two different means:
Both definition mode takes effects when the data logger gets a "start run" transition. Any modification during the run is not applied until the next run is started.
The history variable name for each element of the event is composed following one of the rules below:
[host:chaos:Running]Target>ls -l -r Key name Type #Val Size Last Opn Mode Value --------------------------------------------------------------------------- Target DIR settings DIR Names TGT_ STRING 7 32 10h 0 RWD [0] Time [1] Cryostat vacuum [2] Heat Pipe pressure [3] Target pressure [4] Target temperature [5] Shield temperature [6] Diode temperature Common DIR ... Variables DIR TGT_ FLOAT 7 4 10s 0 RWD [0] 114059 [1] 4.661 [2] 23.16 [3] -0.498 [4] 22.888 [5] 82.099 [6] 40 Statistics DIR ...
Beside the setup through ODBEdit, the Alarm can also be setup through the Midas web page..
Internal features - Top - Data format