Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into issue_347_Galileo_Antex_Offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
renfrob committed Jun 20, 2018
2 parents 26c1aa2 + 39007e5 commit 9d4e9c3
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 21 deletions.
28 changes: 17 additions & 11 deletions ext/lib/GNSSEph/OrbAlmStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,28 @@ namespace gpstk
const unsigned short OrbAlmStore::ADD_SUBJ = 0x02;

//--------------------------------------------------------------------------

Xvt OrbAlmStore::getXvt(const SatID& subjID, const CommonTime& t) const
throw( InvalidRequest )
{
try
{
// test for GPS satellite system in sat?
const OrbAlm* alm = find(subjID,t);
const OrbAlm* alm = find(subjID,t,false);
Xvt sv = alm->svXvt(t);
return sv;
}
catch(InvalidRequest& ir)
{
GPSTK_RETHROW(ir);
}
}

// If the orbital elements are unhealthy, refuse to
// calculate an SV position and throw.
if (!alm->healthy)
{
InvalidRequest exc( std::string("SV is transmitting unhealhty navigation ")
+ std::string("message at time of interest.") );
GPSTK_THROW( exc );
}
//--------------------------------------------------------------------------
Xvt OrbAlmStore::getXvt_WithinValidity(const SatID& subjID, const CommonTime& t) const
throw( InvalidRequest )
{
try
{
const OrbAlm* alm = find(subjID,t);
Xvt sv = alm->svXvt(t);
return sv;
}
Expand All @@ -86,6 +91,7 @@ namespace gpstk
}
}


//------------------------------------------------------------------------------
// This method is basically unimplemented at this level. It may
// be overriden by a descendent that needs to limit access to a
Expand Down
20 changes: 10 additions & 10 deletions ext/lib/GNSSEph/OrbAlmStore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,19 @@ namespace gpstk
/// @return the Xvt of the SV at time
/// @throw InvalidRequest If the request can not be completed for any
/// reason, this is thrown. The text may have additional
/// information as to why the request failed. Possible reasons
/// include
/// 1. No orbital elements stored for the SV
/// 2. No orbital elements with time of validity covering time t
/// 3. Orbital elements appropriate for time t are unhealhty
/// The purpose of getXvt is to be as SAFE as possible.
/// If you MUST obtain SV PVT in the failure conditions noted above,
/// please consider calling findOrbAlm( )
/// directly to obtain elements, then use OrbAlm.svXvt( )
/// to obtain positions.
/// information as to why the request failed. The most common reason
/// is that no orbital elements are stored for the SV.
virtual Xvt getXvt( const SatID& subjID, const CommonTime& t ) const
throw( InvalidRequest );


/// As getXvt( ) with the additional check that the elements used
/// must have a fit interval that covers the requested time. If not,
/// InvalidRequest is thrown.
virtual Xvt getXvt_WithinValidity( const SatID& subjID, const CommonTime& t ) const
throw( InvalidRequest );


/// A debugging function that outputs in human readable form,
/// all data stored in this object.
/// @param[in] s the stream to receive the output; defaults to cout
Expand Down
111 changes: 111 additions & 0 deletions ext/tests/GNSSEph/OrbAlmStore_T.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,115 @@ createAndDump()
// Dump terse in time order
oas.dump(out,3);

//--- Test getXVT( ) and validity
// Verify that getXvt( ) will return values for times beyond the fit interval
// of the alamanc data.
//
// Verify that getXvtWithinValid( ) will throw an exeption in this condition.
// Expect Expect Test
// getXvt getXvt_WithinValid() Time Comment
// 1. True False 12/31/15 00:00:00 Earlier than fit interval
// 2. True True 12/31/15 12:00:00 Within fit interval
// 3. True False 01/31/16 00:00:00 Later than fit interval currMethod = typeDesc + " getXvt()";
currMethod = typeDesc + " OrbAlmStore.getXvt()";
TUCSM(currMethod);

SatID sidXvt(1,SatID::systemGPS);
CommonTime test1 = CivilTime(2015,12,31,00,00,00,TimeSystem::GPS);
CommonTime test2 = CivilTime(2015,12,31,12,00,00,TimeSystem::GPS);
CommonTime test3 = CivilTime(2016, 1,31,00,00,00,TimeSystem::GPS);
vector<CommonTime> ctVector;
ctVector.push_back(test1);
ctVector.push_back(test2);
ctVector.push_back(test3);

// First, verify getXvt( ) succeeds with out-of-fit-interval times
Xvt saveXvt;
for (int i=0;i<3;i++)
{
try
{
Xvt xvt1 = oas.getXvt(sidXvt, ctVector[i]);
stringstream ss;
ss << "getXvt() succeeded for time ";
switch(i)
{
case 0: ss << " earlier than fit interval."; break;
case 1: ss << " within fit interval."; saveXvt = xvt1; break;
case 2: ss << " later than fit interval."; break;
}
TUPASS(ss.str());
}
catch(InvalidRequest ir)
{
stringstream ss;
ss << "getXvt() failed for time ";
switch(i)
{
case 0: ss << " earlier than fit interval."; break;
case 1: ss <<" within fit interval."; break;
case 2: ss <<" later than fit interval."; break;
}
ss << endl << ir;
TUFAIL(ss.str());
}
}
// Next verify getXvt_WithinValid( ) fails in 2-of-3 cases.
for (int i=0;i<3;i++)
{
try
{
Xvt xvt1 = oas.getXvt_WithinValidity(sidXvt, ctVector[i]);
stringstream ss;
switch(i)
{
case 0:
ss << "getXvt_WithinValidity() succeeded (correctly) for time earlier than fit interval.";
TUFAIL(ss.str());
break;
case 1:
ss << "getXvt_WithinValidity() succeeded for time within fit interval.";
TUPASS(ss.str());
if (saveXvt.x[0] != xvt1.x[0] ||
saveXvt.x[1] != xvt1.x[1] ||
saveXvt.x[2] != xvt1.x[2] ||
saveXvt.v[0] != xvt1.v[0] ||
saveXvt.v[1] != xvt1.v[1] ||
saveXvt.v[2] != xvt1.v[2] ||
saveXvt.clkbias != xvt1.clkbias ||
saveXvt.clkdrift != xvt1.clkdrift)
{
TUFAIL("getXvt() and getXvt_WithinValidity() did not return matching results.");
}
break;
case 2:
ss << "getXvt_WithinValidity() succeeded (correctly) for time later than fit interval.";
TUFAIL(ss.str());
break;
}
}
catch(InvalidRequest ir)
{
stringstream ss;
ss << "getXvt() failed for time ";
switch(i)
{
case 0:
ss << "getXvt_WithinValid() failed (correctly) for time earlier than fit interval.";
TUPASS(ss.str());
break;
case 1:
ss << "getXvt_WithinValid() failed for time within fit interval.";
TUFAIL(ss.str());
break;
case 2:
ss << "getXvt_WithinValid() failed (correctly) for time later than fit interval.";
TUPASS(ss.str());
break;
}
}
}

/* This checks for a situation where the OrbAlmStore top-level
* map has satellites mapped to empty maps. Prior to addressing
* this issue, it would seg fault due to trying to dereference
Expand Down Expand Up @@ -1075,6 +1184,8 @@ setUpGLO()
}
}


//---------------------------------------------------------------------------------
int main()
{
unsigned errorTotal = 0;
Expand Down

0 comments on commit 9d4e9c3

Please sign in to comment.