@@ -11,15 +11,21 @@ BuildMain = React.createClass({
getInitialState() {

return {
tankLength: 20,
wallThickness: 5,
fuelRate: 200,
mixRatio: 6,
enginePressure: 80,
nozzleLength: 4,
tankLength: 0,
tankDiameter: 0,
structuralDensity: 0,
massRate: 0,
mixRatio: 0,
enginePressure: 0,
nozzleLength: 0,
performance: [0, 0, 0, 0, 0, 0, 0, 0],
rocketImage: "10ML.png"

massData: [0.1, 0.1],
buttonDisable: true,
rocketImage: "10ML.png",
selectDiameter: "Stage Diameter",
selectFuel: "Fuel/Oxidizer Type",
selectMatStruct: "Structural Material",
SelectMatEng: "Engine Material"
};
},

@@ -28,54 +34,100 @@ BuildMain = React.createClass({
case 0:
if ((this.state.tankLength > min || val > 0) && (this.state.tankLength < max || val < 0)){
this.setState({tankLength: Math.round((this.state.tankLength + val) * 10) /10});
var structure = tankStructure(0, this.state.mixRatio, this.state.tankDiameter, this.state.tankLength + val, this.state.structuralDensity)
this.setState({massData: structure});
}
break;
case 1:
if ((this.state.wallThickness > min || val > 0) && (this.state.wallThickness < max || val < 0)){
this.setState({wallThickness: Math.round((this.state.wallThickness + val) * 10) /10});
if ((this.state.structuralDensity > min || val > 0) && (this.state.structuralDensity < max || val < 0)){
var structure = tankStructure(0, this.state.mixRatio, this.state.tankDiameter, this.state.tankLength, this.state.structuralDensity + val)
this.setState({structuralDensity: Math.round((this.state.structuralDensity + val) * 10) /10});
this.setState({massData: structure});
}
break;
case 2:
if ((this.state.fuelRate > min || val > 0) && (this.state.fuelRate < max || val < 0)){
this.setState({fuelRate: this.state.fuelRate + val});
var thermo = engineThermo(0, this.state.mixRatio, this.state.enginePressure, this.state.nozzleLength, this.state.fuelRate + val);
if ((this.state.massRate > min || val > 0) && (this.state.massRate < max || val < 0)){
this.setState({massRate: this.state.massRate + val});
var thermo = engineThermo(0, this.state.mixRatio, this.state.enginePressure, this.state.nozzleLength, this.state.massRate + val);
this.setState({performance: thermo});
}
break;
case 3:
if ((this.state.mixRatio > min || val > 0) && (this.state.mixRatio < max || val < 0)){
this.setState({mixRatio: Math.round((this.state.mixRatio + val) * 10) /10});
var thermo = engineThermo(0, this.state.mixRatio + val, this.state.enginePressure, this.state.nozzleLength, this.state.fuelRate);
this.setState({performance: thermo});

var structure = tankStructure(0, this.state.mixRatio + val, this.state.tankDiameter, this.state.tankLength, this.state.structuralDensity)
var thermo = engineThermo(0, this.state.mixRatio + val, this.state.enginePressure, this.state.nozzleLength, this.state.massRate);
this.setState({performance: thermo, massData: structure});
}
break;
case 4:
if ((this.state.enginePressure > min || val > 0) && (this.state.enginePressure < max || val < 0)){
this.setState({enginePressure: this.state.enginePressure + val});
var thermo = engineThermo(0, this.state.mixRatio, this.state.enginePressure + val, this.state.nozzleLength, this.state.fuelRate);
var thermo = engineThermo(0, this.state.mixRatio, this.state.enginePressure + val, this.state.nozzleLength, this.state.massRate);
this.setState({performance: thermo});
}
break;
case 5:
if ((this.state.nozzleLength > min || val > 0) && (this.state.nozzleLength < max || val < 0)){
this.setState({nozzleLength: Math.round((this.state.nozzleLength + val) * 10) /10});
var thermo = engineThermo(0, this.state.mixRatio, this.state.enginePressure, this.state.nozzleLength + val, this.state.fuelRate);
var thermo = engineThermo(0, this.state.mixRatio, this.state.enginePressure, this.state.nozzleLength + val, this.state.massRate);
this.setState({performance: thermo});
}
break;
}

var c = document.getElementById("rocket-canvas");
var ctx = c.getContext("2d");
ctx.webkitImageSmoothingEnabled = false;
ctx.imageSmoothingEnabled = false;
ctx.mozImageSmoothingEnabled = false;
ctx.imageSmoothingEnabled = false;
var img = new Image(117, 280);
img.src = "10MLG.png";
ctx.drawImage(img,0,0, 234, 560);
},

handleUserSelect(index, val){
switch(index){
case 0:
this.setState({selectDiameter: val + " Meter Diameter"});
this.setState({
tankLength: val * 3,
tankDiameter: val,
structuralDensity: 20
});
break;
case 1:
this.setState({selectFuel: val + " 1"});
break;
case 2:
this.setState({selectMatStruct: val + " 2"});
break;
case 3:
this.setState({SelectMatEng: val + " 3"});
break;
}
},

handleReset(){
this.setState({
tankLength: 0,
tankDiameter: 0,
structuralDensity: 0,
massRate: 0,
mixRatio: 0,
enginePressure: 0,
nozzleLength: 0,
performance: [0, 0, 0, 0, 0, 0, 0, 0],
massData: [0.1, 0.1],
buttonDisable: true,
rocketImage: "10ML.png",
selectDiameter: "Stage Diameter",
selectFuel: "Fuel/Oxidizer Type",
selectMatStruct: "Structural Material",
SelectMatEng: "Engine Material"
});
},


render(){
return(
@@ -84,12 +136,13 @@ BuildMain = React.createClass({
<div className="row row-1">
<Build_11 />

<Build_12 performance={this.state.performance}/>
<Build_12 performance={this.state.performance}
massData={this.state.massData}/>

<Build_13
tankMass={this.state.tankMass}
engineMass={this.state.engineMass}
fuelMass={this.state.fuelMass}
fuelOxMass={this.state.fuelOxMass}
totalMass={this.state.totalMass}/>

</div>{/* row one ends */}
@@ -98,16 +151,22 @@ BuildMain = React.createClass({
<Build_21 />

<Build_22 tankLength={this.state.tankLength}
wallThickness={this.state.wallThickness}
fuelRate={this.state.fuelRate}
structuralDensity={this.state.structuralDensity}
massRate={this.state.massRate}
mixRatio={this.state.mixRatio}
enginePressure={this.state.enginePressure}
nozzleLength={this.state.nozzleLength}
nozzleLength={this.state.nozzleLength}
buttonDisable={this.state.buttonDisable}
selectDiameter={this.state.selectDiameter}
selectFuel={this.state.selectFuel}
selectMatStruct={this.state.selectMatStruct}
SelectMatEng={this.state.SelectMatEng}
onUserSelect={this.handleUserSelect}
onUserInput={this.handleUserInput}/>

<Build_23 />
<Build_23 onUserReset={this.handleReset}/>
</div>{/* row two ends */}
</div>
)
}
});
});
@@ -1,7 +1,9 @@
engineThermo = function(fuel, mixRatio, pressure, nozzleLength, massRate){

fuel = {

fuel = {
pressure: [1, 10, 25, 50, 75, 100, 150, 200],
data: [1141, 70.8],
mixRatio1: [3.9681,[2802.3, 2979.4, 3037.1, 3074.6, 3093.9, 3106.4, 3122.5, 3132.7],[9.6360, 9.7940, 9.8470, 9.8820, 9.9000, 9.9110, 9.9260, 9.9360],[1.2313, 1.2242, 1.2219, 1.2205, 1.2197, 1.2193, 1.2187, 1.2183]],
mixRatio2: [4.5350,[2898.0, 3119.3, 3198.7, 3253.3, 3282.6, 3302.1, 3327.7, 3344.5],[10.537, 10.758, 10.839, 10.896, 10.926, 10.946, 10.973, 10.991],[1.2267, 1.2181, 1.2152, 1.2132, 1.2122, 1.2115, 1.2106, 1.2100]],
mixRatio3: [5.2908,[2978.0, 3243.6, 3347.0, 3422.0, 3463.9, 3492.6, 3531.5, 3557.7],[11.657, 11.954, 12.073, 12.161, 12.210, 12.244, 12.290, 12.321],[1.2226, 1.2127, 1.2091, 1.2065, 1.2051, 1.2042, 1.2029, 1.2020]],
@@ -25,6 +27,7 @@ engineThermo = function(fuel, mixRatio, pressure, nozzleLength, massRate){
var machNumber;


keys.shift();
keys.shift();

for (var i = 0; i < keys.length; i++){
@@ -94,8 +97,8 @@ engineThermo = function(fuel, mixRatio, pressure, nozzleLength, massRate){
var ispVac = thrustVac / massRate / standardGravity;
var ispAtm = thrustAtm / massRate / standardGravity;

var engineMass = 5 * massRate + Math.pow(throatArea, 0.5) * 550 + nozzleVolume * 80;
var engineMass = 5 * massRate + Math.pow(massRate / pressure, 0.5) * 75 + nozzleVolume * 80;
var heatCoefficient = Math.pow(temperature / 1000, 2) * massRate / 100;
return [thrustVac/1000, thrustAtm/1000, ispVac, ispAtm, thrustVac / engineMass / standardGravity, thrustAtm / engineMass / standardGravity];
return [thrustVac/1000, thrustAtm/1000, ispVac, ispAtm, engineMass];

}
@@ -90,7 +90,8 @@ body{
}

#stage-summary th{
padding-top: 16px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: bold;
font-size: 20px;
width: 50%;
@@ -101,4 +102,18 @@ body{
.title{
font-weight: bold;
font-size: 25px;
}

.dropdown-menu {
width: 100%;
text-align: center;
}

.dropdown-menu li > a:hover{

background-color: #8C8C50;
}

.btn{
width: 100%;
}

This file was deleted.

@@ -0,0 +1,23 @@
tankStructure = function(fuel, mixRatio, tankDiameter, tankLength, structuralDensity){

//with Saturn V materials tank should weight 5.708 * L/D + 1.823 kg/m3
fuel = {
pressure: [1, 10, 25, 50, 75, 100, 150, 200],
data: [1141, 70.8],
mixRatio1: [3.9681,[2802.3, 2979.4, 3037.1, 3074.6, 3093.9, 3106.4, 3122.5, 3132.7],[9.6360, 9.7940, 9.8470, 9.8820, 9.9000, 9.9110, 9.9260, 9.9360],[1.2313, 1.2242, 1.2219, 1.2205, 1.2197, 1.2193, 1.2187, 1.2183]],
mixRatio2: [4.5350,[2898.0, 3119.3, 3198.7, 3253.3, 3282.6, 3302.1, 3327.7, 3344.5],[10.537, 10.758, 10.839, 10.896, 10.926, 10.946, 10.973, 10.991],[1.2267, 1.2181, 1.2152, 1.2132, 1.2122, 1.2115, 1.2106, 1.2100]],
mixRatio3: [5.2908,[2978.0, 3243.6, 3347.0, 3422.0, 3463.9, 3492.6, 3531.5, 3557.7],[11.657, 11.954, 12.073, 12.161, 12.210, 12.244, 12.290, 12.321],[1.2226, 1.2127, 1.2091, 1.2065, 1.2051, 1.2042, 1.2029, 1.2020]],
mixRatio4: [6.3490,[3032.3, 3332.1, 3456.1, 3550.2, 3604.9, 3643.4, 3696.9, 3734.2],[13.074, 13.458, 13.622, 13.748, 13.822, 13.875, 13.949, 14.000],[1.2193, 1.2085, 1.2043, 1.2012, 1.1995, 1.1983, 1.1966, 1.1954]],
mixRatio5: [7.9362,[3050.5, 3361.5, 3492.9, 3594.4, 3654.2, 3696.8, 3756.8, 3799.3],[14.919, 15.381, 15.583, 15.742, 15.837, 15.905, 16.002, 16.071],[1.2170, 1.2060, 1.2017, 1.1984, 1.1965, 1.1952, 1.1934, 1.1921]],
}

var tankVolume = Math.PI / 4 * Math.pow(tankDiameter, 2) * tankLength;
var stuctureMass = tankVolume * structuralDensity;
var fuelOxDensity = (mixRatio + 1) / (mixRatio / fuel.data[0] + 1 / fuel.data[1]);
var fuelOxMass = tankVolume * 0.55 * fuelOxDensity;



return [fuelOxMass, stuctureMass]

}