Skip to content

Commit

Permalink
With additional preliminary code for tetsing spice error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Nov 25, 2024
1 parent 68263c4 commit b823443
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
32 changes: 18 additions & 14 deletions include/tudat/astro/ground_stations/transmittingFrequencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "tudat/math/quadrature/trapezoidQuadrature.h"
#include "tudat/math/interpolators.h"
#include "tudat/astro/basic_astro/dateTime.h"

namespace tudat
{
Expand Down Expand Up @@ -200,20 +201,23 @@ class PiecewiseLinearFrequencyInterpolator: public StationFrequencyInterpolator
// If there are discontinuities
if ( startTimes_.at( i ) != endTimes_.at( i - 1 ) )
{
// If the start and end times are inconsistent throw error
if ( endTimes_.at( i - 1 ) > startTimes_.at( i ) )
{
throw std::runtime_error(
"Error when creating piecewise linear frequency interpolator: inconsistency between ramp end "
"time (" + std::to_string( double( endTimes_.at( i - 1 ) ) ) + ") and start time of the following ramp (" +
std::to_string( double( startTimes_.at( i ) ) ) + "); the end is smaller than the start time." );
}
// If there are gaps in the data save that information
else
{
invalidTimeBlocksStartTimes_.push_back( endTimes_.at( i - 1 ) );
invalidTimeBlocksEndTimes_.push_back( startTimes_.at( i ) );
}
// // If the start and end times are inconsistent throw error
// if ( endTimes_.at( i - 1 ) > startTimes_.at( i ) )
// {
// throw std::runtime_error(
// "Error when creating piecewise linear frequency interpolator: inconsistency between ramp end "
// "time (" + std::to_string( double( endTimes_.at( i - 1 ) ) ) + ";" +
// basic_astrodynamics::getCalendarDateFromTime( endTimes_.at( i - 1 ) ).isoString( ) + ") and start time of the following ramp (" +
// std::to_string( double( startTimes_.at( i ) ) ) + ";" +
// basic_astrodynamics::getCalendarDateFromTime( startTimes_.at( i ) ).isoString( ) +
// "); the end is smaller than the start time." );
// }
// // If there are gaps in the data save that information
// else
// {
// invalidTimeBlocksStartTimes_.push_back( endTimes_.at( i - 1 ) );
// invalidTimeBlocksEndTimes_.push_back( startTimes_.at( i ) );
// }
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/interface/spice/spiceInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Eigen::Vector6d getBodyCartesianStateAtEpoch(
}
else
{
cartesianStateVector.setZero( );
cartesianStateVector.setConstant( 1.0E12 );
}


Expand Down Expand Up @@ -137,7 +137,7 @@ Eigen::Vector3d getBodyCartesianPositionAtEpoch(const std::string &targetBodyNam
}
else
{
cartesianPositionVector.setZero( );
cartesianPositionVector.setConstant( 1.0E12 );
}

// Convert from km to m.
Expand Down Expand Up @@ -185,7 +185,7 @@ Eigen::Vector6d getCartesianStateFromTleAtEpoch(double epoch, std::shared_ptr<ep
}
else
{
cartesianStateVector.setZero( );
cartesianStateVector.setConstant( 1.0E12 );
}

// Convert from km to m.
Expand Down

0 comments on commit b823443

Please sign in to comment.