1. AMS-02 Position

1.1. Global Cartesian Coordinate Systems

1.1.1. (x, y, z): Conventional Terrestrial Reference Coordinate System (CTRS)

The CTRS has the following definition:

  1. Origin: At the geocenter (center of mass of the earth).
  2. z-axis: Directed toward the conventional definition of the North Pole, or more precise, towards the conventional terrestrial pole (CTP) as defined by the International Earth Rotation Service (IERS).
  3. x-axis: Passes through the point of zero longitude (approximately on the Greenwich meridian) as defined by the IERS.
  4. y-axis: Forms a right-handed coordinate system with the x- and z-axes.

An important underlying concept is that reference systems are purely definitions and must be realised through some defined process. Three particularly relevant realisations of the CTRS are WGS84 as used for GPS, PZ90 for GLONASS and the International Terrestrial Reference Frame (ITRF).

1.1.2. Defining the ITRS and Realising the ITRF

The International Terrestrial Reference System (ITRS) is a conceptual system defined by the International Earth Rotation Service (IERS). The conceptual ITRS is realised in practice by the coordinates and velocities of a set of stations on the earth’s surface. The coordinates and velocity of each station result from various global observation techniques, including VLBI, SLR, GPS and DORIS. The realisation of the ITRS by the coordinates and velocities of a particular set of stations, at a particular time and using a particular set of observations is referred to as the International Terrestrial Reference Frame (ITRF).

To re-emphasise - concepts and definitions are called ‘reference systems’ and realisations are called ‘reference frames’.

The IERS, defines ITRF as “the set of points with their 3-dimensional cartesian coordinates which realize an ideal reference system, the International Terrestrial Reference System (ITRS) as defined by the IUGG resolution No. 2 adopted in Vienna, 1991.”

Various realisations of the ITRF over time include ITRF89, ITRF90, ITRF91, ITRF92, ITRF93, ITRF94, ITRF95, ITRF96, ITRF97, ITRF2000, and ITRF2005 1). The successive realisations of ITRF account for better quantities and qualities of observations, improvements to processing algorithms and better models of the movements (or velocities) of the tectonic plates.

There are also many regional densifications of the ITRF such as ETRF89 (European Terrestrial Reference Frame 1989), JGD2000 (Japanese Geodetic Datum 2000), AFREF (African Geodetic Reference Frame), GDA94 (Geodetic Datum of Australia 1994), etc. GDA94, for example, is based on ITRF92 but realised at an epoch (in terms of plate tectonics) of 1 January 1994 (an epoch of 1994.0).

1.1.3. (x, y, z)WG84: World Geodetic System 84

The World Geodetic System is a standard for use in cartography, geodesy, and navigation. It comprises a standard coordinate frame for the Earth, a standard spheroidal reference surface (the datum or reference ellipsoid) for raw altitude data, and a gravitational equipotential surface (the geoid) that defines the nominal sea level.

The latest revision is WGS 84 (dating from 1984 and last revised in 2004), which will be valid up to about 2010.[1] Earlier schemes included WGS 72, WGS 66, and WGS 60. WGS 84 is the reference coordinate system used by the Global Positioning System

  • Main Parameters

The coordinate origin of WGS 84 is meant to be located at the Earth's center of mass; the error is believed to be less than 2 cm.

In WGS 84, the meridian of zero longitude is the IERS Reference Meridian. It lies 5.31 arc seconds east of the Greenwich Prime Meridian, which corresponds to 102.5 metres (336.3 feet) at the latitude of the Royal Observatory.

As of the latest revision, the WGS 84 datum surface is defined as an oblate spheroid (ellipsoid), with major (transverse) radius a = 6,378,137 m at the equator and flattening f = 1/298.257223563. The polar semi-minor (conjugate) radius b can be derived by b = a (1 - f) ≈ 6356752.3142 m. (This is a flattening of 21.384 685 755 km, or ≈ 0.335% in relative terms).

Presently WGS 84 uses the 1996 Earth Gravitational Model (EGM96) geoid, revised in 2004. This geoid defines the nominal sea level surface by means of a spherical harmonics series of degree 360 (which provides about 100 km horizontal resolution).[8] The deviations of the EGM96 geoid from the WGS 84 reference ellipsoid range from about -105 m to about +85 m. EGM96 differs from the original WGS 84 geoid, referred to as EGM84.

