Check for gaps and overlaps in airframe

This commit is contained in:
JoePfeiffer 2023-01-18 10:14:08 -07:00
parent f03e31596a
commit 098223eb31
3 changed files with 26 additions and 15 deletions

View File

@ -1864,6 +1864,8 @@ Warning.LargeAOA.str1 = Large angle of attack encountered.
Warning.LargeAOA.str2 = Large angle of attack encountered (
Warning.DISCONTINUITY = Discontinuity in rocket body diameter
Warning.OPEN_AIRFRAME_FORWARD = Forward end of airframe is open (radius is > 0)
Warning.AIRFRAME_GAP = Gap in rocket airframe
Warning.AIRFRAME_OVERLAP = Two airframe sections overlap
Warning.THICK_FIN = Thick fins may not simulate accurately.
Warning.JAGGED_EDGED_FIN = Jagged-edged fin predictions may be inaccurate.
Warning.LISTENERS_AFFECTED = Listeners modified the flight simulation

View File

@ -309,25 +309,28 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
// We're going to say it's discontinuous if it is presented to the user as having two different
// string representations. Hopefully there are enough digits in the string that it will
// present as different if the discontinuity is big enough to matter.
if (!UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(2.0*sym.getForeRadius()).equals(UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(2.0*prevComp.getAftRadius()))) {
// if ( !MathUtil.equals(sym.getForeRadius(), prevComp.getAftRadius())) {
warnings.add( Warning.DIAMETER_DISCONTINUITY, sym + ", " + prevComp);
}
if (!UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(2.0*sym.getForeRadius())
.equals(UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(2.0*prevComp.getAftRadius()))) {
warnings.add( Warning.DIAMETER_DISCONTINUITY, prevComp + ", " + sym);
}
// double x = component.toAbsolute(Coordinate.NUL)[0].x;
// // Check for lengthwise discontinuity
// if (x > componentX + 0.0001) {
// if (!MathUtil.equals(radius, 0)) {
// warnings.add(Warning.DISCONTINUITY);
// radius = 0;
//}
//componentX = component.toAbsolute(new Coordinate(component.getLengthAerodynamic()))[0].x;
// check for gap in airframe. We'll use a textual comparison as above to see if there is a
// gap or overlap, then use arithmetic comparison to see which it is. This won't be quite as reliable
// as the case for radius, since we never actually display the absolute X position
double compX = comp.toAbsolute(Coordinate.NUL)[0].x;
double prevX = prevComp.toAbsolute(new Coordinate(prevComp.getLength(), 0, 0, 0))[0].x;
if (!UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(compX)
.equals(UnitGroup.UNITS_LENGTH.getDefaultUnit().toStringUnit(prevX))) {
if (compX > prevX) {
warnings.add(Warning.AIRFRAME_GAP, prevComp + ", " + sym);
} else {
warnings.add(Warning.AIRFRAME_OVERLAP, prevComp + ", " + sym);
}
}
}
} else if (comp instanceof ComponentAssembly) {
checkGeometry(configuration, comp, warnings);
}
}
}

View File

@ -362,6 +362,12 @@ public abstract class Warning {
/** A <code>Warning</code> that a ComponentAssembly has an open forward end */
public static final Warning OPEN_AIRFRAME_FORWARD = new Other(trans.get("Warning.OPEN_AIRFRAME_FORWARD"));
/** A <code>Warning</code> that there is a gap in the airframe */
public static final Warning AIRFRAME_GAP = new Other(trans.get("Warning.AIRFRAME_GAP"));
/** A <code>Warning</code> that two airframe components overlap*/
public static final Warning AIRFRAME_OVERLAP = new Other(trans.get("Warning.AIRFRAME_OVERLAP"));
/** A <code>Warning</code> that the fins are thick compared to the rocket body. */
////Thick fins may not be modeled accurately.
public static final Warning THICK_FIN = new Other(trans.get("Warning.THICK_FIN"));