From: Bill Kuker Date: Fri, 17 Apr 2009 19:27:22 +0000 (+0000) Subject: Renamed some methods X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=8cf1d88711c2bec6beac38635def7d2722376c61;p=sw%2Fmotorsim Renamed some methods --- diff --git a/src/com/billkuker/rocketry/motorsim/Burn.java b/src/com/billkuker/rocketry/motorsim/Burn.java index 1ced629..e867b61 100644 --- a/src/com/billkuker/rocketry/motorsim/Burn.java +++ b/src/com/billkuker/rocketry/motorsim/Burn.java @@ -118,12 +118,12 @@ public class Burn { log.info("Volume Burnt: " + volumeBurnt.to(SI.MILLIMETER.pow(3))); - Amount mGenRate = volumeBurnt.times(motor.getFuel().idealDensity().times(densityRatio)).divide(dt).to(MassFlowRate.UNIT); + Amount mGenRate = volumeBurnt.times(motor.getFuel().getIdealDensity().times(motor.getFuel().getDensityRatio())).divide(dt).to(MassFlowRate.UNIT); log.debug("Mass Gen Rate: " + mGenRate); - Amount specificGasConstant = Constants.R.divide(motor.getFuel().getCombustionProduct().effectiveMolarWeight()); - Amount chamberTemp = motor.getFuel().getCombustionProduct().idealCombustionTemperature().times(combustionEfficency); + Amount specificGasConstant = Constants.R.divide(motor.getFuel().getCombustionProduct().getEffectiveMolarWeight()); + Amount chamberTemp = motor.getFuel().getCombustionProduct().getIdealCombustionTemperature().times(motor.getFuel().getCombustionEfficiency()); Amount mNozzle; { @@ -135,7 +135,7 @@ public class Burn { Amount aStar = motor.getNozzle().throatArea(); - double k = motor.getFuel().getCombustionProduct().ratioOfSpecificHeats(); + double k = motor.getFuel().getCombustionProduct().getRatioOfSpecificHeats(); log.debug("K: " + k); @@ -189,7 +189,7 @@ public class Burn { next.chamberPressure.doubleValue(SI.PASCAL), SI.PASCAL); - next.thrust = motor.getNozzle().thrust(next.chamberPressure, atmosphereicPressure, atmosphereicPressure, motor.getFuel().getCombustionProduct().ratioOfSpecificHeats2Phase()); + next.thrust = motor.getNozzle().thrust(next.chamberPressure, atmosphereicPressure, atmosphereicPressure, motor.getFuel().getCombustionProduct().getRatioOfSpecificHeats2Phase()); if ( next.chamberPressure.approximates(atmosphereicPressure)){ log.info("Pressure at Patm on step " + i); diff --git a/src/com/billkuker/rocketry/motorsim/Fuel.java b/src/com/billkuker/rocketry/motorsim/Fuel.java index 976ebd9..2f5f04c 100644 --- a/src/com/billkuker/rocketry/motorsim/Fuel.java +++ b/src/com/billkuker/rocketry/motorsim/Fuel.java @@ -11,33 +11,24 @@ import com.billkuker.rocketry.motorsim.RocketScience.MolarWeight; public interface Fuel { - public Amount idealDensity(); + public Amount getIdealDensity(); public Amount burnRate(Amount pressure); public CombustionProduct getCombustionProduct(); public interface CombustionProduct { - public Amount idealCombustionTemperature(); + public Amount getIdealCombustionTemperature(); - public Amount effectiveMolarWeight(); + public Amount getEffectiveMolarWeight(); - public double ratioOfSpecificHeats(); + public double getRatioOfSpecificHeats(); - public double ratioOfSpecificHeats2Phase(); + public double getRatioOfSpecificHeats2Phase(); } - /* - @Deprecated - public Amount idealCombustionTemperature(); - - @Deprecated - public Amount effectiveMolarWeight(); - - @Deprecated - public double ratioOfSpecificHeats(); + public double getDensityRatio(); - @Deprecated - public double ratioOfSpecificHeats2Phase();*/ + public double getCombustionEfficiency(); } diff --git a/src/com/billkuker/rocketry/motorsim/fuel/KNSB.java b/src/com/billkuker/rocketry/motorsim/fuel/KNSB.java index d835178..d7c2b21 100644 --- a/src/com/billkuker/rocketry/motorsim/fuel/KNSB.java +++ b/src/com/billkuker/rocketry/motorsim/fuel/KNSB.java @@ -23,26 +23,26 @@ public class KNSB extends PiecewiseSaintRobertFuel { } @Override - public Amount idealDensity() { + public Amount getIdealDensity() { return Amount.valueOf(1841, 0, SI.KILOGRAM.divide(SI.METER.pow(3))).to(VolumetricDensity.UNIT); } public CombustionProduct getCombustionProduct() { return new CombustionProduct(){ - public Amount idealCombustionTemperature() { + public Amount getIdealCombustionTemperature() { return Amount.valueOf(1600, SI.KELVIN); } - public Amount effectiveMolarWeight() { + public Amount getEffectiveMolarWeight() { return Amount.valueOf("39.9 kg/kmol").to(MolarWeight.UNIT); } - public double ratioOfSpecificHeats() { + public double getRatioOfSpecificHeats() { return 1.1361; } - public double ratioOfSpecificHeats2Phase() { + public double getRatioOfSpecificHeats2Phase() { return 1.042; } }; @@ -66,4 +66,12 @@ public class KNSB extends PiecewiseSaintRobertFuel { burnRate.show(); } + public double getCombustionEfficiency() { + return .97; + } + + public double getDensityRatio() { + return .96; + } + } diff --git a/src/com/billkuker/rocketry/motorsim/fuel/KNSU.java b/src/com/billkuker/rocketry/motorsim/fuel/KNSU.java index cac65fc..c99e8d4 100644 --- a/src/com/billkuker/rocketry/motorsim/fuel/KNSU.java +++ b/src/com/billkuker/rocketry/motorsim/fuel/KNSU.java @@ -16,7 +16,7 @@ public class KNSU extends SaintRobertFuel { } //@Override - public Amount idealDensity() { + public Amount getIdealDensity() { //return Amount.valueOf(1.889, 0, SI.GRAM.divide(SI.CENTIMETER.pow(3))).to(VolumetricDensity.UNIT); return Amount.valueOf(1889, 0, SI.KILOGRAM.divide(SI.METER.pow(3))).to(VolumetricDensity.UNIT); } @@ -34,22 +34,30 @@ public class KNSU extends SaintRobertFuel { public CombustionProduct getCombustionProduct(){ return new CombustionProduct(){ - public Amount idealCombustionTemperature() { + public Amount getIdealCombustionTemperature() { return Amount.valueOf(1720, SI.KELVIN); } - public Amount effectiveMolarWeight() { + public Amount getEffectiveMolarWeight() { return Amount.valueOf("41.98 kg/kmol").to(MolarWeight.UNIT); } - public double ratioOfSpecificHeats() { + public double getRatioOfSpecificHeats() { return 1.133; } - public double ratioOfSpecificHeats2Phase() { + public double getRatioOfSpecificHeats2Phase() { return 1.044; } }; } + public double getCombustionEfficiency() { + return .97; + } + + public double getDensityRatio() { + return .96; + } + } diff --git a/src/com/billkuker/rocketry/motorsim/fuel/SaintRobertFuel.java b/src/com/billkuker/rocketry/motorsim/fuel/SaintRobertFuel.java index f8e1ab6..284e134 100644 --- a/src/com/billkuker/rocketry/motorsim/fuel/SaintRobertFuel.java +++ b/src/com/billkuker/rocketry/motorsim/fuel/SaintRobertFuel.java @@ -56,6 +56,6 @@ public abstract class SaintRobertFuel implements Fuel { return Amount.valueOf(0, Velocity.UNIT); } - public abstract Amount idealDensity(); + public abstract Amount getIdealDensity(); } diff --git a/src/com/billkuker/rocketry/motorsim/test/ConvergentDivergentNozzleTest.java b/src/com/billkuker/rocketry/motorsim/test/ConvergentDivergentNozzleTest.java index df97885..81ece53 100644 --- a/src/com/billkuker/rocketry/motorsim/test/ConvergentDivergentNozzleTest.java +++ b/src/com/billkuker/rocketry/motorsim/test/ConvergentDivergentNozzleTest.java @@ -43,7 +43,7 @@ public class ConvergentDivergentNozzleTest extends RocketTest { KNSU f = new KNSU(); - Amount t = n.thrust(Po, Pe, Patm, f.getCombustionProduct().ratioOfSpecificHeats2Phase()); + Amount t = n.thrust(Po, Pe, Patm, f.getCombustionProduct().getRatioOfSpecificHeats2Phase()); Amount expected = Amount.valueOf(87.2, .1, SI.NEWTON); @@ -60,7 +60,7 @@ public class ConvergentDivergentNozzleTest extends RocketTest { KNSU f = new KNSU(); - double cF = n.thrustCoefficient(Po, Pe, Patm, f.getCombustionProduct().ratioOfSpecificHeats2Phase()); + double cF = n.thrustCoefficient(Po, Pe, Patm, f.getCombustionProduct().getRatioOfSpecificHeats2Phase()); Assert.assertEquals(cF, 1.2454812344324655); diff --git a/src/com/billkuker/rocketry/motorsim/test/KNSUTest.java b/src/com/billkuker/rocketry/motorsim/test/KNSUTest.java index 917dc77..9845a6f 100644 --- a/src/com/billkuker/rocketry/motorsim/test/KNSUTest.java +++ b/src/com/billkuker/rocketry/motorsim/test/KNSUTest.java @@ -19,12 +19,12 @@ public class KNSUTest extends RocketTest { @Test public void testEffectiveMolarWeight(){ - (new KNSU()).getCombustionProduct().effectiveMolarWeight(); + (new KNSU()).getCombustionProduct().getEffectiveMolarWeight(); } @Test public void testIdealDensity(){ - System.out.println((new KNSU()).idealDensity()); - System.out.println((new KNSU()).idealDensity().isExact()); + System.out.println((new KNSU()).getIdealDensity()); + System.out.println((new KNSU()).getIdealDensity().isExact()); } }