SLAC PEP-II
BABAR
SLAC<->RAL
Babar logo
HEPIC E,S & H Databases PDG HEP preprints
Organization Detector Computing Physics Documentation
Personnel Glossary Sitemap Search Hypernews
Unwrap page!
Comp. Search
Who's who?
Meetings
FAQ Homepage
Archive
Environment
Administration
New User Info.
Web Info/Tools
Monitoring
Training
Tools & Utils
Programming
C++ Standard
SRT, AFS, CVS
QA and QC
Remedy
Histogramming
Operations
PromptReco
Simulation Production
Online SW
Dataflow
Detector Control
Evt Processing
Run Control
Calibration
Databases
Offline
Workbook
Coding Standards
Simulation
Reconstruction
Prompt Reco.
BaBar Grid
Data Distribution
Beta & BetaTools
Kanga & Root
Analysis Tools
RooFit Toolkit
Data Management
Data Quality
Event display
Event Browser
Code releases
Databases
Check this page for HTML 4.01 Transitional compliance with the
W3C Validator
(More checks...)

The DchMon Database:

A manual on the design and uses of the DchMon databases

The DchMon databases are located in the $BFROOT/download/dch/DchMon/db directory. The ones currently in use are DchGlobalSim.db, DchLowVolt.db, DchTemp.db, and DchMon.tmpl. The latter-most is not a database, but instead a template file used when loading the databases into the input-output controller (IOC). These databases were configured using a graphical tool, "GDCT". For those who are unfamiliar with this tool, please refer to either gdct.html or GDCT User's Manual.

Contents:

  1. DchGlobalSim.db
    • The Binary Outputs
    • DchSimFanout
    • DchSimKick

  2. DchTemp.db
    • DchTemp:$(AREA)$(NUM)
    • DchTemp:Sim$(AREA)$(NUM)s
    • DchTemp:Sim$(AREA)$(NUM)
    • Changing Simulation Modes

  3. DchLowVolt.db
    • DchCrt$(CRT):LowV$(V)
    • DchCrt$(CRT):LowVSim$(V)s
    • DchCrt$(CRT):LowVSim$(V)
    • Changing Simulation Modes

  4. DchMon.tmpl
    • Templates and Macros
    • Temperature Macros
    • Low Voltage Macros

1) DchGlobalSim.db


This database is used to toggle any of the DchMon databases back and forth between real and simulation mode, although it would be wise to put all records that require global access in it as well. DchGlobalSim.db has three different types of records: binary outputs, or bo's, a data fanout (dfanout), and a fanout.

All of the bo's serve the same purpose: to toggle to and from real and simulation mode. The leftmost bo, labeled DchSimSwitch, is the global switch; changing the value of this bo will affect all of the DchMon databases. The other four bo's affect smaller sub-databases. The bo labeled DchTemp:SimMode determines the real/simulation state of the whole temperature database. The other three bo's determine the mode of the low voltage database, with each bo controlling one crate. All of the bo's were set so that when their value is "1", they are in simulation mode, and when their value is "0", they are in real mode. I chose not to put a "button" that accesses DchSimSwitch on the EPICS displays; instead, its value may be input in one of the following ways:

  • - from a screen whose operating system is vxWorks, enter the command:
    • dbpf "DchSimSwitch","VAL"

    - from a Unix workstation, use the channel access libraries to modify VAL with the command:
    • caput DchSimSwitch VAL

where the DchMon database would go into simulation mode if VAL was 1, and real mode if VAL was 0. One may also obtain the current value of DchSimSwitch using the following functions:

  • - using vxWorks, enter the command:
    • dbgf "DchSimSwitch"

    - from Unix, enter the channel access command:
    • caget DchSimSwitch

These functions cause the string equivalent, ie Simulation Mode or Real Mode, to be read back to the screen. "Simulation Mode" will also be displayed in red on the Dch Main Menu when DchSimSwitch is "1". All four of these functions may be used for any record in any database, not just this one.