1.1.4. WGS84 vs ITRF

It is important to note that WGS84 is realised and maintained by the United States Department of Defense. The realisation of WGS84 comes through the coordinates and velocities used for the US military’s GPS tracking stations but civilians cannot measure relative to the data from those stations and can typically only directly access WGS84 via GPS point positions, which may have an accuracy of several metres.

Fortunately, WGS84 (G11502) ) was realised to be consistent with ITRF2000 at the few centimetre level and is maintained consistent with ITRF over time. For civilian users this means that positions relative to the current ITRF are directly compatible with WGS84.

Similarly, the WGS84 ellipsoid, for all practical purposes, is identical to the ellipsoid referred to as Geodetic Reference System 1980 (GRS80). GRS80 has a semi-major axis of 6,378,137 m and a flattening of 1:298.2572221101. This system was adopted at the XVII General Assembly of the International Union of Geodesy and Geophysics.

Against this background and considering the context of this guide, a GRS80 ellipsoidal height measured in the current realisation of ITRF can be considered as equal to a WGS84 ellipsoidal height.

1.2. AMS-02 GPS coordinate system

ALERT! AMS-02 On-board GPS uses WGS84 coordinate system.

1.3. ISS coordinates in AMS Software

Collection of Methods contained in file root_setup.C.
Id: root_setup.C,v 1.47 2011/08/22 21:53:40 choutko Exp

1.3.5. Fill Header Method - Fill Event Header

#ifndef __ROOTSHAREDLIBRARY__
bool AMSSetupR::FillHeader(uinteger run){
    // Fill Header from DB
    
    fHeader.Run=run;
    
    const char * nve=getenv("GetIorExec");
    char ior[]="getior.exe";
    if(! (nve && strlen(nve)))nve=ior;
    const char *exedir=getenv("ExeDir");
    const char *amsdatadir=getenv("AMSDataDir");
    char local[1024]="";
    
    if(! (exedir && strlen(exedir))){
        if(amsdatadir && strlen(amsdatadir)){
            strcpy(local,amsdatadir);
            strcat(local,"/DataManagement/exe");
        }
        exedir=local;
    }
    const char *version=AMSCommonsI::getversion(); 
    const char *nvr=AMSCommonsI::getosversion(); 
    if( nve &&strlen(nve) && exedir  && AMSCommonsI::getosname()){
        char t1[1024];
        strcpy(t1,exedir);
        strcat(t1,"/../prod");
        setenv("TNS_ADMIN",t1,0);
        AString systemc("/afs/cern.ch/ams/local/bin/timeout --signal 9 2400 ");
        systemc+=exedir;
        systemc+="/";
        systemc+=AMSCommonsI::getosname();
        systemc+="/";
        systemc+=nve;
        if(strstr(nvr,"2.6")){
            systemc+=".6";
        }
        char u[128];
        sprintf(u," -r %u",fHeader.Run);
        systemc+=u;
        systemc+="  > /tmp/getior.";
        char tmp[80];
        sprintf(tmp,"%u",getpid());
        systemc+=tmp;
        int i=system(systemc);
        if(i){
            cerr <<"  AMSSetupR::FillHeader-E-UnableTo "<<systemc<<endl;
            systemc="rm /tmp/getior."; 
            systemc+=tmp;
            system(systemc);
            fISSData.clear();
            fISSAtt.clear();
            LoadISS(fHeader.Run,fHeader.Run);
            LoadISSAtt(fHeader.Run-60,fHeader.Run+3600);
            LoadISSSA(fHeader.Run-60,fHeader.Run+3600);
            LoadISSCTRS(fHeader.Run-60,fHeader.Run+3600);
            
            return false; 
        }
        else{
            systemc="/tmp/getior."; 
            systemc+=tmp;
            ifstream fbin;
            fbin.open(systemc);
            if(fbin){
                fbin>>run;
                if(run!=fHeader.Run){
                    cerr<<" AMSSetupR::FillHeader-E-WrongRun "<<run<<endl;
                    return false;
                }
                fbin>>fHeader.FEvent;
                fbin>>fHeader.LEvent;
                fbin>>fHeader.FEventTime;
                fbin>>fHeader.LEventTime;
                cout <<" AMSSetupR::FillHeader-I-"<<fHeader.Run<<" "<<fHeader.FEvent<<" "<<fHeader.LEvent<<" "<<fHeader.FEventTime<<" "<<fHeader.LEventTime<<endl;
                fbin.close();
            }
            else cerr<<"AMSSetupR::FillHeader-E-UnableToOpenfile "<<systemc<<endl;
            systemc="rm /tmp/getior."; 
            systemc+=tmp;
            system(systemc);
            fISSData.clear();
            fISSAtt.clear();
            LoadISS(fHeader.FEventTime,fHeader.LEventTime);
            LoadISSAtt(fHeader.FEventTime-60,fHeader.LEventTime+1);
            LoadISSSA(fHeader.FEventTime-60,fHeader.LEventTime+1);
            LoadISSCTRS(fHeader.FEventTime-60,fHeader.LEventTime+1);
            return true;
        }
    }
    else{
        cerr<<" AMSSetupR::FillHeader-E-UnableToTryToGetIORBecauseSomeVarAreNull"<<endl;
        return false;
    }
}
#else
bool AMSSetupR::FillHeader(uinteger run){return true;}
#endif

1.3.6. Load ISS Method - Collect info about ISS GTOD coordinates

Retrieve data from DIR=/afs/cern.ch/ams/Offline/AMSDataDir+AMSSoftVersion and FILE=ISS_tlefile.txt.
Data Time is inside interval t1-t2.
Fill the following Class AMSSetupR::ISSData (more info ISSData).
Data included in ISSData will be used by predict tool to compute satellite parameters.
Format of ISS_tlefile.txt is compatible with Earth satellite orbits defined using the the NORAD "two-line element" set format, or TLE.
Data for each satellite consists of three lines in the following format:

AAAAAAAAAAAAAAAAAAAAAAAA
1 NNNNNU NNNNNAAA NNNNN.NNNNNNNN +.NNNNNNNN +NNNNN-N +NNNNN-N N NNNNN
2 NNNNN NNN.NNNN NNN.NNNN NNNNNNN NNN.NNNN NNN.NNNN NN.NNNNNNNNNNNNNN

Line 0 is a twenty-four character name.
Lines 1 and 2 are the standard Two-Line Orbital Element Set Format identical to that used by NORAD and NASA. The format description is:

Line 1

Column Description
01 Line Number of Element Data
03-07 Satellite Number
08 Classification (U=Unclassified)
10-11 International Designator, last two digits of launch year, 2000+ if < 57.
12-14 International Designator, launch number of the year
15-17 International Designator, piece of the launch
19-20 Epoch Year, last two digits of year, 2000+ if < 57
21-32 Epoch Day of the year and fractional portion of the day
34-43 First Time Derivative of the Mean Motion
45-52 Second Time Derivative of Mean Motion (decimal point assumed)
54-61 BSTAR drag term (decimal point assumed)
63 Ephemeris type
65-68 Element number
69 Checksum (Modulo 10)

(Letters, blanks, periods, plus signs = 0; minus signs = 1)

Line 2

Column Description
01 Line Number of Element Data
03-07 Satellite Number
09-16 Inclination [Degrees]
18-25 Right Ascension of the Ascending Node [Degrees]
27-33 Eccentricity (decimal point assumed)
35-42 Argument of Perigee [Degrees]
44-51 Mean Anomaly [Degrees]
53-63 Mean Motion [Revs per day]
64-68 Revolution number at epoch [Revs]
69 Checksum (Modulo 10)

1305590147
ISS (ZARYA)             
1 25544U 98067A   11136.99747483  .00021224  00000-0  14315-3 0  3681
2 25544  51.6484 320.8582 0002600 282.7050 215.1950 15.75059336715998
1305666169
ISS (ZARYA)             
1 25544U 98067A   11137.87660318 -.00003739  00000-0 -20301-4 0  3721
2 25544  51.6442 316.3353 0002754 285.2081 160.9995 15.75092667716137

