ODB Structure

previous.gif Internal features - Top - Data format next.gif

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 .


ODB /System Tree

The system tree contains information specific to each "Midas client" currenltly connected to the experiment. This information is not primarly for the user but may be informative in some respect to the reader.

[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


ODB /RunInfo Tree

This branch contains system information related to the run information. Several time fields are available for run time statistics.
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


ODB /Equipment Tree

Every frontend create a entry under the /Equipment tree. The name of the sub-tree is taken from the frontend source code in the equipment declaration (frontend.c). More detailed explanation of the composition of that tree will be found throughout this document.
  {
   "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


ODB /Logger Tree

The /Logger ODB tree contains all the relevant information for the Midas logger utility (mlogger task) to run properly. This utility provides the mean of storing the physical data retrieved by the frontend to a storage media. The user has no code to write in order for the system to operate correctly. Its general behavior can be customized and multiple logging channels can be defined. The application supports so far three type of storage devices i.e.: Disk, Tape and FTP channel.

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


ODB /Experiment Tree

Under this tree, the Midas system stores special features for the user in order to facilitate his job on controlling a run. Initially only one empty key is defined labeled Name for the experiment name. The user can create four system keys in order to provide extra run control flexibility i.e.: "Run Parameter/", "Edit on Start/", "Lock when running/" and "Security/".


ODB /History Tree

This tree is automatically created when the logger is started. The logger will create a default sub-tree containing the following structure:
[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.
A second sub-tree is added to the /History by the mhttpd task Midas web server when the button "History" on the main status page is pressed.
[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
This define a default history display under the Midas web server as long as the reference to "System" is correct. See History system for more information regarding explanation on these fields.

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 /Alarms Tree

This branch contains system information related to alarms. Currently the overall alarm is checked once every minute. Once the alarm has been triggered, the message associated to the alarm can be repeated at a different rate. The structure is split in 2 sections. The "Alarms" itself which define the condition to be tested and the "Classes" which defines the action to be taken when the alarm occurs. In order to make the system flexible, beside some default message logging (Classes/Write system message), each action may have a particular "detached script" spawned by it (Classes/Execute command).
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


ODB /Script Tree

This branch permits to invoke scripts from the web page. By creating the ODB tree /Script every entry in that tree will be available on the Web status page with the name of the key. Each key entry is then composed with a list of ODB field (or links). The first ODB field should be the executable command followed by as many arguments as you wish to be passed to the script.

[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


ODB /Alias Tree

This branch is not present until the user creates it. It is meant to contain symbolic links list to any ODB location. It is used for the Midas web interface where all the sub-trees will appear in the main window. By default the clicking of the button in the web interface will spawn a new frame. To force the display of the alias link in the same frame, a "&" has to be added to the name of the alias.

odbedit
ls
create key Alias       
cd Alias
ln /Equipment/Trigger/Common "Trig Setting" <-- New frame
ln /Equipment/Trigger/Common "Trig Setting&"      <-- Same frame


ODB /Elog Tree

This branch describes the Elog settings used through the Midas web server. See mhttpd task for setting up the different Elog page display.

[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


ODB /Programs Tree

System created tree containing task specific characteristics such as the watchdog and alarm condition. See Alarm System .

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


ODB /Lazy Tree

Backup facility Tree. Created with default parameters on the first activation of lazylogger task. This task connects to a defined channel (i.e: Tape). when started. Multiple instance of the program can run contemporary.

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


ODB /EBuilder Tree

The Event Builder tree is created by mevb task and is placed in the Equipment list.

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


ODB /Custom Tree

Web string for custom web page. Editable ONLY from your Web browser through Custom page .

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>


Hot Link

It is often desirable to modify hardware parameters like discriminator levels or trigger logic connected to the frontend computer. Given the according hardware is accessible from the frontend code, theses parameters are easily controllable when a hot-link ODB is established between the frontend and the ODB itself.

HotLink process
hotlink.gif

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
Immediately after each modification the frontend should display the new values. The settings can be saved to a file and loaded back later:
[local]/>cd /Equipment/Trigger/Settings
[local]Settings>save settings.odb
[local]Settings>set level1 789
[local]Settings>load settings.odb
The settings can also be modified from any application just by accessing the ODB. Following listing is a complete user application that modifies the trigger level:
#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();
The following figure summarizes the involved components:

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 ...


History system

The history system is an add-on capability build in the data logger (see mlogger task ) to record information in parallel to the data logging. This information is recorded with a time stamp and saved into "data base file" like for later retrieval. One set of file is created per day containing all the requested history events.

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:


Alarm System

The alarm system is built in and part of the main experiment scheduler. This means no separate task is necessary to beneficate from it, but this feature is active during ONLINE mode ONLY . Alarm setup and activation is done through the Online DataBase. Alarm system includes several other features such as: sequencing control of the experiment. The alarm capabilities are:

Beside the setup through ODBEdit, the Alarm can also be setup through the Midas web page..

Midas Web Alarm setting display
malarm01.gif

Midas Web Alarm setting display
mprog01.gif

Midas Web Alarm Program status display
mprog02.gif

previous.gif Internal features - Top - Data format next.gif


Midas DOC Version 1.9.5 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk