Merge pull request #1800 from JoePfeiffer/fix-1702

Fix 1702
This commit is contained in:
Sibo Van Gool 2022-11-08 11:40:49 +01:00 committed by GitHub
commit 9f06b98bd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 11 deletions

View File

@ -140,12 +140,11 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
WarningSet warnings) WarningSet warnings)
{ {
// forces for this component, and all forces below it, in the rocket-tree // 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(); AerodynamicForces aggregateForces = new AerodynamicForces().zero();
aggregateForces.setComponent(comp); aggregateForces.setComponent(comp);
// forces for this component, _only_ // forces for this component, _only_
if(comp.isAerodynamic()) { if(comp.isAerodynamic() || comp instanceof ComponentAssembly) {
RocketComponentCalc calcObj = calcMap.get(comp); RocketComponentCalc calcObj = calcMap.get(comp);
if (null == calcObj) { if (null == calcObj) {
throw new NullPointerException("Could not find a CalculationObject for aerodynamic Component!: " + comp.getComponentName()); 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())) { if (child instanceof AxialStage && !configuration.isStageActive(child.getStageNumber())) {
continue; continue;
} }
// forces particular to each component // forces particular to each component
AerodynamicForces childForces = calculateForceAnalysis(configuration, conds, child, instances, eachForces, assemblyForces, warnings); AerodynamicForces childForces = calculateForceAnalysis(configuration, conds, child, instances, eachForces, assemblyForces, warnings);
@ -173,7 +173,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
assemblyForces.put(comp, aggregateForces); assemblyForces.put(comp, aggregateForces);
return eachForces.get(comp); return assemblyForces.get(comp);
} }
@Override @Override
@ -944,7 +944,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator {
calcMap = new HashMap<>(); calcMap = new HashMap<>();
for (RocketComponent comp: configuration.getAllComponents()) { for (RocketComponent comp: configuration.getAllComponents()) {
if (!comp.isAerodynamic()) { if (!comp.isAerodynamic() && !(comp instanceof ComponentAssembly)) {
continue; continue;
} }

View File

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

View File

@ -199,6 +199,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
@Override @Override
public Object getValueAt(int row) { public Object getValueAt(int row) {
Object c = stabData.get(row).name; Object c = stabData.get(row).name;
return c.toString(); return c.toString();
} }
@ -237,7 +238,7 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
@Override @Override
public Object getValueAt(int row) { public Object getValueAt(int row) {
return NOUNIT.toString(stabData.get(row).cpx); return unit.toString(stabData.get(row).cpx);
} }
}, },
new Column("<html>C<sub>N<sub>" + ALPHA + "</sub></sub>") { new Column("<html>C<sub>N<sub>" + ALPHA + "</sub></sub>") {
@ -541,11 +542,6 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
rollData.clear(); rollData.clear();
for(final RocketComponent comp: configuration.getAllComponents()) { 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()); CMAnalysisEntry cmEntry = cmMap.get(comp.hashCode());
if (null == cmEntry) { if (null == cmEntry) {
log.warn("Could not find massData entry for component: " + comp.getName()); log.warn("Could not find massData entry for component: " + comp.getName());
@ -556,7 +552,11 @@ public class ComponentAnalysisDialog extends JDialog implements StateChangeListe
continue; 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); stabData.add(row);
row.source = cmEntry.source; row.source = cmEntry.source;