Commit 3d98a78b authored by Reza  ANSARI's avatar Reza ANSARI
Browse files

Ajout de l'option -K pour creation d'un fichier track (trace de satellite ds...

Ajout de l'option -K pour creation d'un fichier track (trace de satellite ds le ciel) , MAJ README et Makefile , Reza 25/11/2018
parent cf658f0d
......@@ -8,6 +8,9 @@ EXE = ./Objs/
SGP4INC = ${EXTLIBDIR}/Satellites/sgp4/libsgp4/
SGP4LIB = ${EXTLIBDIR}/Satellites/sgp4/libsgp4/
#Flag de compilation optionnel
SGP4CCFLG = ''
# Define our target list
all : predictsatsgp4
......@@ -17,7 +20,7 @@ clean :
### Compilation de .o
$(OBJ)/predictsatsgp4.o : predictsatsgp4.cc $(SGP4INC)/Tle.h
$(CXXCOMPILE) -o $(OBJ)/predictsatsgp4.o -I$(SGP4INC) predictsatsgp4.cc
$(CXXCOMPILE) $(SGP4CCFLG) -o $(OBJ)/predictsatsgp4.o -I$(SGP4INC) predictsatsgp4.cc
###### Compilation et link des executables
predictsatsgp4 : $(EXE)/predictsatsgp4
......
......@@ -34,6 +34,21 @@
SpaceTrack Report No. 3 -> spacetrk.pdf
Revisiting Spacetrack Report #3 -> AIAA-2006-6753-Rev2.pdf
.Notes Reza 25 Nov 2018
o Voir aussi le site web http://celestrak.com
et les liens sur ce site, en particulier le livre http://celestrak.com/software/vallado-sw.php
o Pour faire le build sur mon Mac , aprs avoir tlcharger sgp4.git ,
j'ai fait :
> cd $HERESGP4/
> cmake sgp4
-> library: $HERESGP4/libsgp4/libsgp4.a
-> includes: $HERESGP4/sgp4/libsgp4/*.h
A noter aussi que j'ai du modifier les trois fichiers suivants pour enlever la rfrence a librt.a (supprimer -lrt)
sattrack/CMakeFiles/sattrack.dir/link.txt
runtest/CMakeFiles/runtest.dir/link.txt
passpredict/CMakeFiles/passpredict.dir/link.txt
-----
2-/ Step 2 : telecharger les TLE (two-line element sets)
......@@ -57,6 +72,12 @@ Les satellites dont on telecharge les TLE sont listes dans les variables: naviga
.pour changer l'emplacement, ajouter a l'ordre "make ..." les arguments:
OBJ="la ou je veux mettre mes objets" EXE="la ou je veux mettre mes executables"
.Reza 25/11/2018 : Avec le build comme indiqu ci-dessus, j'ai du faire
> make SGP4INC=${HERESGP4}/sgp4/libsgp4/ SGP4LIB=${HERESGP4}/libsgp4/
.Reza 25/11/2018 : Au CC-IN2P3, il faut ajouter l'option de compilation -std=c++11
J'ai donc modifie le Makefile en ajoutant un flag optionnel de compilation - pour faire make au CC
> make SGP4INC=${HERESGP4}/sgp4/libsgp4/ SGP4LIB=${HERESGP4}/libsgp4/ SGP4CCFLG="-std=c++11"
-----
4-/ Step 4 : executer le programme de prediction
-----
......@@ -69,6 +90,8 @@ Les satellites dont on telecharge les TLE sont listes dans les variables: naviga
debug for satellite GSAT0102 (PRN E12) i.e. "37847"
> ./Objs/predictsatsgp4 -D 37847 satname YYYMMDD/galileo.txt [...]
.Reza 25/11/2018 : j'ai ajoute l'option -K au programme, pour creer un fichier avec la trace (track) du satellite
..../AnaPAON4/Satellites/Objs/predictsatsgp4 -T "2018/10/20 15:16:00" -H 0.,81. -T 41859 -p 2 TLE_20181123/*.txt
-----
5-/ Remarques
......
......@@ -23,6 +23,7 @@ void ReadFile(string infile,vector<string>& vline1,vector<string>& vline2,vector
Vector AzAlt2Vec(double az,double alt);
double SepAngle(Vector& v1, Vector& v2);
void DelAzAltSmall(const CoordTopocentric& topo1,const CoordTopocentric& topo2,double &daz,double &dalt);
void SaveTrack(string & satname, SGP4 & sgp4, Observer & obs, DateTime& datestart, DateTime& dateend, TimeSpan& tspaninc, int prtlev=0);
void usage(void);
void usage(void)
......@@ -33,6 +34,7 @@ cout<<"predictsatsgp4 [options] filetle1.txt [filetle2.txt ...] : find satellite
<<" -H azimuth(dd.ddd,N=0,E->W),altitude(dd.ddd,Z+) : (def=180d,83.40d)"<<endl
<<" telescope horizontal coordinates pointing"<<endl
<<" -D satname : print debug for this satellite (even if not in the search area)"<<endl
<<" -K satname : Create a track file for this satellite (same time span as the one defined for scan)"<<endl
<<" -A scanlos(dd.ddd) : search area around los (def=10d)"<<endl
<<" find satellites closer than \"scanlos\" degrees of los"<<endl
<<" -s spanhour(int),spanmin(min),spaninc(min) :"<<endl
......@@ -62,12 +64,14 @@ int main(int narg, char *arg[])
double dang4vel = 1.;
//Satellite name to debug
string debugsatname;
//Satellite name for which to compute and save the track
string tracksatname;
//print level
int lp=0;
//--- Decodage des arguments
char c;
while((c = getopt(narg,arg,"hT:O:H:A:s:D:v:p:")) != -1) {
while((c = getopt(narg,arg,"hT:O:H:A:s:D:K:v:p:")) != -1) {
switch (c) {
case 'T' :
datestr = optarg;
......@@ -87,6 +91,9 @@ int main(int narg, char *arg[])
case 'D' :
debugsatname = optarg;
break;
case 'K' :
tracksatname = optarg;
break;
case 'v' :
dang4vel = atof(optarg);
break;
......@@ -139,6 +146,8 @@ int main(int narg, char *arg[])
//--- Debug satellite:
if(debugsatname.size()>0) cout<<"Debug satellite: "<<debugsatname<<endl;
//--- Debug satellite:
if(tracksatname.size()>0) cout<<"Creating Track file for satellite: "<<tracksatname<<endl;
//--- Sun (ephemerides de la journee d'observation)
cout<<endl;
......@@ -173,6 +182,7 @@ int main(int narg, char *arg[])
string satname(strsatname);
Tle tle = Tle(satname,vline1[isat],vline2[isat]);
long ifounddbg = (debugsatname.size()>0) ? satname.find(debugsatname,0): -1;
long ifoundtrk = (tracksatname.size()>0) ? satname.find(tracksatname,0): -1;
//
try {
SGP4 sgp4(tle);
......@@ -230,6 +240,10 @@ int main(int narg, char *arg[])
if(s<sepmin) {sepmin = s; datemin = datecur; topomin = toposep;}
datecur = datecur + tspaninc;
}
if(ifoundtrk==0) { // Create track file for this satellite
cout<<"***TRK-Creating Track file for SAT="<<satname<<endl;
SaveTrack(satname, sgp4, obspaon4, datestart, dateend, tspaninc, lp);
}
//...Print results
//INFO: "Rng" is the "slant range" (distance observer-satellite) in km
// and "Rng Rt" is the "slant range rate" in km/s
......@@ -357,3 +371,35 @@ void DelAzAltSmall(const CoordTopocentric& topo1,const CoordTopocentric& topo2,d
if(daz > +180.) daz -= 360.; //ex: az1=10d, az2=350d, az2-az1=350-10=+340d -> daz=+340-360=-20d
if(daz <= -180.) daz += 360.; //ex: az1=350d, az2=10d, az2-az1=10-350=-340d -> daz=-340+360=+20d
}
//---------------------------------------------------------
void SaveTrack(string & satname, SGP4 & sgp4, Observer & obs, DateTime& datestart, DateTime& dateend,
TimeSpan& tspaninc, int prtlev)
{
string flnm = "trk_"+satname+".txt";
ofstream ofs(flnm);
ofs << "#### Track for satellite : " << satname << endl;
ofs << "## Date/Time Azimuth Elevation Latitude Longitude " << endl;
if (prtlev>1) {
cout << "#### Track for satellite : " << satname << endl;
cout << "## Date/Time Azimuth Elevation Latitude Longitude " << endl;
}
DateTime datecur = datestart;
while(datecur <= dateend+tspaninc) {
Eci eci = sgp4.FindPosition(datecur);
//-- Vector Velsat = eci.Velocity();
//-- double velsat = Velsat.Magnitude(); //km/s
//...Get look angle for observer to satellite
CoordTopocentric topo = obs.GetLookAngle(eci);
// Vector Vsat = AzAlt2Vec(RadiansToDegrees(topo.azimuth),RadiansToDegrees(topo.elevation));
//...Convert satellite position to geodetic coordinates
CoordGeodetic geo = eci.ToGeodetic();
// Vector Vungeo = AzAlt2Vec(RadiansToDegrees(geo.longitude),RadiansToDegrees(geo.latitude));
ofs <<datecur<<" "<<topo.azimuth<<" "<<topo.elevation<<" "<<geo.latitude<<" "<<geo.longitude<<endl;
if (prtlev>1)
cout <<datecur<<" "<<topo.azimuth<<" "<<topo.elevation<<" "<<geo.latitude<<" "<<geo.longitude<<endl;
datecur = datecur + tspaninc;
}
return;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment