I have a buggy behavior using ProfileThrustPropulsionModel and I cannot tell why.
I’ve made a small test to reproduce the problem: CompareContinuousManeuvers.java (7.5 KB)
I’m comparing two propagations with the same maneuver:
The first propagation uses a ConstantThrustManeuver
The second propagation uses a Maneuver with a constant ProfileThrustPropulsionModel
Both maneuvers last 300s and have the same properties
The thrust and isp are made so that the mass consumption is 1mg per time step of my RK4 integrator
After propagation, the first propagator (with constant thrust) has consumed a mass of fuel of dm_1 = 300 / step mg, which is what I would expect.
But the second propagator has consumed a mass of fuel of dm_2 = 300 / step - 0.16667 mg.
I don’t get where that discrepancy of 166.667 µg (=500/3 µg) comes from…
The misfiring duration is always of step/6 s
If I use a 60s step this represents a misfiring of 10s, which is a lot!
Everything seems to be happening at the end of the maneuver with the ProfileThrustPropulsionModel .
I’ve used a step handler in the uploaded file, and the mass consumptions are fine until the last step.
I came to the same conclusion this weekend.
It indeed fixes the issue for one single maneuver
Also, using a variable time step improves the result since the step before the end of the maneuver is much smaller. But the propagation gets very slow.
My problem is that I have a few thousand maneuvers with some maneuvering arcs comprised of several joined ProfileThrustPropulsionModel. So I don’t know if I should slightly shift the beginning of the arc or the end…
Its an open interval, so the end time is not included in your specification.
My guess is that the segments are being interpolated and you are trying to represent a discontinuous profile with a smooth interpolation, where it seems the interpolation points are set by the integrator rather than you (I confess I have not looked at the code, just your symptom , so it is a guess).
Short of digging deeper into the code, perhaps if you want to control the region over which thrust level interpolates, you could try adding in new short “boundary” PolynomialThurstSegment between the segments of different constant level, which is short enough for you not to mind rescinding control over the region of interpolation?
Adding short segments to control the interpolation didn’t work quite well and slows down the propagation, it can even freeze it (infinite loop in Hipparchus DetectorBasedEventState) if the segment is small enough
If I try with one single ProfileThrustPropulsionModel to model thrusting and coasting (i.e. without thrust) arcs, I have interpolation errors.
The only workaround I found to have a proper computation of my thrusting and coasting arcs is to design one Maneuver with one ProfileThrustPropulsionModel per thrusting arc with the trick of adding a small overshoot (say 1ns) to the last segment of my thrusting arc.