Skip to content

Commit

Permalink
add testing method for wing
Browse files Browse the repository at this point in the history
  • Loading branch information
mjburton committed Oct 25, 2017
1 parent 288aa00 commit f4aab0b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
7 changes: 2 additions & 5 deletions gpkitmodels/GP/aircraft/wing/wing.py
Expand Up @@ -6,11 +6,10 @@
from .wing_interior import WingInterior
from .wing_skin import WingSkin
from .capspar import CapSpar
from .constant_taper_chord import c_bar
from gpfit.fit_constraintset import XfoilFit

#pylint: disable=invalid-name, attribute-defined-outside-init, unused-variable
#pylint: disable=too-many-instance-attributes, too-many-locals
#pylint: disable=too-many-instance-attributes, too-many-locals, no-member

class Planform(Model):
"The thing that creates the lift"
Expand Down Expand Up @@ -97,15 +96,13 @@ class Wing(Model):
flight_model = WingAero
loading = WingLoading

def setup(self, N=5, lam=0.5):
def setup(self, N=5):

self.N = N

W = Variable("W", "lbf", "wing weight")
mfac = Variable("m_{fac}", 1.2, "-", "wing weight margin factor")

cb, eta, deta, cbarmac = c_bar(lam, N)

self.planform = Planform(N)
self.skin = WingSkin(self.planform)
self.components = [self.skin]
Expand Down
32 changes: 32 additions & 0 deletions gpkitmodels/GP/aircraft/wing/wing_test.py
@@ -0,0 +1,32 @@
" wing test "
from gpkitmodels.GP.aircraft.wing.wing import Wing
from gpkit import Variable, Model

class FlightState(Model):
" state variables "
def setup(self):

V = Variable("V", 50, "m/s", "airspeed")
rho = Variable("\\rho", 1.255, "kg/m^3", "air density")
mu = Variable("\\mu", 1.5e-5, "N*s/m**2", "air viscosity")

constraints = [V == V, rho == rho, mu == mu]

return constraints

def wing_test():
" test wing models "

Wcent = Variable("W_{cent}", 100, "lbf", "center weight")

W = Wing()
W.substitutions[W.topvar("W")] = 50
fs = FlightState()
perf = W.flight_model(W, fs)
loading = W.loading(W, Wcent, W.topvar("W"), fs["V"], perf["C_L"])

m = Model(perf["C_d"], [W, fs, perf, loading])
m.solve("mosek")

if __name__ == "__main__":
wing_test()

0 comments on commit f4aab0b

Please sign in to comment.