distomat/laser ranging software routines

Last modified: Tue Apr 15 15:35:16 2014.


List of Routines


Routine Descriptions

LRCMP - COMPUTES HEIGHTS,ANGLES GIVEN LASER RANGING DISTANCES.

[Next Routine] [List of Routines]
NAME:
lrcmp - computes heights,angles  given laser ranging distances.
SYNTAX: istat=lrcmp(pcdat,retdat,ext=ext)
    ARGS:
 pcdat[]: {lrpcinp} data read in by lrpcinp().
 KEYWORDS:
   ext  :  if set then return extended lr data structure: Included
           space for az,zagr,zach (but they are not yet filled in).        
 RETURNS:
retdat[]: {lrdat}   data with computed offsets.
   istat:  int      number of entries computed

DESCRIPTION:
   The routine computes the platform positions from the distomat distances.
It is called by lrpcinp after reading in the raw data from the laser ranging
PC.

 The coordinates and matrices are:

 
   lr6 \                     / lr1
         \                 /d1
        d2  \     T12    /
               \       /
                  \./
                  / \
                 /   \                           |
                /     \                          |
 \lr5       d3 /       \d9       / lr2           | y (+ north)
   \          /         \       /                |
  d4 \       /           \     /d8       ---------X
       \    /             \   /          x (+ west)
         \ /               \ / 
       T8  -----------------  T4          Z (+toward the bowl)
          /        d6       \
         /                   \
        /d5                   \d7
       /                       \
      /lr4                      \lr3

 The d's are the 9 distances (6 measured , 3 known) that will determine
the 9 coordinates of the corners of the triangle

 delta_d=[d1,d2,d3,d4,d5,d6,d7,d8,d9]
 The matrix equation is:
  A*dx = delta_d   where
    dx = [dx1,dy1,dz1,dx2,dy2,dz3,dx3,dy3,dz3]
   1=t12,2=t8,3=t4 is the motion of these corners.
 then
  dx=delta_d * ainverse
 If you compare this with any c code remember that idl has the
 first index varying most rapidly and C has the second (mainly for the
 init of ainv below).

The direction cosines look to be (cornerpoint - point)/dist
The platform corners seem to go in the opposite directions then mmd,jayaram
 memo: T12,T8,T4 rather than T12,T4,T8.
Lets hope the ref distances were also switched.
the distomat ordering looks like lrn on the plot (i think).

NOTES:
   let [] be a vector.
   [Cm]  is the position of one of the 3 corners.
   [Crm] is the reference position for the [Cm]. 
   [DRn] be one of the 6 distomat reference vectors. It points from
       the laser ranger to the target when the 3 platform
       corners are at [Crm]. 
   [Dn] be the instantaneous position from laser ranger to target.
   deltaDn :  magnitude of ([Dn]- [DRn])


 [dxm] be the displacement vector from corner m : [Cm]-[Crm]

 Any motion of [dxm] perpendicular to [Dn] will not change the distance

 The change in distance will be the projection of [dxm] onto
 the [Dn] direction.

 Since the relative motions are small compared to the length  of
 [DRn], use the unit vector of [DRn] rather than [Dn] when computing the
 dot product.

 The unit vector for a [DRn] is just  [DRn]/magnitude(DRn)
 [Drn] points from the distomat to the target.

 As an example,
   DR1  is at -x,+y1,+z
   CRm  is at  0,+y1a,0   where y1a

(See /pkg/rsi/local/libao/phil/lr/lrcmp.pro)


LRPCINP - INPUT PC LASER RANGING DATA.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
lrpcinp - input pc laser ranging data.
SYNTAX: istat=lrpcinp(yymmdd,b,daynum=daynum,year=year,ext=ext)
ARGS:
   yymmdd: long  year,mon,day to input. -1 --> today
  RETURNS:
  b[npts]: {lrdat} array holding the data
   istat :  int    number of entries found
keywords:
   daynum: long    if supplied then use daynum for day of year
   year  : long    if daynum supplied, then year to use. If not supplied,
                   use current year.
      ext:         if set then return extended info.. az,gr,ch positions. 
                   This uses the tdsummary info. It is not available for the
                   current month.

DESCRIPTION:
   The routine inputs a days worth of laser ranging data. It returns the
data from the laser ranging PC as well as the heigts converted to feet
above sea level (the conversion factors were measured in 1990 and have
probably changed!). The data available on disc goes back about 8 months
from the present. New samples are taken once every two minutes. During 
periods of rain, the distomats have no readings and the distances are
set to 0.

   The data structure for the returned data is:
