From 530744d4cc8b912213ce379fd8c0309c3be7f060 Mon Sep 17 00:00:00 2001 From: Daniel_M_Williams Date: Sun, 17 May 2020 18:29:45 -0400 Subject: [PATCH] [fix][simulation] Adds 2 warnings about fins on Phantom-Bodies --- core/resources/l10n/messages.properties | 2 ++ .../net/sf/openrocket/aerodynamics/Warning.java | 7 +++++-- .../aerodynamics/barrowman/FinSetCalc.java | 15 ++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 3226bb598..9344d44c5 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -1695,6 +1695,8 @@ Warning.RECOVERY_LAUNCH_ROD = Recovery device device deployed while on the launc Warning.RECOVERY_HIGH_SPEED = Recovery device deployment at high speed Warning.TUMBLE_UNDER_THRUST = Stage began to tumble under thrust. Warning.EVENT_AFTER_LANDING = Flight Event occurred after landing: +Warning.ZERO_LENGTH_BODY = Zero length bodies may not result in accurate simulations. +Warning.ZERO_RADIUS_BODY = Zero length bodies may not result in accurate simulations. ! Scale dialog ScaleDialog.lbl.scaleRocket = Entire rocket diff --git a/core/src/net/sf/openrocket/aerodynamics/Warning.java b/core/src/net/sf/openrocket/aerodynamics/Warning.java index f29507c26..211e555ac 100644 --- a/core/src/net/sf/openrocket/aerodynamics/Warning.java +++ b/core/src/net/sf/openrocket/aerodynamics/Warning.java @@ -380,7 +380,7 @@ public abstract class Warning { public static final Warning FILE_INVALID_PARAMETER = new Other(trans.get("Warning.FILE_INVALID_PARAMETER")); public static final Warning PARALLEL_FINS = new Other(trans.get("Warning.PARALLEL_FINS")); - + public static final Warning SUPERSONIC = new Other(trans.get("Warning.SUPERSONIC")); public static final Warning RECOVERY_LAUNCH_ROD = new Other(trans.get("Warning.RECOVERY_LAUNCH_ROD")); @@ -388,5 +388,8 @@ public abstract class Warning { public static final Warning TUMBLE_UNDER_THRUST = new Other(trans.get("Warning.TUMBLE_UNDER_THRUST")); public static final Warning EVENT_AFTER_LANDING = new Other(trans.get("Warning.EVENT_AFTER_LANDING")); - + + public static final Warning ZERO_LENGTH_BODY = new Other(trans.get("Warning.ZERO_LENGTH_BODY")); + public static final Warning ZERO_RADIUS_BODY = new Other(trans.get("Warning.ZERO_RADIUS_BODY")); + } diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java index 032bfc823..b70c7b246 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java @@ -1,6 +1,7 @@ package net.sf.openrocket.aerodynamics.barrowman; import static java.lang.Math.pow; +import static net.sf.openrocket.util.MathUtil.EPSILON; import static net.sf.openrocket.util.MathUtil.pow2; import java.util.Arrays; @@ -48,6 +49,7 @@ public class FinSetCalc extends RocketComponentCalc { 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; @@ -64,6 +66,7 @@ public class FinSetCalc extends RocketComponentCalc { FinSet fin = (FinSet) component; thickness = fin.getThickness(); + bodyLength = component.getParent().getLength(); bodyRadius = fin.getBodyRadius(); finCount = fin.getFinCount(); @@ -97,9 +100,15 @@ public class FinSetCalc extends RocketComponentCalc { forces.setCyaw(0); return; } - - // Add warnings (radius/2 == diameter/4) - if( (0 < bodyRadius) && (thickness > bodyRadius / 2)){ + + if((EPSILON > bodyLength)) { + // Add warnings: Phantom Body + warnings.add(Warning.ZERO_LENGTH_BODY); + }else if((EPSILON > bodyRadius)){ + // Add warnings: Phantom Body + warnings.add(Warning.ZERO_RADIUS_BODY); + }else if( (0 < bodyRadius) && (thickness > bodyRadius / 2)){ + // Add warnings (radius/2 == diameter/4) warnings.add(Warning.THICK_FIN); } warnings.addAll(geometryWarnings);