home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.parl.clemson.edu
/
2015-02-07.ftp.parl.clemson.edu.tar
/
ftp.parl.clemson.edu
/
pub
/
portedOneB.tar
/
OneB
/
RAConeb.h
< prev
next >
Wrap
C/C++ Source or Header
|
1999-07-08
|
5KB
|
172 lines
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/times.h>
#include <TimeTools.h>
#include <ModelTools.h>
#include <../Ingest/platform.h>
#define ushort unsigned short
#define uchar unsigned char
#define CHANNELS "11111000000000000000 11"
/*
// Math Constants
const double
m_E = 2.7182818284590452354, // e (natural number)
m_LOG2E = 1.4426950408889634074,
m_LOG10E = 0.43429448190325182765, // log10 x = 0.434 ln x
m_LN2 = 0.69314718055994530942, // ln 2
m_LN10 = 2.30258509299404568402, // ln x = 2.302 log10 x
m_PI = 3.14159265358979323846, // pi
m_PI_2 = 1.57079632679489661923, // pi/2
m_PI_4 = 0.78539816339744830962, // pi/4
m_1_PI = 0.31830988618379067154, // 1/pi
m_2_PI = 0.63661977236758134308, // 2/pi
m_2_SQRTPI = 1.12837916709551257390, // 2/sqrt(pi)
m_SQRT2 = 1.41421356237309504880, // sqrt(2)
m_SQRT1_2 = 0.70710678118654752440, // sqrt(2) / 2
m_twoPi = 6.28318530717958647692,
m_rToD = 57.29577951308238, // radians to deg
m_dToR = 0.01745329251994329 // deg to radians
;
// Physical Constants
const double
p_G = 6.6720e-11, // Gravitation Con. m**3 / kg sec**2
p_c = 2.99792458e+8 // velocity of light m/sec
;
// Earth Constants
const double
// Spherical Harmonics
e_J2 = 1082.6271e-6, // J2
e_J3 = -2.5358868e-6, // J3
e_J4 = -1.624618e-6, // J4
e_J5 = -0.22698599e-6, // J5
e_Re = 6378149.196, // Earth equat. Radius (meters)
e_Rp = 6356764.278, // Earth polar Radius (meters)
e_Me = 5.9742e+24, // earth mass kg.
e_GM = 3.9860064e+14, // GM m**3 / sec**2
e_SQRT_GM = 19964985.35, // sqrt (GM)
e_ecc = 0.081819182, // earth eccentricity
e_ecc_sq = 6.694378665e-3, // earth eccentricity **2
e_f = 3.35281e-3, // earth flattening factor
e_RotV = 0.7292115850e-4 // earth rotational velocity (rad/sec)
;
*/
extern const LDOUBLE
e_Re, // Earth equat. Radius (meters)
m_rToD, // radians to deg
m_dToR, // deg to radians
m_twoPi,
ea_GM, // GM m**3 / sec**2
e_ecc_sq; // earth eccentricity **2
ushort aInt;
float aFloat;
typedef struct
{
ushort Channel[5];
} HRPTElement;
typedef struct
{
LDOUBLE xp, yp, zp;
LDOUBLE xv, yv, zv;
} rct;
typedef struct
{
ushort Sync[6];
ushort ID[2];
ushort TimeCode[4];
ushort Telemetry[10];
ushort BackScanData[30];
ushort SpaceData[50];
ushort SyncDelta;
ushort TIP[520];
ushort SPARE[127];
HRPTElement Element[2048];
ushort unSync[100];
} HRPTScan;
typedef struct
{
char *Tag;
char **Param;
} cmdPair;
/* Calibration Globals */
char RFuncName[132];
float RFuncWave[5], RFuncStep[5], RFuncCount[5], RFuncRead[5], RFuncSum[5];
float RFuncCenterWave[5];
long PRTTotal[3][5];
float PRTAverage[3][5];
float PRT[5];
float PRTCoefficient[5][5];
float PRTWeight[5];
float SpaceRad[5];
float AGIGain[5], AGIInter[5];
float PRTTemperature[5];
long PRTRead[3][5];
int ITDIndex;
int ITDCount;
long ITDTotal[10][5];
float ITDAverage[10][5];
float ITD[5];
int SSDIndex;
int SSDCount;
long SSDTotal[10][5];
float SSDAverage[10][5];
float SSD[5];
float RadSum[5];
float Wave;
float RFuncRad[5];
int RFuncIndex;
float RFuncWidth[5];
float SolarIrradiance[5];
float RFunc[5][60];
float InternalTargetTemperature;
int RACGetArgs(int argc, char **argv, cmdPair *args);
int ReadScanTime(HRPTScan aScan, ttOrbitTime *oTime);
unsigned int ReadLatLon(FILE *EphemFile, ttOrbitTime sTime, double **latList, double **lonList);
rct getCartesian(kep_t kep);
int pack2number (uchar *buffer, short scannum);
int pack4number (uchar *buffer, int scannum);
int encodesat(char *let, int num);
int decodeTime(long msec, short *hr, short *min, double *sec);
int packscantime(uchar *scanline,short scanyear,short scanday,long scangmt);
int packlocation(uchar *buffer, double aLat, double aLon);
int packtelem(unsigned char *buffer, ushort *telem);
int packvideo(unsigned char *buffer,int datatype, ushort *ch1,ushort *ch2,ushort *ch3,ushort *ch4,ushort *ch5);
void *pack1bcpy(void *s1, void *s2, size_t n);
void *pack1bcpy5(void *s1, void *s2_1, void *s2_2, void *s2_3, void *s2_4, void *s2_5, size_t n);
int setPRTjunk(int satellite);
int grabPRTlevels(unsigned short *aux);
int grabPRTgains(unsigned short *aux, float gain[5], float inter[5]);
void swapint(int *tmpint);