tiedown software routines

Last modified: Thu Mar 16 13:07:12 2023.


List of Routines


Routine Descriptions

A_TDINTRO - LOOKING AT TIEDOWN DATA

[Next Routine] [List of Routines]
NAME:
a_tdintro - Looking at tiedown data
   
Where the data comes from:

       The tiedown archive data is recorded with 1 second resolution by
the program tieLogD. It is running on the observer computer and reads
from the scramnet memory. The daily archive files are located in
/share/obs2/tie/log/tieyymmdd.dat. The program is started 
automatically by the  rc3.d/S99local script when the computer is booted. The
source code is found in ~phil/vw/datatk/shm/Mon/Tie/tieLogD.c .

   At the end of each day the daily file is copied to a backup area:
/share/phil/bkup/tie/. At then end of each month the data is moved to
a subdirectory of yymm/.. 

Using the data:

   To look/use the data you need to start idl (preferablly on one
of the linux server machines.. fusion00,fusion01,fusion02, aolc1,..)

   idl
   @phil
   @tdinit
  .. some routines need access to the laser ranging routines.. for these
     @lrinit.

1. The raw data: 

   - tdinpday() this inputs the 1 second data for a day. It can be
                a summary (the default) or the complete data structure.


2. 1 minute summary data:

   - tdsummary() this routine returns summyar info for a  range of dates.
                The data has been intepolated to 1 minute resolution. 
                It also contains the laser ranging info.  This data is 
                created at the end of each month so you can only look 
                at data from months prior to the current.

3. Make some plots:
   - tdchkday() this makes a summary plot of a days worth of data.
                it also returns the full 1 second records.
   - tdkips()   plot the tensions for a day.
   

(See /pkg/rsi/local/libao/phil/td/a_tdintro.pro)


PLTDCOR - PLOT THE TIEDOWN CORRECTION FOR PRF OVER A AZ,ZA GRID.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
pltdcor - plot the tiedown correction for prf over a az,za grid.
SYNTAX:pltdcor,pitchdata,rolldata,tdfocusdata,tdposdatadata,td=td,focrad=focr,
               focrp=focrp,focp=focp,pitch=pitch,roll=roll,prq=prq,ver=ver,
               pitp=pitp,rolp=rolp,note3=note3,oplot=oplot
ARGS:
 pitchdata[360,41]: float the computed pitch on the az,za grid
  rolldata[360,41]: float the computed roll on az,za grid
  focusdata[360,41]: float the computed focus error on az,za grid
  tdposdatadata[3,360,41]: float the computed tiedown positions on the az,za
                       grid.   
KEYWORDS:
   td   : int  12,4, or 8. If provided then plot the relative motion 
               of this tiedown in inches (from the reference position).
   focr : if set then plot radial focus error inches
   focrp: if set then plot radial focus projected to td inches
   pitch: if set then plot pitch angle vs az
   roll : if set then plot roll angle vs az
   pitp : int 12,4,or 8 if provided, then plot pitch projected to td inches
              for the requested td.
   rolp : int 12,4,or 8. if provided, then plot roll projected to td inches
              for the requested td.
   prq   - if set then plot pitch,roll added in quadtrature versus vs az
   note3 - string place note on line 3
   oplot - overplot on whatever was there, no labels either
DESCRIPTION:
   This routine will make various plots of pitch,roll, focus, and tiedown
position that will correct for the pitch roll and focus. It assumes that
the pitch, roll errors have already been computed and that the td corrections
have already been computed on a (360,41) grid of az za (az:0..359, za:0 to 20
degrees za in .5 degree steps). Use pltdcorcmp() to do this computation
before calling this routine.

This routine requires that you do:
@prfinit 
prfit2dio,prfit2d  to input the 2d fit
pltdcorcmp,prfit2d,pitchdata,rolldata,tdposdatadata

 once before calling the routine.

(See /pkg/rsi/local/libao/phil/td/pltdcor.pro)


PLTDCORCMP - COMPUTE DATA FOR THE PLTDCOR ROUTINE.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
pltdcorcmp - compute data for the pltdcor routine.
SYNTAX:pltdcorcmp,pitch,roll,focus,tdposition
ARGS: note
RETURNS:
   pitch[360,41]: float pitch error (degrees) on az,za grid 
    roll[360,41]: float roll  error (degrees) on az,za grid 
   focus[360,41]: float focus error (inches) on az,za grid 