The dfanout, DchSimFanout, was used so that the value of DchSimSwitch could be output to four bo's at once. DchSimSwitch is connected to this record in two ways: its FLNK field is linked to DchSimFanout, causing DchSimFanout to update whenever DchSimSwitch does, and the OUT field of DchSimSwitch is linked to DchSimFanout's VAL field, so that when DchSimFanout processes, its value becomes the same as DchSimSwitch's value. This value is then passed to the VAL fields of the four bo's.

The fanout, DchSimKick, is connected to DchSimFanout's FLNK field. Thus, whenever DchSimFanout processes, so does DchSimKick. The purpose of a fanout is to force several records to process at once; any record that is connected to one of a fanout's LNK fields will update as soon as the fanout updates. This means that when DchSimKick updates, which occurs when DchSimFanout updates (and DchSimFanout updates when DchSimSwitch does), the four bo's will be forced to update to DchSimSwitch's new value. Otherwise, the values of the four bo's may change individually, without affecting the rest of the DchMon database, and without being affected by the present state of DchSimSwitch. The value of DchSimSwitch is only passed on when it is changed; otherwise the current value of DchSimSwitch isn't necessarily the same as the values of the four other bo's.


2) DchTemp.db


This database is meant to monitor the temperatures read by thermocouples stationed at various locations in the drift chamber. This is done with the analog input (ai) labeled DchTemp:$(AREA)$(NUM). This ai is set to simulation or real mode by the record named DchTemp:SimMode, which is located in the DchGlobalSim database. The SIML (simulation mode location, i.e. which record "tells" it to change to simulation or real mode) is connected to DchTemp:SimMode via an external link. The ai's SIOL (simulation input/output location, i.e. where the record gets its value from when it's in simulation mode) may be connected to either a subroutine record (sub) or an ao. Which record it is connected to determines how the simulation data is to be input to the database.

The sub, labeled DchTemp:Sim$(AREA)(NUM)s, obtains its values from two subroutines: one to initialize its value, the other to modify it. The subroutines used may be changed by modifying the INAM and SNAM fields of DchTemp:Sim$(AREA)(NUM)s. This is done by selecting the sub, choosing the "Examine" option, then "Edit Attributes", and modifying the fields in the window that appears. Currently when the database is first loaded the sub calls InitT$(AREA)$(NUM), a subroutine that initializes each voltage to its ideal value, and then whenever the sub updates, it calls the subroutine named subSimData, which changes the value of the subroutine by a pseudo-random value. Both this subroutine and the initialization subroutine are written in C for use with the vxWorks RTOS (Real-Time Operating System). The source code for these subroutines is in the file $BFROOT/download/dch/DchMon/src/subCode.c

The other option for simulated input is to connect the ai to the VAL field of an ao, labeled DchTemp:Sim$(AREA)$(NUM). In this case, the user enters the simulation input into the appropriate simulation panel of the EPICS user interface.

For instructions on changing the simulation mode from one method to another, please consult the documentation displayed on DchTemp's GDCT panel.


3) DchLowVolt.db


This database is meant to monitor the voltages of the low voltage crates. It is set up in basically the same manner as the temperature database, DchTemp.db. In this database, the ao that monitors the voltage is labeled DchCrt$(CRT):LowV$(V). Its SIML field is connected (via an external link) to DchCrt$(CRT):LowVSimMode.VAL, and its SIOL field may be connected to either a sub or an analogue output (ao).

The sub, labeled DchCrt$(CRT):LowVSim$(V)s, obtains its values from two subroutines: one to initialize its value, the other to modify it. The subroutines used may be changed by modifying the INAM and SNAM fields of DchCrt$(CRT):LowVSim$(V)s. This is done by selecting the sub, choosing the "Examine" option, then "Edit Attributes", and modifying the fields in the window that appears. Currently when the database is first loaded the sub calls InitT$(AREA)$(NUM), a subroutine that initializes the value of each thermocouple, and then whenever the sub updates, it calls the subroutine named subSimData, which changes the value of the subroutine by a pseudo- random value. Both this subroutine and the initialization subroutine are written in C for use with the vxWorks RTOS (Real-Time Operating System). The source code for these subroutines is in the file $BFROOT/download/dch/DchMon/src/subCode.c.

