openrocket/openrocket — pull request #208 by teyrana (2014-10-28 17:04:32+00:00)
Title: [Fix] Fixed bug in RSE file loading ( XML-formatted engine description)

Hello, I'd introduced myself on the list a while ago, but I didn't get many replies, so I just went searching for bugs people complained about, and started working.

I apologize for all the whitespace changes. That's mostly eclipse have a mind of its own. I don't care myself, but let me know if you'd like me to fix it, and I'll dig further for a solution.

Please provide feedback, so I can learn and improve. Thanks!
-Dan

Anyway, the Commit Message itself follows:

---

This patch is based off a thread from "The Rocketry Forum"
( http://www.rocketryforum.com/showthread.php?70475-Problems-with-custom-motors-in-OpenRocket ) .

Complaint: Poster had a water-rocket engine file which would raise IOExceptions upon automatic load.
(1) the original .rse motor file, posted in the thread above, has an invalid motor length.
(2) The corrected .rse file follows at the end of this commit message.
Bug: The mass auto-scaling code would over-estimate the mass loss, and declare a negative mass upon motor exhaustion.
The negative mass is small (in this case, ~= -1E-16). However, this error is larger than the single-precision epsilon.
Fix: Added a loop which checked for negative mass during the thrust curve, and reset those values back to zero. (AbstractMotorLoader.java:105)
Also, expanded the number and detail level of some related exception reporting. (ThrustCurveMotor:137)

----

Water Rocket, 90 psi, 800g