From 6205ffc0aa2e42a7b85efd16dd8859f7a210d9c6 Mon Sep 17 00:00:00 2001 From: Oxyde2 Date: Wed, 19 Feb 2020 19:59:19 +0100 Subject: [PATCH 1/5] Added basic upgrades for solid motor compatibility :tada: --- .coverage | Bin 53248 -> 0 bytes REQUIREMENTS.txt | 1 + gofast.py | 10 +++ preflightpy/env.py | 2 +- preflightpy/params.py | 5 +- preflightpy/system.py | 157 ++++++++++++++++++++++++++-------------- tests/input/case.json | 1 + tests/input/gofast.json | 26 +++++-- 8 files changed, 140 insertions(+), 62 deletions(-) delete mode 100644 .coverage create mode 100644 gofast.py diff --git a/.coverage b/.coverage deleted file mode 100644 index 11cf65daa6bb7273127867ad83d307373cb6b6a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 53248 zcmeI)Pi)&%90zba_L8PeaM4snrK|cbD67_VO*_Qa!C1HTFgA((1Az$3oaD9ji0#aF z`sXl>Y!em735hco#EBCJj*KH$ZXluE1_B{2NC*{He$RjMXKSiu(zJH^TKVHY?>)cw zd4C+oPA;B5Yj~V3*p8`tY(^TCWLY}Sm?TO4^i0z;ni4dlMho;Vx6OB(?UyDGv9$J% zl!|{QX_wRQYPr-G>4O75rIwSQ4t$xonyk_WOb~zo1RwwbU!ZY5mB)8H&MpG`w=9puzuo`#Rf>GtnuqsAb_Y7;1c}qMB zU3Ym!9Pwx!9rHxMNk6`rD;gDw73K5-B~-SZipYJ* z(XH|lcPE(MEMeKEe6D&yX&u`<=-I4lSbi}r*YFJ6VtkdC>mILcS-=T_7EOfLUK&d4 ziYU;PAZEC)Hl0@FEnV9JYkor!JjIgXxy_kmN26)3?$UI`_U`RQ z^peg-B6?A^%IpQd%ZS)4s2pm|?S1B8grPg4qcJ-SNI89`txaT>^1w<}yVTj%{1)SK z>L4^0M8Ov7R#|ivSCpY_FLOs<qOs5rSqJTo`atvF%0 zVm_SdYb4Y}W@t!m1U*8GOX9hwqYz?Es|!4IAb9-j*K}`*J(_p1nlhf<6VDtS>Xvbl zg<@X3#&2DS`B`31`1&Rd`r@f{WLd0fW%&$W%Ps3w8ck}t;ZT>QF*rB^FcGk#Q((Ph z*FC@eibcP9iepbJzd-`6<;b2wjr+l=d()2G*=T`fmvmPQK5mwkY`e;JD>x)jz|$`6 z%5a&#>qiepZ?w{I*F+kN%UM4w(J@7g?w6>qMcs;KOjEZi;bBS~eS=hK$QON5>?asI zC?d;JUv#NwK9pvZXt-4jR8jhqHKGuyntCPZ<)SXyQe0W$k0ciygih%m_Y9LW5ya1o z-=0=jK1eNjopym%F7$$jF3Ok+$=WDXpV8}+ac2E$9yrDM6NN7)V+ zV;ybdp^dF(@)nJ=^dYCcc?i2U4zU>QL5yiZ4VD6hC{*|nr+-|W;LF;EL=Q|5fB*y_ z009U<00Izz00bZa0SG*Q0*V}y6XN_|)y_!T$68%`k7h7I00Izz00bZa0SG_<0uX=z z1R$`TKuT3cwdiJwsh1RGXhz&jFg-Orm7AK*FT=EKqS~Q#E)^ee6 zvFsQ%5u~=}ao5XEuxxJGf6dYD1g|$k*Vckf%h?aaP5!F(gQWeS{iXe?-P^8!*aiUz zKmY;|fB*y_009U<00Izzz)lfJDWh`qEri;q49Vh42xUMSk;88sVgt%(GWxC|xc;A# zw7YZ%z-cYDQ%Zq+KmY;|fB*y_009U<00Izz00f?vz)@9^uG6LW;L3Y&;k|X;y>;2W z?K*m)raQXn(jN~TReFz1C*dA9De~c%BCYheXS(7~F^|cr)R23OS}Yot;T4M%Ke+y% zmbCA*buF#E`Lt}2E(9O|0SG_<0uX=z1Rwwb2tZ)R2)w3T@AXu=dH%0HLFDH7zj8!b z>2=S+`G4$~+K`h^e*TaD|JyOG4;g^~1Rwwb2tWV=5P$##AOHafJPiRwR;0AJ{x56) zO7y@40SG_<0uX=z1Rwwb2tWV=5P-mQD4;0mWbpg{JCgQ~_PzGGcIP=PCW-_B2tWV= z5P$##AOHafKmY;|*m(kJRh5(b)IRC>)vvxb$Fd47o>TgyyTg87KkCTwiQ9w8Px>S# zNrRIy3V1n2@qXKU@ZZMbH=93iKG^*I!N%Wz-uw23SoMo|3738x+as&V?I|39?*9m!(>0uX=z1Rwwb2tWV=5P$##AOL|~BoL?X24q$B-xS4vi^Wv>0>Hoi zFAeUZq9CgffB*y_009U<00Izz00bZa0SNRgAg=%8{J&>5M1TMUAOHafKmY;|fB*y_ p009W>Dgp8Pf1LmCswzWfApijgKmY;|fB*y_009U<00KP={0|C*M7;n2 diff --git a/REQUIREMENTS.txt b/REQUIREMENTS.txt index 2738fcc..3e5489f 100644 --- a/REQUIREMENTS.txt +++ b/REQUIREMENTS.txt @@ -1,4 +1,5 @@ matplotlib +numpy coverage pytest pytest-cov diff --git a/gofast.py b/gofast.py new file mode 100644 index 0000000..1b8eff1 --- /dev/null +++ b/gofast.py @@ -0,0 +1,10 @@ +import preflightpy as pre + +params = pre.Parameters("tests/input/gofast.json") # Collects info about the rocket and environmental conditions etc. from the input file. +env = pre.Environment(params.env_variables) # The 'Environment' takes care of computing conditions (e.g. atmosphere, gravity) at various altitudes. +burn_time = 10.43 # The burn time of your engine in seconds. +s = pre.System(params, env, burn_time) # The core of this module, it takes care of the main simulation and the output. + +s.launch() # Blast off! Launches the simulation. + +# Output, in .csv and .log forms, is located in the output folder specified in the input file diff --git a/preflightpy/env.py b/preflightpy/env.py index a6d2aa5..8e849d5 100644 --- a/preflightpy/env.py +++ b/preflightpy/env.py @@ -26,7 +26,7 @@ class Environment: def __init__(self, vars): # Environmental Constants - self.elev, self.t, self.g, self.M_air, self.R, self.gamma, self.Pstatic = vars # noqa + self.elev, self.t, self.g, self.M_air, self.R, self.gamma, self.P_zero = vars # noqa self.g_zero = self.g self.Re = 6356766 self.hb = [ # Layer base altitudes diff --git a/preflightpy/params.py b/preflightpy/params.py index a5060e8..69eb5bc 100644 --- a/preflightpy/params.py +++ b/preflightpy/params.py @@ -57,7 +57,10 @@ def cast(self, x): try: return float(x) except Exception: - return str(x) + if type(x) == dict: + return x + else: + return str(x) # TEMP: for testing purposes # p = Params() diff --git a/preflightpy/system.py b/preflightpy/system.py index 37f1b26..48f3415 100644 --- a/preflightpy/system.py +++ b/preflightpy/system.py @@ -22,6 +22,7 @@ import math import csv import matplotlib.pyplot as plt +import numpy as np class System: @@ -29,24 +30,43 @@ def __init__(self, params, env, burn_time: float): p = params # Environment self.env = env + # Burn time self.num_steps = int(burn_time/self.env.t) self.burn_time = self.num_steps * self.env.t + # Engine specs - self.isp, self.Fthrust = p.package[0] + self.etype = p.package[0][0] + p.package[0].pop(0) + if self.etype == "Liquid": + self.isp, self.thrust = p.package[0] + elif self.etype == "Solid": + self.isp, self.avg_thrust, self.start_equ, self.coast_equ, self.burnout_equ = p.package[0] # noqa + self.start_equ = list(self.start_equ.values()) + self.coast_equ = list(self.coast_equ.values()) + self.burnout_equ = list(self.burnout_equ.values()) + # Fuel Specs self.OFratio, self.Reserve = p.package[1] + # Flow Rate - self.w = (self.Fthrust/self.env.g_zero)/self.isp + if self.etype == "Liquid": + self.w = (self.thrust/self.env.g_zero)/self.isp + elif self.etype == "Solid": + self.w = (self.avg_thrust/self.env.g_zero)/self.isp self.dF = self.w * (1/(self.OFratio+1)) self.dOx = (self.w - self.dF) + # Fuel & Oxidizer self.F = (self.dF * self.burn_time)/(1 - self.Reserve/100) self.Ox = (self.dOx * self.burn_time)/(1 - self.Reserve/100) + # Mass - self.frameM = p.package[2][0] + self.dry_mass = p.package[2][0] + # Aerodynamics - self.Cd, self.Aproj = p.package[3] + self.Cd, self.cross_section = p.package[3] + # Output self.logout, self.csvout = p.package[4] @@ -54,21 +74,21 @@ def __init__(self, params, env, burn_time: float): self.field_names = [ "t", - "Fthrust", - "Fdrag", + "thrust", + "drag", "m", "v", - "Mach", + "mach", "a", "altitude", "asl", "twr", - "maxV", - "maxMach", - "maxAcc", - "minAcc", - "maxG", - "minG" + "max_v", + "max_mach", + "max_acc", + "min_acc", + "max_g", + "min_g" ] with open(self.csvout, "w", newline="") as f: csv_writer = csv.writer(f) @@ -78,25 +98,26 @@ def __init__(self, params, env, burn_time: float): # Flight def launch(self): """Runs a simulation within the given parameters.""" - # Variable setup + # Variables setup + self.t = 0 self.altitude = 0 self.asl = self.altitude + self.env.elev self.calc_mass() self.env.get_status(self.asl) + self.calc_thrust() self.calc_twr() - self.Fdrag = 0 + self.drag = 0 self.v = 0 - self.maxV = 0 - self.Mach = 0 - self.maxMach = 0 - self.maxAcc = 0 - self.maxG = 0 - self.minAcc = 0 - self.minG = 0 + self.max_v = 0 + self.mach = 0 + self.max_mach = 0 + self.max_acc = 0 + self.max_g = 0 + self.min_acc = 0 + self.min_g = 0 self.a = 0 self.j = 0 self.s = 0 - self.t = 0 # Used by matplotlib self.plot_data = [ @@ -119,6 +140,8 @@ def launch(self): self.add_data() # Environment-related self.update_env() + # Thrust-related + self.calc_thrust() # Accelaration/derivative-related self.calc_acc() self.calc_additional_derivatives() @@ -130,23 +153,23 @@ def launch(self): self.calc_drag() self.calc_twr() # Mass-related - self.remove_fuel() + self.calc_propellant() self.calc_mass() # Time-related self.t += self.env.t - if self.twr < 1: - raise RuntimeError("TWR below 1 : {}".format(self.twr)) + #if self.twr < 1: + #raise RuntimeError("TWR = {0} (< 1) at t = {1}".format(self.twr, self.t)) - if self.a > self.maxAcc: - self.maxAcc = self.a - self.maxG = self.maxAcc/self.env.g + if self.a > self.max_acc: + self.max_acc = self.a + self.max_g = self.max_acc/self.env.g - if self.v > self.maxV: - self.maxV = self.v - self.maxMach = self.Mach + if self.v > self.max_v: + self.max_v = self.v + self.max_mach = self.mach - self.Fthrust = 0 + self.thrust = 0 # Deceleration phase while self.v > 0: @@ -169,29 +192,35 @@ def launch(self): # Time-related self.t += self.env.t - if self.a < self.minAcc: - self.minAcc = self.a - self.minG = self.minAcc/self.env.g + if self.a < self.min_acc: + self.min_acc = self.a + self.min_g = self.min_acc/self.env.g self.output( - "maxV", - "maxMach", - "maxAcc", - "minAcc", - "maxG", - "minG" + "max_v", + "max_mach", + "max_acc", + "min_acc", + "max_g", + "min_g" ) def suicide_burn(self): """Run a suicide burn simulation, will affct ascent simulation.""" - self.Vt = math.sqrt((2 * self.m * self.env.g) / (self.env.Rho * self.Aproj * self.Cd)) # noqa + self.Vt = math.sqrt((2 * self.m * self.env.g) / (self.env.Rho * self.cross_section * self.Cd)) # noqa # Mass def calc_mass(self): - self.fuelM = (self.Ox + self.F) - self.m = self.fuelM + self.frameM - - def remove_fuel(self): + self.propellant_mass = (self.Ox + self.F) + self.m = self.propellant_mass + self.dry_mass + + def calc_propellant(self): + if self.etype == "Liquid": + self.w = (self.thrust/self.env.g_zero)/self.isp + elif self.etype == "Solid": + self.w = (self.avg_thrust/self.env.g_zero)/self.isp + self.dF = self.w * (1/(self.OFratio+1)) + self.dOx = (self.w - self.dF) self.Ox -= self.dOx * self.env.t self.F -= self.dF * self.env.t @@ -203,21 +232,39 @@ def set_altitude(self): # Derivatives of position def calc_velocity(self): self.v += self.a * self.env.t - self.Mach = self.v/self.env.c + self.mach = self.v/self.env.c def calc_acc(self): - self.a = (self.Fthrust - (self.m * self.env.g + self.Fdrag)) / self.m + self.a = (self.thrust - (self.m * self.env.g + self.drag)) / self.m def calc_additional_derivatives(self): self.j = (self.a - self.plot_data[4][-1]) / self.env.t self.s = (self.j - self.plot_data[5][-1]) / self.env.t # Forces + def calc_thrust(self): + if self.etype == "Liquid": + pass + elif self.etype == "Solid": + s = self.start_equ + c = self.coast_equ + b = self.burnout_equ + if s[0] <= self.t < s[1]: + poly = np.poly1d(s[2]) + #print(self.t,poly(self.t)) + self.thrust = poly(self.t) + elif c[0] <= self.t < c[1]: + poly = np.poly1d(c[2]) + self.thrust = poly(self.t) + elif b[0] <= self.t <= b[1]: + poly = np.poly1d(b[2]) + self.thrust = poly(self.t) + def calc_drag(self): - self.Fdrag = 0.5 * (self.env.Rho * self.v**2 * self.Cd * self.Aproj) + self.drag = 0.5 * (self.env.Rho * self.v**2 * self.Cd * self.cross_section) # noqa def calc_twr(self): - self.twr = self.Fthrust / (self.m * self.env.g) + self.twr = self.thrust / (self.m * self.env.g) # Environment def update_env(self): @@ -250,14 +297,14 @@ def add_data(self): self.plot_data[4].append(self.a) self.plot_data[5].append(self.j) self.plot_data[6].append(self.s) - self.plot_data[7].append(self.Fdrag) + self.plot_data[7].append(self.drag) self.output( "t", - "Fthrust", - "Fdrag", + "thrust", + "drag", "m", "v", - "Mach", + "mach", "a", "altitude", "asl", diff --git a/tests/input/case.json b/tests/input/case.json index 733cc79..b8d4eca 100644 --- a/tests/input/case.json +++ b/tests/input/case.json @@ -1,5 +1,6 @@ { "Engine" : { + "Type" : "Liquid", "Specific Impulse (s)" : 318, "Thrust (N)" : 500 }, diff --git a/tests/input/gofast.json b/tests/input/gofast.json index d164ae7..8efb9db 100644 --- a/tests/input/gofast.json +++ b/tests/input/gofast.json @@ -1,7 +1,23 @@ { "Engine" : { + "Type" : "Solid", "Specific Impulse (s)" : 212.5, - "Thrust (N)" : 39419 + "Average thrust (N)" : 39419, + "Start thrust curve equation" : { + "Start (s)" : 0.00, + "Stop (s)" : 1.00, + "Polynomial Coefficients" : [28555, -48282, 78808] + }, + "Coast thrust curve equation" : { + "Start (s)" : 1.00, + "Stop (s)" : 7.00, + "Polynomial Coefficients" : [0, 59081] + }, + "Burnout thrust curve equation" : { + "Start (s)" : 7.00, + "Stop (s)" : 10.43, + "Polynomial Coefficients" : [-17225, 179654] + } }, "Fuel" : { "Oxidizer/Fuel Mixture Ratio" : 1, @@ -11,8 +27,8 @@ "Dry Mass (kg)" : 131.36 }, "Aerodynamics" : { - "Drag Coefficient" : 0.0555, - "Frontal Area (m2)" : 0.21 + "Drag Coefficient" : 0.1, + "Frontal Area (m2)" : 0.05 }, "Environment" : { "Elevation (m)" : 1190, @@ -24,7 +40,7 @@ "Standard Atmospheric pressure @SL (Pa)" : 101325 }, "Output" : { - "Log File Path" : "tests/output/gofast.log", - "CSV File Path" : "tests/output/gofast.csv" + "Log File Path" : "./tests/output/gofast.log", + "CSV File Path" : "./tests/output/gofast.csv" } } From 477490f31538fab9f32406cb195a449ae0f3c8bd Mon Sep 17 00:00:00 2001 From: Oxyde2 Date: Thu, 20 Feb 2020 15:26:47 +0100 Subject: [PATCH 2/5] Changed thrust data from polynomials to .csv file input --- gofast.py | 10 ---------- preflightpy/params.py | 9 +-------- preflightpy/system.py | 42 +++++++++++++++++------------------------ tests/input/case.json | 14 +++++++------- tests/input/gofast.json | 33 +++++++++----------------------- 5 files changed, 34 insertions(+), 74 deletions(-) delete mode 100644 gofast.py diff --git a/gofast.py b/gofast.py deleted file mode 100644 index 1b8eff1..0000000 --- a/gofast.py +++ /dev/null @@ -1,10 +0,0 @@ -import preflightpy as pre - -params = pre.Parameters("tests/input/gofast.json") # Collects info about the rocket and environmental conditions etc. from the input file. -env = pre.Environment(params.env_variables) # The 'Environment' takes care of computing conditions (e.g. atmosphere, gravity) at various altitudes. -burn_time = 10.43 # The burn time of your engine in seconds. -s = pre.System(params, env, burn_time) # The core of this module, it takes care of the main simulation and the output. - -s.launch() # Blast off! Launches the simulation. - -# Output, in .csv and .log forms, is located in the output folder specified in the input file diff --git a/preflightpy/params.py b/preflightpy/params.py index 69eb5bc..91f4441 100644 --- a/preflightpy/params.py +++ b/preflightpy/params.py @@ -57,11 +57,4 @@ def cast(self, x): try: return float(x) except Exception: - if type(x) == dict: - return x - else: - return str(x) - -# TEMP: for testing purposes -# p = Params() -# print(p.package, len(str(p.package)), type(p.package[0][1])) + return str(x) diff --git a/preflightpy/system.py b/preflightpy/system.py index 48f3415..1693d4a 100644 --- a/preflightpy/system.py +++ b/preflightpy/system.py @@ -22,7 +22,6 @@ import math import csv import matplotlib.pyplot as plt -import numpy as np class System: @@ -32,7 +31,7 @@ def __init__(self, params, env, burn_time: float): self.env = env # Burn time - self.num_steps = int(burn_time/self.env.t) + self.num_steps = int(burn_time // self.env.t) self.burn_time = self.num_steps * self.env.t # Engine specs @@ -41,20 +40,28 @@ def __init__(self, params, env, burn_time: float): if self.etype == "Liquid": self.isp, self.thrust = p.package[0] elif self.etype == "Solid": - self.isp, self.avg_thrust, self.start_equ, self.coast_equ, self.burnout_equ = p.package[0] # noqa - self.start_equ = list(self.start_equ.values()) - self.coast_equ = list(self.coast_equ.values()) - self.burnout_equ = list(self.burnout_equ.values()) + self.isp, self.avg_thrust, path = p.package[0] # noqa + with(open(path)) as f: + csv_reader = csv.reader(f) + self.thrust_curve = {} + for row in csv_reader: + self.thrust_curve.update({ + float(row[0]): float(row[1]) + }) + f.close() # Fuel Specs - self.OFratio, self.Reserve = p.package[1] - + if self.etype == "Liquid": + self.OFratio, self.Reserve = p.package[1] + elif self.etype == "Solid": + self.OFratio = 0 + self.Reserve = p.package[1][0] # Flow Rate if self.etype == "Liquid": self.w = (self.thrust/self.env.g_zero)/self.isp elif self.etype == "Solid": self.w = (self.avg_thrust/self.env.g_zero)/self.isp - self.dF = self.w * (1/(self.OFratio+1)) + self.dF = self.w * (1 / (self.OFratio + 1)) self.dOx = (self.w - self.dF) # Fuel & Oxidizer @@ -158,9 +165,6 @@ def launch(self): # Time-related self.t += self.env.t - #if self.twr < 1: - #raise RuntimeError("TWR = {0} (< 1) at t = {1}".format(self.twr, self.t)) - if self.a > self.max_acc: self.max_acc = self.a self.max_g = self.max_acc/self.env.g @@ -246,19 +250,7 @@ def calc_thrust(self): if self.etype == "Liquid": pass elif self.etype == "Solid": - s = self.start_equ - c = self.coast_equ - b = self.burnout_equ - if s[0] <= self.t < s[1]: - poly = np.poly1d(s[2]) - #print(self.t,poly(self.t)) - self.thrust = poly(self.t) - elif c[0] <= self.t < c[1]: - poly = np.poly1d(c[2]) - self.thrust = poly(self.t) - elif b[0] <= self.t <= b[1]: - poly = np.poly1d(b[2]) - self.thrust = poly(self.t) + self.thrust = self.thrust_curve[round(self.t, 3)] def calc_drag(self): self.drag = 0.5 * (self.env.Rho * self.v**2 * self.Cd * self.cross_section) # noqa diff --git a/tests/input/case.json b/tests/input/case.json index b8d4eca..389c9a8 100644 --- a/tests/input/case.json +++ b/tests/input/case.json @@ -1,18 +1,18 @@ { "Engine" : { "Type" : "Liquid", - "Specific Impulse (s)" : 318, + "Specific impulse (s)" : 318, "Thrust (N)" : 500 }, "Fuel" : { - "Oxidizer/Fuel Mixture Ratio" : 15, - "Fuel Reserve (%)" : 5 + "Oxidizer/fuel mixture ratio" : 15, + "Fuel reserve (%)" : 5 }, "Mass" : { "Dry Mass (kg)" : 10 }, "Aerodynamics" : { - "Drag Coefficient" : 0.0556, + "Drag coefficient" : 0.0556, "Cross-section (m2)" : 0.0255364 }, "Environment" : { @@ -22,10 +22,10 @@ "Air molar mass (kg/mol)" : 0.02896968, "Gas constant (J/(K.mol))" : 8.314462618, "Air heat capacity ratio" : 1.4, - "Standard Atmospheric pressure @SL (Pa)" : 101325 + "Standard atmospheric pressure @SL (Pa)" : 101325 }, "Output" : { - "Log File Path" : "Flight.log", - "CSV File Path" : "Flight.csv" + ".log file" : "Flight.log", + ".csv file" : "Flight.csv" } } diff --git a/tests/input/gofast.json b/tests/input/gofast.json index 8efb9db..0dc0325 100644 --- a/tests/input/gofast.json +++ b/tests/input/gofast.json @@ -1,34 +1,19 @@ { "Engine" : { "Type" : "Solid", - "Specific Impulse (s)" : 212.5, + "Specific impulse (s)" : 212.5, "Average thrust (N)" : 39419, - "Start thrust curve equation" : { - "Start (s)" : 0.00, - "Stop (s)" : 1.00, - "Polynomial Coefficients" : [28555, -48282, 78808] - }, - "Coast thrust curve equation" : { - "Start (s)" : 1.00, - "Stop (s)" : 7.00, - "Polynomial Coefficients" : [0, 59081] - }, - "Burnout thrust curve equation" : { - "Start (s)" : 7.00, - "Stop (s)" : 10.43, - "Polynomial Coefficients" : [-17225, 179654] - } + "Thrust curve file path" : "Preflight/tests/input/S-50000.csv" }, "Fuel" : { - "Oxidizer/Fuel Mixture Ratio" : 1, - "Fuel Reserve (%)" : 0 + "Fuel reserve (%)" : 0 }, "Mass" : { - "Dry Mass (kg)" : 131.36 + "Dry mass (kg)" : 131.36 }, "Aerodynamics" : { - "Drag Coefficient" : 0.1, - "Frontal Area (m2)" : 0.05 + "Drag coefficient" : 0.1, + "Cross-section (m2)" : 0.05 }, "Environment" : { "Elevation (m)" : 1190, @@ -37,10 +22,10 @@ "Air molar mass (kg/mol)" : 0.02896968, "Gas constant (J/(K.mol))" : 8.314462618, "Air heat capacity ratio" : 1.4, - "Standard Atmospheric pressure @SL (Pa)" : 101325 + "Standard atmospheric pressure @SL (Pa)" : 101325 }, "Output" : { - "Log File Path" : "./tests/output/gofast.log", - "CSV File Path" : "./tests/output/gofast.csv" + ".log file" : "Preflight/tests/output/gofast.log", + ".csv file" : "Preflight/tests/output/gofast.csv" } } From d681eae396e851430a74e97c6ff4d574681cd66b Mon Sep 17 00:00:00 2001 From: Oxyde2 Date: Wed, 26 Feb 2020 19:09:48 +0100 Subject: [PATCH 3/5] Fixing tests :green_heart: --- tests/input/case.params | 4 ++-- tests/params_test.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/input/case.params b/tests/input/case.params index 31f7b16..3cb9378 100644 --- a/tests/input/case.params +++ b/tests/input/case.params @@ -1,7 +1,7 @@ Specific impulse (s) : 318 -Thrust (N) : 500 +Average thrust (N) : 500 +Thrust curve file path : tests/input/thrust.csv ================== ▲ Engine ▲ ================= -Oxidizer/Fuel mixture ratio : 15 Fuel reserve (%) : 5 =================== ▲ Fuel ▲ ================== Dry mass (kg) : 10 diff --git a/tests/params_test.py b/tests/params_test.py index 6898dde..ee3b9d1 100644 --- a/tests/params_test.py +++ b/tests/params_test.py @@ -71,8 +71,8 @@ def test_params_extension(self): p = pre.Parameters("tests/input/case.params") assert p.package == [ - [318, 500], - [15, 5], + ["Solid", 318, 500, "tests/input/thrust.csv"], + [5], [10], [0.0556, 0.0255364], ["Flight.log", "Flight.csv"] @@ -91,7 +91,7 @@ def test_json_extension(self): p = pre.Parameters("tests/input/case.json") assert p.package == [ - [318, 500], + ["Liquid", 318, 500], [15, 5], [10], [0.0556, 0.0255364], From b54a1743b52aefe33e4cab89cf41684efcd46e83 Mon Sep 17 00:00:00 2001 From: Oxyde2 Date: Wed, 26 Feb 2020 19:10:51 +0100 Subject: [PATCH 4/5] Updated README.md --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f2f7ae5..4e21a9e 100644 --- a/README.md +++ b/README.md @@ -62,19 +62,20 @@ The following is the format you'll have to use in your `.json` input files: ```json { "Engine" : { - "Specific Impulse (s)" : 318, - "Thrust (N)" : 500 + "Type" : "Liquid", + "Specific impulse (s)" : 318, + "Thrust (N)" : 500 }, "Fuel" : { - "Oxidizer/Fuel Mixture Ratio" : 15, - "Fuel Reserve (%)" : 5 + "Oxidizer/fuel mixture ratio" : 15, + "Fuel reserve (%)" : 5 }, "Mass" : { - "Dry Mass (kg)" : 10 + "Dry Mass (kg)" : 10 }, "Aerodynamics" : { - "Drag Coefficient" : 0.0556, - "Cross-section (m2)" : 0.0255364 + "Drag coefficient" : 0.0556, + "Cross-section (m2)" : 0.0255364 }, "Environment" : { "Elevation (m)" : 113, @@ -83,11 +84,11 @@ The following is the format you'll have to use in your `.json` input files: "Air molar mass (kg/mol)" : 0.02896968, "Gas constant (J/(K.mol))" : 8.314462618, "Air heat capacity ratio" : 1.4, - "Standard Atmospheric pressure @SL (Pa)" : 101325 + "Standard atmospheric pressure @SL (Pa)" : 101325 }, "Output" : { - "Log File Path" : "path/to/Flight.log", - "CSV File Path" : "path/to/Flight.csv" + ".log file" : "Flight.log", + ".csv file" : "Flight.csv" } } ``` From 11a6a39a09b24f9434644daa9510cba42484e43c Mon Sep 17 00:00:00 2001 From: Oxyde2 Date: Wed, 26 Feb 2020 19:27:40 +0100 Subject: [PATCH 5/5] Fixing tests :green_heart: --- tests/input/case.params | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/input/case.params b/tests/input/case.params index 3cb9378..0c5eed1 100644 --- a/tests/input/case.params +++ b/tests/input/case.params @@ -1,3 +1,4 @@ +Type : Solid Specific impulse (s) : 318 Average thrust (N) : 500 Thrust curve file path : tests/input/thrust.csv