The other option for simulated input is to connect the ai to the VAL field of an ao, labeled DchCrt$(CRT):LowVSim$(V). In this case, the user enters the simulation input into the appropriate simulation panel of the EPICS user interface.

For instructions on changing the simulation mode from one method to another, please consult the documentation displayed on DchLowVolt's GDCT panel.


4) DchMon.tmpl


This file is not a database like the others, but a template file which loads multiple databases from a single file. It is this file that substitutes values for the macros found in the databases, usually creating several copies of the database records. The contents of the template file are grouped according to the database they use. A line containing file db/database name precedes a set of parentheses, inside of which the macro substitutions are made. A macro is indicated in a database by a dollar sign followed by the macro's name in brackets, like this: $(MACRO). The first statement in the template file is the "pattern" statement. Inside the subsequent set of braces are the names of all of the macros for which substitutions are being made, with each name separated by a comma and (optionally) spaces. After the "pattern" statement is all of the values that are to be substituted for the macros. The order of the values must match the order used in the "pattern" statement, and these should also be separated by commas and (optionally) spaces. The substitutions for each copy made must be grouped with parantheses.

The temperature database currently uses three different macro substitutions. The AREA macro specifies the area of the driftchamber in which the thermocouple is located; possible choices are Front, Body, Back, Electronics, and Remote. The NUM macro substitutes the thermocouple number; all areas have three thermocouples, except for remote, which has four. These two substitutions result in sixteen copies of the temperature database, one for each thermocouple. The final macro, ADC, specifies the value of the record's DTYP field. For our uses, the choices are "Soft Channel", which is used during simulation mode, or "AVME-9325 Di", which is the type of analogue-to- digital converter (ADC) that will be used during real mode. Note that since these names are strings, their names must be enclosed in quotes when entered into the file (ex: "Soft Channel").

The low voltage portion of the template file is a bit more complicated than the temperature part, since it has eight different macros to deal with. The CRT macro specifies the low voltage crate number; the crates are numbered, beginning with 01. The V macro determines which voltage the thermocouple is being used to monitor; current choices are 12p (for positive twelve volts), 12m (for negative, or "minus" twelve volts), 6p, 6m, grnd (ground), and thresh (threshold voltage). Like the ADC macro in the temperature database, the values given for this macro must be enclosed in quotation marks. The CRT and V macros are used to make "copies" of the low voltage database; right now, by specifying three different values for CRT (01, 02, 03) and all six possible values for V, eighteen copies of the database are made.

The other low voltage macros are used to specify the characteristics of each voltage being monitored. The HIHI, LOLO, HI, and LO macros specify the record's alarm fields, with HIHI and LOLO representing major alarms, and HI and LO representing minor alarms. The ADC macro serves exactly the same purpose as it does for the temperature database--it specifies the value of the ai's DTYP field. As with the temperature database, there are two possible values: "Soft Channel", used for simulation mode, or "AVME-9325 Di", the name of the ADC used in real mode. Again, note that the name substituted for the ADC macro must be enclosed in quotation marks. The final macro, SUB, specifies the subroutine that the record calls while in simulation mode. The two options are subSimData and subThresh, with the latter subroutine used for records monitoring the threshold voltage (ie the records whose V macro is given the value thresh), and the former used for all other low voltages. This was done because the threshold voltage is the only one whose voltage shouldn't change with time, so the subroutine doesn't affect the threshold voltage when it is called. The other subroutine changes the value of the record calling it by a small, pseudo-random value.


                      ------ Suzanne Komili & Janis McKenna
                                     March 18, 1996

Questions or comments? Send them to:

Suzanne Komili / University of British Columbia / suzannek@slac.stanford.edu - or - suzannek@unixg.ubc.ca