Merge remote-tracking branch 'upstream/unstable' into unstable
This commit is contained in:
commit
d3240ec1a4
@ -1,5 +1,10 @@
|
||||
package net.sf.openrocket.file.rocksim.export;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
|
||||
import net.sf.openrocket.file.rocksim.RocksimDensityType;
|
||||
import net.sf.openrocket.file.rocksim.RocksimFinishCode;
|
||||
@ -12,11 +17,6 @@ import net.sf.openrocket.rocketcomponent.RingComponent;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.StructuralComponent;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* The base class for all OpenRocket to Rocksim conversions.
|
||||
*/
|
||||
@ -88,17 +88,17 @@ public abstract class BasePartDTO {
|
||||
setUseKnownCG(ec.isCGOverridden() || ec.isMassOverridden() ? 1 : 0);
|
||||
setName(ec.getName());
|
||||
|
||||
setXb(ec.getPositionValue() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
setXb(ec.getAxialOffset() * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
|
||||
//When the relative position is BOTTOM, the position location of the bottom edge of the component is +
|
||||
//to the right of the bottom of the parent, and - to the left.
|
||||
//But in Rocksim, it's + to the left and - to the right
|
||||
if (ec.getRelativePosition().equals(RocketComponent.Position.BOTTOM)) {
|
||||
setXb((-1 * ec.getPositionValue()) * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
setXb((-1 * ec.getAxialOffset()) * RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
}
|
||||
else if (ec.getRelativePosition().equals(RocketComponent.Position.MIDDLE)) {
|
||||
//Mapped to TOP, so adjust accordingly
|
||||
setXb((ec.getPositionValue() + (ec.getParent().getLength() - ec.getLength()) /2)* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
setXb((ec.getAxialOffset() + (ec.getParent().getLength() - ec.getLength()) /2)* RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH);
|
||||
}
|
||||
|
||||
if (ec instanceof ExternalComponent) {
|
||||
|
@ -5,6 +5,8 @@ package net.sf.openrocket.file.rocksim.importt;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.file.DocumentLoadingContext;
|
||||
import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
|
||||
@ -18,8 +20,6 @@ import net.sf.openrocket.rocketcomponent.RingComponent;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.TubeCoupler;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* A SAX handler for centering rings, tube couplers, and bulkheads.
|
||||
*/
|
||||
@ -174,7 +174,7 @@ class RingHandler extends PositionDependentHandler<CenteringRing> {
|
||||
result.setName(ring.getName());
|
||||
setOverride(result, ring.isOverrideSubcomponentsEnabled(), ring.getOverrideMass(), ring.getOverrideCGX());
|
||||
result.setRelativePosition(ring.getRelativePosition());
|
||||
result.setPositionValue(ring.getPositionValue());
|
||||
result.setAxialOffset(ring.getAxialOffset());
|
||||
result.setMaterial(ring.getMaterial());
|
||||
result.setThickness(result.getThickness());
|
||||
}
|
||||
|
@ -14,28 +14,14 @@ 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;
|
||||
import net.sf.openrocket.util.Monitorable;
|
||||
|
||||
public class MassCalculator implements Monitorable {
|
||||
|
||||
// public static enum MassCalcType {
|
||||
// NO_MOTORS( Double.NaN),
|
||||
// LAUNCH_MASS(0.),
|
||||
// BURNOUT_MASS(Double.MAX_VALUE);
|
||||
//
|
||||
// public final double motorTime;
|
||||
//
|
||||
// MassCalcType( final double _motorTime ){
|
||||
// this.motorTime = _motorTime; }
|
||||
//
|
||||
// };
|
||||
|
||||
//private static final Logger log = LoggerFactory.getLogger(MassCalculator.class);
|
||||
|
||||
public boolean debug=true;
|
||||
|
||||
public static final double MIN_MASS = 0.001 * MathUtil.EPSILON;
|
||||
|
||||
private int rocketMassModID = -1;
|
||||
@ -90,15 +76,6 @@ public class MassCalculator implements Monitorable {
|
||||
protected MassData calculatePropellantMassData( final FlightConfiguration config ){
|
||||
MassData allPropellantData = MassData.ZERO_DATA;
|
||||
|
||||
if(debug){// vvvv DEVEL vvvv
|
||||
System.err.println("====== ====== calculatePropellantMassData( config: "+config.toDebug()+" ) ====== ====== ====== ====== ====== ======");
|
||||
//String massFormat = " [%2s]: %-16s %6s x %6s = %6s += %6s @ (%s, %s, %s )";
|
||||
//System.err.println(String.format(massFormat, " #", "<Designation>","Mass","Count","Config","Sum", "x","y","z"));
|
||||
String inertiaFormat = " [%2s](%2s): %-16s %6s %6s";
|
||||
System.err.println(String.format(inertiaFormat, " #","ct", "<Designation>","I_ax","I_tr"));
|
||||
}// ^^^^ DEVEL ^^^^
|
||||
|
||||
|
||||
Collection<MotorConfiguration> activeMotorList = config.getActiveMotors();
|
||||
for (MotorConfiguration mtrConfig : activeMotorList ) {
|
||||
MassData curMotorConfigData = calculateClusterPropellantData( mtrConfig, Motor.PSEUDO_TIME_LAUNCH );
|
||||
@ -117,15 +94,6 @@ public class MassCalculator implements Monitorable {
|
||||
protected MassData calculatePropellantMassData( final SimulationStatus status ){
|
||||
MassData allPropellantData = MassData.ZERO_DATA;
|
||||
|
||||
if(debug){// vvvv DEVEL vvvv
|
||||
System.err.println("====== ====== calculatePropellantMassData( status.config: "+status.getConfiguration().toDebug()+" ) ====== ====== ====== ====== ====== ======");
|
||||
//String massFormat = " [%2s]: %-16s %6s x %6s = %6s += %6s @ (%s, %s, %s )";
|
||||
//System.err.println(String.format(massFormat, " #", "<Designation>","Mass","Count","Config","Sum", "x","y","z"));
|
||||
String inertiaFormat = " [%2s](%2s): %-16s %6s %6s";
|
||||
System.err.println(String.format(inertiaFormat, " #","ct", "<Designation>","I_ax","I_tr"));
|
||||
}// ^^^^ DEVEL ^^^^
|
||||
|
||||
|
||||
Collection<MotorClusterState> motorStates = status.getActiveMotors();
|
||||
for (MotorClusterState state: motorStates) {
|
||||
final double motorTime = state.getMotorTime( status.getSimulationTime() );
|
||||
@ -158,11 +126,6 @@ public class MassCalculator implements Monitorable {
|
||||
final double unitLongitudinalInertiaEach = mtrConfig.getUnitLongitudinalInertia();
|
||||
double Ir=unitRotationalInertiaEach*instanceCount*propMassEach;
|
||||
double It=unitLongitudinalInertiaEach*instanceCount*propMassEach;
|
||||
|
||||
if(debug){
|
||||
System.err.println(String.format(" Motor: %-16s ( %2dx): m: %6.4f l: %6.4f od: %6.4f I_xx_u: %6.4g I_yy_u: %6.4g",
|
||||
mtr.getDesignation(), instanceCount, propMassEach, mtr.getLength(), mtr.getDiameter(), unitRotationalInertiaEach, unitLongitudinalInertiaEach));
|
||||
}// ^^^^ DEVEL ^^^^
|
||||
|
||||
if( 1 < instanceCount ){
|
||||
// if not on rocket centerline, then add an offset factor, according to the parallel axis theorem:
|
||||
@ -171,10 +134,7 @@ public class MassCalculator implements Monitorable {
|
||||
Ir += propMassEach*Math.pow( distance, 2);
|
||||
}
|
||||
}
|
||||
if(debug){
|
||||
System.err.println(String.format(" :cluster: m: %6.4f Ixx: %6.4g Iyy: %6.4g", curClusterCM.weight, Ir, It));
|
||||
}
|
||||
|
||||
|
||||
return new MassData( curClusterCM, Ir, It);
|
||||
}
|
||||
|
||||
@ -187,29 +147,10 @@ public class MassCalculator implements Monitorable {
|
||||
* @return the CG of the configuration
|
||||
*/
|
||||
protected MassData calculateBurnoutMassData( final FlightConfiguration config) {
|
||||
if(debug){// vvvv DEVEL vvvv
|
||||
//String massFormat = " [%2s]: %-16s %6s x %6s = %6s += %6s @ (%s, %s, %s )";
|
||||
String inertiaFormat = " [%2s](%2s): %-16s %6s %6s";
|
||||
System.err.println("====== ====== getMotorMassData( config:"+config.toDebug()+" ) ====== ====== ====== ====== ====== ======");
|
||||
//System.err.println(String.format(massFormat, " #", "<Designation>","Mass","Count","Config","Sum", "x","y","z"));
|
||||
System.err.println(String.format(inertiaFormat, " #","ct", "<Designation>","I_ax","I_tr"));
|
||||
}// ^^^^ DEVEL ^^^^
|
||||
|
||||
MassData exceptMotorsMassData = calculateStageData( config);
|
||||
|
||||
if(debug){// vvvv DEVEL vvvv
|
||||
System.err.println(" exc motors stage data: "+exceptMotorsMassData );
|
||||
System.err.println(" ====== ====== ^^^^ stage data ^^^^ ====== ======\n");
|
||||
System.err.println(" ====== ====== vvvv motor spent mass data vvvv ====== ======\n");
|
||||
}// ^^^^ DEVEL ^^^^
|
||||
|
||||
MassData motorMassData = calculateMotorBurnoutMassData( config);
|
||||
|
||||
if(debug){ // vvvv DEVEL vvvv
|
||||
System.err.println(" exc motors stage data: "+motorMassData);
|
||||
System.err.println(" ====== ====== ^^^^ motor spent mass data ^^^^ ====== ======\n\n");
|
||||
} // ^^^^ DEVEL ^^^^
|
||||
|
||||
return exceptMotorsMassData.add( motorMassData );
|
||||
}
|
||||
|
||||
@ -240,15 +181,6 @@ public class MassCalculator implements Monitorable {
|
||||
* @return the MassData struct of the motors at burnout
|
||||
*/
|
||||
private MassData calculateMotorBurnoutMassData(FlightConfiguration config) {
|
||||
// // 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, " #", "<Designation>","Mass","Count","Config","Sum", "x","y","z"));
|
||||
// System.err.println(String.format(inertiaFormat, " #","ct", "<Designation>","I_ax","I_tr"));
|
||||
// }
|
||||
// // ^^^^ DEVEL ^^^^
|
||||
|
||||
MassData allMotorData = MassData.ZERO_DATA;
|
||||
|
||||
@ -273,31 +205,15 @@ public class MassCalculator implements Monitorable {
|
||||
final double unitRotationalInertia = mtrConfig.getUnitRotationalInertia();
|
||||
final double unitLongitudinalInertia = mtrConfig.getUnitLongitudinalInertia();
|
||||
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format(" Processing f/mount: %s [%8s] (ct: %d)(w/spent mass = %g)", mtrConfig.getMount(), mtr.getDesignation(), instanceCount, mtr.getBurnoutMass()));
|
||||
double eachIxx = unitRotationalInertia*burnoutMassEach;
|
||||
double eachIyy = unitLongitudinalInertia*burnoutMassEach;
|
||||
System.err.println(String.format("(MOI: [%8g, %8g])", eachIxx, eachIyy));
|
||||
} // ^^ DEBUG
|
||||
|
||||
double Ir=(unitRotationalInertia*burnoutMassEach)*instanceCount;
|
||||
double It=(unitLongitudinalInertia*burnoutMassEach)*instanceCount;
|
||||
if( 1 < instanceCount ){
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format(" Instanced. %d motors in a %s", instanceCount, mount.getClusterConfiguration().getXMLName()));
|
||||
System.err.println(String.format(" I_long: %6g * %6g * %d = %6g ", unitLongitudinalInertia, burnoutMassEach, instanceCount, It));
|
||||
System.err.println(String.format(" I_rot_base: %6g * %6g * %d = %6g ", unitRotationalInertia, burnoutMassEach, instanceCount, Ir));
|
||||
} // ^^ DEBUG
|
||||
|
||||
for( Coordinate coord : locations ){
|
||||
double distance_squared = ((coord.y*coord.y) + (coord.z*coord.z));
|
||||
double instance_correction = burnoutMassEach*distance_squared;
|
||||
|
||||
Ir += instance_correction;
|
||||
}
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format(" I_rot: %6g ", Ir));
|
||||
} // ^^ DEBUG
|
||||
}
|
||||
|
||||
MassData configData = new MassData( clusterCM, Ir, It);
|
||||
@ -368,6 +284,15 @@ public class MassCalculator implements Monitorable {
|
||||
Coordinate compCM = component.getComponentCG();
|
||||
double compIx = component.getRotationalUnitInertia() * compCM.weight;
|
||||
double compIt = component.getLongitudinalUnitInertia() * compCM.weight;
|
||||
if( 0 > compCM.weight ){
|
||||
throw new BugException(" computed a negative rotational inertia value.");
|
||||
}
|
||||
if( 0 > compIx ){
|
||||
throw new BugException(" computed a negative rotational inertia value.");
|
||||
}
|
||||
if( 0 > compIt ){
|
||||
throw new BugException(" computed a negative longitudinal inertia value.");
|
||||
}
|
||||
|
||||
if (!component.getOverrideSubcomponents()) {
|
||||
if (component.isMassOverridden())
|
||||
@ -379,15 +304,6 @@ public class MassCalculator implements Monitorable {
|
||||
// default if not instanced (instance count == 1)
|
||||
MassData assemblyData = 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()){
|
||||
System.err.println(indent+" ?["+ component.isMassOverridden()+"]["+
|
||||
component.isMassOverridden()+"]["+
|
||||
component.getOverrideSubcomponents()+"]");
|
||||
}
|
||||
}
|
||||
|
||||
MassData childrenData = MassData.ZERO_DATA;
|
||||
// Combine data for subcomponents
|
||||
for (RocketComponent child : component.getChildren()) {
|
||||
@ -405,10 +321,6 @@ public class MassCalculator implements Monitorable {
|
||||
|
||||
// if instanced, adjust children's data too.
|
||||
if ( 1 < component.getInstanceCount() ){
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format("%s Found instanceable with %d children: %s (t= %s)",
|
||||
indent, component.getInstanceCount(), component.getName(), component.getClass().getSimpleName() ));
|
||||
}// ^^ DEBUG
|
||||
|
||||
final double curIxx = childrenData.getIxx(); // MOI about x-axis
|
||||
final double curIyy = childrenData.getIyy(); // MOI about y axis
|
||||
@ -427,11 +339,6 @@ public class MassCalculator implements Monitorable {
|
||||
}
|
||||
|
||||
assemblyData = instAccumData;
|
||||
|
||||
if( debug && (MIN_MASS < compCM.weight)){
|
||||
System.err.println(String.format("%-32s: %s ", indent+"x"+component.getInstanceCount()+"["+component.getName()+"][asbly]", assemblyData.toDebug()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -443,11 +350,7 @@ public class MassCalculator implements Monitorable {
|
||||
}
|
||||
|
||||
// Override total data
|
||||
if (component.getOverrideSubcomponents()) {
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format("%-32s: %s ", indent+"vv["+component.getName()+"][asbly]", assemblyData.toDebug()));
|
||||
}// ^^ DEBUG
|
||||
|
||||
if (component.getOverrideSubcomponents()) {
|
||||
if (component.isMassOverridden()) {
|
||||
double oldMass = assemblyData.getMass();
|
||||
double newMass = MathUtil.max(component.getOverrideMass(), MIN_MASS);
|
||||
@ -463,30 +366,19 @@ public class MassCalculator implements Monitorable {
|
||||
double oldx = assemblyData.getCM().x;
|
||||
double newx = component.getOverrideCGX();
|
||||
Coordinate delta = new Coordinate(newx-oldx, 0, 0);
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format("%-32s: x: %g => %g (%g)", indent+" 88", oldx, newx, delta.x));
|
||||
}// ^^ DEBUG
|
||||
|
||||
assemblyData = assemblyData.move( delta );
|
||||
}
|
||||
}
|
||||
|
||||
if(debug){// vv DEBUG
|
||||
System.err.println(String.format("%-32s: %s ", indent+"<<["+component.getName()+"][asbly]", assemblyData.toDebug()));
|
||||
}// ^^ DEBUG
|
||||
|
||||
return assemblyData;
|
||||
}
|
||||
|
||||
|
||||
/// nooooot quite done, yet.
|
||||
public void revalidateCache( final SimulationStatus status ){
|
||||
//if( ... check what? the config may not have changed, but if the time has, we want to recalculate the cache!
|
||||
rocketSpentMassCache = calculateBurnoutMassData( status.getConfiguration() );
|
||||
rocketSpentMassCache = calculateBurnoutMassData( status.getConfiguration() );
|
||||
|
||||
propellantMassCache = calculatePropellantMassData( status);
|
||||
|
||||
//}
|
||||
propellantMassCache = calculatePropellantMassData( status);
|
||||
}
|
||||
|
||||
public void revalidateCache( final FlightConfiguration config ){
|
||||
@ -511,7 +403,6 @@ public class MassCalculator implements Monitorable {
|
||||
* @param configuration the configuration of the current call
|
||||
*/
|
||||
protected final boolean checkCache(FlightConfiguration configuration) {
|
||||
//System.err.println("?? Checking the cache ... ");
|
||||
if (rocketMassModID != configuration.getRocket().getMassModID() ||
|
||||
rocketTreeModID != configuration.getRocket().getTreeModID()) {
|
||||
rocketMassModID = configuration.getRocket().getMassModID();
|
||||
|
@ -136,23 +136,6 @@ public class MassData {
|
||||
InertiaMatrix combinedMOI = I1_at_3.add(I2_at_3);
|
||||
MassData sumData = new MassData( combinedCM, combinedMOI);
|
||||
|
||||
{ // vvvv DEVEL vvvv
|
||||
// System.err.println(" ?? body1: "+ body1.toDebug() );
|
||||
// System.err.println(" delta 1=>3: "+ delta1);
|
||||
// System.err.println(String.format(" >> 1@3: == [ %g, %g, %g ]",
|
||||
// I1_at_3.xx, I1_at_3.yy, I1_at_3.zz));
|
||||
//
|
||||
// System.err.println(" ?? body2: "+ body2.toDebug() );
|
||||
// System.err.println(" delta 2=>3: "+ delta2);
|
||||
// System.err.println(String.format(" >> 2@3: [ %g, %g, %g ]",
|
||||
// I2_at_3.xx, I2_at_3.yy, I2_at_3.zz));
|
||||
// System.err.println(" ?? asbly3: "+sumData.toDebug()+"\n");
|
||||
|
||||
// InertiaMatrix rev1 = It1.translateInertia(delta1.multiply(-1), body1.getMass());
|
||||
// System.err.println(String.format(" !!XX orig: %s\n", childDataChild.toDebug() ));
|
||||
// System.err.println(String.format("%s!!XX revr: %s\n", indent, reverse.toDebug() ));
|
||||
}
|
||||
|
||||
return sumData;
|
||||
}
|
||||
|
||||
@ -249,11 +232,6 @@ public class MassData {
|
||||
|
||||
MassData newData = new MassData( newCM, this.I_cm);
|
||||
|
||||
{ // DEVEL-DEBUG
|
||||
// System.err.println(" ?? body1: "+ body1.toDebug() );
|
||||
// System.err.println(" delta: "+ delta);
|
||||
// System.err.println(" ?? asbly3: "+newData.toDebug()+"\n");
|
||||
}
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
@ -46,13 +46,15 @@ public class MotorConfiguration implements FlightConfigurableParameter<MotorConf
|
||||
modID++;
|
||||
}
|
||||
|
||||
public MotorConfiguration( final MotorMount _mount, final FlightConfigurationId _fcid, final MotorConfiguration _template ) {
|
||||
public MotorConfiguration( final MotorMount _mount, final FlightConfigurationId _fcid, final MotorConfiguration _source ) {
|
||||
this( _mount, _fcid);
|
||||
|
||||
if( null != _template){
|
||||
ejectionDelay = _template.getEjectionDelay();
|
||||
ignitionEvent = _template.getIgnitionEvent();
|
||||
ignitionDelay = _template.getIgnitionDelay();
|
||||
if( null != _source){
|
||||
motor = _source.motor;
|
||||
ejectionDelay = _source.ejectionDelay;
|
||||
ignitionOveride = _source.ignitionOveride;
|
||||
ignitionEvent = _source.getIgnitionEvent();
|
||||
ignitionDelay = _source.getIgnitionDelay();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class MotorConfigurationSet extends FlightConfigurableParameterSet<MotorC
|
||||
public String toDebug(){
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
final MotorMount mnt = this.getDefault().getMount();
|
||||
buffer.append(String.format(" ====== Dumping MotorConfigurationSet: %d motors in %s ====== ",
|
||||
buffer.append(String.format(" ====== Dumping MotorConfigurationSet: %d motors in %s ======\n",
|
||||
this.size(), mnt.getDebugName() ));
|
||||
|
||||
for( FlightConfigurationId loopFCID : this.map.keySet()){
|
||||
|
@ -87,13 +87,7 @@ public class AxialStage extends ComponentAssembly implements FlightConfigurableC
|
||||
copy.separations = new FlightConfigurableParameterSet<StageSeparationConfiguration>(separations);
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPositionValue() {
|
||||
mutex.verify();
|
||||
|
||||
return this.getAxialOffset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stages may be positioned relative to other stages. In that case, this will set the stage number
|
||||
|
@ -257,25 +257,12 @@ public abstract class FinSet extends ExternalComponent {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setRelativePosition(RocketComponent.Position position) {
|
||||
super.setRelativePosition(position);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPositionValue(double value) {
|
||||
super.setPositionValue(value);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public double getTabHeight() {
|
||||
return tabHeight;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package net.sf.openrocket.rocketcomponent;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
@ -42,18 +41,17 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
|
||||
private class StageFlags implements Cloneable {
|
||||
public boolean active = true;
|
||||
public int prev = -1;
|
||||
public AxialStage stage = null;
|
||||
//public int prev = -1;
|
||||
public int stageNumber = -1;
|
||||
|
||||
public StageFlags(AxialStage _stage, int _prev, boolean _active) {
|
||||
this.stage = _stage;
|
||||
this.prev = _prev;
|
||||
public StageFlags( int _num, boolean _active) {
|
||||
this.stageNumber = _num;
|
||||
this.active = _active;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StageFlags clone(){
|
||||
return new StageFlags( this.stage, this.prev, true);
|
||||
return new StageFlags( this.stageNumber, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +189,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
|
||||
for (StageFlags flags : this.stages.values()) {
|
||||
if (flags.active) {
|
||||
activeStages.add(flags.stage);
|
||||
activeStages.add( rocket.getStage( flags.stageNumber) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +213,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
AxialStage bottomStage = null;
|
||||
for (StageFlags curFlags : this.stages.values()) {
|
||||
if (curFlags.active) {
|
||||
bottomStage = curFlags.stage;
|
||||
bottomStage = rocket.getStage( curFlags.stageNumber);
|
||||
}
|
||||
}
|
||||
return bottomStage;
|
||||
@ -264,18 +262,14 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
}
|
||||
|
||||
private void updateStages() {
|
||||
if (this.rocket.getStageCount() == this.stages.size()) {
|
||||
// no changes needed
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.rocket.getStageCount() == this.stages.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stages.clear();
|
||||
for (AxialStage curStage : this.rocket.getStageList()) {
|
||||
int prevStageNum = curStage.getStageNumber() - 1;
|
||||
if (curStage.getParent() instanceof AxialStage) {
|
||||
prevStageNum = curStage.getParent().getStageNumber();
|
||||
}
|
||||
StageFlags flagsToAdd = new StageFlags(curStage, prevStageNum, true);
|
||||
|
||||
StageFlags flagsToAdd = new StageFlags( curStage.getStageNumber(), true);
|
||||
this.stages.put(curStage.getStageNumber(), flagsToAdd);
|
||||
}
|
||||
}
|
||||
@ -361,9 +355,7 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
private void updateMotors() {
|
||||
this.motors.clear();
|
||||
|
||||
Iterator<RocketComponent> iter = rocket.iterator(false);
|
||||
while( iter.hasNext() ){
|
||||
RocketComponent comp = iter.next();
|
||||
for ( RocketComponent comp : getActiveComponents() ){
|
||||
if (( comp instanceof MotorMount )&&( ((MotorMount)comp).isMotorMount())){
|
||||
MotorMount mount = (MotorMount)comp;
|
||||
MotorConfiguration motorConfig = mount.getMotorConfig( fcid);
|
||||
@ -443,16 +435,21 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a deep-clone. The object references are also cloned and no
|
||||
* listeners are listening on the cloned object. The rocket instance remains the same.
|
||||
* Perform a shallow-clone; copies configuration fields only.
|
||||
*
|
||||
* Preserved:
|
||||
* - components
|
||||
* - motors
|
||||
* - configurables
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public FlightConfiguration clone() {
|
||||
|
||||
// Note the stages are updated in the constructor call.
|
||||
FlightConfiguration clone = new FlightConfiguration( this.rocket, this.fcid );
|
||||
clone.setName("clone[#"+clone.instanceNumber+"]"+clone.fcid.toShortKey());
|
||||
|
||||
clone.setName(configurationName);
|
||||
|
||||
clone.cachedBounds = this.cachedBounds.clone();
|
||||
clone.modID = this.modID;
|
||||
clone.boundsModID = -1;
|
||||
@ -532,8 +529,8 @@ public class FlightConfiguration implements FlightConfigurableParameter<FlightCo
|
||||
final String fmt = " [%-2s][%4s]: %6s \n";
|
||||
buf.append(String.format(fmt, "#", "?actv", "Name"));
|
||||
for (StageFlags flags : stages.values()) {
|
||||
AxialStage curStage = flags.stage;
|
||||
buf.append(String.format(fmt, curStage.getStageNumber(), (flags.active?" on": "off"), curStage.getName()));
|
||||
final int stageNumber = flags.stageNumber;
|
||||
buf.append(String.format(fmt, stageNumber, (flags.active?" on": "off"), rocket.getStage( stageNumber).getName()));
|
||||
}
|
||||
buf.append("\n");
|
||||
return buf.toString();
|
||||
|
@ -22,13 +22,6 @@ public abstract class InternalComponent extends RocketComponent {
|
||||
super.setRelativePosition(position);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public final void setPositionValue(double value) {
|
||||
super.setPositionValue(value);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.MASS_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -105,14 +105,6 @@ public class LaunchLug extends ExternalComponent implements Coaxial, LineInstanc
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPositionValue(double value) {
|
||||
super.setPositionValue(value);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void loadFromPreset(ComponentPreset preset) {
|
||||
if (preset.has(ComponentPreset.OUTER_DIAMETER)) {
|
||||
|
@ -40,7 +40,7 @@ public abstract class MassObject extends InternalComponent {
|
||||
this.radius = radius;
|
||||
|
||||
this.setRelativePosition(Position.TOP);
|
||||
this.setPositionValue(0.0);
|
||||
this.setAxialOffset(0.0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -189,13 +189,6 @@ public class ParallelStage extends AxialStage implements FlightConfigurableCompo
|
||||
fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPositionValue() {
|
||||
mutex.verify();
|
||||
|
||||
return this.getAxialOffset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getAutoRadialOffset(){
|
||||
return this.autoRadialPosition;
|
||||
|
@ -131,13 +131,6 @@ public class PodSet extends ComponentAssembly implements RingInstanceable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPositionValue() {
|
||||
mutex.verify();
|
||||
|
||||
return this.getAxialOffset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stages may be positioned relative to other stages. In that case, this will set the stage number
|
||||
* against which this stage is positioned.
|
||||
|
@ -226,7 +226,12 @@ public class Rocket extends RocketComponent {
|
||||
AxialStage value = stageMap.get(stageNumber);
|
||||
|
||||
if (newStage.equals(value)) {
|
||||
// stage is already added. skip.
|
||||
// stage is already added
|
||||
if( newStage != value ){
|
||||
// but the value is the wrong instance
|
||||
stageMap.put(stageNumber, newStage);
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
stageNumber = getNewStageNumber();
|
||||
newStage.setStageNumber(stageNumber);
|
||||
@ -310,24 +315,12 @@ public class Rocket extends RocketComponent {
|
||||
// Rocket copy is cloned, so non-trivial members must be cloned as well:
|
||||
copy.stageMap = new HashMap<Integer, AxialStage>();
|
||||
copy.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( this.configSet );
|
||||
new HashMap<FlightConfigurationId, FlightConfiguration>();
|
||||
if( 0 < this.configSet.size() ){
|
||||
Rocket.cloneConfigs( this, copy);
|
||||
}
|
||||
copy.selectedConfiguration = copy.configSet.get( this.getSelectedConfiguration().getId());
|
||||
copy.listenerList = new ArrayList<EventListener>();
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
private static void cloneConfigs( final Rocket source, Rocket dest ){
|
||||
source.checkState();
|
||||
dest.checkState();
|
||||
dest.selectedConfiguration = source.selectedConfiguration.clone();
|
||||
for( final FlightConfiguration config : source.configSet ){
|
||||
dest.configSet.set( config.getId(), config.clone() );
|
||||
}
|
||||
}
|
||||
|
||||
public int getFlightConfigurationCount() {
|
||||
checkState();
|
||||
return this.configSet.size();
|
||||
@ -363,7 +356,7 @@ public class Rocket extends RocketComponent {
|
||||
this.functionalModID = r.functionalModID;
|
||||
this.refType = r.refType;
|
||||
this.customReferenceLength = r.customReferenceLength;
|
||||
Rocket.cloneConfigs( r, this);
|
||||
this.configSet = new FlightConfigurableParameterSet<FlightConfiguration>( r.configSet );
|
||||
|
||||
this.perfectFinish = r.perfectFinish;
|
||||
|
||||
@ -467,9 +460,19 @@ public class Rocket extends RocketComponent {
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
updateStageMap();
|
||||
updateConfigurations();
|
||||
}
|
||||
|
||||
private void updateStageMap(){
|
||||
for( RocketComponent component : getChildren() ){
|
||||
if (component instanceof AxialStage) {
|
||||
AxialStage stage = (AxialStage) component;
|
||||
trackStage(stage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfigurations(){
|
||||
this.selectedConfiguration.update();
|
||||
for( FlightConfiguration config : configSet ){
|
||||
|
@ -958,16 +958,6 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position value of the component. The exact meaning of the value is
|
||||
* dependent on the current relative positioning.
|
||||
*
|
||||
* @return the positional value.
|
||||
*/
|
||||
public double getPositionValue() {
|
||||
return this.getAxialOffset();
|
||||
}
|
||||
|
||||
public double getAxialOffset() {
|
||||
mutex.verify();
|
||||
return this.asPositionValue(this.relativePosition);
|
||||
@ -984,26 +974,6 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position value of the component. The exact meaning of the value
|
||||
* depends on the current relative positioning.
|
||||
* <p>
|
||||
* Mince many components do not support setting the relative position. A component that does support
|
||||
* it should override this with a public method that simply calls this
|
||||
* supermethod AND fire a suitable ComponentChangeEvent.
|
||||
*
|
||||
* @deprecated name is ambiguous in three-dimensional space: value may refer to any of the three dimensions. Please use 'setAxialOffset' instead.
|
||||
* @param value the position value of the component.
|
||||
*/
|
||||
@Deprecated
|
||||
public void setPositionValue(double value) {
|
||||
// if (MathUtil.equals(this.position.x, value))
|
||||
// return;
|
||||
// // checkState();
|
||||
// // this.position = new Coordinate(value, 0, 0);
|
||||
setAxialOffset(value);
|
||||
}
|
||||
|
||||
|
||||
protected void setAfter(RocketComponent referenceComponent) {
|
||||
checkState();
|
||||
@ -1031,11 +1001,22 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
||||
this.position = new Coordinate(newAxialPosition, this.position.y, this.position.z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the position value of the component. The exact meaning of the value
|
||||
* depends on the current relative positioning.
|
||||
* <p>
|
||||
* Mince many components do not support setting the relative position. A component that does support
|
||||
* it should override this with a public method that simply calls this
|
||||
* supermethod AND fire a suitable ComponentChangeEvent.
|
||||
*
|
||||
* @param value the position value of the component.
|
||||
*/
|
||||
public void setAxialOffset(double _value) {
|
||||
this.setAxialOffset(this.relativePosition, _value);
|
||||
this.fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
protected void setAxialOffset(final Position positionMethod, final double newOffset) {
|
||||
checkState();
|
||||
if ( this.isAfter()){
|
||||
|
@ -227,13 +227,6 @@ public class TubeFinSet extends ExternalComponent {
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPositionValue(double value) {
|
||||
super.setPositionValue(value);
|
||||
fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getComponentVolume() {
|
||||
double or = getOuterRadius();
|
||||
|
@ -97,7 +97,7 @@ public class DampingMoment extends AbstractSimulationListener {
|
||||
|
||||
double CNa = entry.getValue().getCNa(); //?
|
||||
double Cp = entry.getValue().getCP().length();
|
||||
double z = comp.getPositionValue(); //?
|
||||
double z = comp.getAxialOffset();
|
||||
|
||||
aerodynamicPart += CNa * Math.pow(z - Cp, 2);
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ public class TestRockets {
|
||||
if (c instanceof InternalComponent) {
|
||||
InternalComponent i = (InternalComponent) c;
|
||||
i.setRelativePosition((Position) randomEnum(Position.class));
|
||||
i.setPositionValue(rnd(0.3));
|
||||
i.setAxialOffset(rnd(0.3));
|
||||
}
|
||||
}
|
||||
|
||||
@ -702,7 +702,7 @@ public class TestRockets {
|
||||
coupler.setThickness( bodyTubeThickness);
|
||||
coupler.setLength(0.03);
|
||||
coupler.setRelativePosition(Position.TOP);
|
||||
coupler.setPositionValue(-1.5);
|
||||
coupler.setAxialOffset(-1.5);
|
||||
boosterTube.addChild(coupler);
|
||||
|
||||
int finCount = 3;
|
||||
@ -713,14 +713,14 @@ public class TestRockets {
|
||||
finset = new TrapezoidFinSet(finCount, finRootChord, finTipChord, finSweep, finHeight);
|
||||
finset.setThickness( 0.0032);
|
||||
finset.setRelativePosition(Position.BOTTOM);
|
||||
finset.setPositionValue(1);
|
||||
finset.setAxialOffset(1);
|
||||
finset.setName("Booster Fins");
|
||||
boosterTube.addChild(finset);
|
||||
|
||||
// Motor mount
|
||||
InnerTube boosterMMT = new InnerTube();
|
||||
boosterMMT.setName("Booster MMT");
|
||||
boosterMMT.setPositionValue(0.005);
|
||||
boosterMMT.setAxialOffset(0.005);
|
||||
boosterMMT.setRelativePosition(Position.BOTTOM);
|
||||
boosterMMT.setOuterRadius(0.019 / 2);
|
||||
boosterMMT.setInnerRadius(0.018 / 2);
|
||||
@ -835,7 +835,7 @@ public class TestRockets {
|
||||
|
||||
mcomp = new MassComponent(0.2, 0.03, 0.045 + 0.060);
|
||||
mcomp.setRelativePosition(Position.TOP);
|
||||
mcomp.setPositionValue(0);
|
||||
mcomp.setAxialOffset(0);
|
||||
|
||||
// Stage construction
|
||||
rocket.addChild(stage);
|
||||
@ -916,25 +916,25 @@ public class TestRockets {
|
||||
coupler.setMassOverridden(true);
|
||||
coupler.setOverrideMass(0.360);
|
||||
coupler.setRelativePosition(Position.BOTTOM);
|
||||
coupler.setPositionValue(-0.14);
|
||||
coupler.setAxialOffset(-0.14);
|
||||
tube1.addChild(coupler);
|
||||
|
||||
// Parachute
|
||||
MassComponent mass = new MassComponent(0.05, 0.05, 0.280);
|
||||
mass.setRelativePosition(Position.TOP);
|
||||
mass.setPositionValue(0.2);
|
||||
mass.setAxialOffset(0.2);
|
||||
tube1.addChild(mass);
|
||||
|
||||
// Cord
|
||||
mass = new MassComponent(0.05, 0.05, 0.125);
|
||||
mass.setRelativePosition(Position.TOP);
|
||||
mass.setPositionValue(0.2);
|
||||
mass.setAxialOffset(0.2);
|
||||
tube1.addChild(mass);
|
||||
|
||||
// Payload
|
||||
mass = new MassComponent(0.40, R, 1.500);
|
||||
mass.setRelativePosition(Position.TOP);
|
||||
mass.setPositionValue(0.25);
|
||||
mass.setAxialOffset(0.25);
|
||||
tube1.addChild(mass);
|
||||
|
||||
auxfinset = new TrapezoidFinSet();
|
||||
@ -947,7 +947,7 @@ public class TestRockets {
|
||||
auxfinset.setThickness(0.008);
|
||||
auxfinset.setCrossSection(CrossSection.AIRFOIL);
|
||||
auxfinset.setRelativePosition(Position.TOP);
|
||||
auxfinset.setPositionValue(0.28);
|
||||
auxfinset.setAxialOffset(0.28);
|
||||
auxfinset.setBaseRotation(Math.PI / 2);
|
||||
tube1.addChild(auxfinset);
|
||||
|
||||
@ -955,7 +955,7 @@ public class TestRockets {
|
||||
coupler.setOuterRadiusAutomatic(true);
|
||||
coupler.setLength(0.28);
|
||||
coupler.setRelativePosition(Position.TOP);
|
||||
coupler.setPositionValue(0.47);
|
||||
coupler.setAxialOffset(0.47);
|
||||
coupler.setMassOverridden(true);
|
||||
coupler.setOverrideMass(0.360);
|
||||
tube2.addChild(coupler);
|
||||
@ -963,7 +963,7 @@ public class TestRockets {
|
||||
// Parachute
|
||||
mass = new MassComponent(0.1, 0.05, 0.028);
|
||||
mass.setRelativePosition(Position.TOP);
|
||||
mass.setPositionValue(0.14);
|
||||
mass.setAxialOffset(0.14);
|
||||
tube2.addChild(mass);
|
||||
|
||||
Bulkhead bulk = new Bulkhead();
|
||||
@ -971,13 +971,13 @@ public class TestRockets {
|
||||
bulk.setMassOverridden(true);
|
||||
bulk.setOverrideMass(0.050);
|
||||
bulk.setRelativePosition(Position.TOP);
|
||||
bulk.setPositionValue(0.27);
|
||||
bulk.setAxialOffset(0.27);
|
||||
tube2.addChild(bulk);
|
||||
|
||||
// Chord
|
||||
mass = new MassComponent(0.1, 0.05, 0.125);
|
||||
mass.setRelativePosition(Position.TOP);
|
||||
mass.setPositionValue(0.19);
|
||||
mass.setAxialOffset(0.19);
|
||||
tube2.addChild(mass);
|
||||
|
||||
InnerTube inner = new InnerTube();
|
||||
@ -995,7 +995,7 @@ public class TestRockets {
|
||||
center.setMassOverridden(true);
|
||||
center.setOverrideMass(0.038);
|
||||
center.setRelativePosition(Position.BOTTOM);
|
||||
center.setPositionValue(0);
|
||||
center.setAxialOffset(0);
|
||||
tube3.addChild(center);
|
||||
|
||||
center = new CenteringRing();
|
||||
@ -1005,7 +1005,7 @@ public class TestRockets {
|
||||
center.setMassOverridden(true);
|
||||
center.setOverrideMass(0.038);
|
||||
center.setRelativePosition(Position.TOP);
|
||||
center.setPositionValue(0.28);
|
||||
center.setAxialOffset(0.28);
|
||||
tube3.addChild(center);
|
||||
|
||||
center = new CenteringRing();
|
||||
@ -1015,7 +1015,7 @@ public class TestRockets {
|
||||
center.setMassOverridden(true);
|
||||
center.setOverrideMass(0.038);
|
||||
center.setRelativePosition(Position.TOP);
|
||||
center.setPositionValue(0.83);
|
||||
center.setAxialOffset(0.83);
|
||||
tube3.addChild(center);
|
||||
|
||||
finset = new TrapezoidFinSet();
|
||||
@ -1025,7 +1025,7 @@ public class TestRockets {
|
||||
finset.setThickness(0.005);
|
||||
finset.setSweep(0.3);
|
||||
finset.setRelativePosition(Position.BOTTOM);
|
||||
finset.setPositionValue(-0.03);
|
||||
finset.setAxialOffset(-0.03);
|
||||
finset.setBaseRotation(Math.PI / 2);
|
||||
tube3.addChild(finset);
|
||||
|
||||
@ -1101,7 +1101,7 @@ public class TestRockets {
|
||||
Parachute upperChute= new Parachute();
|
||||
upperChute.setName("Parachute");
|
||||
upperChute.setRelativePosition(Position.MIDDLE);
|
||||
upperChute.setPositionValue(0.0);
|
||||
upperChute.setAxialOffset(0.0);
|
||||
upperChute.setDiameter(0.3);
|
||||
upperChute.setLineCount(6);
|
||||
upperChute.setLineLength(0.3);
|
||||
@ -1111,7 +1111,7 @@ public class TestRockets {
|
||||
ShockCord cord = new ShockCord();
|
||||
cord.setName("Shock Cord");
|
||||
cord.setRelativePosition(Position.BOTTOM);
|
||||
cord.setPositionValue(0.0);
|
||||
cord.setAxialOffset(0.0);
|
||||
cord.setCordLength(0.4);
|
||||
upperStageBody.addChild( cord);
|
||||
}
|
||||
@ -1146,7 +1146,7 @@ public class TestRockets {
|
||||
coreFins.setName("Core Fins");
|
||||
coreFins.setFinCount(4);
|
||||
coreFins.setRelativePosition(Position.BOTTOM);
|
||||
coreFins.setPositionValue(0.0);
|
||||
coreFins.setAxialOffset(0.0);
|
||||
coreFins.setBaseRotation( Math.PI / 4);
|
||||
coreFins.setThickness(0.003);
|
||||
coreFins.setCrossSection(CrossSection.ROUNDED);
|
||||
|
@ -3,6 +3,10 @@
|
||||
*/
|
||||
package net.sf.openrocket.file.rocksim.importt;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
|
||||
import net.sf.openrocket.file.simplesax.PlainTextHandler;
|
||||
@ -10,9 +14,6 @@ import net.sf.openrocket.material.Material;
|
||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||
import net.sf.openrocket.rocketcomponent.Parachute;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* ParachuteHandler Tester.
|
||||
@ -153,12 +154,12 @@ public class ParachuteHandlerTest extends RocksimTestBase {
|
||||
handler.closeElement("LocationMode", attributes, "1", warnings);
|
||||
handler.endHandler("Parachute", attributes, null, warnings);
|
||||
Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
|
||||
Assert.assertEquals(component.getPositionValue(), -10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
Assert.assertEquals(component.getAxialOffset(), -10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
|
||||
handler.closeElement("Xb", attributes, "-10", warnings);
|
||||
handler.closeElement("LocationMode", attributes, "2", warnings);
|
||||
handler.endHandler("Parachute", attributes, null, warnings);
|
||||
Assert.assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
|
||||
Assert.assertEquals(component.getPositionValue(), 10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
Assert.assertEquals(component.getAxialOffset(), 10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,11 @@
|
||||
*/
|
||||
package net.sf.openrocket.file.rocksim.importt;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
|
||||
import net.sf.openrocket.file.simplesax.PlainTextHandler;
|
||||
@ -14,10 +19,6 @@ import net.sf.openrocket.rocketcomponent.EngineBlock;
|
||||
import net.sf.openrocket.rocketcomponent.RingComponent;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.TubeCoupler;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* RingHandler Tester.
|
||||
@ -108,7 +109,7 @@ public class RingHandlerTest extends RocksimTestBase {
|
||||
Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
|
||||
Assert.assertEquals("Test Name", child.getName());
|
||||
Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
|
||||
Assert.assertEquals(0, child.getPositionValue(), 0.0);
|
||||
Assert.assertEquals(0, child.getAxialOffset(), 0.0);
|
||||
Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
|
||||
Assert.assertTrue(child instanceof Bulkhead);
|
||||
|
||||
@ -144,7 +145,7 @@ public class RingHandlerTest extends RocksimTestBase {
|
||||
Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
|
||||
Assert.assertEquals("Test Name", child.getName());
|
||||
Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
|
||||
Assert.assertEquals(0, child.getPositionValue(), 0.0);
|
||||
Assert.assertEquals(0, child.getAxialOffset(), 0.0);
|
||||
Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
|
||||
}
|
||||
|
||||
@ -179,7 +180,7 @@ public class RingHandlerTest extends RocksimTestBase {
|
||||
Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
|
||||
Assert.assertEquals("Test Name", child.getName());
|
||||
Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
|
||||
Assert.assertEquals(0, child.getPositionValue(), 0.0);
|
||||
Assert.assertEquals(0, child.getAxialOffset(), 0.0);
|
||||
Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
|
||||
Assert.assertEquals(4d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, child.getCG().x, 0.000001);
|
||||
|
||||
@ -214,7 +215,7 @@ public class RingHandlerTest extends RocksimTestBase {
|
||||
Assert.assertEquals(10d / RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, child.getLength(), 0.001);
|
||||
Assert.assertEquals("Test Name", child.getName());
|
||||
Assert.assertEquals(109.9/1000, child.getMass(), 0.001);
|
||||
Assert.assertEquals(0, child.getPositionValue(), 0.0);
|
||||
Assert.assertEquals(0, child.getAxialOffset(), 0.0);
|
||||
Assert.assertEquals(RocketComponent.Position.TOP, child.getRelativePosition());
|
||||
Assert.assertTrue(child instanceof CenteringRing);
|
||||
}
|
||||
|
@ -3,6 +3,11 @@
|
||||
*/
|
||||
package net.sf.openrocket.file.rocksim.importt;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||
import net.sf.openrocket.file.rocksim.RocksimCommonConstants;
|
||||
import net.sf.openrocket.file.rocksim.RocksimDensityType;
|
||||
@ -11,10 +16,6 @@ import net.sf.openrocket.material.Material;
|
||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.rocketcomponent.Streamer;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* StreamerHandler Tester.
|
||||
@ -149,13 +150,13 @@ public class StreamerHandlerTest extends RocksimTestBase {
|
||||
handler.closeElement("LocationMode", attributes, "1", warnings);
|
||||
handler.endHandler("Streamer", attributes, null, warnings);
|
||||
Assert.assertEquals(RocketComponent.Position.ABSOLUTE, component.getRelativePosition());
|
||||
Assert.assertEquals(component.getPositionValue(), -10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
Assert.assertEquals(component.getAxialOffset(), -10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
|
||||
handler.closeElement("Xb", attributes, "-10", warnings);
|
||||
handler.closeElement("LocationMode", attributes, "2", warnings);
|
||||
handler.endHandler("Streamer", attributes, null, warnings);
|
||||
Assert.assertEquals(RocketComponent.Position.BOTTOM, component.getRelativePosition());
|
||||
Assert.assertEquals(component.getPositionValue(), 10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
Assert.assertEquals(component.getAxialOffset(), 10d/ RocksimCommonConstants.ROCKSIM_TO_OPENROCKET_LENGTH, 0.001);
|
||||
|
||||
handler.closeElement("Thickness", attributes, "0.02", warnings);
|
||||
Assert.assertEquals(0.01848, handler.computeDensity(RocksimDensityType.ROCKSIM_BULK, 924d), 0.001);
|
||||
|
@ -47,9 +47,6 @@ public class MassCalculatorTest extends BaseTestCase {
|
||||
config.setAllStages();
|
||||
rkt.setName("TestRocket."+Thread.currentThread().getStackTrace()[1].getMethodName());
|
||||
|
||||
// String treeDump = rkt.toDebugTree();
|
||||
// System.err.println( treeDump);
|
||||
|
||||
// Validate Boosters
|
||||
MassCalculator mc = new MassCalculator();
|
||||
// any config will do, beceause the rocket literally has no defined motors.
|
||||
|
@ -64,7 +64,6 @@ public class MassDataTest extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testTwoPointGeneral() {
|
||||
boolean debug=false;
|
||||
double m1 = 2.5;
|
||||
Coordinate r1 = new Coordinate(0,-40, -10, m1);
|
||||
double I1xx=28.7;
|
||||
@ -81,20 +80,8 @@ public class MassDataTest extends BaseTestCase {
|
||||
MassData asbly3 = body1.add(body2);
|
||||
|
||||
Coordinate cm3_expected = r1.average(r2);
|
||||
// System.err.println(" @(1): "+ body1.toDebug());
|
||||
// System.err.println(" @(2): "+ body2.toDebug());
|
||||
// System.err.println(" @(3): "+ asbly3.toDebug());
|
||||
// System.err.println(" Center of Mass: (3) expected: "+ cm3_expected);
|
||||
assertEquals(" Center of Mass calculated incorrectly: ", cm3_expected, asbly3.getCM() );
|
||||
|
||||
|
||||
if(debug){
|
||||
System.err.println(" Body 1: "+ body1.toDebug() );
|
||||
System.err.println(" Body 2: "+ body2.toDebug() );
|
||||
System.err.println(" Body 3: "+ asbly3.toDebug() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// these are a bit of a hack, and depend upon all the bodies being along the y=0, z=0 line.
|
||||
Coordinate delta13 = asbly3.getCM().sub( r1);
|
||||
Coordinate delta23 = asbly3.getCM().sub( r2);
|
||||
@ -152,10 +139,6 @@ public class MassDataTest extends BaseTestCase {
|
||||
MassData asbly4_indirect = asbly3.add(body5);
|
||||
Coordinate cm4_expected = r1.average(r2).average(r5);
|
||||
|
||||
//System.err.println(" Center of Mass: (3): "+ asbly3.toCMDebug() );
|
||||
//System.err.println(" MOI: (3): "+ asbly3.toIMDebug() );
|
||||
//System.err.println(" Center of Mass: indirect:"+ asbly4_indirect.getCM() );
|
||||
//System.err.println(" Center of Mass: (4) direct: "+ cm4_expected);
|
||||
assertEquals(" Center of Mass calculated incorrectly: ", cm4_expected, new Coordinate( 0, 7.233644859813085, 0, m1+m2+m5 ) );
|
||||
|
||||
// these are a bit of a hack, and depend upon all the bodies being along the y=0, z=0 line.
|
||||
@ -166,21 +149,17 @@ public class MassDataTest extends BaseTestCase {
|
||||
|
||||
double I14zz = I1t + m1*MathUtil.pow2( Math.abs(body1.getCM().y - y4) );
|
||||
double I24zz = I2t + m2*MathUtil.pow2( Math.abs(body2.getCM().y - y4) );
|
||||
// System.err.println(String.format(" I24yy: %8g = %6g + %3g*%g", I24zz, I2t, m2, MathUtil.pow2( Math.abs(body2.getCM().y - y4)) ));
|
||||
// System.err.println(String.format(" : delta y24: %8g = ||%g - %g||", Math.abs(body2.getCM().y - y4), body2.getCM().y, y4 ));
|
||||
double I54zz = I5t + m5*MathUtil.pow2( Math.abs(body5.getCM().y - y4) );
|
||||
|
||||
double I4xx = I14ax+I24ax+I54ax;
|
||||
double I4yy = I1t+I2t+I5t;
|
||||
double I4zz = I14zz+I24zz+I54zz;
|
||||
MassData asbly4_expected = new MassData( cm4_expected, I4xx, I4yy, I4zz);
|
||||
//System.err.println(String.format(" Ixx: direct: %12g", I4xx ));
|
||||
|
||||
assertEquals("x-axis MOI don't match: ", asbly4_indirect.getIxx(), asbly4_expected.getIxx(), EPSILON*10);
|
||||
|
||||
//System.err.println(String.format(" Iyy: direct: %12g", I4yy ));
|
||||
|
||||
assertEquals("y-axis MOI don't match: ", asbly4_indirect.getIyy(), asbly4_expected.getIyy(), EPSILON*10);
|
||||
|
||||
//System.err.println(String.format(" Izz: direct: %12g", I4zz));
|
||||
assertEquals("z-axis MOI don't match: ", asbly4_indirect.getIzz(), asbly4_expected.getIzz(), EPSILON*10);
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ public class FinSetTest extends BaseTestCase {
|
||||
fin.setOverrideCGX(0.012);
|
||||
fin.setOverrideMass(0.0123);
|
||||
fin.setOverrideSubcomponents(true);
|
||||
fin.setPositionValue(0.1);
|
||||
fin.setAxialOffset(0.1);
|
||||
fin.setRelativePosition(Position.ABSOLUTE);
|
||||
fin.setTabHeight(0.01);
|
||||
fin.setTabLength(0.02);
|
||||
|
@ -417,7 +417,7 @@ public class ParallelStageTest extends BaseTestCase {
|
||||
|
||||
Coordinate resultantRelativePosition = booster.getOffset();
|
||||
assertThat(" 'setAxialPosition(double)' failed: \n" + treeDump + " Relative position: ", resultantRelativePosition.x, equalTo(expectedX));
|
||||
double resultantPositionValue = booster.getPositionValue();
|
||||
double resultantPositionValue = booster.getAxialOffset();
|
||||
assertThat(" 'setAxialPosition(double)' failed: \n" + treeDump + " PositionValue: ", resultantPositionValue, equalTo(targetX));
|
||||
double resultantAxialPosition = booster.getAxialOffset();
|
||||
assertThat(" 'setAxialPosition(double)' failed: \n" + treeDump + " Relative position: ", resultantAxialPosition, equalTo(targetX));
|
||||
@ -450,7 +450,7 @@ public class ParallelStageTest extends BaseTestCase {
|
||||
Coordinate resultantRelativePosition = sustainer.getOffset();
|
||||
assertThat(" 'setAxialPosition(double)' failed: \n" + treeDump + " Sustainer Relative position: ", resultantRelativePosition.x, equalTo(expectedX));
|
||||
double expectedPositionValue = 0;
|
||||
double resultantPositionValue = sustainer.getPositionValue();
|
||||
double resultantPositionValue = sustainer.getAxialOffset();
|
||||
assertThat(" 'setPositionValue()' failed: \n" + treeDump + " Sustainer Position Value: ", resultantPositionValue, equalTo(expectedPositionValue));
|
||||
|
||||
double expectedAxialOffset = 0;
|
||||
@ -486,7 +486,7 @@ public class ParallelStageTest extends BaseTestCase {
|
||||
double resultantAxialOffset = booster.getAxialOffset();
|
||||
assertThat(" 'getAxialPosition()' failed: \n" + treeDump + " Axial Offset: ", resultantAxialOffset, equalTo(targetOffset));
|
||||
|
||||
double resultantPositionValue = booster.getPositionValue();
|
||||
double resultantPositionValue = booster.getAxialOffset();
|
||||
assertThat(" 'setPositionValue()' failed: \n" + treeDump + " Position Value: ", resultantPositionValue, equalTo(targetOffset));
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ public class ParallelStageTest extends BaseTestCase {
|
||||
Coordinate resultantAbsolutePosition = booster.getLocations()[0];
|
||||
assertThat(" 'setAxialPosition(double)' failed: \n" + treeDump + " Absolute position: ", resultantAbsolutePosition.x, equalTo(expectedAbsoluteX));
|
||||
|
||||
double resultantPositionValue = booster.getPositionValue();
|
||||
double resultantPositionValue = booster.getAxialOffset();
|
||||
assertThat(" 'setPositionValue()' failed: \n" + treeDump + " Position Value: ", resultantPositionValue, equalTo(targetOffset));
|
||||
|
||||
double resultantAxialOffset = booster.getAxialOffset();
|
||||
@ -542,7 +542,7 @@ public class ParallelStageTest extends BaseTestCase {
|
||||
Coordinate resultantAbsolutePosition = booster.getLocations()[0];
|
||||
assertThat(" 'setAxialPosition(double)' failed: \n" + treeDump + " Absolute position: ", resultantAbsolutePosition.x, equalTo(expectedAbsoluteX));
|
||||
|
||||
double resultantPositionValue = booster.getPositionValue();
|
||||
double resultantPositionValue = booster.getAxialOffset();
|
||||
assertThat(" 'setPositionValue()' failed: \n" + treeDump + " Position Value: ", resultantPositionValue, equalTo(targetOffset));
|
||||
|
||||
double resultantAxialOffset = booster.getAxialOffset();
|
||||
|
@ -17,23 +17,21 @@ public class RocketTest extends BaseTestCase {
|
||||
@Test
|
||||
public void testCopyIndependence() {
|
||||
Rocket rkt1 = TestRockets.makeEstesAlphaIII();
|
||||
FlightConfiguration config1 = rkt1.getSelectedConfiguration();
|
||||
FlightConfigurationId fcid1 = config1.getId();
|
||||
FlightConfiguration config1 = new FlightConfiguration(rkt1, null);
|
||||
rkt1.setFlightConfiguration( config1.getId(), config1);
|
||||
rkt1.setSelectedConfiguration( config1.getId());
|
||||
FlightConfiguration config2 = new FlightConfiguration(rkt1, null);
|
||||
rkt1.setFlightConfiguration( config2.getId(), config2);
|
||||
FlightConfiguration config3 = new FlightConfiguration(rkt1, null);
|
||||
rkt1.setFlightConfiguration( config3.getId(), config3);
|
||||
|
||||
//System.err.println("src: "+ rkt1.toDebugConfigs());
|
||||
// vvvv test target vvvv
|
||||
Rocket rkt2 = rkt1.copyWithOriginalID();
|
||||
// ^^^^ test target ^^^^
|
||||
//System.err.println("cpy: "+ rkt1.toDebugConfigs());
|
||||
|
||||
FlightConfiguration config4 = rkt2.getSelectedConfiguration();
|
||||
FlightConfigurationId fcid4 = config4.getId();
|
||||
assertThat("fcids should match: ", fcid1.key, equalTo(fcid4.key));
|
||||
assertThat("Configurations should be different match: "+config1.toDebug()+"=?="+config4.toDebug(), config1.instanceNumber, not( config4.instanceNumber));
|
||||
|
||||
assertThat("fcids should match: ", config1.getId().key, equalTo(fcid4.key));
|
||||
assertThat("Configurations should be different: "+config1.toDebug()+"=?="+config4.toDebug(), config1.instanceNumber, not( config4.instanceNumber));
|
||||
|
||||
FlightConfiguration config5 = rkt2.getFlightConfiguration(config2.getId());
|
||||
FlightConfigurationId fcid5 = config5.getId();
|
||||
|
Binary file not shown.
@ -123,7 +123,7 @@ public class EllipticalFinSetConfig extends FinSetConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("EllipticalFinSetCfg.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -24,6 +24,9 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import net.sf.openrocket.document.OpenRocketDocument;
|
||||
import net.sf.openrocket.gui.SpinnerEditor;
|
||||
@ -52,9 +55,6 @@ import net.sf.openrocket.startup.Application;
|
||||
import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class FreeformFinSetConfig extends FinSetConfig {
|
||||
private static final long serialVersionUID = 2504130276828826021L;
|
||||
private static final Logger log = LoggerFactory.getLogger(FreeformFinSetConfig.class);
|
||||
@ -145,7 +145,7 @@ public class FreeformFinSetConfig extends FinSetConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("FreeformFinSetCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -153,7 +153,7 @@ public class InnerTubeConfig extends RocketComponentConfig {
|
||||
panel.add(new JLabel(trans.get("ringcompcfg.plus")), "right");
|
||||
|
||||
//// PositionValue
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -124,7 +124,7 @@ public class LaunchLugConfig extends RocketComponentConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -120,7 +120,7 @@ public class MassComponentConfig extends RocketComponentConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("MassComponentCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -151,7 +151,7 @@ public class ParachuteConfig extends RecoveryDeviceConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("ParachuteCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -93,7 +93,7 @@ public class RailButtonConfig extends RocketComponentConfig {
|
||||
{ //// plus
|
||||
final double parentLength = ((BodyTube)rbc.getParent()).getLength();
|
||||
panel.add(new JLabel(trans.get("RailBtnCfg.lbl.Plus")), "right");
|
||||
DoubleModel offsetModel = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
DoubleModel offsetModel = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
JSpinner offsetSpinner = new JSpinner(offsetModel.getSpinnerModel());
|
||||
offsetSpinner.setEditor(new SpinnerEditor(offsetSpinner));
|
||||
panel.add(offsetSpinner, "growx");
|
||||
|
@ -139,7 +139,7 @@ public class RingComponentConfig extends RocketComponentConfig {
|
||||
panel.add(new JLabel(trans.get("ringcompcfg.plus")), "right");
|
||||
|
||||
//// PositionValue
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -75,7 +75,7 @@ public class ShockCordConfig extends RocketComponentConfig {
|
||||
//// plus
|
||||
panel2.add(new JLabel(trans.get("ShockCordCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel2.add(spin, "growx");
|
||||
|
@ -152,7 +152,7 @@ public class StreamerConfig extends RecoveryDeviceConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("StreamerCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -179,7 +179,7 @@ public class TrapezoidFinSetConfig extends FinSetConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("TrapezoidFinSetCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -137,7 +137,7 @@ public class TubeFinSetConfig extends RocketComponentConfig {
|
||||
//// plus
|
||||
panel.add(new JLabel(trans.get("LaunchLugCfg.lbl.plus")), "right");
|
||||
|
||||
m = new DoubleModel(component, "PositionValue", UnitGroup.UNITS_LENGTH);
|
||||
m = new DoubleModel(component, "AxialOffset", UnitGroup.UNITS_LENGTH);
|
||||
spin = new JSpinner(m.getSpinnerModel());
|
||||
spin.setEditor(new SpinnerEditor(spin));
|
||||
panel.add(spin, "growx");
|
||||
|
@ -4,16 +4,16 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||
import net.sf.openrocket.rocketcomponent.BodyTube;
|
||||
import net.sf.openrocket.rocketcomponent.CenteringRing;
|
||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||
import net.sf.openrocket.util.BaseTestCase.BaseTestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class FinSetConfigTest extends BaseTestCase {
|
||||
|
||||
static Method method;
|
||||
@ -56,11 +56,11 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setLength(0.004);
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setPositionValue(0.43);
|
||||
ring1.setAxialOffset(0.43);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setLength(0.004);
|
||||
ring2.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring2.setPositionValue(0.45);
|
||||
ring2.setAxialOffset(0.45);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
parent.addChild(ring1);
|
||||
@ -82,7 +82,7 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setLength(0.004);
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setPositionValue(0.43);
|
||||
ring1.setAxialOffset(0.43);
|
||||
rings.add(ring1);
|
||||
|
||||
RocketComponent parent = new BodyTube();
|
||||
@ -103,11 +103,11 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setLength(0.004);
|
||||
ring1.setPositionValue(0.43);
|
||||
ring1.setAxialOffset(0.43);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring2.setLength(0.004);
|
||||
ring2.setPositionValue(0.45);
|
||||
ring2.setAxialOffset(0.45);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
|
||||
@ -130,11 +130,11 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setLength(0.004);
|
||||
ring1.setPositionValue(0.43);
|
||||
ring1.setAxialOffset(0.43);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring2.setLength(0.004);
|
||||
ring2.setPositionValue(0.48);
|
||||
ring2.setAxialOffset(0.48);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
|
||||
@ -155,11 +155,11 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setLength(0.004);
|
||||
ring1.setPositionValue(0.4701);
|
||||
ring1.setAxialOffset(0.4701);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setLength(0.004);
|
||||
ring2.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring2.setPositionValue(0.48);
|
||||
ring2.setAxialOffset(0.48);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
RocketComponent parent = new BodyTube(1.0d, 0.1d);
|
||||
@ -181,12 +181,12 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setLength(0.004);
|
||||
ring1.setPositionValue(0.4701);
|
||||
ring1.setAxialOffset(0.4701);
|
||||
parent.addChild(ring1);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setLength(0.004);
|
||||
ring2.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring2.setPositionValue(0.4750);
|
||||
ring2.setAxialOffset(0.4750);
|
||||
parent.addChild(ring2);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
@ -207,11 +207,11 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring1.setLength(0.004);
|
||||
ring1.setPositionValue(0.48);
|
||||
ring1.setAxialOffset(0.48);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setRelativePosition(RocketComponent.Position.TOP);
|
||||
ring2.setLength(0.004);
|
||||
ring2.setPositionValue(0.49);
|
||||
ring2.setAxialOffset(0.49);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
RocketComponent parent = new BodyTube(1.0d, 0.1d);
|
||||
@ -233,20 +233,20 @@ public class FinSetConfigTest extends BaseTestCase {
|
||||
CenteringRing ring1 = new CenteringRing();
|
||||
ring1.setRelativePosition(RocketComponent.Position.ABSOLUTE);
|
||||
ring1.setLength(0.004);
|
||||
ring1.setPositionValue(0.47);
|
||||
ring1.setAxialOffset(0.47);
|
||||
CenteringRing ring2 = new CenteringRing();
|
||||
ring2.setRelativePosition(RocketComponent.Position.ABSOLUTE);
|
||||
ring2.setLength(0.004);
|
||||
ring2.setPositionValue(0.4702);
|
||||
ring2.setAxialOffset(0.4702);
|
||||
CenteringRing ring3 = new CenteringRing();
|
||||
ring3.setRelativePosition(RocketComponent.Position.ABSOLUTE);
|
||||
ring3.setLength(0.004);
|
||||
ring3.setPositionValue(0.4770);
|
||||
ring3.setAxialOffset(0.4770);
|
||||
rings.add(ring1);
|
||||
rings.add(ring2);
|
||||
rings.add(ring3);
|
||||
BodyTube parent = new BodyTube(1.0d, 0.1d);
|
||||
parent.setPositionValue(0);
|
||||
parent.setAxialOffset(0);
|
||||
parent.addChild(ring1);
|
||||
parent.addChild(ring2);
|
||||
parent.addChild(ring3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user