How to use the gpkit.tools.te_exp_minus1 function in gpkit

To help you get started, we’ve selected a few gpkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github convexengineering / SPaircraft / gpkitmodels / Commercial Sizing / Commerical_Flight_Profile_Simple_Performance.py View on Github external
self.fuseP = self.aircraftP.fuseP
        self.engineP = self.aircraftP.engineP
                        
        #variable definitions
        z_bre = Variable('z_{bre}', '-', 'Breguet Parameter')
        Rng = Variable('Rng', 'nautical_miles', 'Cruise Segment Range')

        constraints = []

        constraints.extend([
             #steady level flight constraint on D 
             self.aircraftP['D'] == aircraft['numeng'] * self.engineP['thrust'],

             #taylor series expansion to get the weight term
             TCS([self.aircraftP['W_{burn}']/self.aircraftP['W_{end}'] >=
                  te_exp_minus1(z_bre, nterm=3)]),

             #breguet range eqn
             # old version -- possibly unneeded numeng
 #            TCS([z_bre >= (self.aircraft['numeng'] * self.engineP['TSFC'] * self.aircraftP['thr']*
 #                           self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

            # new version -- needs to be thought through carefully
             # seems correct to me - I switched T to D below (steady level flight) but fogot
             #about the Negn term
             TCS([z_bre >= (self.engineP['TSFC'] * self.aircraftP['thr']*
                            self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

             #time
             self.aircraftP['thr'] * state['V'] == Rng,
             ])
github convexengineering / SPaircraft / stand_alone_simple_profile.py View on Github external
self.fuseP = self.aircraftP.fuseP
        self.engineP = self.aircraftP.engineP

        #variable definitions
        z_bre = Variable('z_{bre}', '-', 'Breguet Parameter')
        Rng = Variable('Rng', 'nautical_miles', 'Cruise Segment Range')

        constraints = []

        constraints.extend([
             #steady level flight constraint on D
             self.aircraftP['D'] == aircraft['numeng'] * self.engineP['thrust'],

             #taylor series expansion to get the weight term
             TCS([self.aircraftP['W_{burn}']/self.aircraftP['W_{end}'] >=
                  te_exp_minus1(z_bre, nterm=3)]),

             #breguet range eqn
             # old version -- possibly unneeded numeng
 #            TCS([z_bre >= (self.aircraft['numeng'] * self.engineP['TSFC'] * self.aircraftP['thr']*
 #                           self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

            # new version -- needs to be thought through carefully
             # seems correct to me - I switched T to D below (steady level flight) but fogot
             #about the Negn term
             TCS([z_bre >= (self.engineP['TSFC'] * self.aircraftP['thr']*
                            self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

             #time
             self.aircraftP['thr'] * state['V'] == Rng,
             ])
github convexengineering / SPaircraft / CFP_Fuselage_Performance.py View on Github external
self.fuseP = self.aircraftP.fuseP
        self.engineP = self.aircraftP.engineP

        #variable definitions
        z_bre = Variable('z_{bre}', '-', 'Breguet Parameter')
        Rng   = Variable('Rng', 'nautical_miles', 'Cruise Segment Range')

        constraints = []

        constraints.extend([
             # Steady level flight constraint on D
             self.aircraftP['D'] == aircraft['numeng'] * self.engineP['thrust'],

             # Taylor series expansion to get the weight term
             TCS([self.aircraftP['W_{burn}']/self.aircraftP['W_{end}'] >=
                  te_exp_minus1(z_bre, nterm=3)]),

             # Breguet range eqn
             TCS([z_bre >= (self.engineP['TSFC'] * self.aircraftP['thr']*
                            self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

             # Time
             self.aircraftP['thr'] * state['V'] == Rng,
             ])

        return constraints, self.aircraftP
github convexengineering / gplibrary / 1682 / gas_male / gasmale.py View on Github external
#----------------------------------------------------
        # Breguet Range
        z_bre = VectorVariable(NSeg, 'z_{bre}', '-', 'breguet coefficient')
        t_cruise = Variable('t_{cruise}', 1, 'days', 'time to station')
        t_station = Variable('t_{station}',6, 'days', 'time on station')
        R = Variable('R', 200, 'nautical_miles', 'range to station')
        R_cruise = Variable('R_{cruise}', 180, 'nautical_miles',
                            'range to station during climb')

        constraints.extend([
            z_bre >= P_shafttot*t*BSFC*g/W_end,
            R_cruise/NCruise1 <= V[iCruise1]*t[iCruise1],
            R/NCruise2 <= V[iCruise2]*t[iCruise2],
            t[iLoiter] >= t_station/NLoiter,
            sum(t[iCruise+iClimb]) <= t_cruise,
            FuelOilFrac*W_fuel/W_end >= te_exp_minus1(z_bre, 3)
            ])

        #----------------------------------------------------
        # Aerodynamics model

        CLmax = Variable('C_{L-max}', 1.5, '-', 'Maximum lift coefficient')
        e = Variable('e', 0.95, '-', 'Spanwise efficiency')
        AR = Variable('AR', '-', 'Aspect ratio')
        b = Variable('b', 'ft', 'Span')
        Re = VectorVariable(NSeg, 'Re', '-', 'Reynolds number')

        # fuselage drag
        Kfuse = Variable('K_{fuse}', 1.1, '-', 'Fuselage form factor')
        S_fuse = Variable('S_{fuse}', 'ft^2', 'Fuselage surface area')
        Cffuse = VectorVariable(NSeg, 'C_{f-fuse}', '-',
                                'Fuselage skin friction coefficient')
github convexengineering / SPaircraft / HT_simple_profile.py View on Github external
self.fuseP = self.aircraftP.fuseP
        self.engineP = self.aircraftP.engineP
                        
        #variable definitions
        z_bre = Variable('z_{bre}', '-', 'Breguet Parameter')
        Rng = Variable('Rng', 'nautical_miles', 'Cruise Segment Range')

        constraints = []

        constraints.extend([
             #steady level flight constraint on D 
             self.aircraftP['D'] == aircraft['numeng'] * self.engineP['thrust'],

             #taylor series expansion to get the weight term
             TCS([self.aircraftP['W_{burn}']/self.aircraftP['W_{end}'] >=
                  te_exp_minus1(z_bre, nterm=3)]),

             #breguet range eqn
             TCS([z_bre >= (self.engineP['TSFC'] * self.aircraftP['thr']*
                            self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

             #time
             self.aircraftP['thr'] * state['V'] == Rng,
             ])

        Model.__init__(self, None, constraints + self.aircraftP)
github convexengineering / SPaircraft / HT_debug.py View on Github external
self.fuseP = self.aircraftP.fuseP
        self.engineP = self.aircraftP.engineP
                        
        #variable definitions
        z_bre = Variable('z_{bre}', '-', 'Breguet Parameter')
        Rng = Variable('Rng', 'nautical_miles', 'Cruise Segment Range')

        constraints = []

        constraints.extend([
             #steady level flight constraint on D 
             self.aircraftP['D'] == aircraft['numeng'] * self.engineP['thrust'],

             #taylor series expansion to get the weight term
             TCS([self.aircraftP['W_{burn}']/self.aircraftP['W_{end}'] >=
                  te_exp_minus1(z_bre, nterm=3)]),

            # new version -- needs to be thought through carefully
             # seems correct to me - I switched T to D below (steady level flight) but fogot
             #about the Negn term
             TCS([z_bre >= (self.engineP['TSFC'] * self.aircraftP['thr']*
                            self.aircraftP['D']) / self.aircraftP['W_{avg}']]),

             #time
             self.aircraftP['thr'] * state['V'] == Rng,
             ])

        Model.__init__(self, None, constraints + self.aircraftP)
github convexengineering / SPaircraft / gpmodel / gp_d8.py View on Github external
self.perf = aircraft.dynamic(self.state)
            Wstart = Variable('W_{start}', 'N', 'Segment Start Weight')
            Wend = Variable('W_{end}', 'N', 'Segment End Weight')
            Wburn = Variable("W_{burn}", "N", "fuel burned weight")
            d = Variable("d", "nautical_miles", "flight distance")
            t = Variable("t", "hrs", "flight time")
            zbre = Variable('z_{bre}', '-', 'Breguet Parameter')

        Wfuel = Variable("W_{fuel}", "N", "flight segment fuel weight")
        R = Variable("R", "nautical_miles", "flight segment range")

        constraints = [
            self.perf["W_{avg}"] == (Wstart*Wend)**0.5,
            Wfuel >= sum(Wburn),
            zbre >= self.perf["TSFC"]*t*self.perf["D"]/self.perf["W_{avg}"],
            Wburn/Wend >= te_exp_minus1(zbre, nterm=3),
            Wstart >= Wend + Wburn,
            d == t*self.state["V"],
            R == d*N]

        if N > 1:
            constraints.extend([Wend[:-1] >= Wstart[1:]])

        return constraints, self.state, self.perf
github convexengineering / gplibrary / 1682 / gas_hale_rebuild3.py View on Github external
# Weight breakdown
        constraints.extend([W_airframe >= f_airframe*MTOW,
                            W_zfw >= W_pay + W_avionics + W_airframe + W_engtot])
        
        #----------------------------------------------------
        # Breguet Range
        z_bre = VectorVariable(NSeg, 'z_{bre}', '-', 'breguet coefficient')
        BSFC = VectorVariable(NSeg,'BSFC', [0.5,.55,0.6], 'lbf/hr/hp', 'brake specific fuel consumption')
        t = VectorVariable(NSeg, 't', 'days', 'time on station')
        R = Variable('R', 200, 'nautical_miles', 'range to station')
        g = Variable('g', 9.81, 'm/s^2', 'Gravitational acceleration')

        constraints.extend([z_bre >= V*t*BSFC*CD/CL/eta_prop,
                            R == V[NCruise]*t[NCruise],
                            t[NLoiter] == 5*units('days'),
                            W_fuel/W_end >= te_exp_minus1(z_bre, 3)])

        #----------------------------------------------------
        # Aerodynamics model

        Cd0 = Variable('C_{d0}', 0.02, '-', 'Non-wing drag coefficient')
        CLmax = Variable('C_{L-max}', 1.5, '-', 'Maximum lift coefficient')
        e = Variable('e', 0.9, '-', 'Spanwise efficiency')
        AR = Variable('AR', '-', 'Aspect ratio')
        b = Variable('b', 'ft', 'Span')
        mu = Variable(r'\mu', 1.5e-5, 'N*s/m^2', 'Dynamic viscosity')
        Re = VectorVariable(NSeg, 'Re', '-', 'Reynolds number')
        Cf = VectorVariable(NSeg, 'C_f', '-', 'wing skin friction coefficient')
        Kwing = Variable('K_{wing}', 1.3, '-', 'wing form factor')
        cl_16 = Variable('cl_{16}', 0.0001, '-', 'profile stall coefficient')

        constraints.extend([CD >= Cd0 + 2*Cf*Kwing + CL**2/(pi*e*AR) + cl_16*CL**16,
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / mission / breguet_endurance.py View on Github external
def setup(self, perf):
        z_bre = Variable("z_{bre}", "-", "Breguet coefficient")
        t = Variable("t", "days", "Time per flight segment")
        f_fueloil = Variable("f_{(fuel/oil)}", 0.98, "-", "Fuel-oil fraction")
        Wfuel = Variable("W_{fuel}", "lbf", "Segment-fuel weight")
        g = Variable("g", 9.81, "m/s^2", "gravitational acceleration")

        constraints = [
            TCS([z_bre >= (perf["P_{total}"]*t*perf["BSFC"]*g
                           / (perf["W_{end}"]*perf["W_{start}"])**0.5)]),
            f_fueloil*Wfuel/perf["W_{end}"] >= te_exp_minus1(z_bre, 3),
            perf["W_{start}"] >= perf["W_{end}"] + Wfuel
            ]

        return constraints
github convexengineering / gplibrary / gpkitmodels / atmosphere.py View on Github external
def __init__(self, **kwargs):
        T_tp = 216.65
        k = GRAVITATIONAL_ACCEL/(GAS_CONSTANT*T_tp)

        p11 = Variable('p_{11}', 22630, 'Pa', 'Pressure at 11 km')

        objective = 1/rho  # maximize density
        constraints = [h >= 11*units.km,
                       h <= 20*units.km,

                       # Temperature is constant in the tropopause
                       T == T_tp,

                       # Pressure-altitude relation, using taylor series exp
                       TCS([np.exp(k*11000)*p11/p >=
                            1 + te_exp_minus1(g/(R*T)*h, 15)], reltol=1E-4),

                       # Ideal gas law
                       rho == p/(R*T),
                       ]
        su = Sutherland()
        lc = su.link(constraints)

        Model.__init__(self, objective, lc, **kwargs)