Cosmo Logic Impulse Study

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

#include <iostream>

#include <cmath>
#include <ctime>
#include <stdlib.h>
using namespace std;
int main()
{
srand(time(NULL));
const float pi = 3.14159265359; //the value of pi
float VHlaunch; //volume of hydrogen on laucnh
float VHelaunch; //volume of helium on launch
float Vburst = 1150.347; //burst volume in m^3
float VHr; //hydrogen volume ratio
float VHer; //helium volume ratio
float maxaltH; //max alt hyrogen
float maxaltHe; //max alt helium
float DlaunchH; //diameter of hydrogen balloon
float DlaunchHe; //diamter of helium balloon
float SlaunchH; //surface area of hydrogen balloon
float SlaunchHe; //surface area of helium balloon
float GrossLiftH; //gross lift of hydrogen balloon
float GrossLiftHe; //gross lift of helium balloon
float freeLiftH; //free lift of hydrogen balloon
float freeLiftHe; //free lift of helium balloon
float NLiftH; //normal lift hydrogen
float NLiftHe; //normal lift helium
float VaccH; //hydrogen ascent velocity
float VaccHe; //helium ascent velocity
float flighttimeH;//hydrogen balloon flight time
float flighttimeHe; //helium balloon flight time
const float cd = .25; //balloon cd value for lift
const float g = 9.80665; //gravitational acceleration
const float rhoAir = 1.275; //air density
const
const
const
const
const
const
const
const
const
float
float
float
const

float pH = .0889; //hydrogen density


float pHe = .1786; //helium density
float alpha = -44330.76923; //alt. equation coefficient
float beta = 1.234875393; //alt equation coefficient
float PWT = 15.00; //payload weight
float TWT = 20.55; //total weight
float Bcost = 400; //cost of the flight
float Hcost = 8.83; //cost of hydrogen per m^3
float Hecost = 44.14; //cost of helium per 5.66337 m^3
cost; //cost of a flight
HS[1150][5]; //velocity, alt, time, cost and mass for hydrogen
HeS[1150][5]; //velocity, alt, time, cost and mass for helium
float minAlt = 25908.00; //minimum altitude for a flight

int count = 0; //counts loop iterations


VHlaunch = 1; //used to increment velocity
do
{
VHr = Vburst / VHlaunch; //volume ratio
DlaunchH = pow(3.0 / 4.0 * VHlaunch / pi, (1.0 / 3.0)) * 2; //diamter at
launch
SlaunchH = pi / 4.0 * pow(DlaunchH, 2); //cross sectional area

GrossLiftH = VHlaunch * (rhoAir - pH); //gross lift


freeLiftH = GrossLiftH - (TWT + VHlaunch * pH); //free lift
NLiftH = (PWT + freeLiftH) * g; //neutral lift adjusted for g
VaccH = sqrt(2 * NLiftH / (cd * SlaunchH * rhoAir)); //ascent velocity
maxaltH = alpha * (Vburst * pow((1.0 / VHr), beta) - VHlaunch) / VHlaunch; /
/max alt
flighttimeH = maxaltH / VaccH / 60; //time in minutes
cost = Bcost + VHlaunch * Hcost ; //cost of flight
HS[count][0] = maxaltH; //stores alt for an itteration
HS[count][1] = VaccH; //stores ascent velocity for an itteration
HS[count][2] = flighttimeH; //stores time for an itteration
HS[count][3] = cost; //stores cost for an itteration
HS[count][4] = PWT; //stores payload weight for a itteration
VHlaunch++; //increments volume
count++; //increments itteration count
} while (VHlaunch <= Vburst); //continues loop until launch volume = burst vol
ume
cout << endl << "Hydrogen Values" << endl;
cout << "Alt -- Asc V -- Time -- Cost -- Payload Mass -- Volume" << endl;
for (int i = 0; i < count; i += 10)
{
if (HS[i][0] >= minAlt && HS[i][1] >= .1 && (HS[i][2] >= 30 && HS[i][2]
<= 120))
{
cout << HS[i][0] << " -- " //ouputs alt, vasc, flighttime, cost, paylo
ad
<< HS[i][1] << " -- " //weight, and launch volume of the balloon
<< HS[i][2] << " -- " //of values that fit the critera for a viable l
aunch
<< HS[i][3] << " -- "
<< HS[i][4] << " -- "
<< i + 1 << endl;
}
}
//The next loop does the same exact calculations and functions the exact same
//as the previous loop, but uses values for helium instead.
//I won't comment everything becuase it's the exact same as before.
count = 0;
VHelaunch = 1;
do
{
VHer = Vburst / VHelaunch; //volume ratio
DlaunchHe = pow((3.0 / 4.0 * VHelaunch / pi), (1.0 / 3.0)) * 2; //diamte
r at launch
SlaunchHe = pi / 4.0 * pow(DlaunchHe, 2); //cross sectional area
GrossLiftHe = VHelaunch * (rhoAir - pHe); //gross lift

freeLiftHe = GrossLiftHe - (TWT + VHelaunch * pHe); //free lift


NLiftHe = (PWT + freeLiftHe) * g; //neutral lift adjusted for g
VaccHe = sqrt(2 * NLiftHe / (cd * SlaunchHe * rhoAir)); //ascent velocit
y
maxaltHe = alpha * (Vburst * pow((1.0 / VHer), beta) - VHelaunch) / VHelaunc
h; //max alt
flighttimeHe = maxaltHe / VaccHe / 60; //time in minutes
cost = Bcost + VHelaunch * Hecost;
HeS[count][0] = maxaltHe;
HeS[count][1] = VaccHe;
HeS[count][2] = flighttimeHe;
HeS[count][3] = cost;
HeS[count][4] = PWT;
VHelaunch++;
count++;
} while (VHelaunch <= Vburst);
cout << endl << "Helium Values" << endl;
cout << "Alt -- Asc V -- Time -- Cost -- Payload Mass -- Volume" << endl;
for (int i = 0; i < count; i += 10)
{
if (HeS[i][0] >= minAlt && HeS[i][1] >= .1 && (HeS[i][2] >= 30 && HeS[i]
[2] <= 120))
{
cout << HeS[i][0] << " -- "
<< HeS[i][1] << " -- "
<< HeS[i][2] << " -- "
<< HeS[i][3] << " -- "
<< HeS[i][4] << " -- "
<< i + 1 << endl;
}
}
return 0;
}

You might also like