# Gas System

# Software Manual

# 

# Brookhaven National Laboratory

# 

# 

# 

# 

# 

# By Peter Kravtsov (E-mail: <PAKravtsov@lbl.gov>**)**

# This document location: <http://www-rnc.lbl.gov/~pkravt/pdf/phenix_soft.pdf>

# 

# 

# **May 2000**

## Introduction

> The software described in this document was developed for each of the
> TEC/TRD and DC/PC gas systems. The differences between these two
> programs are negligible, therefore we will consider TEC/TRD gas system
> software in this document. It provides manual control of the gas
> system, data acquisition, shows measured system parameters and
> maintains gas system database. Besides, the software reacts on some
> gas system faults and takes care for automatic recovering.
>
> The gas system software consists of two on-line processes: main
> process, which does the most job, and DBWriter, which maintains
> database. In addition, third application -- DBViewer \[4\], can be
> used to visualize gas system parameters from database or export the
> data to text files for further analysis. The database used for gas
> system data is MS Access 97 database, which requires Data Access
> Objects (DAO3.5) be installed on computer for normal work of DBWriter
> and DBViewer \[4\]. Data Access Objects are included in MS Office 97
> installation. The main process logs every event into text file (may be
> changed to Windows NT application event log in future).
>
> The main control process contains two threads. The first one provides
> graphical user interface (GUI) and events log, while the second thread
> does data acquisition, device control and alarms handling. The
> priority of the second thread is set to highest value for reliable
> work in crowded system.

## Main Process

