May 31, 2001
Start the program with the left mouse button on any blank screen: choose HV Programs --> HV Control. Or type "hv_control" in any window. The file hv_control is actually a script which starts two processes: hv_control_server (if it's not already running) and hv_control_client. The system is designed so that there may be several clients, all communicating with the SY527 only via hv_control_server. However, at the moment only one client (hv_control_client) has supported software, and running more than one copy of hv_control_client at once is not recommended, since it will result in interleaved entries in the record file! In the rest of this document, references to the "hv_control" program generally are really referring to hv_control_client.
If the CAEN crate has been switched off and on while hv_control_server is running, the server tends to be left in a strange state causing hv_control to report "unknown errors". If this happens, kill hv_control_server and restart it.
When it starts, hv_control first reads the files hv_params.dat and hv_map.dat to find out which boards and channels it needs to control, and then reads the current parameters of each of those channels from the CAEN crate. Then it displays the top menu and waits (for a while) for instructions.
A few parameters can be controlled in a simple and self-explanatory way from the "Control HV" (1) menu. For complete control of the parameters, use the "Channel configuration menu" (2).
The program maintains an internal list of parameters for all channels. The parameters in this list related to the CAEN settings may be displayed with the command "Show HV channels settings" (2-->3); however, they are not necessarily the parameters actually in use.The internal parameter list may be made to correspond to the values actually stored in the HV boards via the commands "Read settings from boards" (2-->5) and "Load settings into HV boards" (2-->6). This list may also be made to agree with the file hv_params.dat using the commands "Read settings from file" (2-->7) and "Save settings to file"(2-->8).
IMPORTANT: When it is started, hv_control takes the HV settings in its parameter list from the hardware, not from the file hv_params.dat . It uses hv_params.dat only to find out which boards and channels are active, and which of those should be logged.
The system is designed in this way to minimize the probability of unintended changes to the actual hardware settings (and turns out to be just what users really want, most of the time). It means that most of the parameters in hv_params.dat really serve only as a set of reference parameters which are not generally used but are available for setting up the system or restoring it to a standard configuration.
The parameter list also includes the logging parameters: detector number, type, segments and tag. They may be displayed with the option "Show/change HV map" (2-->10). As with the HV parameters, a set of logging parameters appears in the file hv_params.dat but the values actually used are found elsewhere, this time in the file hv_map.dat. However, unlike the HV parameters, the logging parameters displayed are always the ones actually in use. Note that if you want to save logging parameter changes to hv_params.dat, you have to follow the changes with "Save settings to file", and before doing that you should make sure that the HV parameters are correct. So, the usual sequence would be: 2-->7 (read settings), 2-->10 (change settings), 2-->3 (check settings), 2-->8 (save settings).
Normally, the "Show/change HV map" command should be used to change the logging parameters, rather than directly editing hv_map.dat, since it automatically updates the hv_map.log file at the same time (but it is also easy to directly edit hv_map.log).
The monitoring pages are the ones entitled "Status of high voltage for crate m, slot n" and are reached from the "Control HV" submenu (1-->3).
IMPORTANT: Voltage and current logging and trip recovery are only running when the program is displaying the monitoring page(s).
If you are interested in logging, then except when you are actually doing some other operation (like changing the voltage settings) the program should always be left in monitoring mode. To help you remember this, the program automatically switches to monitoring (after a series of timeouts) if it is left anywhere in the menu chain which leads to it. However, if it is left in some other submenu, it will stay there indefinitely.
To regain control from the monitoring, just hit "Return".
The maximum logging frequency is the rate at which the monitoring page is updated (about once a second).
All channels with logging turned on will be correctly logged as long as any monitor pages are being displayed (even if their particular pages are not being displayed).
Channels defined as inactive are not displayed, and their parameters and states are not modified by any of the commands in the HV Control menu.
Your HV PC should have a CAEN A303 ISA card installed (it has two LEMO connectors, a red light, and no label). Connect a cable between one of the A303 connectors and one of the HIGH SPEED CAENET connectors on the CAEN SY527 HV crate. Put a 50 ohm terminator on the other HIGH SPEED CAENET connector.
When the HV crate is switched on, it should come on with the parameters of each module set to the values they had when the module was last switched off, except that all HV channels will be OFF. To make doubly sure that the HV is off until the settings are correct, you can set the HV_Enable switch on the CAEN crate to DISABLE . Then switch on the HV crate. Start the hv_control program and use option 5 to set and load the parameters you want, and option 1 to switch off the HV. Then set HV_Enable to ON.
The selection of V0 or V1, I0 or I1, is made with NIM inputs on the CAEN front panel. If there is no input, V0 and I0 are used. This program is designed to work with either 0 or 1, but has been most extensively tested with 0.
The CAEN A303 driver must be loaded. It is /home/fast/fast_daq/drivers/a303/drv/a303drv.o, and is normally loaded automatically because there is an entry for it in the file /etc/rc.d/rc.local. Check that it's running with "cat /proc/modules"; look for an entry "a303drv".
Source software for the system is in three subdirectories of /home/fast/fast_daq/slow_control/high_voltage: common, history and server_client. Each directory has its own Makefile. This causes a little bit of confusion, because hv_control_client is made in the server_client makefile, but most of the code is in the common directory. To make a new version of hv_control_client, do "make" in the server_client subdirectory. Also note that if you want to change hv_control_server, you have to explicitly kill it, since the hv_control script won't restart the server it if it's already running.
The system configuration file is /home/fast/fast_daq/slow_control/high_voltage/common/include/config.inc.
Binary executables are put in /home/fast/bin.
The hv_control_client program reads from and writes to several external files. Their locations are defined in config.inc. In their current locations, these files are:
|
/home/fast/data/hv_config/hv_params.dat |
configuration of all CAEN modules to be controlled |
|
/home/fast/data/hv_config/hv_map.dat |
specifies the logging tags for the CAEN channels |
|
/home/fast/data/hv_log/hv_map.log |
record of changes to the hv_map file |
|
/home/fast/data/hv_log/hv_log_mm_dd |
log of changes in channel status (obsolete) |
|
/home/fast/data/hv_record/hv_yyyy_mm_dd.dat |
record of one day's monitoring |
|
/home/fast/data/hv_history/me234_2_001.hvh |
one CSC's high voltage history |
There are two ways to update the hv_params.dat file. One way is to put the desired modules in the CAEN crate, do a "Probe to learn hardware configuration" (2-->9), use the "Change HV channels settings" menu (2-->4) to set all the module parameters to the values you want, and then choose "Save settings to file" (2-->8). This will overwrite the current hv_params.dat file with a new file reflecting the current status of all parameters . This method is a little slow because the probe operation looks for all 100 possible CAEN crates, with a timeout for each. After a new module is found, if you do "Show HV channels settings" (2-->3) the channels of the new module will be displayed with only the words "not used". This means that the channels are not active; you can activate them with (2-->4) at the same time that you adjust their parameters.
Caution: when adding new modules by probing, often the channel names read from the boards include unprintable characters. For obscure reasons, these characters can prevent the channel from being correctly loaded later (with the program reporting an error). It's recommended to change all the channel names of new modules by hand, or at least if loading errors occur.
The probe software is unable to read the board polarity automatically, so it will appear as "polarity unknown" (but not cause any problem) until you tell it the correct polarity with 2-->4.
Alternatively, you may edit the existing hv_params.dat file by hand. This is usually faster if there is a similar module already in the file which you can copy. Modules in the crate which are not in the hv_params.dat file are completely ignored by the hv_control (except during the crate scan).
The format of this file is defined by the code of the read_stored subroutine in common/src/hv_control_lib.f. Here is an example hv _params.dat file, for one crate and one 12-channel module in the third slot:

For each crate, there are ten entries describing in order the boards in the ten slots. Each entry must be either a line containing just "0" or composed of one line describing the board plus one line per channel describing the channels. (There are no slot or board numbers in the file.)
The detector type, number and segments parameters are used by the logging system (not by the CAEN crate). The detector types are defined in the include file common/include/detector_names.inc. For the segments parameter, the conventional bit assignment is an outer loop over layers 1-6 and an inner loop over segments 1-5 (so for example 00000010 is segment 5 of layer 1).
The hv_control program will not start without an hv_params.dat file which is consistent with the hardware. Consistent means that modules may be missing, but there cannot be extra modules. The simplest such file is 12 lines which are 1 (the number of crates), nn (the crate number), and ten zeros representing empty slots. This is enough to get the program started.
If you add new logged channels by editing hv_params.dat directly, use option 2-->10 (see section 4 below) afterwards to update the hv_map.dat and hv_map.log files. The software handling the hv_map is fairly new and is not guaranteed to be able to follow all possible ways of changing the configuration, so it's a good idea to check hv_map.dat and hv_map.log (and correct them by editing them directly if necessary) before returning to the monitoring page.
By default, automatic trip recovery is disabled. You can toggle between enabled and disabled with menu option 8.
The trip recovery parameters are defined in the file config.inc.
IMPORTANT: Trip recovery has NOT been tested in this version of the high_voltage control software. If you want to use it, test it first.
Logged data is written to two files: /home/fast/data/hv_log/hv_log_mm_dd and /home/fast/data/hv_record/hv_yyyy_mm_dd.rec, where yyyy is the year, mm is the month and dd is the day. A new file is created each day, or whenever the program wants to log and no file has yet been created.
The "record file" hv_yyyy_mm_dd.dat file is a record of the monitored values and is most usefully read by computer. The current status (channel number, mapping, logging tag, voltage, various current measurements and status) is written to the record file for selected channels. The channels can be selected with "Change HV channels settings" (2-->4), while the channel mapping can be modified with "Show/change HV map" (2-->10). The logging frequency can be changed by editing the parameter "record_interval" in config.inc (and recompiling).
The "log file" hv_log_mm_dd file has messages about actions taken by the hv_control program (whether in response to user commands, or automatically), and is meant to be read by people. When the hv_control program is started or whenever the status of a channel changes, the channel status is written to the log file. When HV is switched on or off for any channel, this action is recorded in the log file. Every action taken by the automatic trip recovery is logged. In other versions of the hv_control software the log file also sometimes contains channel parameters like voltage and current, but in this version the logging software has been a little bit neglected since it was superceded by the record_file system.
In the FAST site system, each chamber is supposed to have a history file in the directory /home/fast/data/hv_history which contains a record of its high voltage training. The history files are updated with data from the record files by the program hv_history_update, which updates the history files of all chambers which appear in the record file. It is scheduled to run automatically once a day at 1 a.m. (using the crontab utility), but can be run at any time. The history files can be updated from any particular record file by running slow_control/high_voltage/history/bin/interactive_update. Both update routines only add information which is newer than last lines in the file.
The logging parameters include a "logging tag", which may be any letter. Our convention is that only channels with tags "A" or "B" will be displayable using the chamber history graphical display, with A intended for normal channels and B intended for problem channels undergoing special training.