From 31e7c532d9bf2ebeacc87c99a4b0132c61541ec4 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Sat, 24 Dec 2022 03:24:52 +0100 Subject: [PATCH 1/3] [#1894] Add inline pods warning --- core/resources/l10n/messages.properties | 1 + core/src/net/sf/openrocket/aerodynamics/Warning.java | 1 + 2 files changed, 2 insertions(+) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index e1e9dd23d..4721c4e23 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1860,6 +1860,7 @@ Warning.NO_RECOVERY_DEVICE = No recovery device defined in the simulation. Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: Warning.ZERO_VOLUME_BODY = Zero-volume bodies may not simulate accurately. +Warning.INLINE_PODS = Inline pods may not simulate accurately. Warning.TUBE_SEPARATION = Space between tube fins may not simulate accurately. Warning.TUBE_OVERLAP = Overlapping tube fins may not simulate accurately. Warning.EMPTY_BRANCH = Simulation branch contains no data diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index c746650ea..cba62d3e5 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -391,6 +391,7 @@ public abstract class Warning { public static final Warning EVENT_AFTER_LANDING = new Other(trans.get("Warning.EVENT_AFTER_LANDING")); public static final Warning ZERO_VOLUME_BODY = new Other(trans.get("Warning.ZERO_VOLUME_BODY")); + public static final Warning INLINE_PODS = new Other(trans.get("Warning.INLINE_PODS")); public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION")); public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP")); From 60896d2236fd706694a10ad7f7b6e48afe001b3b Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 17 Jan 2023 00:05:08 +0100 Subject: [PATCH 2/3] Better warning component printing --- core/src/net/sf/openrocket/aerodynamics/WarningSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/aerodynamics/WarningSet.java b/core/src/net/sf/openrocket/aerodynamics/WarningSet.java index 6f709e83b..6fcd7b837 100644 --- a/core/src/net/sf/openrocket/aerodynamics/WarningSet.java +++ b/core/src/net/sf/openrocket/aerodynamics/WarningSet.java @@ -76,7 +76,7 @@ public class WarningSet extends AbstractSet implements Cloneable, Monit * */ public boolean add (Warning w, String d) { - return this.add(w.toString() + ": " + d); + return this.add(w.toString() + ": \"" + d + "\""); } @Override From 4f3d63f1db26c7db7be38d2d1cabda1d84433182 Mon Sep 17 00:00:00 2001 From: SiboVG Date: Tue, 17 Jan 2023 00:18:47 +0100 Subject: [PATCH 3/3] Apply zero-volume body warning earlier on + add component information --- core/resources/l10n/messages.properties | 3 +- .../aerodynamics/BarrowmanCalculator.java | 11 +++++-- .../sf/openrocket/aerodynamics/Warning.java | 1 - .../aerodynamics/barrowman/FinSetCalc.java | 29 +++++++------------ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index bc6eabbeb..0a286092b 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1899,8 +1899,7 @@ Warning.RECOVERY_HIGH_SPEED = Recovery device deployment at high speed Warning.NO_RECOVERY_DEVICE = No recovery device defined in the simulation. Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: -Warning.ZERO_VOLUME_BODY = Zero-volume bodies may not simulate accurately. -Warning.INLINE_PODS = Inline pods may not simulate accurately. +Warning.ZERO_VOLUME_BODY = Zero-volume bodies may not simulate accurately Warning.TUBE_SEPARATION = Space between tube fins may not simulate accurately. Warning.TUBE_OVERLAP = Overlapping tube fins may not simulate accurately. Warning.EMPTY_BRANCH = Simulation branch contains no data diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 264c1298b..5c161082b 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -1,5 +1,6 @@ package net.sf.openrocket.aerodynamics; +import static net.sf.openrocket.util.MathUtil.EPSILON; import static net.sf.openrocket.util.MathUtil.pow2; import java.util.*; @@ -300,9 +301,9 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { SymmetricComponent sym = (SymmetricComponent) comp; prevComp = sym.getPreviousSymmetricComponent(); - if( null == prevComp){ + if (prevComp == null) { if (sym.getForeRadius() - sym.getThickness() > MathUtil.EPSILON) { - warnings.add(Warning.OPEN_AIRFRAME_FORWARD, sym.toString()); + warnings.add(Warning.OPEN_AIRFRAME_FORWARD, sym.getName()); } } else { // Check for radius discontinuity @@ -314,6 +315,12 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { warnings.add( Warning.DIAMETER_DISCONTINUITY, sym + ", " + prevComp); } } + + // Check for phantom tube + if ((sym.getLength() < MathUtil.EPSILON) || + (sym.getAftRadius() < MathUtil.EPSILON && sym.getForeRadius() < MathUtil.EPSILON)) { + warnings.add(Warning.ZERO_VOLUME_BODY, sym.getName()); + } // double x = component.toAbsolute(Coordinate.NUL)[0].x; // // Check for lengthwise discontinuity diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index 0558cc762..b3c31fecc 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -394,7 +394,6 @@ public abstract class Warning { public static final Warning EVENT_AFTER_LANDING = new Other(trans.get("Warning.EVENT_AFTER_LANDING")); public static final Warning ZERO_VOLUME_BODY = new Other(trans.get("Warning.ZERO_VOLUME_BODY")); - public static final Warning INLINE_PODS = new Other(trans.get("Warning.INLINE_PODS")); public static final Warning TUBE_SEPARATION = new Other(trans.get("Warning.TUBE_SEPARATION")); public static final Warning TUBE_OVERLAP = new Other(trans.get("Warning.TUBE_OVERLAP")); diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java index 1bafd4abc..53746d2e6 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java @@ -46,10 +46,9 @@ public class FinSetCalc extends RocketComponentCalc { protected final WarningSet geometryWarnings = new WarningSet(); private final double[] poly = new double[6]; - + private final double thickness; private final double bodyRadius; - private final double bodyLength; private final int finCount; private final double cantAngle; private final FinSet.CrossSection crossSection; @@ -62,20 +61,17 @@ public class FinSetCalc extends RocketComponentCalc { ///why not put FinSet in the parameter instead? public FinSetCalc(FinSet component) { super(component); - - FinSet fin = component; - thickness = fin.getThickness(); - bodyLength = component.getParent().getLength(); - bodyRadius = fin.getBodyRadius(); - finCount = fin.getFinCount(); + this.thickness = component.getThickness(); + this.bodyRadius = component.getBodyRadius(); + this.finCount = component.getFinCount(); + + this.cantAngle = component.getCantAngle(); + this.span = component.getSpan(); + this.finArea = component.getPlanformArea(); + this.crossSection = component.getCrossSection(); - cantAngle = fin.getCantAngle(); - span = fin.getSpan(); - finArea = fin.getPlanformArea(); - crossSection = fin.getCrossSection(); - - calculateFinGeometry(fin); + calculateFinGeometry(component); calculatePoly(); calculateInterferenceFinCount(component); } @@ -101,10 +97,7 @@ public class FinSetCalc extends RocketComponentCalc { return; } - if ((bodyLength < EPSILON) || (bodyRadius < EPSILON)) { - // Add warnings: Phantom Body - warnings.add(Warning.ZERO_VOLUME_BODY); - }else if( (0 < bodyRadius) && (thickness > bodyRadius / 2)){ + if ((bodyRadius > 0) && (thickness > bodyRadius / 2)){ // Add warnings (radius/2 == diameter/4) warnings.add(Warning.THICK_FIN); }