void AMSSetupR::LoadISS(unsigned int t1, unsigned int t2){
#ifdef __ROOTSHAREDLIBRARY__
}
#else
    char amsdatadir[]="/afs/cern.ch/ams/Offline/AMSDataDir";
    char *amsd=getenv("AMSDataDir");
    if(!amsd || !strlen(amsd))amsd=amsdatadir;
    string ifile=amsd;
    ifile+="/";
    ifile+=AMSCommonsI::getversion();
    ifile+="/ISS_tlefile.txt";
    ifstream ifbin;
    ifbin.clear();
    ifbin.open(ifile.c_str());
    if(ifbin){
   char stime[80],namei[80], line1i[80], line2i[80];
        while(!ifbin.eof()){
            namei[0]=0;
            line1i[0]=0;
            line2i[0]=0;
            stime[0]=0;
            unsigned int tme;
            ifbin.getline(stime,75);
            tme=atol(stime);
            ifbin.getline(namei,75);
            ifbin.getline(line1i,75);
            ifbin.getline(line2i,75);
            if(!ifbin.eof() ){
                ISSData a;
                a.TL1=line1i;
                a.TL2=line2i;
                a.Name=namei;
                if(tme<t1)fISSData.clear();
                fISSData.insert(make_pair(tme,a));
                if(tme>t2)break;
            }
        }
        ifbin.close();
    }
}

#endif

1.3.7. Load ISS Attitude Method - Collect info about ISS attitude

Retrieve data from DIR=/afs/cern.ch/ams/local/altec and FILE=ISS_ATT_EULR_LVLH-YEAR-GMTDAY-24H.csv.
Data Time is inside interval t1-t2.
Fill the following Class AMSSetupR::ISSAtt (more info ISSAtt).
Format of data file is as follow:

GMT,ALT_YAW_LVLH,ALT_PITCH_LVLH,ALT_ROLL_LVLH
2011_249:00:00:00.699,-4.19710315503803,-2.58693227874961,0.892783203426158
2011_249:00:00:01.699,-4.19721937409141,-2.58666629547677,0.892504863555288
2011_249:00:00:02.699,-4.19720320000739,-2.58656454752053,0.892272229153422
...

All angles in degrees.

int AMSSetupR::LoadISSAtt(unsigned int t1, unsigned int t2){
#ifdef __ROOTSHAREDLIBRARY__
    return 0;
}
#else
    
    char AMSISSlocal[]="/afs/cern.ch/ams/local/altec/";
    char * AMSISS=getenv("AMSISS");
    if(!AMSISS || !strlen(AMSISS))AMSISS=AMSISSlocal;
    
    if(t1>t2){
        cerr<< "AMSSetupR::LoadISSAtt-S-BegintimeNotLessThanEndTime "<<t1<<" "<<t2<<endl;
        return 2;
    }
    else if(t2-t1>864000){
        cerr<< "AMSSetupR::LoadISSAtt-S-EndBeginDifferenceTooBigMax864000 "<<t2-t1<<endl;
        t2=t1+864000;
    }
    const char fpatb[]="ISS_ATT_EULR_LVLH-";
    const char fpate[]="-24H.csv";
    const char fpate2[]="-24h.csv";
    
    // convert time to GMT format
    
    // check tz
    unsigned int tzd=0;
    tm tmf;
    {
        char tmp2[255];
        time_t tz=t1;
        strftime(tmp2,80,"%Y_%j:%H:%M:%S",gmtime(&tz));
        strptime(tmp2,"%Y_%j:%H:%M:%S",&tmf);
        time_t tc=mktime(&tmf);
        tc=mktime(&tmf);
        tzd=tz-tc;
        cout<< "AMSSetupR::LoadISSAtt-I-TZDSeconds "<<tzd<<endl;
        
    }
    
    char tmp[255];
    time_t utime=t1;
    strftime(tmp, 40, "%Y", gmtime(&utime));
    unsigned int yb=atol(tmp);
    strftime(tmp, 40, "%j", gmtime(&utime));
    unsigned int db=atol(tmp);
    utime=t2;
    strftime(tmp, 40, "%Y", gmtime(&utime));
    unsigned int ye=atol(tmp);
    strftime(tmp, 40, "%j", gmtime(&utime));
    unsigned int de=atol(tmp);
    
    unsigned int yc=yb;
    unsigned int dc=db;
    int bfound=0;
    int efound=0;
    while(yc<ye || dc<=de){
        string fname=AMSISS;
        fname+=fpatb;
        char utmp[80];
        sprintf(utmp,"%u-%03u",yc,dc);
        fname+=utmp;
        fname+=fpate;
        ifstream fbin;
        fbin.close();    
        fbin.clear();
        fbin.open(fname.c_str());
        if(!fbin){
            // change 24H to 24h
            fname=AMSISS;
            fname+=fpatb;
            char utmp[80];
            sprintf(utmp,"%u-%03u",yc,dc);
            fname+=utmp;
            fname+=fpate2;
            fbin.close();    
            fbin.clear();
            fbin.open(fname.c_str());
        }
        if(fbin){
            while(fbin.good() && !fbin.eof()){
                char line[120];
                fbin.getline(line,119);
                
                if(isdigit(line[0])){
                    char *pch;
                    pch=strtok(line,".");
                    ISSAtt a;
                    if(pch){
                        strptime(pch,"%Y_%j:%H:%M:%S",&tmf);
                        time_t tf=mktime(&tmf)+tzd;
                        pch=strtok(NULL,",");
                        char tm1[80];
                        sprintf(tm1,".%s",pch);
                        double tc=tf+atof(tm1);
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        a.Yaw=atof(pch)*3.14159267/180;
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        a.Pitch=atof(pch)*3.14159267/180;
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        a.Roll=atof(pch)*3.14159267/180;
                        fISSAtt.insert(make_pair(tc,a));
                        
                        if(tc>=t1 && tc<=t2){
                            if(abs(bfound)!=2){
                                fISSAtt.clear();
                                fISSAtt.insert(make_pair(tc,a));
                                bfound=bfound?2:-2;
                                //               cout <<" line "<<line<<" "<<tc<<endl;
                            }
                        }
                        else if(tc<t1)bfound=1;
                        else if(tc>t2){
                            efound=1;
                            break;
                        }
                    }   
                }
            }
        }
        else{
            cerr<<"AMSSetupR::LoadISSAtt-E-UnabletoOpenFile "<<fname<<endl;
        }
        dc++;
        if(dc>366){
            dc=1;
            yc++;
        }
    }
    
    
    int ret;
    if(bfound>0 &&efound)ret=0;
    else if(!bfound && !efound )ret=2;
    else ret=1;
    cout<< "AMSSetupR::LoadISSAtt-I- "<<fISSAtt.size()<<" Entries Loaded"<<endl;
    
    return ret;
}
#endif

