From b823443971cd79b27184f8f0cf16c159ab60ab62 Mon Sep 17 00:00:00 2001 From: Dominic Dirkx Date: Mon, 25 Nov 2024 09:59:40 +0100 Subject: [PATCH] With additional preliminary code for tetsing spice error handling --- .../ground_stations/transmittingFrequencies.h | 32 +++++++++++-------- src/interface/spice/spiceInterface.cpp | 6 ++-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/include/tudat/astro/ground_stations/transmittingFrequencies.h b/include/tudat/astro/ground_stations/transmittingFrequencies.h index cb7119e18..a200485bb 100644 --- a/include/tudat/astro/ground_stations/transmittingFrequencies.h +++ b/include/tudat/astro/ground_stations/transmittingFrequencies.h @@ -16,6 +16,7 @@ #include "tudat/math/quadrature/trapezoidQuadrature.h" #include "tudat/math/interpolators.h" +#include "tudat/astro/basic_astro/dateTime.h" namespace tudat { @@ -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 ) ); +// } } } diff --git a/src/interface/spice/spiceInterface.cpp b/src/interface/spice/spiceInterface.cpp index e1d4827be..ce6f8fb92 100644 --- a/src/interface/spice/spiceInterface.cpp +++ b/src/interface/spice/spiceInterface.cpp @@ -95,7 +95,7 @@ Eigen::Vector6d getBodyCartesianStateAtEpoch( } else { - cartesianStateVector.setZero( ); + cartesianStateVector.setConstant( 1.0E12 ); } @@ -137,7 +137,7 @@ Eigen::Vector3d getBodyCartesianPositionAtEpoch(const std::string &targetBodyNam } else { - cartesianPositionVector.setZero( ); + cartesianPositionVector.setConstant( 1.0E12 ); } // Convert from km to m. @@ -185,7 +185,7 @@ Eigen::Vector6d getCartesianStateFromTleAtEpoch(double epoch, std::shared_ptr