The coordinate systems used are:
  C1: x-west,ynorth,z-down cm no corrections to move to Sea level crdSys
  C2: x-west,ynorth,z-up feet above sea level

 name        type  coordSys  value      description.
 DATE        DOUBLE        1.0057176 daynumber with fractional day
 TEMPB       FLOAT         0.00000   bowl temp F (not recorded)
 TEMPPL      FLOAT         70.1000   platform temp degF
 DIST        FLOAT         Array[6]  distomat distances [meters].
 DISTTM      FLOAT         Array[6]  secs when reading completed.
 AVGH        FLOAT C2      1256.33   Average hght Ft above sealevel.
 CORNERH     FLOAT C2      array[3]  Corner hght [12,4,8]
 DX          FLOAT C1     -1.50626   Avg x-translation [cm]
 DY          FLOAT C1      4.52196   Avg y-translation [cm]
 DZ          FLOAT C1     -100.191   Avg z-translation [cm]
 XROT        FLOAT C1   -0.00127837  rotation about x-axis [rad]
 YROT        FLOAT C1    0.00106705  rotation about y-axis [rad]
 ZROT        FLOAT C1   -0.00022241  rotation about z-axis [rad]
 PNTS        FLOAT C1    Array[3,3]  [xyz,T12/T4/T8] corner points
 DOK         INT              1      1 if all 6 distances measured ok
 SECPERPNT   INT            120       spacing between measurements [secs]

NOTES:
   You need to do @lrinit once before calling this routine to define the
   {lrdat} structure.

(See /pkg/rsi/local/libao/phil/lr/lrpcinp.pro)


LRPCINPRANGE - INPUT A RANGE OF PC LASER RANGING DATA.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
lrpcinprange - input a range of pc laser ranging data.
SYNTAX: istat=lrpcinprange(year,mmdd1,mmdd2,b,ext=ext)
ARGS:
    year: long  4 digit year of interest
   mmdd1: long  mon,day to start
   mmdd2: long  mon,day to end
KEYWORDS:
     ext:       if set then try and return extended info.. az,gr,ch positions. 
                This uses the tdsummary info. It is not available for the
                current month.
  RETURNS:
  b[npts]: {lrdat} array holding the data
   istat :  int    number of entries found
                   use current year.
                   -1 if an error  

DESCRIPTION:
   The routine inputs multiple days worth of laser ranging data. It returns the
data from the laser ranging PC as well as the heigts converted to feet
above sea level (the conversion factors were measured in 1990 and have
probably changed!). The data available goes back to 2000. The routine
constrains you to 1 year at a time. see lrpcinp for a description
of the data.

NOTES:
   You need to do @lrinit once before calling this routine to define the
   {lrdat} structure.

(See /pkg/rsi/local/libao/phil/lr/lrpcinprange.pro)


LRPLOTDISTFAIL - PLOT DISTOMAT FAILURES BY AZ,ZA

[Previous Routine] [Next Routine] [List of Routines]
NAME:
lrplotdistfail - plot distomat failures by az,za

 SYNTAX: lrplotdistfail,d,year,gooddist=gooddist,includehr=includehr,$
                          exclHr=exclhr,totcnt=totcnt,badcnt=badcnt
   ARGS:
d[npts]: {lrdat} laser ranging data input via lrpcinprange with the /ext
                 option set.
   year:  long   4 digit year for data in d (d had daynumber but no year)

KEYWORDS:
 gooddist: int     number of distomats that have to have good data
                   before the measurement is used (default is 3).
 includehr:fltarr[2]   range of hours (min,max) to use. default is
                        0 to 24.
    exclhr:fltarr[2]   range of hours (min,max) to exclude.
                        0 to 24.
    title : string  title to use on top of plot.. default is date range.
RETURNS:
    totcnt:lonarr[2]:  totcnt[0]: number of measurments made (after applying 
                                  includehr, exclude hr, and the ch at stow.
                       totcnt[1]: number of measurements that had at least
                                  1 distomat bad but at least goodist ok.
    badcnt:lonarr[6]: number of bad counts for each distomat.

 also outputs the plot..

DESCRIPTION:
   Make a plot of distomat failures versus az,za for the data set passed in. 
To input the dataset use:
 lrpcinprange(y,mmdd1,mmdd2,d,/ext)
Data is made available after the monthly processing of each month ( so the
current months is not available unless the processing is run manually).

   The points in the dataset will be constrained so that:
1. there are at least "gooddist" distomat measurements for each point
   used. This is to eliminate heavy rainfall where all of them were
   out. The default value is that 3 distomats must be working.

2. The hour of the meausurment must fall within includehdr (default
   is 0 to 24) and it must not fall within excludehr (default is 
   to not exclude anything.

 The hour include/exclude allows to to look at daytime or nighttime
 eg. includehr[6.,19.] will use 6am to 7pm (daylight)
     exclhr=[6.,19.] will exclude 6am to 7pm (to keep nighttime)

   The routine then plots the distomats that were not working versus 
azimuth and zenith angle. The distomats at the same platform corner are 
grouped together (1,6 td12), (2,3 td 4), (4,5 td8). Colors are used to 
differentiate the two distomats at each color. Yellow dashed lines are 
plotted at the azimuth of the corner that contains the two distomat 
targets and at 180 degrees away. This is the azimuth where the dome
can cause the maximum platform tilt for this pair. 

Example:

 istat=lrpcinprange(2004,1201,1231,d,/ext)
 pscol,'lrfail_dec04.ps',/full
 lrplotdistfail,d,totcnt=totcnt,badcnt=badcnt
 hardcopy
 x

(See /pkg/rsi/local/libao/phil/lr/lrplotdistfail.pro)


LRPLOTHGHT - PLOT THE PLATFORM HEIGHT VERSUS TIME

[Previous Routine] [Next Routine] [List of Routines]
NAME:
lrplothght - plot the platform height versus time

 SYNTAX: lrplothght,b,defhght=defhght,sym=sym,year=year
   ARGS:
b[npts]: {lrdat} laser ranging data input via lrpcinp.

KEYWORDS:
 defhght: float    value to print out as default height (1256.35)
     sym: int      symbol to use for each point (-1 to -8). def: no symbol
    year: long     4 digit year to use. Default is current year

DESCRIPTION:
   Make a plot of platform height versus hour of day. The data in b[] must
first be read in using the routine lrpcinp. The output is in feet above
sea level and includes:
 white: the average platform height 
   red: tower 12 height
 green: tower  4 height
yellow: tower  8 height

The date at the middle of the plot and the time,temp, and average height at 
the last point of the plot are printed (note that the last point is usually
from the start of the next day).
The plots show that the tiedowns are trying to keep the average height of
the platform fixed while the corners move depending on the unbalanced load 
(which is a function of the dome/carriage house positions).

Example:
istat=lrpcinp(010505,b)
ver,1256,1257
hor,0,24
lrplothght,b

(See /pkg/rsi/local/libao/phil/lr/lrplothght.pro)


LRPLOTTEMP - PLOT PLATFORM TEMP FOR THE DATA SET PASSED IN.

[Previous Routine] [List of Routines]
NAME:
lrplottemp - plot platform temp for the data set passed in.
SYNTAX:
   lrplottemp,d ,title=title,cs=cs,xp=xp,off=off,sep=sep,clip=clip,year=year
ARGS:
   d[n]: {lrdist}  data input from lrpcinprange 
KEYWORDS:
   title   - string title for top of each plot
   cs      - float  scale factor for labels. For multiple windows you may
                    want to increase this to 1.5 or 1.8. default is 1.
   xp      - float  xposition [0.,1.] where dates are printed. default:.02.
                    For hardcopy setting this to 1. puts the dates on the
                    right column.
   off     - float  number of degrees to offset each day within it's 
                    window so the plots don't lay on top of each other.
                    defaut:0.
   sep     -        if set then make 1 plot per day user should set
				     !p.multi before calling the routine. 
   clip[]  -float   clip the data to [mintemp,maxtemp]. allows auto scaling
					 with bad data points..
   year    - long   for the first point of the file. If not supplied then
                    assume the current year.
                    
DESCRIPTION
   Plot the platform temperature by  hour of day for the data passed in.
(the routine limits the output to a maximum of 31 days).
The plot will have N subwindows with up to 7 consecutive days per window. 
Each day will be color coded within a window. Any extra days (>28 will appear
in the last window). The routine internally uses daynumber of year for
computations so it will not cross year boundaries gracefully. 

You should call ldcolph to setup the colortables for indices 0-10. You 
should also set the vertical scale to temperature range you want via 
ver,vmin,vmax. The horizontal scale should be set to hor,0,24.
The extra keywords that may be used are:
 charsize=cs. If the multiple windows cause the letters to come out
too small.

EXAMPLES:
   hor,0,24
   ver,70,90
   lrplottemp,d,title='platform temps for jul01',  cs=1.6
NOTES:
	The routine is setup to plot 1 month of data at a time.

(See /pkg/rsi/local/libao/phil/lr/lrplottemp.pro)