interim commit. This moves the mass <0 from a separate loop into the previous loop.
This commit is contained in:
commit
534a61ee7e
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user