How to use the gpkit.parse_variables 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 / gpkit / docs / source / examples / boundschecking.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self):
        self.cost = F
        return [
            F >= D + T,
            D == rf*V**2*Ap,
            Ap == nu,
            T == mf*V,
            mf >= mi + mb,
            mf == rf*V,
            Fs <= mi
        ]
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / wing / wing_skin.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self, surface):
        self.surface = surface

        croot = surface.croot
        S = surface.S
        rho = self.material.rho
        tau = self.material.tau
        tmin = self.material.tmin

        return [W >= rho*S*2*t*g,
                t >= tmin,
                tau >= 1/Jtbar/croot**2/t*Cmw*S*rhosl*Vne**2]
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / tail / horizontal_tail.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self, N=3):
        self.ascs = Wing.setup(self, N)
        self.planform.substitutions.update(
            {self.planform.AR: 4, self.planform.lam: 0.8})
        if self.fillModel:
            self.foam.substitutions.update({self.foam.Abar: 0.0548,
                                            self.foam.material.rho: 0.024})

        return self.ascs, mh*(1+2.0/self.planform["AR"]) <= 2*np.pi
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / tail / vertical_tail.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self, N=3):
        self.ascs = Wing.setup(self, N)
        self.planform.substitutions.update(
            {self.planform.lam: 0.8, self.planform.AR: 4})
        if self.fillModel:
            self.foam.substitutions.update({self.foam.Abar: 0.0548,
                                            self.foam.material.rho: 0.024})

        return self.ascs
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / tail / tail_aero.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self, static, state):
        self.state = state

        cmac = self.cmac = static.planform.cmac
        b = self.b = static.planform.b
        S = self.S = static.planform.S
        tau = self.tau = static.planform.tau
        rho = self.rho = state.rho
        V = self.V = state.V
        mu = self.mu = state.mu
        path = os.path.dirname(__file__)
        fd = pd.read_csv(path + os.sep + "tail_dragfit.csv").to_dict(
            orient="records")[0]

        constraints = [
            Re == V*rho*S/b/mu,
github convexengineering / gplibrary / gpkitmodels / SP / aircraft / prop / propeller.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self,static,  state):
        V       = state.V
        rho     = state.rho
        R       = static.R
        mu      = state.mu
        path = os.path.dirname(__file__)
        fd = pd.read_csv(path + os.sep + "dae51_fitdata.csv").to_dict(
            orient="records")[0]
        c = static.c
        constraints = [TCS([Wa>=V + va]),
                        TCS([Wt + vt<=omega*r]),
                        TCS([G == (1./2.)*Wr*c*cl]),
                        F == (2./pi)*(1.01116*f**.0379556)**(10), #This is the GP fit of arccos(exp(-f))
                        M == Wr/a,
                        lam_w == (r/R)*(Wa/Wt),
                        va == vt*(Wt/Wa),
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / wing / gustloading.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self, wing, state, out=False):
        self.load = SparLoading.setup(self, wing, state, out=out)

        cbar = self.wing.planform.cbar
        W = self.W  # from SparLoading
        q = self.q
        N = self.N
        b = self.b

        path = os.path.dirname(os.path.abspath(__file__))
        df = pd.read_csv(path + os.sep + "arctan_fit.csv").to_dict(
            orient="records")[0]

        constraints = [
            # fit for arctan from 0 to 1, RMS = 0.044
            FitCS(df, agust, [cosminus1*vgust/v]),
github convexengineering / gplibrary / gpkitmodels / GP / aircraft / wing / sparloading.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self, wing, state, out=False):
        self.wing = wing

        b = self.b = self.wing.planform.b
        I = self.I = self.wing.spar.I
        Sy = self.Sy = self.wing.spar.Sy
        cave = self.cave = self.wing.planform.cave
        cbar = self.cbar = self.wing.planform.cbar
        E = self.wing.spar.material.E
        sigma = self.wing.spar.material.sigma
        deta = self.wing.planform.deta

        constraints = []
        if not out:
            constraints.extend([
                S[:-1] >= S[1:] + 0.5*deta*(b/2.)*(q[:-1] + q[1:]),
github convexengineering / gpkit / docs / source / examples / performance_modeling.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self):
        self.fuse = Fuselage()
        self.wing = Wing()
        self.components = [self.fuse, self.wing]

        return {
            "definition of W":
                W >= sum(c.W for c in self.components),
            "components":
                self.components}
github convexengineering / gplibrary / gpkitmodels / GP / materials / foam.py View on Github external
    @parse_variables(__doc__, globals())
    def setup(self):
        pass