diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 526dacf32..b85074405 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -140,12 +140,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { WarningSet warnings) { // forces for this component, and all forces below it, in the rocket-tree - // => regardless `if(comp isinstance ComponentAssembly)`, or not. AerodynamicForces aggregateForces = new AerodynamicForces().zero(); aggregateForces.setComponent(comp); // forces for this component, _only_ - if(comp.isAerodynamic()) { + if(comp.isAerodynamic() || comp instanceof ComponentAssembly) { RocketComponentCalc calcObj = calcMap.get(comp); if (null == calcObj) { throw new NullPointerException("Could not find a CalculationObject for aerodynamic Component!: " + comp.getComponentName()); @@ -163,6 +162,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { if (child instanceof AxialStage && !configuration.isStageActive(child.getStageNumber())) { continue; } + // forces particular to each component AerodynamicForces childForces = calculateForceAnalysis(configuration, conds, child, instances, eachForces, assemblyForces, warnings); @@ -173,7 +173,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { assemblyForces.put(comp, aggregateForces); - return eachForces.get(comp); + return assemblyForces.get(comp); } @Override @@ -944,7 +944,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { calcMap = new HashMap<>(); for (RocketComponent comp: configuration.getAllComponents()) { - if (!comp.isAerodynamic()) { + if (!comp.isAerodynamic() && !(comp instanceof ComponentAssembly)) { continue; } diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/ComponentAssemblyCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/ComponentAssemblyCalc.java new file mode 100644 index 000000000..2017bb168 --- /dev/null +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/ComponentAssemblyCalc.java @@ -0,0 +1,37 @@ +package net.sf.openrocket.aerodynamics.barrowman; + +import net.sf.openrocket.aerodynamics.AerodynamicForces; +import net.sf.openrocket.aerodynamics.FlightConditions; +import net.sf.openrocket.aerodynamics.WarningSet; +import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.util.Transformation; + +/* + * Aerodynamic properties of a component assembly. Since an "assembly" + * has no impact except as a summation of its subparts, just returns 0 + * + */ +public class ComponentAssemblyCalc extends RocketComponentCalc { + public ComponentAssemblyCalc(RocketComponent c) { + super(c); + } + + @Override + public void calculateNonaxialForces(FlightConditions conditions, Transformation transform, + AerodynamicForces forces, WarningSet warnings) { + // empty + } + + @Override + public double calculateFrictionCD(FlightConditions conditions, double componentCf, WarningSet warnings) { + return 0; + } + + @Override + public double calculatePressureCD(FlightConditions conditions, + double stagnationCD, double baseCD, WarningSet warnings) { + return 0; + } + + +} diff --git a/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java b/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java index bbcf8f8d3..b0b120c82 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/ComponentAnalysisDialog.java @@ -199,6 +199,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe @Override public Object getValueAt(int row) { Object c = stabData.get(row).name; + return c.toString(); } @@ -237,7 +238,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe @Override public Object getValueAt(int row) { - return NOUNIT.toString(stabData.get(row).cpx); + return unit.toString(stabData.get(row).cpx); } }, new Column("CN" + ALPHA + "") { @@ -541,11 +542,6 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe rollData.clear(); for(final RocketComponent comp: configuration.getAllComponents()) { - // // this is actually redundant, because the analysis will not contain inactive stages. - // if (!configuration.isComponentActive(comp)) { - // continue; - // } - CMAnalysisEntry cmEntry = cmMap.get(comp.hashCode()); if (null == cmEntry) { log.warn("Could not find massData entry for component: " + comp.getName()); @@ -556,7 +552,11 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe continue; } - LongitudinalStabilityRow row = new LongitudinalStabilityRow(cmEntry.name, cmEntry.source); + String name = cmEntry.name; + if (cmEntry.source instanceof Rocket) { + name = trans.get("componentanalysisdlg.TOTAL"); + } + LongitudinalStabilityRow row = new LongitudinalStabilityRow(name, cmEntry.source); stabData.add(row); row.source = cmEntry.source;