Skip to content
Snippets Groups Projects
README 9.51 KiB
Newer Older
Wed Mar 20 16:46:23 PDT 2013

Added matrices (cdsMuxMatrix) to the /proc/{system}/epics interface.
A matrix will show up as a single read/write file. For example:

-rw-rw-rw- 1 1001 root 512 Mar 20 16:52 /proc/x1ats/epics/X1:ATS-OUTMATRIX

Reading from the file will return all elements at once, here is
the result of reading 8 by 1 matrix values:

cat /proc/x1ats/epics/X1:ATS-OUTMATRIX
        1.3
        1
        1
        2.299999999999999
        1.2345
        1
        1
        1

Writing into the matrix file requires an extra argument:

echo 1 7 > /proc/x1ats/epics/X1:ATS-OUTMATRIX

command will set matrix element at index 7 to 1. Index is zero based
and calculated as "row * ncols + col":

Similarly "f" command has an extra parameter to indicate the index:

echo f 1.2345 4 1047858350.4 > /proc/x1ats/epics/X1:ATS-OUTMATRIX

command will set the element at index 4 to 1.2345 at 1047858350.4.


Fri Mar 15 15:18:12 PDT 2013

There is a change to /proc/{system} file.

First, a single file was replaced with the directory:

controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ ls -altR /proc/x1ats/ | head -30
/proc/x1ats/:
total 0
dr-xr-xr-x   3 root root     0 Mar 15 15:19 .
dr-xr-xr-x   2 root root     0 Mar 15 15:19 epics
-r--r--r--   1 1001 root   128 Mar 15 15:19 gps
-r--r--r--   1 1001 root 10240 Mar 15 15:19 status
dr-xr-xr-x 122 root root     0 Mar  5 02:39 ..

/proc/x1ats/epics:
total 0
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:ATS-_DCU_ID
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_ADC_WAIT
-rw-rw-rw- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_BURT_RESTORE
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_CPU_METER
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_CPU_METER_MAX
-rw-rw-rw- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_DACDT_ENABLE
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_DIAG_WORD
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_GDS_MON_0
-r--r--r-- 1 1001 root   128 Mar 15 15:19 X1:FEC-77_GDS_MON_1

/proc/x1ats/status has the status information now (same as before):
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ cat /proc/x1ats/status
startGpsTime=1047420886
uptime=365
cpuTimeEverMax=2
cpuTimeEverMaxWhen=1047420890
adcHoldTime=61
adcHoldTimeEverMax=63
adcHoldTimeEverMaxWhen=1047420907
adcHoldTimeMax=62
adcHoldTimeMin=59
adcHoldTimeAvg=60
usrTime=0
usrHoldTime=0
cycle=12285
gps=1047421251
buildDate=Mar 15 2013 15:13:57
cpuTimeMax(cur,past sec)=1,2
cpuTimeMaxCycle(cur,past sec)=4140,4146
cycleHist: 1=16383@17 2=1@4146

In addition there is a gps file that report the current GPS seconds and a fraction:
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ cat /proc/x1ats/gps
1047421291.43

There is new directory /proc/x1ats/epics which has a file per Epics channel. These files,
as indicated by the permissions, are read only or read/write. Reading them returns
the current value of the corresponding Epics channel.

controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
1

Read/write files are the setpoints. The mechanism to modify them is as follows: A set of 
channels needs to be masked before a new values can be written. User needs to write single letter "m"
to mask the channel or single letter "u" to unmask it.

controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ echo m > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
        1
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ echo u > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
1

Note the difference in readout value (the presence of a tab before the value) when channel is masked.

After a channel is masked then its values cannot be changed via Epics channels access route. There are two 
ways to change a value of a channel through the /proc file:

1. Write to the file to change the value immediately:

controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ echo m > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ echo 123 > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
        123
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ caget X1:FEC-77_BURT_RESTORE
X1:FEC-77_BURT_RESTORE         123
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ echo u > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone /opt/rtcds/tst/x1/rtbtrunk/src/include $ caget X1:FEC-77_BURT_RESTORE
X1:FEC-77_BURT_RESTORE         123

2. 'f' command can be used to program value change in the future:

controls@standalone ~ $ echo m > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone ~ $ cat /proc/x1ats/gps
1047422062.40
controls@standalone ~ $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
        123
controls@standalone ~ $ echo f 1 1047422162.40 > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
controls@standalone ~ $ cat /proc/x1ats/epics/futures
X1:FEC-77_BURT_RESTORE 1 1047422162 6553
controls@standalone ~ $ cat /proc/x1ats/gps
1047422110.13
controls@standalone ~ $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
        123
controls@standalone ~ $ cat /proc/x1ats/gps
	1047422131.30
controls@standalone ~ $ cat /proc/x1ats/gps
	1047422163.82
controls@standalone ~ $ cat /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE
        1
