From a5b083ade75b462da0f00924bb71d2b2030ed2e0 Mon Sep 17 00:00:00 2001 From: Kevin Ruland Date: Tue, 7 Jun 2016 20:24:10 -0500 Subject: [PATCH] Use actual burn time for determination of burnout event. Compute average thrust while simulating. --- .../openrocket/masscalc/MassCalculator.java | 119 ++++++++++-------- core/src/net/sf/openrocket/motor/Motor.java | 10 +- .../sf/openrocket/motor/ThrustCurveMotor.java | 82 ++++++++++-- .../motor/ThrustCurveMotorPlaceholder.java | 18 ++- .../simulation/AbstractSimulationStepper.java | 4 +- .../BasicEventSimulationEngine.java | 7 +- .../simulation/MotorClusterState.java | 27 ++-- .../sf/openrocket/utils/MotorCorrelation.java | 3 +- .../sf/openrocket/utils/MotorDigester.java | 2 +- .../file/motor/TestMotorLoader.java | 3 +- 10 files changed, 195 insertions(+), 80 deletions(-) diff --git a/core/src/net/sf/openrocket/masscalc/MassCalculator.java b/core/src/net/sf/openrocket/masscalc/MassCalculator.java index 514bd56d5..82bf37079 100644 --- a/core/src/net/sf/openrocket/masscalc/MassCalculator.java +++ b/core/src/net/sf/openrocket/masscalc/MassCalculator.java @@ -1,5 +1,6 @@ package net.sf.openrocket.masscalc; +import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -8,13 +9,14 @@ import org.slf4j.LoggerFactory; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.motor.MotorConfiguration; -import net.sf.openrocket.motor.ThrustCurveMotor; import net.sf.openrocket.rocketcomponent.AxialStage; import net.sf.openrocket.rocketcomponent.FlightConfiguration; import net.sf.openrocket.rocketcomponent.Instanceable; import net.sf.openrocket.rocketcomponent.MotorMount; import net.sf.openrocket.rocketcomponent.ParallelStage; import net.sf.openrocket.rocketcomponent.RocketComponent; +import net.sf.openrocket.simulation.MotorClusterState; +import net.sf.openrocket.simulation.SimulationStatus; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.Coordinate; import net.sf.openrocket.util.MathUtil; @@ -73,7 +75,7 @@ public class MassCalculator implements Monitorable { for (Coordinate cord : motorMount.toAbsolute(cg) ) { totalCM = totalCM.average(cord); } - + return totalCM; } @@ -95,9 +97,9 @@ public class MassCalculator implements Monitorable { * are relative to their respective CG. */ private HashMap< Integer, MassData> cache = new HashMap(); -// private MassData dryData = null; -// private MassData launchData = null; -// private Vector< MassData> motorData = new Vector(); + // private MassData dryData = null; + // private MassData launchData = null; + // private Vector< MassData> motorData = new Vector(); // this turns on copious amounts of debug. Recommend leaving this false // until reaching code that causes troublesome conditions. @@ -108,7 +110,7 @@ public class MassCalculator implements Monitorable { } ////////////////// Mass property calculations /////////////////// - + /** * Return the CG of the rocket with the specified motor status (no motors, @@ -137,7 +139,7 @@ public class MassCalculator implements Monitorable { dryCM = stageData.cm.average(dryCM); } - + Coordinate totalCM=null; if( MassCalcType.NO_MOTORS == type ){ @@ -163,39 +165,39 @@ public class MassCalculator implements Monitorable { return MassData.ZERO_DATA; } -// // vvvv DEVEL vvvv -// //String massFormat = " [%2s]: %-16s %6s x %6s = %6s += %6s @ (%s, %s, %s )"; -// String inertiaFormat = " [%2s](%2s): %-16s %6s %6s"; -// if( debug){ -// System.err.println("====== ====== getMotorMassData( config:"+config.toDebug()+", type: "+type.name()+") ====== ====== ====== ====== ====== ======"); -// //System.err.println(String.format(massFormat, " #", "","Mass","Count","Config","Sum", "x","y","z")); -// System.err.println(String.format(inertiaFormat, " #","ct", "","I_ax","I_tr")); -// } -// // ^^^^ DEVEL ^^^^ - + // // vvvv DEVEL vvvv + // //String massFormat = " [%2s]: %-16s %6s x %6s = %6s += %6s @ (%s, %s, %s )"; + // String inertiaFormat = " [%2s](%2s): %-16s %6s %6s"; + // if( debug){ + // System.err.println("====== ====== getMotorMassData( config:"+config.toDebug()+", type: "+type.name()+") ====== ====== ====== ====== ====== ======"); + // //System.err.println(String.format(massFormat, " #", "","Mass","Count","Config","Sum", "x","y","z")); + // System.err.println(String.format(inertiaFormat, " #","ct", "","I_ax","I_tr")); + // } + // // ^^^^ DEVEL ^^^^ + MassData allMotorData = MassData.ZERO_DATA; //int motorIndex = 0; for (MotorConfiguration mtrConfig : config.getActiveMotors() ) { - ThrustCurveMotor mtr = (ThrustCurveMotor) mtrConfig.getMotor(); + Motor mtr = (Motor) mtrConfig.getMotor(); MotorMount mount = mtrConfig.getMount(); RocketComponent mountComp = (RocketComponent)mount; Coordinate[] locations = mountComp.getLocations(); // location of mount, w/in entire rocket int instanceCount = locations.length; double motorXPosition = mtrConfig.getX(); // location of motor from mount - + Coordinate localCM = type.getCM( mtr ); // CoM from beginning of motor localCM = localCM.setWeight( localCM.weight * instanceCount); // a *bit* hacky :P Coordinate curMotorCM = localCM.setX( localCM.x + locations[0].x + motorXPosition ); - + // alternate version: -// double Ir = inst.getRotationalInertia(); -// double It = inst.getLongitudinalInertia(); -// + -// + Coordinate curMotorCM = type.getCG(inst); - + // double Ir = inst.getRotationalInertia(); + // double It = inst.getLongitudinalInertia(); + // + + // + Coordinate curMotorCM = type.getCG(inst); + double motorMass = curMotorCM.weight; double Ir_single = mtrConfig.getUnitRotationalInertia()*motorMass; double It_single = mtrConfig.getUnitLongitudinalInertia()*motorMass; @@ -206,7 +208,7 @@ public class MassCalculator implements Monitorable { It=It_single; }else{ It = It_single * instanceCount; - + Ir = Ir_single*instanceCount; // these need more complex instancing code... for( Coordinate coord : locations ){ @@ -220,17 +222,17 @@ public class MassCalculator implements Monitorable { // BEGIN DEVEL //if( debug){ - // // Inertia - // System.err.println(String.format( inertiaFormat, motorIndex, instanceCount, mtr.getDesignation(), Ir, It)); - // // mass only - //double singleMass = type.getCG( mtr ).weight; - //System.err.println(String.format( massFormat, motorIndex, mtr.getDesignation(), - // singleMass, instanceCount, curMotorCM.weight, allMotorData.getMass(),curMotorCM.x, curMotorCM.y, curMotorCM.z )); + // // Inertia + // System.err.println(String.format( inertiaFormat, motorIndex, instanceCount, mtr.getDesignation(), Ir, It)); + // // mass only + //double singleMass = type.getCG( mtr ).weight; + //System.err.println(String.format( massFormat, motorIndex, mtr.getDesignation(), + // singleMass, instanceCount, curMotorCM.weight, allMotorData.getMass(),curMotorCM.x, curMotorCM.y, curMotorCM.z )); //} //motorIndex++; // END DEVEL } - + return allMotorData; } @@ -261,7 +263,7 @@ public class MassCalculator implements Monitorable { motorData = getMotorMassData(config, type); } - + MassData totalData = structureData.add( motorData); if(debug){ System.err.println(String.format(" >> Structural MassData: %s", structureData.toDebug())); @@ -329,6 +331,25 @@ public class MassCalculator implements Monitorable { } return mass; } + + + /** + * Return the total mass of the motors + * + * @param motors the motor configuration + * @param configuration the current motor instance configuration + * @return the total mass of all motors + */ + public double getPropellantMass(SimulationStatus status ){ + double mass = 0; + Collection activeMotorList = status.getMotors(); + for (MotorClusterState curConfig : activeMotorList ) { + int instanceCount = curConfig.getMount().getInstanceCount(); + double motorTime = curConfig.getMotorTime(status.getSimulationTime()); + mass += (curConfig.getMotor().getMassAtMotorTime(motorTime) - curConfig.getMotor().getBurnoutMass())*instanceCount; + } + return mass; + } /** * Compute an analysis of the per-component CG's of the provided configuration. @@ -400,10 +421,10 @@ public class MassCalculator implements Monitorable { if (component.isCGOverridden()) compCM = compCM.setXYZ(component.getOverrideCG()); } - + // default if not instanced (instance count == 1) MassData resultantData = new MassData( compCM, compIx, compIt); - + if( debug && (MIN_MASS < compCM.weight)){ System.err.println(String.format("%-32s: %s ",indent+"ea["+ component.getName()+"]", compCM )); if( component.isMassOverridden() && component.isMassOverridden() && component.getOverrideSubcomponents()){ @@ -423,7 +444,7 @@ public class MassCalculator implements Monitorable { // child data, relative to parent's reference frame MassData childData = calculateAssemblyMassData(child, indent+"...."); - + childrenData = childrenData.add( childData ); } resultantData = resultantData.add( childrenData); @@ -442,23 +463,23 @@ public class MassCalculator implements Monitorable { Coordinate templateCM = resultantData.cm; MassData instAccumData = new MassData(); // accumulator for instance MassData Coordinate[] instanceLocations = ((Instanceable) component).getInstanceOffsets(); - for( Coordinate curOffset : instanceLocations ){ - Coordinate instanceCM = curOffset.add(templateCM); + for( Coordinate curOffset : instanceLocations ){ + Coordinate instanceCM = curOffset.add(templateCM); MassData instanceData = new MassData( instanceCM, curIxx, curIyy, curIzz); // 3) Project the template data to the new CM // and add to the total instAccumData = instAccumData.add( instanceData); } - - resultantData = instAccumData; - - if( debug && (MIN_MASS < compCM.weight)){ - System.err.println(String.format("%-32s: %s ", indent+"x"+component.getInstanceCount()+"["+component.getName()+"][asbly]", resultantData.toDebug())); - } - + + resultantData = instAccumData; + + if( debug && (MIN_MASS < compCM.weight)){ + System.err.println(String.format("%-32s: %s ", indent+"x"+component.getInstanceCount()+"["+component.getName()+"][asbly]", resultantData.toDebug())); + } + } - + // move to parent's reference point resultantData = resultantData.move( component.getOffset() ); @@ -480,7 +501,7 @@ public class MassCalculator implements Monitorable { double newIxx = resultantData.getIxx() * newMass / oldMass; double newIyy = resultantData.getIyy() * newMass / oldMass; double newIzz = resultantData.getIzz() * newMass / oldMass; - + resultantData = new MassData( newCM, newIxx, newIyy, newIzz ); } if (component.isCGOverridden()) { @@ -497,7 +518,7 @@ public class MassCalculator implements Monitorable { if( debug){ System.err.println(String.format("%-32s: %s ", indent+"<<["+component.getName()+"][asbly]", resultantData.toDebug())); } - + return resultantData; } diff --git a/core/src/net/sf/openrocket/motor/Motor.java b/core/src/net/sf/openrocket/motor/Motor.java index 631272cba..73f376258 100644 --- a/core/src/net/sf/openrocket/motor/Motor.java +++ b/core/src/net/sf/openrocket/motor/Motor.java @@ -121,6 +121,8 @@ public interface Motor extends Cloneable { // there's a second (non-trivial) type of motor to support... public double getThrustAtMotorTime( final double motorTimeDelta ); + public double getAverageThrust( final double startTime, final double endTime ); + public double getLaunchCGx(); public double getBurnoutCGx(); @@ -148,5 +150,11 @@ public interface Motor extends Cloneable { * Return an estimate of the total impulse of this motor, or NaN if an estimate is unavailable. */ public double getTotalImpulseEstimate(); - + + + double getMassAtMotorTime(final double motorTime); + + + double getBurnTime(); + } diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java index 9d581022c..2a175f7d6 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotor.java @@ -44,9 +44,9 @@ public class ThrustCurveMotor implements Motor, Comparable, Se private final double[] thrust; // private final double[] cgx; // cannot add without rebuilding the motor database ... automatically on every user's install. // private final double[] mass; // cannot add without rebuilding the motor database ... on every user's install. - private final Coordinate[] cg; /// @deprecated, but required b/c the motor database is serialized java classes. + private final Coordinate[] cg; private double maxThrust; - private double burnTime; + private double burnTimeEstimate; private double averageThrust; private double totalImpulse; @@ -74,7 +74,7 @@ public class ThrustCurveMotor implements Motor, Comparable, Se // this.cgx = Arrays.copyOf(m.cgx, m.cgx.length); // this.mass = Arrays.copyOf(m.mass, m.mass.length); this.maxThrust = m.maxThrust; - this.burnTime = m.burnTime; + this.burnTimeEstimate = m.burnTimeEstimate; this.averageThrust = m.averageThrust; this.totalImpulse = m.totalImpulse; @@ -254,6 +254,51 @@ public class ThrustCurveMotor implements Motor, Comparable, Se } } + @Override + public double getAverageThrust( final double startTime, final double endTime ) { + + int timeIndex = 0; + + while( timeIndex < time.length-2 && startTime > time[timeIndex+1] ) { + timeIndex++; + } + + if ( timeIndex == time.length ) { + return 0.0; + } + + if ( endTime <= time[timeIndex+1] ) { + // we are completely within this time slice so the computation of the average is pretty easy: + double avgImpulse = MathUtil.map(startTime, time[timeIndex], time[timeIndex+1], thrust[timeIndex], thrust[timeIndex+1]); + avgImpulse += MathUtil.map(endTime, time[timeIndex], time[timeIndex+1], thrust[timeIndex], thrust[timeIndex+1]); + avgImpulse /= 2.0; + return avgImpulse; + } + + // portion from startTime through time[timeIndex] + double avgImpulse = 0.0; + // For numeric stability. + if( time[timeIndex+1] - startTime > 0.001 ) { + avgImpulse = (MathUtil.map(startTime, time[timeIndex], time[timeIndex+1], thrust[timeIndex], thrust[timeIndex+1]) + thrust[timeIndex+1]) + / 2.0 * (time[timeIndex+1] - startTime); + } + + // Now add the whole steps; + timeIndex++; + while( timeIndex < time.length -1 && endTime >= time[timeIndex+1] ) { + avgImpulse += (thrust[timeIndex] + thrust[timeIndex+1]) / 2.0 * (time[timeIndex+1]-time[timeIndex]); + timeIndex++; + } + + // Now add the bit after the last time index + if ( timeIndex < time.length -1 ) { + double endInstImpulse = MathUtil.map( endTime, time[timeIndex], time[timeIndex+1], thrust[timeIndex], thrust[timeIndex+1]); + avgImpulse += (thrust[timeIndex] + endInstImpulse) / 2.0 * (endTime - time[timeIndex]); + } + + return avgImpulse / (endTime - startTime); + } + @Override public double getThrustAtMotorTime( final double searchTime ){ double pseudoIndex = getPseudoIndex( searchTime ); @@ -355,7 +400,7 @@ public class ThrustCurveMotor implements Motor, Comparable, Se } @Override - public ThrustCurveMotor clone() { + public Motor clone() { return new ThrustCurveMotor(this); } @@ -379,6 +424,12 @@ public class ThrustCurveMotor implements Motor, Comparable, Se return cg[cg.length-1].weight; //mass[mass.length - 1]; } + @Override + public double getBurnTime() { + return time[time.length-1]; + } + + // FIXME - there seems to be some numeric problems in here... private static double interpolateValueAtIndex( final double[] values, final double pseudoIndex ){ final double SNAP_TOLERANCE = 0.0001; @@ -388,11 +439,11 @@ public class ThrustCurveMotor implements Motor, Comparable, Se final int upperIndex= lowerIndex+1; // if the pseudo - if( SNAP_TOLERANCE > (1-lowerFrac) ){ + if( SNAP_TOLERANCE > lowerFrac ){ // 1-lowerFrac = 1-(1-upperFrac) = upperFrac ?!? // index ~= int ... therefore: - return values[ (int) pseudoIndex ]; + return values[ lowerIndex ]; }else if( SNAP_TOLERANCE > upperFrac ){ - return values[ (int)upperIndex ]; + return values[ upperIndex ]; } final double lowerValue = values[lowerIndex]; @@ -409,6 +460,13 @@ public class ThrustCurveMotor implements Motor, Comparable, Se public double getMotorTimeAtIndex( final double index ){ return interpolateValueAtIndex( this.time, index ); } + + @Override + public double getMassAtMotorTime( final double motorTime ) { + double pseudoIndex = getPseudoIndex(motorTime); + Coordinate cg = getCGAtIndex( pseudoIndex ); + return cg.weight; + } @Deprecated public Coordinate getCGAtIndex( final double pseudoIndex ){ @@ -431,7 +489,7 @@ public class ThrustCurveMotor implements Motor, Comparable, Se final Coordinate upperValue = cg[upperIndex].multiply(upperFrac); // return simple linear interpolation - return lowerValue.add( upperValue ); + return lowerValue.average( upperValue ); } @@ -461,7 +519,7 @@ public class ThrustCurveMotor implements Motor, Comparable, Se @Override public double getBurnTimeEstimate() { - return burnTime; + return burnTimeEstimate; } @Override @@ -541,7 +599,7 @@ public class ThrustCurveMotor implements Motor, Comparable, Se // Burn time - burnTime = Math.max(burnEnd - burnStart, 0); + burnTimeEstimate = Math.max(burnEnd - burnStart, 0); // Total impulse and average thrust @@ -567,8 +625,8 @@ public class ThrustCurveMotor implements Motor, Comparable, Se } } - if (burnTime > 0) { - averageThrust /= burnTime; + if (burnTimeEstimate > 0) { + averageThrust /= burnTimeEstimate; } else { averageThrust = 0; } diff --git a/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java b/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java index da8a48db0..748e7c1bf 100644 --- a/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java +++ b/core/src/net/sf/openrocket/motor/ThrustCurveMotorPlaceholder.java @@ -197,5 +197,21 @@ public class ThrustCurveMotorPlaceholder implements Motor { public double getThrustAtMotorTime(double pseudoIndex) { return 0; } - + + + @Override + public double getAverageThrust(double startTime, double endTime) { + return 0; + } + + @Override + public double getMassAtMotorTime(final double motorTime) { + return 0; + } + + @Override + public double getBurnTime() { + return 0; + } + } diff --git a/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java b/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java index 8d041d66c..3699dcddf 100644 --- a/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java +++ b/core/src/net/sf/openrocket/simulation/AbstractSimulationStepper.java @@ -128,7 +128,7 @@ public abstract class AbstractSimulationStepper implements SimulationStepper { longitudinalInertia = calc.getLongitudinalInertia(status.getConfiguration(), MassCalcType.LAUNCH_MASS); rotationalInertia = calc.getRotationalInertia(status.getConfiguration(), MassCalcType.LAUNCH_MASS); mass = new MassData(cg, rotationalInertia, longitudinalInertia); - propellantMass = calc.getPropellantMass(status.getConfiguration(), MassCalcType.LAUNCH_MASS); + propellantMass = calc.getPropellantMass(status); mass.setPropellantMass( propellantMass ); // Call post-listener @@ -172,7 +172,7 @@ public abstract class AbstractSimulationStepper implements SimulationStepper { final double currentTime = status.getSimulationTime() + timestep; Collection activeMotorList = status.getMotors(); for (MotorClusterState currentMotorState : activeMotorList ) { - thrust += currentMotorState.getThrust( currentTime, atmosphericConditions ); + thrust += currentMotorState.getAverageThrust( status.getSimulationTime(), currentTime ); } // Post-listeners diff --git a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java index ddabdb146..580730e7e 100644 --- a/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java +++ b/core/src/net/sf/openrocket/simulation/BasicEventSimulationEngine.java @@ -252,8 +252,8 @@ public class BasicEventSimulationEngine implements SimulationEngine { FlightEvent event; log.trace("HandleEvents: current branch = " + currentStatus.getFlightData().getBranchName()); - log.trace("EventQueue = " + currentStatus.getEventQueue().toString()); for (event = nextEvent(); event != null; event = nextEvent()) { + log.trace("EventQueue = " + currentStatus.getEventQueue().toString()); // Ignore events for components that are no longer attached to the rocket if (event.getSource() != null && event.getSource().getParent() != null && @@ -345,9 +345,10 @@ public class BasicEventSimulationEngine implements SimulationEngine { if (!SimulationListenerHelper.fireMotorIgnition(currentStatus, motorId, mount, motorState)) { continue; } - + // and queue up the burnout for this motor, as well. - double duration = motorState.getMotor().getBurnTimeEstimate(); +// double duration = motorState.getMotor().getBurnTimeEstimate(); + double duration = motorState.getBurnTime(); double burnout = currentStatus.getSimulationTime() + duration; addEvent(new FlightEvent(FlightEvent.Type.BURNOUT, burnout, event.getSource(), motorState )); diff --git a/core/src/net/sf/openrocket/simulation/MotorClusterState.java b/core/src/net/sf/openrocket/simulation/MotorClusterState.java index 47228cd3e..ac855046d 100644 --- a/core/src/net/sf/openrocket/simulation/MotorClusterState.java +++ b/core/src/net/sf/openrocket/simulation/MotorClusterState.java @@ -1,6 +1,5 @@ package net.sf.openrocket.simulation; -import net.sf.openrocket.models.atmosphere.AtmosphericConditions; import net.sf.openrocket.motor.IgnitionEvent; import net.sf.openrocket.motor.Motor; import net.sf.openrocket.motor.MotorConfiguration; @@ -52,12 +51,15 @@ public class MotorClusterState { public void burnOut( final double _burnOutTime ){ if( ThrustState.THRUSTING == currentState ){ - this.ignitionTime = _burnOutTime; + this.cutoffTime = _burnOutTime; this.currentState = this.currentState.getNext(); // }else{ // System.err.println("!! Attempted to turn off motor state "+toDescription()+" with current status=" // +this.currentState.getName()+" ... Ignoring."); - } + } + if( !this.hasEjectionCharge() ) { + this.currentState = ThrustState.SPENT; + } } public void expend( final double _ejectionTime ){ @@ -70,6 +72,9 @@ public class MotorClusterState { } } + public double getBurnTime( ) { + return motor.getBurnTime(); + } /** * Alias for "burnOut(double)" */ @@ -105,10 +110,18 @@ public class MotorClusterState { return _simulationTime - this.getIgnitionTime(); } - public double getThrust( final double simulationTime, final AtmosphericConditions cond){ - if( this.currentState.isThrusting() ){ - double motorTime = this.getMotorTime( simulationTime); - return this.motorCount * motor.getThrustAtMotorTime( motorTime ); + /** + * Compute the average thrust over an interval. + * + * @param simulationTime + * @param cond + * @return + */ + public double getAverageThrust( final double startTime, final double endTime) { + if( this.currentState.isThrusting() ) { + double motorStartTime = this.getMotorTime( startTime ); + double motorEndTime = this.getMotorTime(endTime); + return this.motorCount * motor.getAverageThrust( motorStartTime, motorEndTime ); }else{ return 0.0; } diff --git a/core/src/net/sf/openrocket/utils/MotorCorrelation.java b/core/src/net/sf/openrocket/utils/MotorCorrelation.java index fc9c42a1f..23642f766 100644 --- a/core/src/net/sf/openrocket/utils/MotorCorrelation.java +++ b/core/src/net/sf/openrocket/utils/MotorCorrelation.java @@ -9,7 +9,6 @@ import java.util.List; import net.sf.openrocket.file.motor.GeneralMotorLoader; import net.sf.openrocket.file.motor.MotorLoader; import net.sf.openrocket.motor.Motor; -import net.sf.openrocket.motor.ThrustCurveMotor; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.MathUtil; @@ -116,7 +115,7 @@ public class MotorCorrelation { // Output motor digests final int count = motors.size(); for (int i = 0; i < count; i++) { - System.out.println(files.get(i) + ": " + ((ThrustCurveMotor) motors.get(i)).getDigest()); + System.out.println(files.get(i) + ": " + ((Motor) motors.get(i)).getDigest()); } // Cross-correlate every pair diff --git a/core/src/net/sf/openrocket/utils/MotorDigester.java b/core/src/net/sf/openrocket/utils/MotorDigester.java index 5940f4622..4cc971d5c 100644 --- a/core/src/net/sf/openrocket/utils/MotorDigester.java +++ b/core/src/net/sf/openrocket/utils/MotorDigester.java @@ -46,7 +46,7 @@ public class MotorDigester { continue; } - String digest = ((ThrustCurveMotor) m).getDigest(); + String digest = ((Motor) m).getDigest(); if (printFileNames) { System.out.print(file + ": "); } diff --git a/core/test/net/sf/openrocket/file/motor/TestMotorLoader.java b/core/test/net/sf/openrocket/file/motor/TestMotorLoader.java index ee8e47978..8d1cc719a 100644 --- a/core/test/net/sf/openrocket/file/motor/TestMotorLoader.java +++ b/core/test/net/sf/openrocket/file/motor/TestMotorLoader.java @@ -10,7 +10,6 @@ import java.util.Arrays; import java.util.List; import net.sf.openrocket.motor.Motor; -import net.sf.openrocket.motor.ThrustCurveMotor; import org.junit.Test; @@ -63,7 +62,7 @@ public class TestMotorLoader { String[] d = new String[digests.length]; for (int i = 0; i < motors.size(); i++) { - d[i] = ((ThrustCurveMotor) motors.get(i)).getDigest(); + d[i] = ((Motor) motors.get(i)).getDigest(); } Arrays.sort(digests);