Merge pull request #1979 from SiboVG/issue-1894

Warn for phantom tubes earlier on
This commit is contained in:
Sibo Van Gool 2023-01-21 13:22:32 +01:00 committed by GitHub
commit 989e757e4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 22 deletions

View File

@ -1876,7 +1876,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.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

View File

@ -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

View File

@ -76,7 +76,7 @@ public class WarningSet extends AbstractSet<Warning> implements Cloneable, Monit
*
*/
public boolean add (Warning w, String d) {
return this.add(w.toString() + ": " + d);
return this.add(w.toString() + ": \"" + d + "\"");
}
@Override

View File

@ -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);
}