cleaned up extra debug statements
This commit is contained in:
parent
4e8838aa4c
commit
9d78d823b6
@ -66,7 +66,7 @@ public class MassCalculator implements Monitorable {
|
||||
// private Vector< MassData> motorData = new Vector<MassData>();
|
||||
|
||||
// unless in active development, this should be set to false.
|
||||
public boolean debug = false;
|
||||
//public boolean debug = false;
|
||||
|
||||
////////////////// Constructors ///////////////////
|
||||
public MassCalculator() {
|
||||
@ -100,9 +100,9 @@ public class MassCalculator implements Monitorable {
|
||||
throw new BugException("method: calculateStageCache(...) is faulty-- returned null data for an active stage: "+stage.getName()+"("+stage.getStageNumber()+")");
|
||||
}
|
||||
dryCM = stageData.cm.average(dryCM);
|
||||
if( debug){
|
||||
System.err.println(" stageData <<@"+stageNumber+"mass: "+dryCM.weight+" @"+dryCM.toString());
|
||||
}
|
||||
// if( debug){
|
||||
// System.err.println(" stageData <<@"+stageNumber+"mass: "+dryCM.weight+" @"+dryCM.toString());
|
||||
// }
|
||||
}
|
||||
|
||||
Coordinate totalCM=null;
|
||||
@ -114,11 +114,11 @@ public class MassCalculator implements Monitorable {
|
||||
totalCM = dryCM.average(motorCM);
|
||||
}
|
||||
|
||||
if(debug){
|
||||
Coordinate cm = totalCM;
|
||||
System.err.println(String.format("==>> Combined Mass: %5.3gg @( %g, %g, %g)",
|
||||
cm.weight, cm.x, cm.y, cm.z ));
|
||||
}
|
||||
// if(debug){
|
||||
// Coordinate cm = totalCM;
|
||||
// System.err.println(String.format("==>> Combined Mass: %5.3gg @( %g, %g, %g)",
|
||||
// cm.weight, cm.x, cm.y, cm.z ));
|
||||
// }
|
||||
|
||||
return totalCM;
|
||||
}
|
||||
@ -140,13 +140,13 @@ public class MassCalculator implements Monitorable {
|
||||
MassData motorData = MassData.ZERO_DATA;
|
||||
|
||||
// vvvv DEVEL vvvv
|
||||
if( debug){
|
||||
System.err.println("====== ====== getMotorCM: (type: "+type.name()+") ====== ====== ====== ====== ====== ======");
|
||||
System.err.println(" [Number] [Name] [mass]");
|
||||
}
|
||||
// if( debug){
|
||||
// System.err.println("====== ====== getMotorCM: (type: "+type.name()+") ====== ====== ====== ====== ====== ======");
|
||||
// System.err.println(" [Number] [Name] [mass]");
|
||||
// }
|
||||
// ^^^^ DEVEL ^^^^
|
||||
|
||||
int motorCount = 0;
|
||||
// int motorCount = 0;
|
||||
for (MotorInstance inst : config.getActiveMotors() ) {
|
||||
//ThrustCurveMotor motor = (ThrustCurveMotor) inst.getMotor();
|
||||
|
||||
@ -159,13 +159,13 @@ public class MassCalculator implements Monitorable {
|
||||
motorData = motorData.add( instData );
|
||||
|
||||
// BEGIN DEVEL
|
||||
if( debug){
|
||||
System.err.println(String.format(" motor %2d: %s %s", //%5.3gg @( %g, %g, %g)",
|
||||
motorCount, inst.getMotor().getDesignation(), instData.toDebug()));
|
||||
System.err.println(String.format(" >> %s",
|
||||
motorData.toDebug()));
|
||||
}
|
||||
motorCount++;
|
||||
// if( debug){
|
||||
// System.err.println(String.format(" motor %2d: %s %s", //%5.3gg @( %g, %g, %g)",
|
||||
// motorCount, inst.getMotor().getDesignation(), instData.toDebug()));
|
||||
// System.err.println(String.format(" >> %s",
|
||||
// motorData.toDebug()));
|
||||
// }
|
||||
// motorCount++;
|
||||
// END DEVEL
|
||||
}
|
||||
|
||||
@ -201,10 +201,10 @@ public class MassCalculator implements Monitorable {
|
||||
|
||||
|
||||
MassData totalData = structureData.add( motorData);
|
||||
if(debug){
|
||||
System.err.println(String.format("==>> Combined MassData: %s", totalData.toDebug()));
|
||||
|
||||
}
|
||||
// if(debug){
|
||||
// System.err.println(String.format("==>> Combined MassData: %s", totalData.toDebug()));
|
||||
//
|
||||
// }
|
||||
|
||||
return totalData.getLongitudinalInertia();
|
||||
}
|
||||
@ -237,10 +237,10 @@ public class MassCalculator implements Monitorable {
|
||||
}
|
||||
|
||||
MassData totalData = structureData.add( motorData);
|
||||
if(debug){
|
||||
System.err.println(String.format("==>> Combined MassData: %s", totalData.toDebug()));
|
||||
|
||||
}
|
||||
// if(debug){
|
||||
// System.err.println(String.format("==>> Combined MassData: %s", totalData.toDebug()));
|
||||
//
|
||||
// }
|
||||
|
||||
return totalData.getRotationalInertia();
|
||||
}
|
||||
@ -301,9 +301,9 @@ public class MassCalculator implements Monitorable {
|
||||
|
||||
private void calculateStageCache(FlightConfiguration config) {
|
||||
int stageCount = config.getActiveStageCount();
|
||||
if(debug){
|
||||
System.err.println(">> Calculating CG cache for config: "+config.toShort()+" with "+stageCount+" stages");
|
||||
}
|
||||
// if(debug){
|
||||
// System.err.println(">> Calculating CG cache for config: "+config.toShort()+" with "+stageCount+" stages");
|
||||
// }
|
||||
if( 0 < stageCount ){
|
||||
for( AxialStage curStage : config.getActiveStages()){
|
||||
int index = curStage.getStageNumber();
|
||||
@ -325,20 +325,20 @@ public class MassCalculator implements Monitorable {
|
||||
* of the specified component, not global coordinates.
|
||||
*/
|
||||
private MassData calculateAssemblyMassData(RocketComponent component) {
|
||||
return calculateAssemblyMassData(component, "....");
|
||||
}
|
||||
|
||||
private MassData calculateAssemblyMassData(RocketComponent component, String indent) {
|
||||
// return calculateAssemblyMassData(component, "....");
|
||||
// }
|
||||
//
|
||||
// private MassData calculateAssemblyMassData(RocketComponent component, String indent) {
|
||||
|
||||
Coordinate parentCM = component.getComponentCG();
|
||||
double parentIx = component.getRotationalUnitInertia() * parentCM.weight;
|
||||
double parentIt = component.getLongitudinalUnitInertia() * parentCM.weight;
|
||||
MassData parentData = new MassData( parentCM, parentIx, parentIt);
|
||||
|
||||
if(( debug) &&( 0 < component.getChildCount()) && (MIN_MASS < parentCM.weight)){
|
||||
//System.err.println(String.format("%-32s: %s ",indent+">>["+ component.getName()+"]", parentData.toCMDebug() ));
|
||||
System.err.println(String.format("%-32s: %s ",indent+">>["+ component.getName()+"]", parentData.toDebug() ));
|
||||
}
|
||||
// if(( debug) &&( 0 < component.getChildCount()) && (MIN_MASS < parentCM.weight)){
|
||||
// //System.err.println(String.format("%-32s: %s ",indent+">>["+ component.getName()+"]", parentData.toCMDebug() ));
|
||||
// System.err.println(String.format("%-32s: %s ",indent+">>["+ component.getName()+"]", parentData.toDebug() ));
|
||||
// }
|
||||
|
||||
if (!component.getOverrideSubcomponents()) {
|
||||
if (component.isMassOverridden())
|
||||
@ -356,7 +356,7 @@ public class MassCalculator implements Monitorable {
|
||||
}
|
||||
|
||||
// child data, relative to parent's reference frame
|
||||
MassData childData = calculateAssemblyMassData(child, indent+"....");
|
||||
MassData childData = calculateAssemblyMassData(child);//, indent+"....");
|
||||
|
||||
childrenData = childrenData.add( childData );
|
||||
}
|
||||
@ -367,10 +367,10 @@ public class MassCalculator implements Monitorable {
|
||||
int instanceCount = component.getInstanceCount();
|
||||
boolean hasChildren = ( 0 < component.getChildCount());
|
||||
if (( 1 < instanceCount )&&( hasChildren )){
|
||||
if(( debug )){
|
||||
System.err.println(String.format("%s Found instanceable with %d children: %s (t= %s)",
|
||||
indent, component.getInstanceCount(), component.getName(), component.getClass().getSimpleName() ));
|
||||
}
|
||||
// if(( debug )){
|
||||
// System.err.println(String.format("%s Found instanceable with %d children: %s (t= %s)",
|
||||
// indent, component.getInstanceCount(), component.getName(), component.getClass().getSimpleName() ));
|
||||
// }
|
||||
|
||||
final double curIxx = childrenData.getIxx(); // MOI about x-axis
|
||||
final double curIyy = childrenData.getIyy(); // MOI about y axis
|
||||
@ -380,10 +380,10 @@ public class MassCalculator implements Monitorable {
|
||||
MassData instAccumData = new MassData(); // accumulator for instance MassData
|
||||
Coordinate[] instanceLocations = ((Instanceable) component).getInstanceOffsets();
|
||||
for( Coordinate curOffset : instanceLocations ){
|
||||
if( debug){
|
||||
//System.err.println(String.format("%-32s: %s", indent+" inst Accum", instAccumData.toCMDebug() ));
|
||||
System.err.println(String.format("%-32s: %s", indent+" inst Accum", instAccumData.toDebug() ));
|
||||
}
|
||||
// if( debug){
|
||||
// //System.err.println(String.format("%-32s: %s", indent+" inst Accum", instAccumData.toCMDebug() ));
|
||||
// System.err.println(String.format("%-32s: %s", indent+" inst Accum", instAccumData.toDebug() ));
|
||||
// }
|
||||
|
||||
Coordinate instanceCM = curOffset.add(eachCM);
|
||||
|
||||
@ -425,10 +425,10 @@ public class MassCalculator implements Monitorable {
|
||||
//
|
||||
// move to parent's reference point
|
||||
resultantData = resultantData.move( component.getOffset() );
|
||||
if( debug){
|
||||
//System.err.println(String.format("%-32s: %s ", indent+"<<["+component.getName()+"][asbly]", resultantData.toCMDebug()));
|
||||
System.err.println(String.format("%-32s: %s ", indent+"<<["+component.getName()+"][asbly]", resultantData.toDebug()));
|
||||
}
|
||||
// if( debug){
|
||||
// //System.err.println(String.format("%-32s: %s ", indent+"<<["+component.getName()+"][asbly]", resultantData.toCMDebug()));
|
||||
// System.err.println(String.format("%-32s: %s ", indent+"<<["+component.getName()+"][asbly]", resultantData.toDebug()));
|
||||
// }
|
||||
|
||||
|
||||
return resultantData;
|
||||
|
@ -453,6 +453,7 @@ public class BodyTube extends SymmetricComponent implements MotorMount, Coaxial
|
||||
return new Coordinate(this.getLength() - motor.getLength() + this.getMotorOverhang());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toMotorDebug(){
|
||||
return this.motors.toDebug();
|
||||
}
|
||||
|
@ -291,78 +291,6 @@ public class MassCalculatorTest extends BaseTestCase {
|
||||
assertEquals(" Delta Heavy Booster CM is incorrect: ", expCM, boosterSetCM);
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testBoosterMotorCM() {
|
||||
// Rocket rocket = TestRockets.makeFalcon9Heavy();
|
||||
// FlightConfiguration defaultConfig = rocket.getDefaultConfiguration();
|
||||
// FlightConfigurationID fcid = defaultConfig.getFlightConfigurationID();
|
||||
// rocket.setName("TestRocket."+Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
//
|
||||
// BoosterSet boosters = (BoosterSet) rocket.getChild(1).getChild(1);
|
||||
// int boostNum = boosters.getStageNumber();
|
||||
// rocket.getDefaultConfiguration().setAllStages(false);
|
||||
// rocket.getDefaultConfiguration().setOnlyStage( boostNum);
|
||||
//// String treeDump = rocket.toDebugTree();
|
||||
//// System.err.println( treeDump);
|
||||
//
|
||||
// // Validate Boosters
|
||||
// InnerTube inner = (InnerTube)boosters.getChild(1).getChild(0);
|
||||
// MassCalculator mc = new MassCalculator();
|
||||
//
|
||||
// double innerStartX = inner.getLocations()[0].x;
|
||||
// double innerLength = inner.getLength();
|
||||
// MotorInstance moto= inner.getMotorInstance(fcid);
|
||||
// double motorStart = innerStartX + innerLength + inner.getMotorOverhang() - moto.getMotor().getLength();
|
||||
//
|
||||
// int instanceCount = boosters.getInstanceCount()*inner.getInstanceCount();
|
||||
// assertEquals(" Total engine count is incorrect: ", 8, instanceCount);
|
||||
//
|
||||
// // LAUNCH
|
||||
// {
|
||||
//
|
||||
// Coordinate motorCM = mc.getMotorCG( rocket.getDefaultConfiguration(), MassCalcType.LAUNCH_MASS);
|
||||
//
|
||||
// double expMotorMass = 0.123*instanceCount;
|
||||
// double actMotorMass = motorCM.weight;
|
||||
// assertEquals(" Booster motor launch mass is incorrect: ", expMotorMass, actMotorMass, EPSILON);
|
||||
//
|
||||
// double expMotorCMX = motorStart + moto.getMotor().getLaunchCG().x;
|
||||
// Coordinate expMotorCM = new Coordinate(expMotorCMX, 0, 0, expMotorMass);
|
||||
// assertEquals(" Booster Motor CM.x is incorrect: ", expMotorCM.x, motorCM.x, EPSILON);
|
||||
// assertEquals(" Booster Motor CM.y is incorrect: ", expMotorCM.y, motorCM.y, EPSILON);
|
||||
// assertEquals(" Booster Motor CM.z is incorrect: ", expMotorCM.z, motorCM.z, EPSILON);
|
||||
// assertEquals(" Booster Motor CM is incorrect: ", expMotorCM, motorCM );
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // EMPTY / BURNOUT
|
||||
// {
|
||||
// Coordinate motorCM = mc.getMotorCG( rocket.getDefaultConfiguration(), MassCalcType.BURNOUT_MASS);
|
||||
//
|
||||
// double expMotorMass = 0.064*instanceCount;
|
||||
// double actMotorMass = motorCM.weight;
|
||||
// assertEquals(" Booster motor burnout mass is incorrect: ", expMotorMass, actMotorMass, EPSILON);
|
||||
//
|
||||
// // vvvv DEVEL vvvv
|
||||
//// System.err.println("\n ====== ====== ");
|
||||
//// System.err.println(String.format(" final position: %g = %g innerTube start", motorStart, innerStart ));
|
||||
//// System.err.println(String.format(" + %g innerTube Length ", innerLength ));
|
||||
//// System.err.println(String.format(" + %g overhang", inner.getMotorOverhang() ));
|
||||
//// System.err.println(String.format(" - %g motor length", moto.getMotor().getLength() ));
|
||||
//// double motorOffs = innerLength + inner.getMotorOverhang() - moto.getMotor().getLength();
|
||||
//// System.err.println(String.format(" [ %g motor Offset ]", motorOffs ));
|
||||
//// System.err.println(String.format(" [ %g motor CM ]", moto.getMotor().getEmptyCG().x));
|
||||
// // ^^^^ DEVEL ^^^^
|
||||
//
|
||||
// double expCMX = motorStart + moto.getMotor().getEmptyCG().x;
|
||||
// Coordinate expMotorCM = new Coordinate(expCMX, 0, 0, expMotorMass);
|
||||
// assertEquals(" Booster Motor CM.x is incorrect: ", expMotorCM.x, motorCM.x, EPSILON);
|
||||
// assertEquals(" Booster Motor CM.y is incorrect: ", expMotorCM.y, motorCM.y, EPSILON);
|
||||
// assertEquals(" Booster Motor CM.z is incorrect: ", expMotorCM.z, motorCM.z, EPSILON);
|
||||
// assertEquals(" Booster Motor CM is incorrect: ", expMotorCM, motorCM );
|
||||
// }
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testBoosterTotalCM() {
|
||||
Rocket rocket = TestRockets.makeFalcon9Heavy();
|
||||
@ -450,11 +378,11 @@ public class MassCalculatorTest extends BaseTestCase {
|
||||
|
||||
// Validate Boosters
|
||||
MassCalculator mc = new MassCalculator();
|
||||
mc.debug = true;
|
||||
//mc.debug = true;
|
||||
double expMOI_axial = 0.00752743;
|
||||
double boosterMOI_xx= mc.getRotationalInertia( defaultConfig, MassCalcType.LAUNCH_MASS);
|
||||
|
||||
double expMOI_tr = 0.0436639;
|
||||
double expMOI_tr = 0.0436639379937;
|
||||
double boosterMOI_tr= mc.getLongitudinalInertia( defaultConfig, MassCalcType.LAUNCH_MASS);
|
||||
|
||||
assertEquals(" Booster x-axis MOI is incorrect: ", expMOI_axial, boosterMOI_xx, EPSILON);
|
||||
|
Loading…
x
Reference in New Issue
Block a user