tdposition[3,360,41]: float tiedown position (inches) on az,za grid 
DESCRIPTION:
   pltdcorcmp computes the pitch, roll, focuserr, and then tiedown 
positions that correct for these errors. This data is then passed to
pltdcor  so it doesn't have to be recomputed on each all to pltdcor
   The data is computed on an az,za grid of (360,41). Az=0..359 in 1 deg
steps and za 0..20 with .5 degree steps.1
The temperature used is the reference temp (usually 72 degrees).

Before calling this routine, you should:
@prfinit
@tdinit

(See /pkg/rsi/local/libao/phil/td/pltdcorcmp.pro)


TDCHECKENDIAN - CHECK WHETHER THE DATA NEEDS TO BE FLIPPED OR NOT.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdcheckendian - check whether the data needs to be flipped or not.
SYNTAX: needsflip=tcheckendian(d)
ARGS:
   d   :   {tdall} data to check for endian nes..
RETURNS:
   needsflip: int  1 need to flip data, 0 data in current machine format.
DESCRIPTION:
   tdcheckendian will check if the data needs to be flipped (via swap_endian)
or not.

(See /pkg/rsi/local/libao/phil/td/tdcheckendian.pro)


TDCHKDAY - CHECK TD PERFORMANCES FOR A DAY

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdchkday - check td performances for a day
SYNTAX: nrec=tdchkday,yymmdd,tmrange=tmrange,td=td,usetd=usetd,$
                sym=sym,v1=v1,v2=v2,v3=v3,v4=v4,v5=v5,flaghr=flaghr,$
                title=title,cmdveltd=cmdveltd,cs=cs,font=font
ARGS:
    yymmdd: long  date to look at
tmrange[2]: float start,end hour to display. default is entire day  

KEYWORDS:
    v1[2]: float   vert range for position (inches 0,24)
    v2[2]: float   vert range for velocity fdback (dacnts: -2048:2048)
    v3[2]: float   vert range for ampSpd (dacnts: -2048:2048)
    v4[2]: float   vert range for status (0 to 2)
    v5[2]: float   vert range for current (a/d counts: 0:2048)
    sym  : int     symbol to used (def -1)
flagHr[m]: float   range of hours to flag in each plot
    title: string  to add to top of first plot
cmdVeltd : int     0 to 2. overplotted commanded velocity on velfb plot
                   for this td
tmrange[2]:long    if provided, then limit the plots to
                   the tmrange[0],tmrange[1] time range. the format
                   for each is hours
    usetd: long    if set then the routine will use the info in the
                   td=td structure passed in by the user rather than
                   reading the data from the disc. This lets you rapidly
                   replot various time ranges.
       td[]:{}     This can be output or input. On the first call the
                   data array is returned here. On subsequent calls if
                   /usetd is set then this will be the source of the
                   data rather than rereading it from disc.
       cs: float   chars=cs in plot command. def=1.8
     font: int     font=1 --> truetime (for plotting). 0 -
  
RETURNS:
   nrec: int number of records found in tmrange
td[nrec]:{} td structre for the day.

DESCRIPTION:
   Input a days worth of tiedown archive information (at 1 second
resolution and make a plot of the info. The tmrange[2] can limit the
range of the input data to tmrange=[hhmmss1,hhmmss2]. The data input
will be returned in the keyword td=td;
   You can make subsequent calls on the same data set by setting
 /usetd and passing in the data td=td read from the previous call. You
can change the tmrange=tmrange values to blowup different portions of the
day.
   The plot is color coded with white=td12,red=td4, green=td8.The plot
contains:
1. tiedown position in inches versus hour of day.
2. Velocity feedback of the D/A versus time. This yellow plot is
   the requested commanded velocity for td12 (this can be changed with the
   cmdVelTd keyword).
3. The amplifier speed monitor for each of the tiedowns.
4. The drive status of each of the tiedowns. The values are:
    0 - off
    1 - enabled and running
    2 - powered (but no running).
5.  The drive current for each of the motors. I think the units are
    amps but the calibration may be a little off. It should at least be
    linear in current.

EXAMPLES:
   Input a days worth of data, the recall the routine blowing up the
area around 230000 to 240000 and finally 234500 to 235500.
    nrec=tdchkday,060302,td=td)

