procedure to recover webserver etc

  1. run 'ps aux' and grep "nginx", if no output, run "sudo /etc/init.d/nginx start"
  2. visit "http://130.199.97.242", if it says "Please try again later", run "sudo /etc/init.d/cat-fcgi start"
  3. go to "http://130.199.97.242/about", look at the list of processes, if it says "hvlog NOT RUNNING", run "sudo /etc/init.d/hvlog start"
  4. check nfs mount, if not mounted run "sudo mount -a", if it doesn't work, restart the nfs service on the host machine

Info below are 2 years old, maybe not useful

DAQ Operation

  1. type "daq" from "phenix-rpcdb"
  2. check the status line by line
  3. status is printed by type "s"
  4. if it says "no protocol open", type "daq_open"
  5. if "daq_open" failed, type "pdaq" to log on to pdaq and type "./server_setup.sh" to restart aml
  6. set the max volume by "daq_set_max_volume" if necessary
  7. stop the run if any run is active
  8. type "daq_begin" to start
  9. it tells you the last run number if you don't supply the run number
  10. use "s" to check the status
  11. "daq_end" to end the run
  12. "logout" to quit daq
  13. run information can be found at http://127.0.0.1/rc, to modify the spreadsheet, go to http://127.0.0.1/rc/edit
  14. to see the timing distribution in each TDC, type "mon" from a terminal

process need to be running

  1. cam-movie.pl
  2. checkip
  3. motion

Server Address

Linux and Windows (on BNL network, internal access or tunnel)

RPC DB basic

The following things are identical with the PostgreSQL 8.2 manual:

To start at boot, in file /etc/rc.d/rc.local:

/usr/local/pgsql/bin/pg_ctl start -l logfile -D /usr/local/pgsql/data

everything runs with the user "postgres", and its home is at /var/lib/pgsql

the data cluster for PostgreSQL at factory is at /usr/local/pgsql/data

pg_ctl start -D /usr/local/pgsql/data -l logfile

The database is named rpcdb.

to accept remote connections, need to set listen_addresses in postgresql.conf in the data dir, also the pg_hba.conf file.

php5 is installed with postgres database support, phpPgAdmin is also installed.

Temperature/Humidity/Pressure monitoring

monitoring information will be stored in this table inside:

CREATE TABLE weather (
    "time" timestamp without time zone,
    temp2 real,
    temp0 real,
    humi0 real,
    humi2 real,
    temp1 real,
    temp3 real,
    humi1 real,
    humi3 real,
    pres0 real
);
GRANT ALL ON TABLE weather TO postgres;
GRANT ALL ON TABLE weather TO templog;
GRANT SELECT ON TABLE weather TO reader;
ALTER TABLE weather ADD CONSTRAINT weather_pk PRIMARY KEY (time);

to add/delete/rename a column

ALTER TABLE products ADD COLUMN description text;
ALTER TABLE products DROP COLUMN description;
ALTER TABLE products RENAME COLUMN product_no TO product_number;

Temperature/Humidity/Pressure sensors

specs for sensors from hobby-board website. For the Humidity Sensor:

For the Humidity Sensor:
  The range is 0-100% Relative Humidity
  The accuracy is +-2%
  The resolution is +-0.5%

For the Temperature Sensor:
  There are two different temperature sensors in the combined
  device. The DS2438 converts the output of the humidity and solar
  sensors to be 1-Wire compatible, and the DS18S20 temperature sensor.

For the DS2438:
  The range is -55 - +125 degrees Celsius
  The accuracy is +-2 degrees Celsius


For the DS18S20:
  The range is -55 - +125 degrees Celsius
  The accuracy is +-0.5 degrees Celsius

Barometer

needs calibration, the elevation of Bldg 912 is 23m

http://www.hobby-boards.com/catalog/howto_barometer.php?referer=product_info.php?products_id=36

http://www.hobby-boards.com/catalog/baro_calc.php

numbers we use: (assumed 28 meters or 91.9 ft for altitude)

Calibration Information
Offset Voltage: 3.555 The voltage that needs to be set when calibrating the Barometer.

For software that uses pressure and voltage Hi/Low
Pressure Low: 28 The low pressure entered above.
Pressure High: 32 The high pressure entered above.
Output Voltage Low: 2 The voltage output when the pressure is at the lowest value.
Output Voltage High: 8.039 The voltage output when the pressure is at the highest value.

For software that uses slope and intercept
Slope: 0.6624 The calculated slope.
Intercept: 26.6752 The calculated intercept.

Informational
Actual Pressure Low: 27.91 The actual low pressure calculated for the altitude entered.
Actual Pressure High: 31.89 The actual high pressure calculated for the altitude entered.
Max. Res.: 0.007 The resolution of the Barometer with the current settings.
Fixed Gain: 10 The fixed gain of the Barometer set by R1.

conversions:

1 inHg = 3386 Pa (at 0C) = 0.0334 atm = 0.491 psi
1 atm = 101,325 Pa
1 psi = 6895 Pa

OWAPI

OneWire Windows driver download: http://www.maxim-ic.com/products/ibutton/software/tmex/

To test the device, OneWireViewer found at the same website would be enough.

OneWire Java API download: http://www.maxim-ic.com/products/ibutton/software/1wire/1wire_api.cfm

the program for factory is based on the example "ReadTemp.java"

onewire Java API reference page: http://files.dalsemi.com/auto_id/softdev/owapi/index.html

search onewire examples http://www.maxim-ic.com/products/ibutton/example/

Taking weather data

the process is running on the Windows machine. It is a system service that is automatically start at system boot.

It is located at c:\work\WeatherLog\bin\WeatherLog.pl

To remove/install/check/stop/start the service

WeatherLog -remove
WeatherLog -install
WeatherLog -check
net stop WeatherLog
net start WeatherLog

The actual program is at WeatherLog.class at the same place. The source is at c:\work\WeatherLog\src\WeatherLog.java

Now we are using a hub (contains 3 DS2409's) for connection of multiple devices. The devices connected on the hub does not show up automatically. For programming, additional search is needed. Examples on OWAPI website demonstrated how to iterate devices on "com.dalsemi.onewire.container.SwitchContainer"

plot weather data

Perl module Chart::Strip has been used for the plots because it automatically calculates the division of the time axis. This module requires GD.

The default palette Catalyst::View::Chart::Strip uses is

our $def_pal = [qw/
    FF0000
    00CC00
    0000FF
    CC00CC
    00BBDD
    DDBB00
    000000
    666666
    557700
/];

Apache server

apache 2.0 is running at the factory.

X forwarding

when the lo interface is not up, the forwarding doesn't work

to bring lo back:

sudo ifconfig lo up

http://ubuntuforums.org/archive/index.php/t-246059.html

NFS and related

need to bring up the eth0:0 interface

sudo ifup eth0:0

mount the NFS disk on the daq machine, sometimes need to run rpc.statd when mount reports an error that it's not running:

sudo ifup -a
sudo /etc/init.d/portmap restart # if necessary
sudo /etc/init.d/nfs-common restart # if necessary
sudo mount -a

Gap QA Data from KODEL

the file from KODEL is Excel, the following columns will be in the table,

create table GapQA_KODEL_sample (
    Bar_Code varchar(50),
    Bak_codeGND varchar(50),
    Bak_Status1 varchar(10),
    Silk_Resis1 real,
    Bak_code_HV varchar(50),
    Bak_Status2 varchar(10),
    Silk_Resis2 real,
    Leak_Pass_Fail varchar(10),
    Spacer_Failures varchar(10),
    DATE_HV date,
    DC8_5kV_uA1 real,
    DC8_5KV_uA2 real,
    DC_9_0KV_uA real,
    DC_9_4KV_uA1 real,
    DC_9_4KV_uA2 real,
    DC_9_4KV_uA3 real,
    DC_9_4KV_uA4 real,
    HV_test_Pass_Fail varchar(10),
    Status_Electrodes varchar(10),
    Status_Hot_melt varchar(10),
    Status_Oil varchar(10),
    Status_PET varchar(10),
    comment text
);

convert the Excel file to a CSV file, it can then be imported into psql

COPY gapqa_kodel_sample FROM '/home/phenix/www/misc/kodel-data/re33r_20070520.csv' USING DELIMITERS ',';

import CSV file to a table

COPY gapqa_kodel_protoc FROM '/var/www/RPCFact/misc/kodel-data/rawqadata/phenix_20071228.csv.new' DELIMITERS ',' CSV;

PRDF files

to look at the content:

ddump -O -n5 run_00034_08.evt

Ubuntu problems

scrollkeeper eats all cpu:

http://ubuntu-forum.com/showthread.php?p=4266393

CAEN HV

telnet 192.168.12.99 1527 # or whatever its ip is

Webcam

we use 4 creative webcams to monitor activities in the factory. The driver is SPCA5XX that comes with Ubuntu.

motion is used to record the images

http://www.lavrsen.dk/twiki/bin/view/Motion/MotionGuideBasicFeatures

It serves both mjpeg streams and still pictures.

Scanner

We use the HHG 3800g scanner. By scanning a command in the manual, a carriage return can be added to each scan.

Ganglia

gmond has a Windows native binary

http://aprconsulting.ch/product_ganglia.htm

Reference

notes on Catalyst

http://developer.mozilla.org

http://www.postgresql.org/docs/8.2/static/index.html