Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constraints.extend([
SignomialEquality(hft[i+Nclimb1], 10000*units('ft')+(i+1)*dhft[i+Nclimb1])
])
for i in range(0, Nseg):
constraints.extend([
TCS([W_start[i] >= W_end[i] + W_fuel[i]])
])
#constrain the segment weights in a loop
for i in range(1, Nseg):
constraints.extend([
W_start[i] == W_end[i-1]
])
Model.__init__(self, W_ftotal, constraints, **kwargs)
#constrain the max wing loading
WLoad <= WLoadmax,
#compute fuel burn from TSFC
W_burn == aircraft['numeng']*self.engineP['TSFC'] * thours * self.engineP['thrust'],
#time unit conversion
t == thours,
#make lift equal weight --> small angle approx in climb
self.wingP['L_{wing}'] >= W_avg,
## SignomialEquality(self.wingP['L_{wing}'] , W_avg + self.htP['L_h'])
])
Model.__init__(self, None, [self.Pmodels + constraints], **kwargs)
self.wing = Wing()
self.engine = Engine()
self.VT = VerticalTail(self.fuse, self.engine)
#variable definitions
numeng = Variable('numeng', '-', 'Number of Engines')
constraints = []
constraints.extend([
numeng == numeng, #need numeng in the model
])
self.components = [self.fuse, self.wing, self.engine, self.VT]
Model.__init__(self, None, [self.components + constraints], **kwargs)
constraints.extend([
#wing weight constraint
#based off of a raymer weight and 737 data from TASOPT output file
(S/(dum1))**.65 == W_wing/(dum2),
#compute wing span and aspect ratio, subject to a span constraint
AR == (span**2)/S,
#AR == 9,
span <= span_max,
#compute K for the aircraft
K == (pi * e * AR)**-1,
])
Model.__init__(self, None, constraints)
def __init__(self, aircraft, **kwargs):
self.state = FlightState()
self.cruiseP = aircraft.cruise_dynamic(self.state)
Model.__init__(self, None, [self.state, self.cruiseP], **kwargs)
def __init__(self, fuse, wing,**kwargs):
self.fuse = fuse
self.wing = wing
self.htns = HorizontalTailNoStruct(self.fuse, self.wing)
self.wb = WingBox(self.htns)
Model.__init__(self, None, self.htns + self.wb)
#climb rate constraints
TCS([excessP + state['V'] * self.aircraftP['D'] <= state['V'] * aircraft['numeng'] * self.engineP['thrust']]),
RC == excessP/self.aircraftP['W_{avg}'],
RC >= 500*units('ft/min'),
#make the small angle approximation and compute theta
theta * state['V'] == RC,
dhft == self.aircraftP['tmin'] * RC,
#makes a small angle assumption during climb
RngClimb == self.aircraftP['thr']*state['V'],
])
Model.__init__(self, None, constraints + self.aircraftP)
#make new constraints
constraints = []
constraints.extend([
V == V, #required so velocity variable enters the model
#compute the speed of sound with the state
a == (gamma * R * self.atm['T_{atm}'])**.5,
#compute the mach number
V == M * a,
])
#build the model
Model.__init__(self, None, constraints + self.atm + self.alt, **kwargs)
gamma = Variable('\\gamma', 1.4, '-', 'Air Specific Heat Ratio')
M = Variable('M', '-', 'Mach Number')
#make constraints
constraints = []
constraints.extend([
rho == .38*units('kg/m^3'),
V == V,
V == M * a,
a == (gamma * R * T_atm)**.5,
a == 297 * units('m/s'),
mu == mu,
])
Model.__init__(self, None, constraints)
CM == CM,
mw == mw,
cbar == cbar,
cave == (cb[1:] + cb[:-1])/2*S/b,
croot == S/b*cb[0],
cmac == S/b]
self.capspar = CapSpar(b, cave, tau, N)
self.wingskin = WingSkin(S, croot, b)
self.winginterior = WingInterior(cave, b, N)
self.components = [self.capspar, self.wingskin, self.winginterior]
self.loading = WingLoading
constraints.extend([W/mfac >= sum(c["W"] for c in self.components)])
Model.__init__(self, None, [self.components, constraints],
**kwargs)