1.3.8. ISS CTRSR Creator - Fill with circular coordinates

Circular coordinates of ISS respect to Conventional Terrestrial Reference System Coordinate System (CTRS).

AMSSetupR::ISSCTRSR::ISSCTRSR(const  AMSSetupR::ISSCTRS &a){
    r=sqrt(a.x*a.x+a.y*a.y+a.z*a.z);
    phi=atan2(a.y,a.x);
    theta=asin(a.z/r);
    v=sqrt(a.vx*a.vx+a.vy*a.vy+a.vz*a.vz);
    vphi=atan2(a.vy,a.vx);
    vtheta=asin(a.vz/v);
    v=v/r;
    r*=100000;
}


int AMSSetupR::getISSCTRS(AMSSetupR::ISSCTRSR & a, double xtime){
    if (fISSCTRS.size()==0)return 2; 
    
    AMSSetupR::ISSCTRS_i k=fISSCTRS.lower_bound(xtime);
    if(k==fISSCTRS.begin()){
        a=ISSCTRSR(k->second);
        return 1;
    }
    if(k==fISSCTRS.end()){
        k--;
        a=ISSCTRSR(k->second);
        return 1;
    }
    AMSSetupR::ISSCTRS b;
    float s0[2]={-1.,-1};
    double tme[2]={0,0};
    tme[0]=k->first;
    AMSSetupR::ISSCTRS_i l=k;
    l++;
    tme[1]=l->first;
    //  cout <<" alpha "<< k->second.alpha<<" "<<l->second.alpha<<endl;
    //   cout << int(k->first)<<" "<<int(l->first)<<" "<<int(xtime)<<endl;
    {
        double ang1=k->second.x;
        double ang2=l->second.x;
        s0[0]=ang1;
        s0[1]=ang2;
        double s1=s0[0]+(xtime-tme[0])/(tme[1]-tme[0]+1.e-6)*(s0[1]-s0[0]);
        b.x=s1;
    }
    {
        double ang1=k->second.y;
        double ang2=l->second.y;
        s0[0]=ang1;
        s0[1]=ang2;
        double s1=s0[0]+(xtime-tme[0])/(tme[1]-tme[0]+1.e-6)*(s0[1]-s0[0]);
        b.y=s1;
    }
    {
        double ang1=k->second.z;
        double ang2=l->second.z;
        s0[0]=ang1;
        s0[1]=ang2;
        double s1=s0[0]+(xtime-tme[0])/(tme[1]-tme[0]+1.e-6)*(s0[1]-s0[0]);
        b.z=s1;
    }
    {
        double ang1=k->second.vx;
        double ang2=l->second.vx;
        s0[0]=ang1;
        s0[1]=ang2;
        double s1=s0[0]+(xtime-tme[0])/(tme[1]-tme[0]+1.e-6)*(s0[1]-s0[0]);
        b.vx=s1;
    }
    {
        double ang1=k->second.vy;
        double ang2=l->second.vy;
        s0[0]=ang1;
        s0[1]=ang2;
        double s1=s0[0]+(xtime-tme[0])/(tme[1]-tme[0]+1.e-6)*(s0[1]-s0[0]);
        b.vy=s1;
    }
    
    {
        double ang1=k->second.vz;
        double ang2=l->second.vz;
        s0[0]=ang1;
        s0[1]=ang2;
        double s1=s0[0]+(xtime-tme[0])/(tme[1]-tme[0]+1.e-6)*(s0[1]-s0[0]);
        b.vz=s1;
    }
    
    a=ISSCTRSR(b);
    return 0;
    
    
}

