\r
\r
Amount<RocketScience.Impulse> ns = Amount.valueOf(0, RocketScience.NEWTON_SECOND);\r
- Amount<Force> averageThrust = Amount.valueOf(0, SI.NEWTON);\r
+ \r
+ Amount<Duration> thrustTime = Amount.valueOf(0, SI.SECOND);\r
Amount<Force> maxThrust = Amount.valueOf(0, SI.NEWTON);\r
Amount<Pressure> maxPressure = Amount.valueOf(0, SI.MEGA(SI.PASCAL));\r
- int thrustCount = 0;\r
- \r
+\r
for( Interval i: burn.getData().values() ){\r
ns = ns.plus(i.dt.times(i.thrust));\r
if ( i.thrust.isGreaterThan(Amount.valueOf(0.01, SI.NEWTON))){\r
- thrustCount++;\r
- averageThrust = averageThrust.plus(i.thrust);\r
+ thrustTime = thrustTime.plus(i.dt);\r
}\r
if ( i.thrust.isGreaterThan(maxThrust))\r
maxThrust = i.thrust;\r
if ( i.chamberPressure.isGreaterThan(maxPressure))\r
maxPressure = i.chamberPressure;\r
}\r
- if ( thrustCount > 0)\r
- averageThrust = averageThrust.divide(thrustCount);\r
+ \r
+ Amount<Force> averageThrust = Amount.valueOf(0, SI.NEWTON);\r
+ if ( thrustTime.isGreaterThan(Amount.valueOf(0, SI.SECOND)))\r
+ averageThrust = ns.divide(thrustTime).to(SI.NEWTON);\r
\r
int cn = (int)(Math.log(ns.doubleValue(RocketScience.NEWTON_SECOND)/1.25) / Math.log(2));\r
char cl = (char)((int)'A' + cn);\r