> The main process of gas system software gives user a possibility to
> control gas system manually (Fig. 1). The buttons on the gas scheme
> represent every solenoid valve and device controlled by software. Red
> button state means either closed valve or switched off device, while
> green one stays for open valve or switched on device. Note that some
> solenoid valves and devices are controlled by the Alarm System (see
> [Alarm System Manual](http://www-rnc.lbl.gov/~pkravt/pdf/alarm_manual.pdf)
> \[3\] for details) and the pressure switch therefore they may block
> software control. The gas scheme at the main window is simplified
> \[2,3\].
>
> All the sensors being read by software are displayed at right side of
> the window. There is a possibility to see sensor's voltages, which can
> be useful for coefficients calculation. The buttons beneath sensors
> list are used to enable or disable alarms and open preferences window.
> Note that all alarms are disabled by default at program start. Each
> software event is logged into list at the bottom of window and into
> text log file as well. Event log at this window is capable to keep up
> to 200 lines. Text file is tab‑delimited and it's easy to analyze it
> in MS Excel. When the program starts, it executes DBWriter
> automatically.![](media/image1.png){width="6.686805555555556in"
> height="5.3284722222222225in"}
>
> The Preferences dialog window contains two tabs: Analog inputs
> configuration and Alarms configuration. First tabsheet (Fig. 2) allows
> one to adjust translation coefficients for each sensor, it's name and
> physical units. Voltage is converted to physical value using the
> formula: $S = \left( V - \text{KA} \right) \cdot \text{KB}$, where V
> is voltage, S -- physical value. The sensors configuration list can be
> saved to registry (\[OK/Save\] button), to binary file
> (\[Save to file\] button), loaded from binary file with \[Load from
> file\] button and exported to tab-delimited text file (\[Export to
> Text\] button).![](media/image2.png){width="6.482638888888889in"
> height="4.616666666666666in"}
>
> There is also trackbar for changing DAQ interval, i.e. interval
> between reading of all sensors. User has not to do it too small,
> because it increases number of database records, seeing each reading
> is stored in database. History file location resides underneath DAQ
> interval trackbar. All these parameters are saved into registry by
> \[Ok/Save\] button and restored at program startup.
>
> The Alarms configuration tabsheet (Fig. 3) is designed to display and
> change alarms levels and actions to be taken in case of any particular
> alarm. For every alarm one can change:

-   Alarm name

-   Active sensor for this alarm

-   Alarm level (sensor value exceeding level causes alarm)

-   Alarm return level (sensor value below this level recovers system
    from alarm, once it has been
    triggered)![](media/image3.png){width="6.491666666666666in"
    height="4.622916666666667in"}

-   Threshold sign (sensor value comparison sign)

-   Count (number of exceeded sensor values for alarm) \[*not used
    yet*\]

-   Enabled (allows enable or disable each alarm)

-   Alarm message, which will be logged in case of alarm

-   Alarm message color

-   Valves configuration

> Alarms handling algorithm is almost the same like in Alarm System (see
> [Alarm System Manual](http://www-rnc.lbl.gov/~pkravt/pdf/alarm_manual.pdf)
> \[3\] for details). After each measuring cycle, DAQ thread compares
> alarm thresholds for all enabled alarms with appropriate sensor values
> using alarm comparison signs. If sensor value exceeds the alarm level,
> it displays alarm message and updates valves accordingly alarm valves
> configuration (red valves will be closed, green will be open, while
> gray will be left intact), storing list of affected valves in memory.
> Upon alarm recovery event, i.e. if sensor value returns to alarm
> return level, the code changes only those valves, which were not
> alarmed by the other sensors, making use of the stored list of the
> changed outputs.
>
> Note that instead of special **default state** used in Alarm System,
> PC software uses **current valves state** at every alarms checking
> cycle. This means that no valves and devices are affected if nothing
> happens with alarm situation, i.e. neither alarms nor alarm returns
> happened.
>
> Alarms configuration is stored in registry. There are two copies of
> alarms setup: normal and defaults. Normal setup is used each time the
> program starts, while defaults intended to be used as a reference. The
> buttons at the window's bottom allows to perform service tasks:

  ----------------------------------------------------- -------------------------------------------------------------
  ![](media/image4.png){width="0.3645833333333333in"    -- Save alarms configuration to binary file
  height="0.3125in"}                                    

  ![](media/image5.png){width="0.3645833333333333in"    -- Load alarms configuration from binary file
  height="0.3125in"}                                    

  ![](media/image6.png){width="0.3645833333333333in"    -- Export alarms configuration to tab-delimited text file
  height="0.3125in"}                                    

  ![](media/image7.png){width="0.3645833333333333in"    -- Export alarms configuration to MS Excel file (takes about
  height="0.3125in"}                                    2 minutes!)

  ![](media/image8.png){width="0.3645833333333333in"    -- Save alarms configuration to registry as defaults
  height="0.3125in"}                                    

  ![](media/image9.png){width="0.3645833333333333in"    -- Add new alarm to bottom of alarms list
  height="0.3125in"}                                    

  ![](media/image10.png){width="0.3645833333333333in"   -- Copy current alarm to a new one at the bottom of the list
  height="0.3125in"}                                    

  ![](media/image11.png){width="0.3645833333333333in"   -- Move current alarm up (just for aesthetic purposes)
  height="0.3125in"}                                    

  ![](media/image12.png){width="0.3645833333333333in"   -- Move current alarm down (just for aesthetic purposes)
  height="0.3125in"}                                    
  ----------------------------------------------------- -------------------------------------------------------------

> If user changed either alarms or analog inputs configuration and wants
> to switch to other tabsheet, he will be asked about saving changes
> (Fig. 4). ![](media/image13.png){width="2.870138888888889in"
> height="1.2819444444444446in"}

## DBWriter

> The DBWriter window (Fig. 5) is usually minimized and resides in
> system tray. It has it's own log, which is not saved to text file.
> Actually the DBWriter window is used only for solving problems with
> data recording to database or for changing database. One can create a
> new database in DBWriter. It is recommended to change database
> sometimes, because huge amount of data makes it difficult to search
> and select data. For example, the same database in STAR experiment has
> about 200,000 records for three and a half months and takes about
> 50Mb. Therefore it seems to be wise to start a new database every 3-5
> months.
>
> See [DBViewer Manual](http://www-rnc.lbl.gov/~pkravt/pdf/DBViewer.pdf)
> \[4\] for information about data analysis and processing.

![](media/image14.png){width="4.995138888888889in"
height="2.9458333333333333in"}

References

1.  TEC/TRD Gas System scheme.

2.  DC/PC Gas System scheme.

3.  [Alarm System Manual:
    http://www-rnc.lbl.gov/\~pkravt/pdf/alarm_manual.pdf](http://www-rnc.lbl.gov/~pkravt/pdf/alarm_manual.pdf)

4.  [DBViewer Manual:
    http://www-rnc.lbl.gov/\~pkravt/pdf/DBViewer.pdf](http://www-rnc.lbl.gov/~pkravt/pdf/DBViewer.pdf)