for ax, row in zip(axes.flatten(), finalyy): ax.plot(myx, row, "r-") # ax.set_label('Label via method') # ax.legend() # turn remaining axes off for i in range(len(finalyy), m): axes.flatten()[i].axis("off") # ax.legend() # ax.title(i) plt.tight_layout() if __name__ == "__main__": plt.show() return mycombination x = lifting_line_theory_subplots() def final_subplot(): num = 1 # num = int(input('Select the graph:')) #AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA return x[num - 1] y = final_subplot() if __name__ == "__main__": print(y[0], "this is twist", y[1], "and this is the wing incidence") write_to_db("alpha_twist", y[0]) write_to_db("wing_incidence", y[1])
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # # SOFTWARE. # # ----- # # Copyright (c) 2020 KENYA ONE PROJECT # ################################################################################## import sys sys.path.append("../") from CORE.API.db_API import write_to_db from CORE.engines.prerequisitesEngine import paxWeight, crewWeight, payloadPax rhoSL: float = 0.0023769 write_to_db("rhoSL", rhoSL) # testing main line 37 replace later # Get from prerequisites? DONE: # paxWeight = 180 # crewWeight = 200 # payloadPax = 50 write_to_db("paxWeight", paxWeight) write_to_db("crewWeight", crewWeight) write_to_db("payloadPax", payloadPax)
CLto: float = 0.5 groundFriction: float = 0.04 def oswaldEff(AR: float) -> float: e = (1.78 * (1 - (0.045 * AR ** 0.68))) - 0.64 return e e = oswaldEff(AR) k: float = 1 / (pi * AR * e) write_to_db("k", k) # dynamic pressure at altitude def rhoAlt(cruiseAltitude: int) -> float: rhoalt = rhoSL * (1 - 0.0000068756 * cruiseAltitude) ** 4.2561 return rhoalt rhoCruise = rhoAlt(cruiseAltitude) # print ('air density at cruise altitude, rho = ' +str(rhoCruise)) qAltitude = 0.5 * rhoCruise * (1.688 * cruiseSpeed) ** 2 # print('dynamic pressure at altitude = ' +str(qAltitude)) # Gag Ferrar Model def gagFerrar(bhp):
final, "possible combination", fuselage_angle, "<fuselage angle", df, "match", ) num1 = "{0:.2f}".format(fuselage_angle) num2 = "{0:.2f}".format(df) mycombination.append((num1, num2)) outputcombination.append((fuselage_angle, df)) myy = final finalyy.append(myy) yy = np.asarray(finalyy) else: pass print(mycombination, "select one ") return outputcombination # select one combination combination = llt_final() selectone = 0 ##########A mycombination = combination[selectone] print(mycombination, "final fuselage_angle and df") llt_full(mycombination[0], mycombination[1]) write_to_db("CL_TO", initial_CL_TO)
## 3D Lift Curve Slope # for elliptical wing Mach = cruiseSpeed / 11164.27 wing3 = aa.CLalfa(clalfa, rangeAR, Mach, sweepHalfChord) # make this shit work # finalCLalfa = np.average(wing1.ellipticalCLalfa(),wing1.hemboldCLalfa(),wing1.polhamusCLalfa()) finalCLalfa = (wing3.ellipticalCLalfa() + wing3.hemboldCLalfa() + wing3.polhamusCLalfa()) / 3 # print(wing3.ellipticalCLalfa()) # print(wing3.hemboldCLalfa()) # # print(wing3.polhamusCLalfa()) # print('average CLalfa') # print(finalCLalfa,"final Clalfa") write_to_db("finalCLalfa", finalCLalfa) CLo = -alfazero * finalCLalfa / 57.3 # print(CLo) write_to_db("CLo", CLo) Cma = (finalCLalfa / 57.3) * (cma / (clalfa / 57.3)) # print(Cma) write_to_db("Cma", Cma) cruiseCL = (CLo + ((initialWeight + finalWeight) / (altitudeDensity * S * cruiseSpeed**2)) + ((finalCLalfa / 57.3) * alfazero)) print(cruiseCL, "cruiseCl") write_to_db("cruiseCL", cruiseCL)
################################################################################## import sys sys.path.append("../") from CORE.API.db_API import write_to_db, read_from_db import numpy as np # type: ignore import matplotlib.pylab as plt # type: ignore a = np.arange(50) ws = np.arange(10, 35, 0.01) cdmin: float = 0.025 write_to_db("cdMin", cdmin) do = read_from_db("rhoSL") dalt = read_from_db("altitudeDensity") # AAAAA k = read_from_db("k") # v = read_from_db('cruiseSpeed') * 1.688 v: float = 140 * 1.688 # AAAAA qcruise = 0.5 * dalt * v**2 # dynamic pressure at cruise qtakeoff = 0.5 * do * v**2 # dynamic pressure at take-off turnangle = 40 # turn angle loadfactor = 1 / (np.cos(turnangle)) # loadfactor twturn = (qcruise * ((cdmin / ws) + (k * (loadfactor / qcruise)**2) * ws) * (v * 5850 / (0.8 * 550 * 0.6604)))
payload = (payloadPax * pax) + paxTotal # total payload crewTotal = crew * crewWeight ## also in input main file, decide what to import and from which file oswaldeff = ( 1.78 * (1 - 0.045 * AR ** 0.68) - 0.64 ) # e is oswalds span efficiency factor 0.7-0.95 # k = 1 / (np.pi * oswaldeff * AR) # k is the induced drag factor k=1/(pi*e*AR) # cdo: float = 0.025 # zerolift drag coefficient cdo = 0.022 - 0.028# ldmax1 = 2 * np.sqrt(k * cdo) ldMax = ldmax1 ** (-1) write_to_db("cdo", cdo) write_to_db("ldMax", ldMax) write_to_db("k", k) Vc: float = 140.0 # AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA cbhp: float = 0.4 fuelAllowance: float = 5.0 # in % write_to_db("cbhp", cbhp) w4w3 = math.exp((-Range * 3280.8399 * cbhp / 3600) / (propEff * ldMax * 550)) w2w1: float = 0.98 w3w2: float = 0.97 w5w4: float = 0.99 w6w5: float = 0.997 w6w1 = w2w1 * w3w2 * w4w3 * w5w4 * w6w5
propEff = read_from_db("propEff") cruiseSpeed = ( read_from_db("maxSpeed") / 1.2 ) # CALCULATE THIS, MAYBE USE MAXSPEED/1.2 THEN LATER OPTIMIZE IN PERFORMANCE Range = read_from_db("Range") * 3280.84 # ft cdMin = 0.02541 # CALCULATE THIS SOMEHOW CZ WE HAVE IMPORTED IT INTO THE VALUES FILES endurance = 5.172 # hours ### check spelling from previous modules ldMax = read_from_db("ldMax") rhoSL = read_from_db("rhoSL") altitudeDensity = read_from_db("altitudeDensity") write_to_db("cdMin", cdMin) write_to_db("cbhp", cbhp) write_to_db("cruiseSpeed", cruiseSpeed) wing = wapi.aspectRatio( initialWeight, finalWeight, cruiseSpeed, S, rhoSL, altitude, cbhp, propEff, Range, cdMin,