-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NaN ephemeris time passed to SPICE spkezr_c #77
Comments
The issue here is that the time-step control goes haywire, and ends up suggesting a NaN time step. I think it's a good idea to add a check, but let's put it at the level of the integrator (and possibly in the spice function as well), that way it will be caught at the 'source' |
I would then suggest the following changes:
About the latter: if we then use the minimum step size that is user-defined, this step size could be too high for the problem dynamics. I think that the warning that is printed should then describe this, informing that the propagation results could be slightly off due to this. We could also just use the minimum step size divided by an arbitrary factor, to try to alleviate this problem. I am currently investigating the implementation for all of this. |
Agreed on the first point. For the second, the issue is not that the time step goes below the permitted time step, but that the state becomes NaN/Inf at some point, which is then used in the time step control algorithm. I propose to catch this at the level of the DynamicsStateDerivativeModel class, checking at the beginning if the input is Inf/NaN. |
Since I would propose to completely refactor the time step control anyway, I don't think it's necessary to put a lot of time into this part of the code now. |
Fix pushed to develop :) |
Thanks for the fix :) I am running a different fix on my machine that sets the integration step as the minimum one in |
With the exception that you have implemented to throw in the SPICE interface and DynamicsStateDerivativeModel, I get the following (instead of the error message):
I think there is an issue in how |
Turns out that throwing a I changed these in DynamicsStateDerivativeModel, RungeKuttaVariableStepSizeIntegrator, and spiceInterface with 1a1ea80. With this commit, I have also included a few more cases in which the error should be thrown in spiceInterface (negative or inf ephemeris times). |
That's quite odd.. Could you elaborate a bit on what you mean here? What was the output you got in this case before this update?
That's good. What output from this is now communicated to the user (if any)? |
What I mean is that, if a
Now that I changed this so that we throw a
With the latest implementation, if the cartesian state of a body at
|
Hi Jeremie, I am making some small modifications: the isinf function is not platform-independent, so I'm removing this check from the spice functions for now. |
Perfect, I didn't know that this was platform-dependent |
Also, the input time can be <0 (this means the time is before J2000). I'm removing this check as well. |
Oh, I thought it couldn't, because I thought the ephemeris input to spice was different to the tudat epochs. I got confused by this issue, since the error message states that a negative time is invalid. I assume that these times are then different. My apologies if this caused any errors to someone. |
When I run a Mars ascent propagation with a RKF7(8) integrator with an increasingly small time step, and that my propagation needs for some reason to call the
spkezr_c
method from SPICE, I get the following error:After some testing, I changed the
getBodyCartesianStateAtEpoch()
function fromspiceInterface.cpp
to print theephemerisTime
input, and it appears that, after some time into the propagagtion, the ephemeris time that is input to this function is-nan
.Now I still have no idea why tudat decides to change my ephemeris time (from 9.82325e+08) to
-nan
after some time. I expect that this error is caused by something that breaks in my simulation at small time steps.Nevetherless, I suggest to add a check to the
getBodyCartesianStateAtEpoch()
function to trigger an error if theephemerisTime
is negative or nan. We could also print a warning and return a zero vector as the body cartesian position, but that could lead to more issues down the line.The text was updated successfully, but these errors were encountered: