diff --git a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java index 634a8ecf3..6cbf1ca04 100644 --- a/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java +++ b/core/src/net/sf/openrocket/aerodynamics/BarrowmanCalculator.java @@ -402,7 +402,7 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { !(c instanceof FinSet)) continue; - // iterate across component instances + // iterate across component instances final ArrayList contextList = entry.getValue(); for(InstanceContext context: contextList ) { @@ -515,39 +515,46 @@ public class BarrowmanCalculator extends AbstractAerodynamicCalculator { base = calculateBaseCD(conditions.getMach()); total = 0; - for (RocketComponent c : configuration.getActiveComponents()) { + final InstanceMap imap = configuration.getActiveInstances(); + for(Map.Entry> entry: imap.entrySet() ) { + final RocketComponent c = entry.getKey(); if (!c.isAerodynamic()) continue; - - // Pressure fore drag - double cd = calcMap.get(c).calculatePressureDragForce(conditions, stagnation, base, - warnings); - total += cd; - - if (map != null) { - map.get(c).setPressureCD(cd); - } - - if(c.isCDOverridden()) continue; - - // Stagnation drag - if (c instanceof SymmetricComponent) { - SymmetricComponent s = (SymmetricComponent) c; + // iterate across component instances + final ArrayList contextList = entry.getValue(); + for(InstanceContext context: contextList ) { - if (radius < s.getForeRadius()) { - double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius)); - cd = stagnation * area / conditions.getRefArea(); - total += cd; - if (map != null) { - map.get(c).setPressureCD(map.get(c).getPressureCD() + cd); - } + // Pressure fore drag + double cd = calcMap.get(c).calculatePressureDragForce(conditions, stagnation, base, + warnings); + total += cd; + + if (map != null) { + map.get(c).setPressureCD(cd); } - radius = s.getAftRadius(); + if(c.isCDOverridden()) continue; + + + // Stagnation drag + if (c instanceof SymmetricComponent) { + SymmetricComponent s = (SymmetricComponent) c; + + if (radius < s.getForeRadius()) { + double area = Math.PI * (pow2(s.getForeRadius()) - pow2(radius)); + cd = stagnation * area / conditions.getRefArea(); + total += cd; + if (map != null) { + map.get(c).setPressureCD(map.get(c).getPressureCD() + cd); + } + } + + radius = s.getAftRadius(); + } } } - + return total; } diff --git a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java index 8f7b80c51..c7d2b9754 100644 --- a/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java +++ b/core/src/net/sf/openrocket/aerodynamics/barrowman/FinSetCalc.java @@ -645,7 +645,7 @@ public class FinSetCalc extends RocketComponentCalc { // Airfoil assumed to have zero base drag // Scale to correct reference area - drag *= finCount * span * thickness / conditions.getRefArea(); + drag *= span * thickness / conditions.getRefArea(); return drag; }