;  now recal it
    nrec=tdchkday(060302,td=td,/usetd,tmrange=[230000,240000])

;  now look closer

    nrec=tdchkday(060302,td=td,/usetd,tmrange=[234500,235500])

 You can resize the plot window by dragging the cornerers and then 
replotting the data.
NOTE:
 	171120- program now checks if hardcopy is being done.
           the default keyword values are modified as:
           font= hardcopy?1:-1 ..looks better in hardcopy
           sym =hardcopy ?0:-1 ..sym=-1 file gets too big for hardcopy
           These can be overridden by specifying the keywords

(See /pkg/rsi/local/libao/phil/td/tdchkday.pro)


TDCHKKIPS - CHECK TD KIPS AND AVG PLT HEIGHT

[Previous Routine] [Next Routine] [List of Routines]
NAME:          
tdchkkips - check td kips and avg plt height
SYNTAX: n=tdchkkips(yymmdd,retI)
ARGS:
  yymmdd :   date to look at
RETURNS:
   n:     int  how many td entries found
  retI[n]: {}  array of structs holding info found
DESCRIPTION:
   Plot showing tiedown tensions for each cable. Also return
avg platform height.
 need @tdinit, @lrinit before calling

(See /pkg/rsi/local/libao/phil/td/tdchkkips.pro)


TDCOR - COMPUTE THE TD POSITIONS TO CORRECT FOR PITCH,ROLL, AND FOCUS

[Previous Routine] [Next Routine] [List of Routines]
NAME:
 tdcor - compute the td positions to correct for pitch,roll, and focus

 SYNTAX:
  tdposition=tdcor(az,za,p,r,refTemp=refTemp,refPos=refPos,focus=focus,$
                   temp=temp)

  ARGS:
  az[npts]:float  azimuth in degrees
  za[npts]:float  za   in degrees
  p[npts] :float  pitch error at az,za in degrees
  r[npts] :float  roll  error at az,za in degrees
  KEYWORDS:
 refPos[3]:float  use this as the tiedown ref position at ref temp instead
                  of the default. The default is measured at 72 degF.
   refTemp:float  reference temperature for the reference position.
                  Default is 72. This temp should correspond to the
                  refPos
focus[npts]:float use this array for focus error, rather then the standard
     temp:int     if set then include the platform vertical motion from
                  temperature. It will be measured relative to the 
                  refTemp,refPosition

 RETURNS:
      tdposition[3,npts]  tdposition for each point

 DESCRIPTION:
 This routine computes the tiedown motion needed to correct for
 a pitch,roll, focus error at the requested temperature and positions. It then
 adds this to the reference position to return the actual tiedown positions
 after correction. If the
 dome is measured to have a pitch error of .1 degrees, we end up moving it
 by -.1 degrees. This routines wants .1 as the input (the current error,
 not the requested motion).

10may00 - updated focus computation *cos(za) to 1/cos(za) 

(See /pkg/rsi/local/libao/phil/td/tdcor.pro)


TDFINDFILE - FIND THE LOCATIONS OF A TIEDOWN FILE.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdfindfile - find the locations of a tiedown file.
SYNTAX: istat=tdfindfile(yymmdd,fullname)
ARGS:
   yymmdd: long    Date to search for. YY is the last two digits of the year.
RETURNS:
   istat:  int     1 -found it, 0 did not find it
 fullname: string  if found then this is the full name of the file
                   (path name and basename)

DESCRIPTION:
   Search the various online directories for the location of
a tiedown file. Return 1 if it is found with the name in the fullname
variable. Return 0 if it is not found.

(See /pkg/rsi/local/libao/phil/td/tdfindfile.pro)


TDGETPOSKIPS - INTERPOLATE POS,KIPS TO REQUESTED TIMES

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdgetposkips - interpolate pos,kips to requested times
SYNTAX: npnts=tdgetposkips(jdar,posAr,kipsAr,okAr)
ARGS:
    jdar: double  array of julian dates for time points you want.
