#### boatgeek

##### Well-Known Member

- Joined
- Dec 27, 2014

- Messages
- 4,955

- Reaction score
- 4,089

It's actually a very good idea and one of the methods that was evaluated. The issue arrises with the "after boost" part. You don't know when "after boost" is yet so it started by scaling a generic thrust curve and then fitting a least squares model for burn time, avg thrust/mass, and a (Cd*A)/m term. It actually worked surprisingly well for max speed but it could get tricked and trade burn time vs thrust, e.g. it would occasionally fit to a high thrust, short burn curve that gave a very similar coast to apogee.

The way it's currently implemented is much simpler and so far more reliable. The assumption is the acceleration is constant over a short interval. Integrating twice says you expect a 2nd order polynomial for altitude. You fit a least squares polynomial to the altitude data over that time interval and then going backwards, the first derivative of that function at the midpoint is the velocity and the 2nd derivative is the acceleration. You then slide over one time step and repeat for all of the data. If you only care about the velocity, it still works quite well with just a linear regression through the altitude data in the interval. For the Mini though, the accel term is also used to estimate the burn time and the 2nd order fit is still fairly easy to implement in code.

And this is why it's a good thing that these things are being implemented by people smarter than me. Seriously, looks like a great product.