controls@standalone ~ $ cat /proc/x1ats/epics/futures
controls@standalone ~ $ echo u > /proc/x1ats/epics/X1\:FEC-77_BURT_RESTORE

The format of 'f' command is 'f' <new value> <gps time>. File /proc/x1ats/epics/futures
can be examined to see currently programmed future value updates.

Wed Aug 15 10:32:57 PDT 2012

There is a change to controller.c which will require a new patch to the kernel to expose
a new function:

-rw-r--r-- 1 controls controls 6112 Aug 15 10:35 linux-3.0-cs.patch
-rw-r--r-- 1 controls controls 6198 Aug 15 10:35 linux-2.6.34.1-cs.patch

Please update your kernel or models would not load.

Mon Jul 30 16:11:19 PDT 2012

As of r2996 there is a change to the Epics record/device initialization code.
In order for the new code to work correctly there is a new requirement to define
an environment variable EPICS_DB_INCLUDE_PATH to point to $EPICS_BASE/dbd directory,
for instance:

export EPICS_DB_INCLUDE_PATH=/opt/rtapps/epics/base/dbd

If this is not set in the execution environment, then the Epics process would not start.

Wed May 30 15:19:34 PDT 2012

IMPORTANT, installing new daqd and nds will require moving raw minute trend data
into the subdirectories. The new daqd frame writer will save raw minute trend files not all
into the same directory (/frames/trend/minute_raw) but instead the CRC8 is calculated
on the file name, a subdirectory is created using the calculated CRC8 hex number (0 through ff)
and then the file is created/appended in that subdirectory.

For example, when before we had 

/frames/trend/minute_raw/X2:FEC-18_DAC_OVERFLOW_0_4

from now on it will be kept here:

/frames/trend/minute_raw/0/X2:FEC-18_DAC_OVERFLOW_0_4

where "0" is the subdirectory and its name is arrived at by calculating the CRC8 sum
on string "X2:FEC-18_DAC_OVERFLOW_0_4". The reason this is implemented is that we
need to be able to avoid keeping all the files in the same directory, where "ls"
command would takes a few seconds to execute: the more files are n the same directory
the slower ls will execute. So we would like to spread the files 
evenly among the 255 subdirectories and using the CRC8 on the file names creates the uniform
file distribution.

There are two programs used to move the files into the subdirectories. crc8 program,
which calculates the CRC8 checksum, needs to be compiled as follows:

./configure
make rcv
cd build/rcv
make crc8
sudo cp crc8 /usr/local/bin

There is a Perl script which is used to print the move commands out:

cd src/daqd/util
sudo cp mv_trend.pl /usr/local/bin

Once these two commands are installed in /usr/local/bin they can be used as follows,
assuming the raw minute trend files are kept in /frames/trend/minute_raw (check frame writer daqdrc file):

cd /frames/trend/minute_raw
/usr/local/bin/mv_trend.pl

Examine the output of mv_trend.pl script and if it looks good to you, you can rerun it and pipe
the output into bash in order to execute the move commands:

/usr/local/bin/mv_trend.pl | bash

Once this is done, the contents of /frames/trend/minute_raw should look roughly as follows:

ls@x2daqfw /opt/rtcds/rtscore/alex/advLigoRTS $ ls /frames/trend/minute_raw/
0   17  2   28  31  3a  43  4d  55  5e  66  6f  77  8   88  90  99  a1  ab  b3  bc  c4  cd  d5  de  e7  f   f8
1   18  20  29  32  3b  44  4e  56  5f  67  7   78  80  89  91  9a  a2  ac  b4  bd  c5  ce  d6  df  e8  f0  f9
10  19  21  2a  33  3c  45  4f  57  6   68  70  79  81  8a  92  9b  a3  ad  b5  be  c6  cf  d7  e   e9  f1  fa
11  1a  22  2b  34  3d  46  5   58  60  69  71  7a  82  8b  93  9c  a4  ae  b6  bf  c7  d   d8  e0  ea  f2  fb
12  1b  23  2c  35  3f  47  50  59  61  6a  72  7b  83  8c  94  9d  a5  af  b7  c   c8  d0  d9  e1  eb  f3  fc
13  1c  24  2d  36  4   48  51  5a  62  6b  73  7c  84  8d  95  9e  a6  b   b8  c0  c9  d1  da  e2  ec  f4  fd
14  1d  25  2e  37  40  49  52  5b  63  6c  74  7d  85  8e  96  9f  a7  b0  b9  c1  ca  d2  db  e4  ed  f5  fe
15  1e  26  3   38  41  4a  53  5c  64  6d  75  7e  86  8f  97  a   a8  b1  ba  c2  cb  d3  dc  e5  ee  f6  ff
16  1f  27  30  39  42  4c  54  5d  65  6e  76  7f  87  9   98  a0  aa  b2  bb  c3  cc  d4  dd  e6  ef  f7 

Alex