interim commit. This moves the mass <0 from a separate loop into the previous loop.

This commit is contained in:
Daniel_M_Williams 2014-10-28 12:14:44 -06:00
commit 534a61ee7e

View File

@ -99,14 +99,12 @@ public abstract class AbstractMotorLoader implements MotorLoader {
scale = prop / totalMassChange; scale = prop / totalMassChange;
for (double dm : deltam) { for (double dm : deltam) {
total -= dm * scale; total -= dm * scale;
mass.add(total); // to correct negative mass error condition: (caused by rounding errors in the above loop)
} if (total < 0) {
total = 0;
// to correct negative mass error condition: (caused by rounding errors in the above loops)
for (int mass_index = 0; mass_index < mass.size(); mass_index++) {
if (mass.get(mass_index) < 0) {
mass.set(mass_index, 0.0d);
} }
mass.add(total);
} }
return mass; return mass;
} }