RETURNS:
   npnts         : long  points returned
   posAr[npnts,3]: float positions interpolated to requested times. Order
                         is td12,td4,td8
   KipsAr[npnts,6]: float kips interpolated to requested times. Order
                         is td12a,b td4a,b, td8a,b where a,b are the two
                         cable tensions at each tiedown.
  okAr[npnts]     : int  1 if data for this day was read from disc (0 if not)

DESCRIPTION:
   The user passes in julian dates for times when they want the tiedown
position and tension info. The routine will read the info from the disc
and interpolate the measured data to the requested times. The positions
and kips are returned. An OkAr is also returned. OkAr[npnts] will have
a 0 in each element whose days data was not found on disc. 

NOTE: okAr equals 1 for each point who's data was found on disc. If
      there was a large gap in the data for a pariticular day, it will 
      still interpolate the data and return a 1 in that element of 
      okAr[] (this is probably not what you want.. it would be better
      if okAr[] returned 0 if there is no data within N secs of the
      requested point).

(See /pkg/rsi/local/libao/phil/td/tdgetposkips.pro)


TDGETSUM - INPUT TIEDOWN SUMMARY FROM ARCHIVE.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdgetsum - input tiedown summary from archive.
SYNTAX: nrecs=tdgetsum(yymmdd1,yymmdd2,tds)
ARGS: 
      yymmdd1  : long    year,month,day of first day to get (ast)
      yymmdd2  : long    year,month,day of last  day to get (ast)
RETURNS:
   tds[nrecs] : {tdlr}   return summary data 
        nrecs : long     number of records found
DESCRIPTION:
   Input the the tiedown summary information from the archive. The archive
starts on 01oct01 and continues till the present day (new data is added
to the archive at the end of the month). Each record is a {tdlr} structure
and contains:
** Structure TDLR, 9 tags, length=68, data length=68:
DAY             DOUBLE   1.6951389  ; daynumber of year (count from 1)
AZ              FLOAT  315.157      ; azimuth (gregorian side)
GR              FLOAT   11.4503     ; gregorian za
CH              FLOAT    8.83490    ; ch za
POS             FLOAT  Array[3]     ; td jack positions inches (td12,td4,td8)
KIPS            FLOAT  Array[2, 3]  ; td kips [2cables,td12/td4/td8]
KIPST           FLOAT   112.920     ; total tension kips
TEMP            FLOAT    76.2484    ; platform temp deg F
HGHT            FLOAT  1256.35      ; platform average hgt feet above sealevel

   Since the structure only has the daynumber of the year, records of the
same daynumber can not be differentiated by year.
   When accessing the data, there will be about 43200 entries per month.
The data is normally sampled once a minute. Occasionally there will be
incomplete data. This is caused by the distomats not recording the heights
(because of bad weather) or temperatures not being recorded. I have tried
to flag this data with zeros. The tiedown tensions occasionally drift
(or actually jump after a lightning strike). A good way to test for this
is by looking at the difference in the tensions for individual tiedowns.
There are two cables with two tension measurements on each tiedown block.
These values should be the same.

SEE ALSO:

(See /pkg/rsi/local/libao/phil/td/tdgetsum.pro)


TDINPDAY - INPUT A DAYS WORTH OF TD ARCHIVE DATA.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdinpday - input a days worth of td archive data.
  SYNTAX:  n=tdinpday(yymmdd,td,alldat=alldat)
    ARGS:   
  yymmdd:long  day to input
KEYWORDS:
  alldat:      if set then return all the data. The default is to return
               a subset of the data.
RETURNS:
      n:long   number of samples we found 
  td[n]:{}     structure holding the tiedown data. This format will
               depend on the /alldat keyword.
DESCRPIPTION:
   Input a days worth of the tiedown archive data. This info is written
once a second. the default data returned is:

** Structure TD, 7 tags, length=56, data length=56:
   SECM  LONG  0           seconds from midnite this sample
   AZ    FLOAT 359.372     az position deg.
   GR    FLOAT 2.40010     gregorian position deg
   CH    FLOAT 8.83440     carriage house position deg.
   POS   FLOAT Array[3]    tie positions [12,4,8] in inches (0 is up)
   KIPS  FLOAT Array[2, 3] tiedown cable tensios in kips [2cbl,3td]
   KIPST FLOAT 129.620     total kips (sum off kips[])

 If the alldat keyword is used then then entire data structure is returned:

