From d0c19efd3d96cc142f4e660e4b6e2eb3568a0be3 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Wed, 28 Dec 2022 11:01:54 -0700 Subject: [PATCH] Add check for open airframe forward end Also, it turned out the discontinuity check didn't correctly check across stages (so it wouldn't notice if the aft end of one state wasn't the same as the forward end of the next). Fixed. --- core/resources/l10n/messages.properties | 1 + .../aerodynamics/BarrowmanCalculator.java | 18 +++++++++--------- .../sf/openrocket/aerodynamics/Warning.java | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 87a2d18d9..4a9a4e1e2 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1849,6 +1849,7 @@ PlotConfiguration.Groundtrack = Ground track 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.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 diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 4f22f93bb..96ae2c947 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -44,7 +44,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { private double cacheDiameter = -1; private double cacheLength = -1; - public BarrowmanCalculator() { } @@ -299,14 +298,16 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { } SymmetricComponent sym = (SymmetricComponent) comp; + prevComp = sym.getPreviousSymmetricComponent(); if( null == prevComp){ - prevComp = sym; - continue; - } - - // Check for radius discontinuity - if ( !MathUtil.equals(sym.getForeRadius(), prevComp.getAftRadius())) { - warnings.add( Warning.DIAMETER_DISCONTINUITY, sym + ", " + prevComp); + if (sym.getForeRadius() - sym.getThickness() > MathUtil.EPSILON) { + warnings.add(Warning.OPEN_AIRFRAME_FORWARD, sym.toString()); + } + } else { + // Check for radius discontinuity + if ( !MathUtil.equals(sym.getForeRadius(), prevComp.getAftRadius())) { + warnings.add( Warning.DIAMETER_DISCONTINUITY, sym + ", " + prevComp); + } } // double x = component.toAbsolute(Coordinate.NUL)[0].x; @@ -318,7 +319,6 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { //} //componentX = component.toAbsolute(new Coordinate(component.getLengthAerodynamic()))[0].x; - prevComp = sym; }else if( comp instanceof ComponentAssembly ){ checkGeometry(configuration, comp, warnings); } diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index c746650ea..b3c31fecc 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -358,6 +358,9 @@ public abstract class Warning { /** A Warning that the body diameter is discontinuous. */ ////Discontinuity in rocket body diameter. public static final Warning DIAMETER_DISCONTINUITY = new Other(trans.get("Warning.DISCONTINUITY")); + + /** A Warning that a ComponentAssembly has an open forward end */ + public static final Warning OPEN_AIRFRAME_FORWARD = new Other(trans.get("Warning.OPEN_AIRFRAME_FORWARD")); /** A Warning that the fins are thick compared to the rocket body. */ ////Thick fins may not be modeled accurately.