1.3.9. Load ISSCTRS Method - Collect info about ISS CTRS coordinates

Retrieve data from DIR=/afs/cern.ch/ams/local/isssa and FILE=ISS_CTRS_VECTORS_YEAR_GMTDAY_24H.csv.
Data Time is inside interval t1-t2.
Fill the following Class AMSSetupR::ISSCTRS (more info AMSSetupR::ISSCTRS).
Format of data file is as follow:

GMT,LADP06MD2403H,LADP06MD2404H,LADP06MD2405H,LADP06MD2407R,LADP06MD2408R,LADP06MD2409R
2011_250:10:41:10.000,5444.266,-413.297,3988.986,-2484.573,5708.222,3957.401
2011_250:10:41:20.000,5419.114,-356.171,4028.301,-2545.909,5716.825,3905.624
2011_250:10:41:30.000,5393.349,-298.962,4067.097,-2606.907,5724.784,3853.342
...

where first field is UTC time, 2nd-4th are x,y,z (km) in CTRS, 5th-7th are v_x,v_y,v_z (km/s).



int AMSSetupR::LoadISSCTRS(unsigned int t1, unsigned int t2){
#ifdef __ROOTSHAREDLIBRARY__
    return 0;
}
#else
    
    char AMSISSlocal[]="/afs/cern.ch/ams/local/isssa/";
    char * AMSISS=getenv("AMSISSSA");
    if(!AMSISS || !strlen(AMSISS))AMSISS=AMSISSlocal;
    
    if(t1>t2){
        cerr<< "AMSSetupR::LoadISSCTRS-S-BegintimeNotLessThanEndTime "<<t1<<" "<<t2<<endl;
        return 2;
    }
    else if(t2-t1>864000){
        cerr<< "AMSSetupR::LoadISSCTRS-S-EndBeginDifferenceTooBigMax864000 "<<t2-t1<<endl;
        t2=t1+864000;
    }
    const char fpatb[]="ISS_CTRS_Vectors_";
    const char fpate[]="-24H.csv";
    const char fpate2[]="-24h.csv";
    
    // convert time to GMT format
    
    // check tz
    unsigned int tzd=0;
    tm tmf;
    {
        char tmp2[255];
        time_t tz=t1;
        strftime(tmp2,80,"%Y_%j:%H:%M:%S",gmtime(&tz));
        strptime(tmp2,"%Y_%j:%H:%M:%S",&tmf);
        time_t tc=mktime(&tmf);
        tc=mktime(&tmf);
        tzd=tz-tc;
        cout<< "AMSSetupR::LoadISSCTRS-I-TZDSeconds "<<tzd<<endl;
        
    }
    
    char tmp[255];
    time_t utime=t1;
    strftime(tmp, 40, "%Y", gmtime(&utime));
    unsigned int yb=atol(tmp);
    strftime(tmp, 40, "%j", gmtime(&utime));
    unsigned int db=atol(tmp);
    utime=t2;
    strftime(tmp, 40, "%Y", gmtime(&utime));
    unsigned int ye=atol(tmp);
    strftime(tmp, 40, "%j", gmtime(&utime));
    unsigned int de=atol(tmp);
    
    unsigned int yc=yb;
    unsigned int dc=db;
    int bfound=0;
    int efound=0;
    while(yc<ye || dc<=de){
        string fname=AMSISS;
        fname+=fpatb;
        char utmp[80];
        sprintf(utmp,"%u_%03u",yc,dc);
        fname+=utmp;
        fname+=fpate;
        ifstream fbin;
        fbin.close();    
        fbin.clear();
        fbin.open(fname.c_str());
        if(!fbin){
            // change 24H to 24h
            fname=AMSISS;
            fname+=fpatb;
            char utmp[80];
            sprintf(utmp,"%u_%03u",yc,dc);
            fname+=utmp;
            fname+=fpate2;
            fbin.clear();
            fbin.close();    
            fbin.clear();
            fbin.open(fname.c_str());
        }
        if(fbin){
            while(fbin.good() && !fbin.eof()){
                char line[120];
                fbin.getline(line,119);
                
                if(isdigit(line[0])){
                    char *pch;
                    pch=strtok(line,".");
                    ISSCTRS a;
                    if(pch){
                        strptime(pch,"%Y_%j:%H:%M:%S",&tmf);
                        //cout <<" pch "<<pch<<endl;
                        time_t tf=mktime(&tmf)+tzd;
                        pch=strtok(NULL,",");
                        char tm1[80];
                        sprintf(tm1,".%s",pch);
                        double tc=tf+atof(tm1);
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        if(!isdigit(pch[0]) && pch[0]!='-' && pch[0]!='.')continue;
                        a.x=atof(pch);
                        //cout <<" alpha "<<a.x<<" "<<tf<<" "<<tc<<endl;
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        if(!isdigit(pch[0])&& pch[0]!='-'&& pch[0]!='.')continue;
                        a.y=atof(pch);
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        if(!isdigit(pch[0])&& pch[0]!='-'&& pch[0]!='.')continue;
                        a.z=atof(pch);
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        if(!isdigit(pch[0])&& pch[0]!='-'&& pch[0]!='.')continue;
                        a.vx=atof(pch)/1000.;
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        if(!isdigit(pch[0])&& pch[0]!='-'&& pch[0]!='.')continue;
                        a.vy=atof(pch)/1000.;
                        pch=strtok(NULL,",");
                        if(!pch)continue;
                        if(!isdigit(pch[0])&& pch[0]!='-'&& pch[0]!='.')continue;
                        a.vz=atof(pch)/1000.;
                        fISSCTRS.insert(make_pair(tc,a));
                        
                        if(tc>=t1 && tc<=t2){
                            if(abs(bfound)!=2){
                                fISSCTRS.clear();
                                fISSCTRS.insert(make_pair(tc,a));
                                bfound=bfound?2:-2;
                                //               cout <<" line "<<line<<" "<<tc<<endl;
                            }
                        }
                        else if(tc<t1)bfound=1;
                        else if(tc>t2){
                            efound=1;
                            break;
                        }
                    }   
                }
            }
        }
        else{
            cerr<<"AMSSetupR::LoadISSCTRS-E-UnabletoOpenFile "<<fname<<endl;
        }
        dc++;
        if(dc>366){
            dc=1;
            yc++;
        }
    }
    
    
    int ret;
    if(bfound>0 &&efound)ret=0;
    else if(!bfound && !efound )ret=2;
    else ret=1;
    cout<< "AMSSetupR::LoadISSCTRS-I- "<<fISSCTRS.size()<<" Entries Loaded"<<endl;
    
    return ret;
}

#endif

2. Geomagnetic Cut-Off

International Geomagnetic Reference Field %IMP http://www.ngdc.noaa.gov/IAGA/vmod/igrf.html

3. East-West asymmetry

Attached interesting picture showing electron and positron horizons at fixed rigidity.

Topic attachments
I Attachment History Action Size Date Who Comment
JPEGjpg orizzonti-LAT.jpg r1 manage 63.4 K 2011-12-05 - 12:02 FedericoPilo  
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r6 - 2014-11-20 - TWikiAdminUser
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback