;----------------------------------------------- ; pointing structure loaded into scramnet memory by pointing program... ;----------------------------------------------- ; DEFINED: ; /home/phil/vw/h/pntProgState.h ;----------------------------------------------- ; PROGRAM: ; The pointing program consists of two programs: ; pntMprog.c (master program) ; pntXProg.c (Xformation program) ; ; /home/phil/vw/datatk/pnt/prg/pntMProg.c - communications program. ; It waits on messages for pointing, and then passes them ; along to the various programs/devices.. ; ; /home/phil/vw/datatk/pnt/prg/pntXform.c - the pointing transformation ; program that is running on the one second tick interrupt. ; It is doing the transformations from astronomical to device ; coordinates and then sending out the data. ; ; The pointing program does the conversion from the astronomical to ; the device coordinates. It normally computes positions for two seconds ; in the future and then sends them to the individual device programs. ; See pntXform.c routine convert() for forward transformation ; The device programs are: ; agcProg - az,greg, ch program. This controls the azimuth,gregorian, ; and carriage house ; ttProg - this controls the turret. ; tieProg= this controls the tiedowns ; terProg= this controls the tertiary. ; ; The pointing program does not bother with device details. These are ;handled by the device programs. In particular, the pntProg does not ;care where the devices currently are, only where it wants them to ;be... ;----------------------------------------------- ; NOMENCLATURE: ; ; In the structures below: ; ; PL stands for pipelined. this info is typically computed for 2 seconds ; in the futurei and sent to the various devices on the appropriate ; one second tick. This information is computed in the future, but ; it is loaded into scramnet memory on the correct second. The pointing ; program buffers this info for two secs and then loads it into scramnet ; memory. ; ; POINT: this contains timestamps, positions, offsets, rates, and ; even some types of patterns that are supposed to occur at a ; particular moment. A single point can be active for a long ; period of time. A point that says track and ra,dec will ; cause a continual conversion from ra,dec to az,za once ; a second (until it is replaced by another request). ; ; CUR_PNT This is the current point that is being processed by pntXform. ; once a second the transformation is done to generate the ; device coordinates. ; ; REQ_PNT This is probably better described as a pending point. ; When a user sends a new point to the pointing, it becomes ; the pending point. If it is an immediate request, then on the ; next second tick it becomes the CUR_PNT. If it is a timed ; request then it remains the pending point until two seconds ; before the activation time. There is only one pending point. ; If a newer point is sent before the pending point becomes ; active, the old pending point is replaced by the new one. ; ; The TRANSFORMATIONS.. VECTORS and ANGLES. ; The pointing transformation is done via matrices. Rather than ; doing a single matrix multiply, it is done one step at a time. This ; allows offsets/rates to be applied at arbitrary places.. ; eg. suppose you havera/dec B1950 but you want to apply ha/dec rates ; Rather than going B1950 straight to az,za the program does: ; B1950 -> J2000 ; J2000 -> current/true (befor aberation) ;; Current/true-> current apparent (after aberation) ; ra/decApp -> hour angle,dec ; hourangle,dec -> az,za ; At any step in the process , offsets, rates may be applied. ; ; Since the transformations use matrices, most of the values ; are stored as 3 vectors. Later they are converted from 3 vectors ; back to angles. ; ------------------------------------------------------------------------- A DESCRIPTION OF THE POINTING SCRAMNET STRUCUTURE ------------------------------------------------------------------------- PNT_STATE: This is the main structure. typedef struct { PNT_X_STATE x; /* from Program pntXform.c */ } PNT_STATE; ------------------------------------------------------------------------- PNT_X_STATE: loaded from pntXform.c transformation program. typedef struct { PNT_X_PL pl; The pipelined data for requested and in use positions/timestamps. it gets loaded into scramnet on the second that it becomes active. PNT_X_TIME curTm; Time information from the 1 second tick that just occured. PNT_X_STATWD statWd; bit mapped status word short settleTmCnt; for telesctop char tdToUse; /* 0->7 1-td12,2=td4,4-td8*/ char terToUse; /* 0->7 1-Ver,2-hor,4=tile*/ int agcStErrs; /* times we had an error*/ ; below are semaphores used for sharing data structures. int errAgcSemTakePntX; /* agcState semaphore*/ int errAgcSemTakePntT; int errPntXSemTakePntX; /* pntXReq semaphore*/ }PNT_X_STATE; /* (42*int)*/ ------------------------------------------------------------------------- PNT_X_PL: This is the pipelined data. This is the pipelined data. It is computed for two seconds in the future. --> it is buffered in the pointing program and loaded into scramnet memory on the second that it is programmed for. It does not appear in scramnet memory two seconds early.. In the structure below, REQ refers to a requested or pending position. All points sent are first loaded in the REQ/PENDING structure. They are moved from the REQ/PENDING to CUR_PNT when the time is appropriate. For immediate points, this is on the next second. For timed points, it is when the time becomes active (usually two seconds before the time specified). For people looking for telescope info, ignore the _REQ_ data. these are pending requests to do something.. typedef struct { PNT_X_TIME tm; time info for the current point*/ PNT_X_CUR_PNT curP; This is the current point that we are working on. It is being transformed once a second PNT_X_MODEL model; This is the model information for the current point we are transforming. PNT_X_REQ req; This is a requested/pending point. People can request a position in the future. It sits in this structure until the time becomes ready to process it. It then gets moved from req -> curP. The program always does the transformation on the current point. There is only one requested/pending point. If you send a new position before the requested/pending point becomes active, then the old requested/pending point is replaced with the last one sent. It does not matter if the new point is a timed or immediate point. All positions sent get loaded in the requested/pending point. /* turret info */ PNT_X_REQ_TUR reqTur; /* Requested/pending turret position*/ PNT_X_CUR_TUR curTur; /* Current/active turret position*/ PNT_X_REQ_TIE reqTie; /* Requested/pending tiedow position*/ PNT_X_CUR_TIE curTie; /* current/active tiedown position*/ PNT_X_REQ_TER reqTer; /* Requested/pending tiertiary position*/ PNT_X_CUR_TER curTer; /* current/active tertiary position*/ } PNT_X_PL; ------------------------------------------------------------------------- PNT_X_TIME: time information for a particular point.. These are various representations of the time point. All of these times refer to the POINT they are associated with..If it is a REQ/PENDING point then it is for the start time. If it is the current point then it is updated once a second. For the current point, it will be computed for two seconds in the future. It will be loaded in scramnet memory two seconds later when its time has arrived. typedef struct { double secMidD; /* seconds from midnight AST.*/ double astFrac; /* fraction of day ast*/ double ut1Frac; /* fraction of day ut1*/ double lmstRd; /* local mean sidereal time in radians*/ double lastRd; /* local apparent sidereal time in radians*/ int dayNum; /* dayNumber 1..366 ast*/ int year; /* 4 digit ast*/ int mjd; /* modified julian day for ut1Frac*/ int fill; } PNT_X_TIME; /* 14 * int*/ ------------------------------------------------------------------------- PNT_X_CUR_PNT curP; This is the current point that we are transforming. ; V stands for 3 vectore, Rd stands for Radian. ; typedef struct { PNT_COORD pnt; /* requested coordinate point it contains the requested position, offsets, rates, coordinate systems for this point..see below for a description of the PNT_COORD. double raDecTrueV[3]; this is the ra/dec after precession nutation and before abberation correction double aberV[3];/* aberation vector to apply to radecTrueV*/ double raDecAppV[3];/*apparent ra/dec after abberation*/ double haAppRd; /*hour angle apparent*/ double azRd; /* enc az radians this is what gets sent to agcProg double zaRd; /* feed za radians that gets sent to agcProg /* c1offCum,c2OffCum are used for display only.It is not used for any computations. They are the cumulative offset,rates that have been applied to the requested position. It is only valid if the offsets and rates are the same coordinate system. Units are radians. double c1OffCum; double c2OffCum; double lastAzRd; /* remember previous az encoder value sent. Used for checking the wrap corAz,za are the total corrections applied to the computed az,za encoder values. it includes: 1. model correction. 2. pitch,roll,focus corrections if active. 3. any encoder offsets requested by user (pnt cor off xxx double corAzRd; /* total correction applied to zimuth*/ double corZaRd; /* total correction applied zenith angle*/ double modelCorAzRd; /* model correction for az*/ double modelCorZaRd; /* model correction for za*/ double modelLocAzDeg;/* where we evaluated model*/ double modelLocZaDeg; After all is said and done, we end up with a requested az,za to send. We may have started from B1950, J2000, current, or even az,za. The program always takes the final requested az,za and then back computes to ra,dec J2000. This is a convenience for people using the data. It is not used for any further computations. It is still the requested position. double raJ; /* ra J2000 back converted from az,za Radians double decJ; /* dec J2000 back converted from az,za Radians double geoVelProj; /* geocentric vel of the observer projected onto the requested pointing direction. units:v/c*/ double helioVelProj;/* helio centric vel observer of the observer projected onto the requested pointing direction. units: v/c*/ short validPnt; /* True if we should be transforming the data in this point. It is set to false on program startup until a request is specified. short axis; /* to control 1-az,2-gr,4-ch*/ float parallacticRd; /* parallactic angle in radians for the requested position*/ } PNT_X_CUR_PNT; /*(52*int)*/ ; ------------------------------------------------------------------------- PNT_COORD: point coordinate information. The basic point tracking command is : pnt tr {-Ux} p1 p2 -Cx -Tx {-o o1 o2 -Cx -Tx} {-r r1 r2 -Cx -Tx } -Ux units for coordinates. R,D,N for Radians Degs Normal(hhmmss,ddmmss, etc) If not specified then the Normal (default) units are used ra,dec hhmmss ddmmss az,za deg deg Once a -U is specified, it remains in affect for all following coordinates on the line (or until another -U on the same line). p1,p2 are postions . {-o ..o1, o2 are offsets} {-r ..r1, r2 are rates (per second)} Cx coordSys x=J,B,G,E,H,.2000,1950,gal,eclip,HourAngDec A,F,X,S...srcAzZa,FdAzZa,FdAzZaNoModel,SinzaGC Tx startTime x= secsFromMidnite for this coordinate pair. Restrictions on start times.. You can not specify a starting rate before the p1,p2 positions become active. eg.. pnt tr ra dec -T2100 -r r1 r2 -T1980 point coordinates contain position offsets rates. Each of these have a start time and a coordinate system. -1 --> start immediate (not timed start typedef struct { double c1; /* coordinate 1 radians*/ double c2; /* coordinate 2 radians*/ double st; /* start time .. seconds from midnight ast*/ int cs; /* coordinate system for this coordinate see table*/ int fill; } PNT_TUPLE; /* * coordinate. Set of tupples that defines a point in pos,off,rate space */ typedef struct { PNT_TUPLE pos; /* position (8*int)*/ PNT_TUPLE off; /* offset (8*int)*/ PNT_TUPLE rate; /* rate (8*int)*/ double rateStDayNum;/* dayNum.frac ast for start time */ double rateDur; /* duration rate active. solar secs*/ } PNT_COORD; /* 28*int*/ The rateStDayNum tells when the rate was/will be applied. rateDur tells how long the rate has been applied. ------------------------------------------------------------------------- Coordinate system codes used to specify position coordinate systems. In file: /home/phil/vw/h/pntXformLib.h #define PNT_CRD_NOT_IN_USE 0 #define PNT_CRD_GAL 1 #define PNT_CRD_B1950 2 #define PNT_CRD_J2000 3 #define PNT_CRD_BECLIPTIC 4 #define PNT_CRD_JECLIPTIC 5 #define PNT_CRD_CURRENT 6 #define PNT_CRD_HA_DEC 7 #define PNT_CRD_AZZA_SRC 8 #define PNT_CRD_AZZA_FEED 9 #define PNT_CRD_AZZA_NOMOD 10 #define PNT_CRD_AZZA_GC 11 #define PNT_CRD_MAX_NUM 11 ------------------------------------------------------------------------- Where to look for information in the structures: assume the following definition PNT_STATE pntst. 1. all information is requested (except for the curTm structure). there are no device positions. All of these are in the device scramnet blocks. 2. To tell whether the telescope is doing what is requested, use the requested positions (device coordinates) and the measured encoder positions from the encoders. 3. Last second. pntst.x.curTm.secMidD or any other value in this structure These values should be the same as: pntst.x.pl.tm.secMidD since the pipeline struct was loaded in scram net 2 seconds later. 4. coordinates that have been requested.. The position coordinates (without rates or offsets..) pntst.x.pl.curP.pnt.pos.c1 , c1 coordinate 1,2 in radians pntst.x.pl.curP.pnt.pos.c2 , c2 coordinate 1,2 in radians pntst.x.pl.curP.pnt.pos.st , start time for this coordinate. -1 --> immediate. pntst.x.pl.curP.pnt.pos.cs , coordsystem for these points. see table above eg. 3 = J2000 The offset coordinates pntst.x.pl.curP.pnt.off.c1 , c1 coordinate 1,2 in radians pntst.x.pl.curP.pnt.off.c2 , c2 coordinate 1,2 in radians pntst.x.pl.curP.pnt.off.st , start time for this coordinate. -1 --> immediate. pntst.x.pl.curP.pnt.off.cs , coord system for these points. see table above eg. 3 = J2000 the rate coordinates: pntst.x.pl.curP.pnt.rate.c1 , c1 coordinate 1,2 in radians/sec pntst.x.pl.curP.pnt.rate.c2 , c2 coordinate 1,2 in radians pntst.x.pl.curP.pnt.rate.st , start time for this coordinate. -1 --> immediate. pntst.x.pl.curP.pnt.rate.cs , coord system for these points. see table above eg. 3 = J2000 You cannot necessarily add the positions, offsets, and rates because they may not be in the same coordinate system. The J2000 ra,dec requested: back computed from the az,za pntst.x.pl.curP.raJ in radians pntst.x.pl.curP.decJ in radians This belongs to the timestamp: pntst.x.pl.tm.secMidD ast.. or pntst.x.pl.tm.astFrac ast.. or pntst.x.pl.tm.ut1Frac ut1 and pntst.x.pl.tm.mjd integer for ut1Frac ; ; The requested az,za position (after all corrections) ; pntst.x.pl.azRd azimuth radians pntst.x.pl.zaRd zenith angle radians ; 5. to compute the tracking error. - in the agcProgState.h scramnet block. see (/home/phil/vw/h/agcProgState.h) AGC_STATE agcSt; agcSt.secMLastTick ast seconds from midnite for this info.. agcSt.posErr.reqPosDifRd[3] encoder error measured - requested at the above time stamp (in radians). 0,1,2 is az, gr, ch typically this value is .1 to .3 arcseconds... You need to be careful that this timestamp agrees with the timestamp you are using for the pointing data block (especially if you are getting the scrmnet info via the multicast system). if you want the error in ra,dec then you will have to backcompute from the az,za postion that was measured at See: /home/phil/vw/datatk/pnt/Prog/pntXform.c routine convertInv() ;----------------------------------------------- FILES: /home/phil/vw/h .. include files pntProgState.h point structure loaded in scramnet agcProgState.h az,greg,ch structure loaded in scramnet (az,greg,ch device program) ttProgState.h turret structure loaded in scramnet tieProgState.h tiedown structure loaded in scramnet terProgState.h tertiary structure loaded in scramnet pntXformLib.h constants used by point transformation program: pntXform.c pntAgcLim.h hold some limits for az,greg,ch pntProgDat.h defines the coordinate system letters j,b,c, etc.. programs: /home/phil/vw/datatk/pnt/Prog/pntMProg.c - pointing communications prog /home/phil/vw/datatk/pnt/Prog/pntXProg.c - pointing transformation prog /home/phil/vw/datatk/pnt/agc/agcProg.c - az,greg,ch control program running on vxWorks and communicating with vertex sys. /home/phil/vw/datatk/pnt/ttt/tt/turProg.c - turret program running on vxWorks (not little stars) /home/phil/vw/datatk/pnt/ttt/tie/tieProg.c - tiedown program running on vxWorks. /home/phil/vw/datatk/pnt/ttt/ter/terProg.c - tertiary program running on vxWorks.