** Structure TDALL, 10 tags, length=276, data length=276:
   SECM     LONG   0
   STATWD   LONG   33
   SYNCTRY  LONG   9
   SYNCFAIL LONG   0
   VTXTMMS  LONG   86400025
   AZ       LONG   3593720
   GR       LONG   24001
   CH       LONG   88344
   TEMPPL   LONG   0
   SLV      STRUCT TDSLV Array[3]

this is the same as the online data strcuture: see ~phil/vw/h/tieProgState.h

(See /pkg/rsi/local/libao/phil/td/tdinpday.pro)


TDKIPS - INPUT AND PLOT TIEDOWN TENSIONS

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdkips - input and plot tiedown tensions 
SYNTAX: nrec=tdkips(yymmdd,tmrange=tmrange,td=td,usetd=usetd,$
                sym=sym,v1=v1,v2=v2,flaghr=flaghr,title=title,$
                hardcopy=hardcopy,psname=psname,plotnum=plotnum,cont=cont,$
				 cs=cs,avgmin=avgmin)
ARGS:
    yymmdd: long  date to look at
tmrange[2]: float start,end hour to display. default is entire day  

KEYWORDS:
    v1[2]: float   vert range for individual cable kips
    v2[2]: float   vert range for ldcell1-ldcell2
    sym  : int     symbol to used (default: none)
flagHr[m]: float   range of hours to flag in each plot
    title: string  to add to top of first plot
tmrange[2]:long    if provided, then limit the plots to
                   the hours tmrange[0] to tmrange[1].
    usetd: long    if set then the routine will use the info in the
                   td=td structure passed in by the user rather than
                   reading the data from the disc. This lets you rapidly
                   replot various time ranges.
     td[]:{}        This can be output or input. On the first call the
                   data array is returned here. On subsequent calls if
                   /usetd is set then this will be the source of the
                   data rather than rereading it from disc.
 hardcopy:         if set then make a postscript hardcopy. If psname is
                   not set, then the output filename will be 
                   tdkips_ddMONyy.ps.
   psname:string   The name of the postscript file to write (if hardcopy
                   is set). The default is 'tdkips_ddMONyy.ps'
   plotnum:int     1 --> just do first plot (kips vs hour of day)
                   2 --> just do 2nd plot (ldcell1-ldcell2) vs avg kips
      cont:        if set then don't call !p.multi=0. This lets you 
                   put multiple days data on the same page
  avgMin:          if set then output minute averages

  
RETURNS:
   nrec: int number of records found in tmrange
td[nrec]:{} td structure for the day.

DESCRIPTION:
   Input a days worth of tiedown archive information (at 1 second
resolution) and make a plot of the tensions. The tmrange keyword can limit the
range of the input data to tmrange=[hourst,hourend]. The data input
will be returned in the keyword td=td;

   You can make subsequent calls on the same data set by setting
 /usetd and passing in the data td=td read from the previous call. This 
will speed things up since it doesn't have to reread the data. You
can also change the tmrange=tmrange values to blowup different portions of the
day.

   The top plot is the tiedown tensions in kips (1000lbs=1kip) versus
hour of day. The tensions are color coded:

  white td12-1    red td12-2
  green  td4-1   blue  td4-2
 yellow  td8-2 purple  td8-2


The bottom plot is the difference in the tensions for 1 tiedown vs the
average tension of that tiedown. This will show offsets and non linearities.
They difference are color coded:

 white  (td12-1 - td12-2)
 green  ( td4-1 -  td4-2)
 yellow ( td8-1 -  td8-2)

EXAMPLES:

1. plot the tiedown tensions for 28apr06

   n=tdkips(060428,td=td)

2. replot the time range 12:00 to 16:00

   n=tdkips(060428,td=td,/usetd,tmr=[12,16])

3. replot the time range 18 to 20 hours limiting the vertical range
   of the first plot to 0 to 25 kips, and the range of the 2nd plot to
   -10 to 10 kips

   n=tdkips(060428,td=td,/usetd,tmr=[18,20],v1=[0,25],v2=[-10,10])

4. make a hardcopy of the plot in 3. use the default name:tdkips_28apr06.ps
   n=tdkips(060428,td=td,/usetd,tmr=[18,20],v1=[0,25],v2=[-10,10],/hard)

SEE ALSO: tdchkday

(See /pkg/rsi/local/libao/phil/td/tdkips.pro)


TDLAB - RETURN LABELS FOR VARIOUS TIEDOWN BITMAPS

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdlab - return labels for various tiedown bitmaps
SYNTAX: lab=tdlab(type)
ARGS  :
       type    : string :
 		    'prgstat': program status
           'devstat': device status
           'dils'   : digital input little star
           'di1_2'  : digital uio 1 and 2 (18 entries)
           'dols'   : digital out little star
        'drv_fltstat': drive and fault status

RETURNS:
lab[n] : strarr    labels for each bit in the word

DESCRIPTION:
	This routine is normally called from tdplotsum(). It provides 
the labels for all of the status bits.

Warning:
 the order of the labels returned has been modified slightly. Some
of the original status words had coded sets of bits rather than individual
bits. This routine provides a decoded list. See tdplotsum to see 
what you have to do with the binary numbers to used these labels.

(See /pkg/rsi/local/libao/phil/td/tdlab.pro)


TDPARMS - RETURN PARAMETERS USED FOR TIEDOWN COMPUTATIONS.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdparms - return parameters used for tiedown computations.
SYNTAX: tdparms,reftdpos=reftdpos,limits=limits,slimits=slimits,$
               reftemp=reftemp,$
               plInperDegF=plInperDegF,tdRadiusHor= tdRadiusHor$
               RotScale=rotScale,trScale =trScale,Sscale=S,date=date
               inchPerEncCnt=inchPerEncCnt,encCntPerInch=encCntPerInch,$
                cntsToKips=cntsToKips
ARGS: none
KEYWORDS:
   reftdpos[3]: float reference position focus at ref temp. td inches
   limits[2,3]: float (min/max,td12/4/8) min (extended), max tiedown limits.
   slimits[2,3]: float (min/max,td12/4/8) min (extended), max tiedown limits.
                      these are the soft limits .2 inches inside the others.
   refTemp    : float reference temperature for refpos. deg F
   plInPerDegF: float platform motion(inches) per deg F. (-.205)
   tdRadiusHor: float center triangel to tiedown cable
   rotScale   : float ratio absolute value( tdin/platformin) when rotating
    trScale   : float ratio absolute value( tdin/platformin) when pulling down
        Sscale: float (1deg*pi/180*192*12*rotScale)
   date       : long  yymmdd date to use. default is most recenter data
 inchPerEncCnt: float inches per encoder count
 encCntPerInch: float encoder counts/inch (1./inchPerEncCnt)
 cntsToKips   : float to convert loadcell counts to kips

(See /pkg/rsi/local/libao/phil/td/tdparms.pro)


TDPLOTSUM - PLOT A SUMMARY OF THE TIEDOWN DATA.

[Previous Routine] [Next Routine] [List of Routines]
NAME:
tdplotsum - plot a summary of the tiedown data.
SYNTAX: tdplotsum,d,tdstat=tdstat,title=title,tmrange=tmrange,$
                  vpos=vpos,vkips=vkips,vtq=vtq,tqinc=tqinc,tqsmo=tqsmo,$
                  win=win,wait=wait,page=page,fl=fl,$
				   cs=cs,ncs=ncs,font=font,th=th,loff=loff
ARGS:
    d[] :{tdall} data to display. read via tdinpday() or tdinp(xx,/all)

KEYWORDS:
 tdstat : int    tiedown to use for status display: 12,4,8 (def=12)
   title: string title for each plot (eg date..)'
tmrange[2]:long  if provided, then limit the plots to
                 the tmrange[0],tmrange[1] time range. the units are hours.
   vpos[2]:float min max for pos vs time
  vkips[2]:float min max for kips vs time
    vtq[2]:float min max for torque plots
    tqinc :float display offset between each motor tq plot. def=0
   tqsmo  :int   number of seconds to smooth motor tqs. def=1 (no smoothing)
     win[]:int   window numbers to plot each page in..
     wait :      if set then wait for user to hit a key between each plot
      fl[]:float list of hours to flag in each page
     page :int   plot just one page of the info. default is all

DESCRIPTION:
    Plot the tiedown data and status info. The data comes from:
n=tdinpday(yymmdd,td,/all) .. you need to use the /all keyword.

    You can plot a subset of the data in td by using the tmr=[hr1,hr2] keyword
to limit the plots to between hr1 and hr2 hours of the day.

    the keyword page=n will output a single page (1..7)
    By default pages are output one after another with stopping. This is
normally used when plotting to a file. For inspection from a terminal,
use /wait so the program pauses after each page waiting for keyboard input.

    The output consists of analog data as well as status bits. 

    The analog data is output for all 3 tiedowns using color to distinguish
the tiedown. The outputs are:
        position,torques: red=td12,green=td4,blue=td8
        kips: Tension on each tiedown cable is output 2*3=6 outputs. the
              colors used are:
              white,red    : td12 cable1,2
              green,blue   :td4 cable 1,2
              yellow,purple:td8 cable 1,2
		
    The status info is output for a single tiedown ( the default is td12).
You can change the tiedown for status output using tdstat=[12,4,8].
    The status plots:
   -  Each bit is plotted as a line vs time
   -  The left side shows the bit label as well as a colored *.
   -  The * is the value=0 position the bit, value=1 moves the line 
      farther up.
   -  Labels that start with - (eg -CRmEmgS) negate the label.
       eg. -CRmEmgSt 1 value means control room emergency stop is off.

The pages are:
   
page 1; position, kips
page 2: the tiedown device status vs time
page 3: the little star digital inputs 
page 4: digital uio 1 and 2 inputs
page 5: little star digital output
page 6: drive and fault status
page 7: motor torques (for all 3 tiedowns)

To use these routines:
idl71
@phil
@tdinit
yymmdd=110413
n=tdinpday(yymmdd,td,/all)
tdplotsum,td,/wait

to send output to a ps file:

pscol,'junk.ps',/full
tdplotsum,d
hardcopy
x

(See /pkg/rsi/local/libao/phil/td/tdplotsum.pro)


TDSUMMARY - CREATE TD SUMMARY INFO FOR A DATE RANGE

[Previous Routine] [List of Routines]
NAME:
tdsummary - create td summary info for a date range
SYNTAX: istat=tdsummary(yymmdd1,yymmdd2,tdsum)
ARGS:
   yymmdd1: long   first day to include (usually start of month)
   yymmdd2: long   last day to get (usually last day of month)

RETURNS:
   npts:    long   number of points created
   tdsum[npts]:{tdsumI} Interpolated data 

DESCRIPTION:
   Read through the daily archives files for the tiedown and the laser 
rangers for the specified date range. The tiedowns are sampled once a 
second while the laser rangers are sampled every 2 minutes. This routine
return a array of structure containing the tiedown and laser ranger data 
after interpolating to 1 minute resolution. It exclude bad data points.
   The returned structure (interpolated to 1 minute) contains:

** Structure TDLR, 9 tags, length=68, data length=68:
DAY             DOUBLE   1.6951389  ; daynumber of year (count from 1)
AZ              FLOAT  315.157      ; azimuth (gregorian side)
GR              FLOAT   11.4503     ; gregorian za
CH              FLOAT    8.83490    ; ch za
POS             FLOAT  Array[3]     ; td jack positions inches (td12,td4,td8)
KIPS            FLOAT  Array[2, 3]  ; td kips [2cables,td12/td4/td8]
KIPST           FLOAT   112.920     ; total tension kips
TEMP            FLOAT    76.2484    ; platform temp deg F
HGHT            FLOAT  1256.35      ; platform average hgt feet above sealevel

   This routine is normally run at the end of the month to create the
tiedown/laser ranger monthly summary files. These are stored by 
month in /share/megs/phil/x101/td/tds_yymm.sav'. This data can then
be accessed with the tdgetsum(yymmdd1,yymmdd2,td) idl routine.

   To run this routine you must first call @tdinit,@lrinit to setup the
paths.

(See /pkg/rsi/local/libao/phil/td/tdsummary.pro)