Skip to content

Commit

Permalink
fix sens_chart and update solar for fixes in gplibrary
Browse files Browse the repository at this point in the history
  • Loading branch information
mjburton committed Apr 29, 2018
1 parent 60d23bb commit f2a516a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
8 changes: 4 additions & 4 deletions solar/sens_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def test():
else:
path = ""

V = Aircraft(Npod=3, sp=True)
M = Mission(V, latitude=[15])
V = Aircraft(Npod=0, sp=False)
M = Mission(V, latitude=[20])
M.cost = M[M.aircraft.Wtotal]
sol = M.localsolve("mosek")
sol = M.solve("mosek")

vns = {M.aircraft.Wpay: "$W_{\\mathrm{pay}}$",
M.aircraft.battery.etacharge: "$\\eta_{\\mathrm{charge}}$",
Expand All @@ -121,6 +121,6 @@ def test():
"Nmax": "$N_{\\mathrm{max}}$",
"e": "$e$", "etaprop": "$\\eta_{\\mathrm{prop}}$"}

sd = get_highestsens(M, sol, N=15)
sd = get_highestsens(M, sol, N=10)
f, a = plot_chart(sd)
f.savefig(path + "sensbar.pdf", bbox_inches="tight")
36 changes: 17 additions & 19 deletions solar/solar.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
from gpkit.tests.helpers import StdoutCaptured
from gpkitmodels.GP.aircraft.wing.wing import Wing as WingGP
from gpkitmodels.SP.aircraft.wing.wing import Wing as WingSP
from gpkitmodels.GP.aircraft.wing.boxspar import BoxSpar
from gpkitmodels.GP.aircraft.wing.boxspar import BoxSpar as BoxSparGP
from gpkitmodels.SP.aircraft.wing.boxspar import BoxSpar as BoxSparSP
from gpkitmodels.GP.aircraft.wing.wing_skin import WingSecondStruct
from gpkitmodels.GP.aircraft.tail.empennage import Empennage
from gpkitmodels.GP.aircraft.tail.horizontal_tail import HorizontalTail
Expand Down Expand Up @@ -122,7 +123,7 @@ def setup(self, static, state, onDesign = False):

self.wing.substitutions[e] = 0.95
self.wing.substitutions[self.wing.CLstall] = 4

self.wing.substitutions[e] = 0.95
dvars = [cdht*Sh/Sw, cdvt*Sv/Sw, cftb*Stb/Sw]

Expand Down Expand Up @@ -163,8 +164,8 @@ class Aircraft(Model):
minvttau 0.09 [-] minimum vertical tail tau ratio
minhttau 0.06 [-] minimum horizontal tail tau ratio
maxtau 0.144 [-] maximum wing tau ratio
SKIP VERIFICATION
SKIP VERIFICATION
Upper Unbounded
---------------
Expand Down Expand Up @@ -210,27 +211,27 @@ def setup(self, Npod=0, sp=False):
foamhd.substitutions.update({foamhd.rho: 0.03})
materials = [cfrpud, cfrpfabric, foamhd]

HorizontalTail.sparModel = BoxSpar
HorizontalTail.sparModel = BoxSparGP
HorizontalTail.fillModel = None
HorizontalTail.skinModel = WingSecondStruct
VerticalTail.sparModel = BoxSpar
VerticalTail.sparModel = BoxSparGP
VerticalTail.fillModel = None
VerticalTail.skinModel = WingSecondStruct
TailBoom.__bases__ = (BoxSpar,)
TailBoom.__bases__ = (BoxSparGP,)
TailBoom.secondaryWeight = True
self.emp = Empennage(N=5)
self.solarcells = SolarCells()
self.battery = Battery()
if sp:
WingSP.sparModel = BoxSpar
WingSP.sparModel = BoxSparSP
WingSP.fillModel = None
WingSP.skinModel = WingSecondStruct
self.wing = WingSP(N=20)
else:
WingGP.sparModel = BoxSpar
WingGP.sparModel = BoxSparGP
WingGP.fillModel = None
WingGP.skinModel = WingSecondStruct
self.wing = WingGP(N=10)
self.wing = WingGP(N=20)
self.motor = Motor()
Propeller.flight_model = ActuatorProp
self.propeller = Propeller()
Expand Down Expand Up @@ -462,23 +463,20 @@ def setup(self, aircraft, latitude=35, day=355):

self.aircraft = aircraft
self.fs = FlightState(latitude=latitude, day=day)
self.aircraftPerf = self.aircraft.flight_model(aircraft, self.fs, True)
self.aircraftPerf = self.aircraft.flight_model(aircraft, self.fs, False)
self.slf = SteadyLevelFlight(self.fs, self.aircraft,
self.aircraftPerf)

if aircraft.Npod is not 0:
if aircraft.Npod is not 1:
assert self.aircraft.sp
loadsp = self.aircraft.sp
else:
loadsp = False
if aircraft.Npod is not 0 and aircraft.Npod is not 1:
assert self.aircraft.sp
loadsp = self.aircraft.sp
else:
loadsp = False

self.wingg = self.aircraft.wing.spar.loading(
self.aircraft.wing, self.fs, sp=loadsp)
self.aircraft.wing, self.fs, out=loadsp)
self.winggust = self.aircraft.wing.spar.gustloading(
self.aircraft.wing, self.fs, sp=loadsp)
self.aircraft.wing, self.fs, out=loadsp)
self.htailg = self.aircraft.emp.htail.spar.loading(
self.aircraft.emp.htail, self.fs)
self.vtailg = self.aircraft.emp.vtail.spar.loading(
Expand Down

0 comments on commit f2a516a

Please sign in to comment.