#include <GPS.h>
Public Types | |
| enum | RockType { NONE, UPDOWN, SLEWING, ONEPERORBIT } |
Public Methods | |
| GPStime | time () const |
| GPS synchronized time for the satellite. More... | |
| double | lat () const |
| present latitude. More... | |
| double | lon () const |
| present longitude. More... | |
| double | pitch () const |
| present 'pitch' angle in N-S direction (roll around x-axis). More... | |
| double | yaw () const |
| present 'yaw' angle - (rotate around z-axis). More... | |
| double | roll () const |
| present 'roll' andle in E-W direction (roll around y-axis). More... | |
| double | phase () const |
| get the current phase of the orbit. More... | |
| const Orbit * | orbit () const |
| access to the orbit (for computation only). More... | |
| Coords | state () const |
| current state of the GPS system. More... | |
| double | expansion () const |
| expansion of the current orbit. More... | |
| GPStime | sampleintvl () const |
| sample interval for random orbit distribution. More... | |
| double | ascendingLon () const |
| return the orbit's ascending longitude. More... | |
| std::pair< double, double > | rotateAngles () |
| access m_rotangles. More... | |
| void | getPointingCharacteristics (double seconds) |
| get the pointing characteristics of the satellite, given a location and rocking angle. More... | |
| void | orbit (Orbit *) |
| set a specific Orbit object for lat/lon calculations. More... | |
| void | pass (double) |
| pass a specific amount of time. More... | |
| void | phase (double) |
| set the current phase of the orbit. More... | |
| void | expansion (double) |
| set the expansion factor for the orbit (-1) = random. More... | |
| void | synch () |
| synchronize w. scheduler. More... | |
| void | sampleintvl (GPStime) |
| set the sample interval. More... | |
| void | ascendingLon (double) |
| special to set the ascending longitude. More... | |
| void | rotateAngles (std::pair< double, double > coords) |
| set m_rotangles. More... | |
| void | printOn (std::ostream &out) const |
| print time & position. More... | |
| void | notifyObservers () |
| Subject & | notification () |
| Rotation | rockingAngleTransform (double seconds) |
| return the rotation for compensation for the rocking angles. More... | |
| Rotation | transformGlastToGalactic (double seconds) |
| this transforms glast-local (cartesian) vectors into galactic (cartesian) vectors. More... | |
| Rotation | GPS::CELTransform (double seconds) |
| Rotation | GPS::transformCelToGlast (double seconds) |
| void | rockingDegrees (double rockDegrees) |
| Orbit * | orbit () |
| void | setRockType (RockType rockType) |
| void | setRockType (int rockType) |
| double | RAX () const |
| double | RAZ () const |
| double | DECX () const |
| double | DECZ () const |
| double | RAZenith () const |
| double | DECZenith () const |
| Hep3Vector | position (double seconds) const |
Static Public Methods | |
| GPS * | instance () |
| void | kill () |
Protected Methods | |
| GPS () | |
| virtual | ~GPS () |
| void | pitch (double) |
| void | yaw (double) |
| void | roll (double) |
| void | lat (double) |
| void | lon (double) |
| void | time (GPStime) |
| GPStime | orbittime () const |
| void | orbittime (GPStime) |
| void | setState (const GPS::Coords &) |
Protected Attributes | |
| std::pair< double, double > | m_rotangles |
Private Attributes | |
| astro::EarthOrbit * | m_earthOrbit |
| Orbit * | m_orbit |
| double | m_expansion |
| GPStime | m_time |
| GPStime | m_orbittime |
| double | m_sampleintvl |
| double | m_RAX |
| double | m_RAZ |
| double | m_DECX |
| double | m_DECZ |
| double | m_RAZenith |
| double | m_DECZenith |
| Hep3Vector | m_position |
| Subject | m_notification |
| double | m_rockDegrees |
| RockType | m_rockType |
Static Private Attributes | |
| GPS * | s_instance = 0 |
Friends | |
| class | FluxGenerator |
$Header $
Definition at line 44 of file GPS.h.
|
|
Definition at line 48 of file GPS.h. Referenced by setRockType(), and FluxMgr::setRockType().
00048 {
00049 NONE,
00050 UPDOWN,
00051 SLEWING,
00052 ONEPERORBIT
00053 };
|
|
|
Definition at line 17 of file GPS.cxx. Referenced by instance().
00018 : m_orbit(new Orbit), 00019 m_rockDegrees(15.), 00020 m_rockType(NONE), 00021 m_earthOrbit(new astro::EarthOrbit), 00022 m_expansion(1.), // default expansion:regular orbit for now 00023 m_time(0.), 00024 m_orbittime(m_time), 00025 m_sampleintvl(0.001), 00026 m_rotangles(std::make_pair<double,double>(0.,0.)) 00027 {} |
|
|
Definition at line 38 of file GPS.cxx. References m_orbit.
00039 { delete m_orbit; }
|
|
|
special to set the ascending longitude.
Definition at line 223 of file GPS.cxx. References Orbit::ascendingLon(), lon(), and m_orbit.
00224 {
00225 m_orbit->ascendingLon(lon);
00226 }
|
|
|
return the orbit's ascending longitude.
Definition at line 227 of file GPS.cxx. Referenced by FluxMgr::setGlastPosition().
00228 {
00229 return m_orbit->ascendingLon();
00230 }
|
|
|
Definition at line 154 of file GPS.h. References m_DECX. Referenced by ExposureAlg::execute().
00154 {return m_DECX;}
|
|
|
Definition at line 155 of file GPS.h. References m_DECZ. Referenced by ExposureAlg::execute().
00155 {return m_DECZ;}
|
|
|
Definition at line 157 of file GPS.h. References m_DECZenith. Referenced by ExposureAlg::execute().
00157 {return m_DECZenith;}
|
|
|
set the expansion factor for the orbit (-1) = random.
Definition at line 145 of file GPS.cxx. References m_expansion.
00146 {
00147 m_expansion = e;
00148 }
|
|
|
expansion of the current orbit.
Definition at line 118 of file GPS.cxx. References m_expansion. Referenced by FluxMgr::setExpansion(), and synch().
00119 {
00120 return m_expansion;
00121 }
|
|
|
get the pointing characteristics of the satellite, given a location and rocking angle.
Definition at line 355 of file GPS.cxx. References m_DECX, m_DECZ, m_DECZenith, m_earthOrbit, m_position, m_RAX, m_RAZ, m_RAZenith, m_rockDegrees, m_rockType, NONE, ONEPERORBIT, SLEWING, time(), and UPDOWN. Referenced by ExposureAlg::execute().
00355 {
00356 //this is being used by exposureAlg right now, and should be reworked
00357 //to use the rest of this class.
00358 using namespace astro;
00359
00360 double time = m_earthOrbit->dateFromSeconds(seconds);
00361
00362 double inclination = m_earthOrbit->inclination();
00363 double orbitPhase = m_earthOrbit->phase(time);
00364 m_position = m_earthOrbit->position(time);
00365
00366 //first make the directions for the x and Z axes, as well as the zenith direction.
00367 SkyDir dirZenith(m_position.unit());
00368 //before rotation, the z axis points along the zenith:
00369 SkyDir dirZ(m_position.unit());
00370 SkyDir dirX(dirZ.ra()-90., 0.0);
00371
00372 //rotate the x direction so that the x direction points along the orbital direction.
00373 dirX().rotate(dirZ.dir() , inclination*cos(orbitPhase));
00374
00375 //now set the zenith direction before the rocking.
00376 m_RAZenith = dirZ.ra();
00377 m_DECZenith = dirZ.dec();
00378
00379
00380
00381
00382
00383 // now, we want to find the proper transformation for the rocking angles:
00384 //HepRotation rockRot(Hep3Vector(0,0,1).cross(dirZ.dir()) , rockNorth);
00385 //and apply the transformation to dirZ and dirX:
00386 double rockNorth = m_rockDegrees*M_PI/180;
00387 //here's where we decide how much to rock about the x axis. this depends on the
00388 //rocking mode.
00389 if(m_rockType == NONE){
00390 rockNorth = 0.;
00391 }else if(m_rockType == UPDOWN){
00392 if(m_DECZenith <= 0) rockNorth *= -1.;
00393 }else if(m_rockType == SLEWING){
00394 //slewing is experimental
00395 if(m_DECZenith <= 0) rockNorth *= -1.;
00396 if(m_DECZenith >= -5.5 && m_DECZenith <= 5.5){
00397 rockNorth -= rockNorth*((5.5-fabs(m_DECZenith))/5.5);
00398 }
00399 }else if(m_rockType == ONEPERORBIT){
00400 //this needs an implementation - it only rocks one way now!
00401 }
00402
00403 dirZ().rotate(dirX.dir() , rockNorth);
00404
00405 m_RAX = dirX.ra();
00406 m_RAZ = dirZ.ra();
00407 m_DECX = dirX.dec();
00408 m_DECZ = dirZ.dec();
00409
00410 //a test - to ensure the rotation went properly
00411 //std::cout << " degrees between xhat and zhat directions: " <<
00412 // dirZ.difference(dirX)*180./M_PI << std::endl;
00413 }
|
|
|
Referenced by notification(). |
|
|
Referenced by notification(). |
|
|
Definition at line 180 of file GPS.cxx. References GPS(), and s_instance. Referenced by HeSpectrum::askGPS(), GalElSpectrum::askGPS(), CHIMESpectrum::askGPS(), AlbedoPSpectrum::askGPS(), HeSpectrum::calculate_rate(), GalElSpectrum::calculate_rate(), CHIMESpectrum::calculate_rate(), AlbedoPSpectrum::calculate_rate(), FluxMgr::CELTransform(), ExposureAlg::execute(), FluxMgr::getOrientation(), FluxSource::getSurfacePosDir(), HeSpectrum::init(), GalElSpectrum::init(), CHIMESpectrum::init(), AlbedoPSpectrum::init(), FluxMgr::location(), FluxSource::occluded(), FluxMgr::orientTransform(), FluxMgr::pass(), sampleintvl(), FluxMgr::setExpansion(), FluxMgr::setGlastPosition(), FluxMgr::setOrientation(), FluxMgr::setRockType(), FluxMgr::synch(), FluxMgr::test(), and FluxMgr::time().
00181 { return (s_instance != 0) ? s_instance : (s_instance = new GPS()); }
|
|
|
Definition at line 183 of file GPS.cxx. References s_instance.
00184 {
00185 delete s_instance;
00186 s_instance = 0;
00187 }
|
|
|
Definition at line 165 of file GPS.cxx. References m_orbit, and Orbit::setLatitude().
00166 {
00167 m_orbit->setLatitude(l);
00168 }
|
|
|
present latitude.
Definition at line 97 of file GPS.cxx. References Orbit::latitude(), orbit(), and orbittime(). Referenced by FluxMgr::location(), printOn(), and state().
|
|
|
Definition at line 170 of file GPS.cxx. References m_orbit, and Orbit::setLongitude().
00171 {
00172 m_orbit->setLongitude(l);
00173 }
|
|
|
present longitude.
Definition at line 102 of file GPS.cxx. References Orbit::longitude(), orbit(), and orbittime(). Referenced by ascendingLon(), FluxMgr::location(), printOn(), and state().
|
|
|
Definition at line 129 of file GPS.h. References GPS::CELTransform(), GPS::transformCelToGlast(), and m_notification. Referenced by HeSpectrum::init(), GalElSpectrum::init(), CHIMESpectrum::init(), and AlbedoPSpectrum::init().
00129 { return m_notification; }
|
|
|
Definition at line 128 of file GPS.h. References m_notification. Referenced by synch().
00128 { m_notification.notify();}
|
|
|
Definition at line 62 of file GPS.cxx. References m_orbit.
00063 {
00064 return m_orbit;
00065 }
|
|
|
set a specific Orbit object for lat/lon calculations.
Definition at line 123 of file GPS.cxx. References m_orbit.
|
|
|
access to the orbit (for computation only).
Definition at line 57 of file GPS.cxx. References m_orbit. Referenced by lat(), lon(), phase(), pitch(), roll(), state(), synch(), and yaw().
00058 {
00059 return m_orbit;
00060 }
|
|
|
Definition at line 194 of file GPS.cxx. References m_orbittime.
00195 {
00196 m_orbittime = t;
00197 }
|
|
|
Definition at line 199 of file GPS.cxx. References m_orbittime. Referenced by lat(), lon(), phase(), pitch(), roll(), synch(), and yaw().
00200 {
00201 return m_orbittime;
00202 }
|
|
|
pass a specific amount of time.
Definition at line 131 of file GPS.cxx. References time(). Referenced by FluxMgr::pass().
|
|
|
set the current phase of the orbit.
Definition at line 138 of file GPS.cxx. References orbit(), Orbit::period(), Orbit::startphase(), and time().
00139 {
00140 // jump to a particular point in the orbit
00141 double pd = orbit()->period();
00142 if (pd != 0.) orbit()->startphase(p - 2.*M_PI*time()/pd);
00143 }
|
|
|
get the current phase of the orbit.
Definition at line 112 of file GPS.cxx. References orbit(), orbittime(), and Orbit::phase(). Referenced by state().
|
|
|
Definition at line 150 of file GPS.cxx. References m_orbit, and Orbit::setPitch().
|
|
|
present 'pitch' angle in N-S direction (roll around x-axis).
Definition at line 42 of file GPS.cxx. References orbit(), orbittime(), and Orbit::pitch(). Referenced by state().
|
|
|
Definition at line 159 of file GPS.h. References m_earthOrbit, and time(). Referenced by ExposureAlg::execute().
00159 {
00160 double time = m_earthOrbit->dateFromSeconds(seconds);
00161 return m_earthOrbit->position(time);
00162 /*return m_position;*/} //interface to EarthOrbit::position()
|
|
|
print time & position.
Definition at line 231 of file GPS.cxx. References lat(), lon(), and time().
|
|
|
Definition at line 152 of file GPS.h. References m_RAX. Referenced by ExposureAlg::execute().
00152 {return m_RAX;}
|
|
|
Definition at line 153 of file GPS.h. References m_RAZ. Referenced by ExposureAlg::execute().
00153 {return m_RAZ;}
|
|
|
Definition at line 156 of file GPS.h. References m_RAZenith. Referenced by ExposureAlg::execute().
00156 {return m_RAZenith;}
|
|
|
return the rotation for compensation for the rocking angles.
Definition at line 252 of file GPS.cxx. References m_DECZenith, m_earthOrbit, m_position, m_RAZenith, m_rockDegrees, m_rockType, NONE, ONEPERORBIT, SLEWING, time(), and UPDOWN. Referenced by FluxMgr::orientTransform(), and transformGlastToGalactic().
00252 {
00253 //Purpose: return the rotation to correct for satellite rocking.
00254 //Input: Current time
00255 //Output: 3x3 rocking-angle transformation matrix.
00256 using namespace astro;
00257
00258 double time = m_earthOrbit->dateFromSeconds(seconds);
00259
00260 double inclination = m_earthOrbit->inclination();
00261 double orbitPhase = m_earthOrbit->phase(time);
00262 m_position = m_earthOrbit->position(time);
00263
00264 SkyDir dirZ(m_position.unit());
00265 SkyDir dirX(dirZ.ra()-90., 0.0);
00266
00267 //rotate the x direction so that the x direction points along the orbital direction.
00268 dirX().rotate(dirZ.dir() , inclination*cos(orbitPhase));
00269
00270 //now set the zenith direction to do the rocking properly.
00271 m_RAZenith = dirZ.ra();
00272 m_DECZenith = dirZ.dec();
00273
00274 double rockNorth = m_rockDegrees*M_PI/180;
00275
00276 //here's where we decide how much to rock about the x axis. this depends on the
00277 //rocking mode.
00278 if(m_rockType == NONE){
00279 rockNorth = 0.;
00280 }else if(m_rockType == UPDOWN){
00281 if(m_DECZenith <= 0) rockNorth *= -1.;
00282 }else if(m_rockType == SLEWING){
00283 //slewing is experimental
00284 if(m_DECZenith <= 0) rockNorth *= -1.;
00285 if(m_DECZenith >= -5.5 && m_DECZenith <= 5.5){
00286 rockNorth -= rockNorth*((5.5-fabs(m_DECZenith))/5.5);
00287 }
00288 }else if(m_rockType == ONEPERORBIT){
00289 //this needs an implementation - it only rocks one way now!
00290 }
00291 // now, we want to find the proper transformation for the rocking angles:
00292 HepRotation rockRot;
00293 rockRot./*rotateZ(inclination*cos(orbitPhase)).*/rotateX(rockNorth);
00294
00295 return rockRot;
00296 }
|
|
|
Definition at line 145 of file GPS.h. References m_rockDegrees.
00145 {m_rockDegrees = rockDegrees;}
|
|
|
Definition at line 160 of file GPS.cxx. References m_orbit, and Orbit::setRoll().
|
|
|
present 'roll' andle in E-W direction (roll around y-axis).
Definition at line 52 of file GPS.cxx. References orbit(), orbittime(), and Orbit::roll(). Referenced by state().
|
|
|
set m_rotangles.
Definition at line 247 of file GPS.cxx. References m_rotangles.
00247 {
00248 m_rotangles=coords;
00249 }
|
|
|
access m_rotangles.
Definition at line 241 of file GPS.cxx. References m_rotangles. Referenced by FluxMgr::getOrientation(), FluxMgr::setOrientation(), and FluxMgr::test().
00241 {
00242 return m_rotangles;
00243
00244 }
|
|
|
set the sample interval.
Definition at line 204 of file GPS.cxx. References m_sampleintvl.
00205 {
00206 m_sampleintvl = s;
00207 }
|
|
|
sample interval for random orbit distribution.
Definition at line 209 of file GPS.cxx. References m_sampleintvl. Referenced by sampleintvl().
00210 {
00211 return m_sampleintvl;
00212 }
|
|
|
Definition at line 415 of file GPS.cxx. References m_rockType, NONE, ONEPERORBIT, SLEWING, and UPDOWN.
00415 {
00416 m_rockType = NONE;
00417 if(rockType == 1) m_rockType = UPDOWN;
00418 if(rockType == 2) m_rockType = SLEWING;
00419 if(rockType == 3) m_rockType = ONEPERORBIT;
00420 } |
|
|
Definition at line 149 of file GPS.h. References m_rockType, and RockType. Referenced by FluxMgr::setRockType().
00149 {m_rockType = rockType;}
|
|
|
Definition at line 214 of file GPS.cxx. References GPS::Coords::lat(), GPS::Coords::lon(), m_orbit, GPS::Coords::pitch(), GPS::Coords::roll(), Orbit::setLatitude(), Orbit::setLongitude(), Orbit::setPitch(), Orbit::setRoll(), Orbit::setYaw(), time(), GPS::Coords::time(), and GPS::Coords::yaw().
|
|
|
current state of the GPS system.
Definition at line 189 of file GPS.cxx. References lat(), lon(), orbit(), phase(), pitch(), roll(), time(), and yaw().
|
|
|
synchronize w. scheduler.
Definition at line 67 of file GPS.cxx. References Orbit::ascendingLon(), expansion(), m_sampleintvl, notifyObservers(), orbit(), orbittime(), and time(). Referenced by FluxMgr::synch().
00068 {
00069 static bool first=true;
00070 bool changed= false;
00071
00072 if (Scheduler::instance()->running()) {
00073 time( Scheduler::instance()->elapsed_time() );
00074 changed = true; // maybe have threshold before nofitying?
00075 }
00076 if (expansion() < 0.) {
00077 static GPStime last_time = time();
00078 if ((time() - last_time) > m_sampleintvl) {
00079 orbittime( RandFlat::shoot(orbit()->period()) );
00080 orbit()->ascendingLon(RandFlat::shoot(360.));
00081 last_time = time();
00082 changed = true;
00083
00084 }
00085 }
00086 else if( expansion()>0 ) {
00087 orbittime( time()*expansion() );
00088 changed=true;
00089 }
00090
00091 // notify observers if changed (or first time thru)
00092 if( changed || first) notifyObservers();
00093 first=false;
00094
00095 }
|
|
|
Definition at line 175 of file GPS.cxx. References m_time.
00176 {
00177 m_time = t;
00178 }
|
|
|
GPS synchronized time for the satellite.
Definition at line 107 of file GPS.cxx. Referenced by getPointingCharacteristics(), pass(), phase(), position(), printOn(), rockingAngleTransform(), setState(), state(), synch(), and FluxMgr::time().
00108 {
00109 return m_time;
00110 }
|
|
|
this transforms glast-local (cartesian) vectors into galactic (cartesian) vectors.
Definition at line 351 of file GPS.cxx. References rockingAngleTransform().
00351 {
00352 return (CELTransform(seconds).inverse())*(rockingAngleTransform(seconds).inverse());
00353 }
|
|
|
Definition at line 155 of file GPS.cxx. References m_orbit, and Orbit::setYaw().
|
|
|
present 'yaw' angle - (rotate around z-axis).
Definition at line 47 of file GPS.cxx. References orbit(), orbittime(), and Orbit::yaw(). Referenced by state().
|
|
|
|
|
|
Definition at line 193 of file GPS.h. Referenced by DECX(), and getPointingCharacteristics(). |
|
|
Definition at line 193 of file GPS.h. Referenced by DECZ(), and getPointingCharacteristics(). |
|
|
Definition at line 194 of file GPS.h. Referenced by DECZenith(), getPointingCharacteristics(), and rockingAngleTransform(). |
|
|
Definition at line 186 of file GPS.h. Referenced by getPointingCharacteristics(), position(), and rockingAngleTransform(). |
|
|
Definition at line 189 of file GPS.h. Referenced by expansion(). |
|
|
Definition at line 197 of file GPS.h. Referenced by notification(), and notifyObservers(). |
|
|
Definition at line 188 of file GPS.h. Referenced by ascendingLon(), lat(), lon(), orbit(), pitch(), roll(), setState(), yaw(), and ~GPS(). |
|
|
Definition at line 191 of file GPS.h. Referenced by orbittime(). |
|
|
Definition at line 195 of file GPS.h. Referenced by getPointingCharacteristics(), and rockingAngleTransform(). |
|
|
Definition at line 193 of file GPS.h. Referenced by getPointingCharacteristics(), and RAX(). |
|
|
Definition at line 193 of file GPS.h. Referenced by getPointingCharacteristics(), and RAZ(). |
|
|
Definition at line 194 of file GPS.h. Referenced by getPointingCharacteristics(), RAZenith(), and rockingAngleTransform(). |
|
|
Definition at line 198 of file GPS.h. Referenced by getPointingCharacteristics(), rockingAngleTransform(), and rockingDegrees(). |
|
|
Definition at line 199 of file GPS.h. Referenced by getPointingCharacteristics(), rockingAngleTransform(), and setRockType(). |
|
|
Definition at line 179 of file GPS.h. Referenced by rotateAngles(). |
|
|
Definition at line 192 of file GPS.h. Referenced by sampleintvl(), and synch(). |
|
|
Definition at line 190 of file GPS.h. Referenced by time(). |
|
|
|
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001