Add logging for easier debugging later

Dump interpolation parameters so I can create a good unittest
This commit is contained in:
JoePfeiffer 2022-01-09 14:02:03 -07:00
parent 5412f89419
commit a2341f4c18
2 changed files with 17 additions and 2 deletions

View File

@ -18,7 +18,8 @@ import net.sf.openrocket.util.MathUtil;
import net.sf.openrocket.util.PolyInterpolator;
import net.sf.openrocket.util.Transformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Calculates the aerodynamic properties of a <code>SymmetricComponent</code>.
@ -32,6 +33,8 @@ import net.sf.openrocket.util.Transformation;
*/
public class SymmetricComponentCalc extends RocketComponentCalc {
private final static Logger log = LoggerFactory.getLogger(SymmetricComponentCalc.class);
public static final double BODY_LIFT_K = 1.1;
private final double length;
@ -375,7 +378,16 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
interpolator.addPoint(m, stag * Math.pow(int1.getValue(m) / stag, log4));
}
}
// dump transonic/supersonic knots, in a format easily imported into python
String vel = "vel = [ ";
String cd = "cd = [ ";
for (double m : interpolator.getXPoints()) {
vel = vel + m + ", ";
cd = cd + interpolator.getValue(m) + ", ";
}
log.debug(vel + "]");
log.debug(cd + "]");
/*
* Now the transonic/supersonic region is ok. We still need to interpolate
@ -391,6 +403,9 @@ public class SymmetricComponentCalc extends RocketComponentCalc {
double cdMach0 = 0.8 * pow2(sinphi);
double minDeriv = (interpolator.getValue(min + 0.01) - minValue) / 0.01;
log.debug("cdMach0 = " + cdMach0);
log.debug("minDeriv = " + minDeriv);
// These should not occur, but might cause havoc for the interpolation
if ((cdMach0 >= minValue - 0.01) || (minDeriv <= 0.01)) {