def get_curve(X_lst, Tdays, benchmark): WingModel = Wing.Wing() para = benchmark[benchmark['day'] == Tdays] tmp = WingModel.volatility_curve( X_lst, Tdays, para.loc[0, 'alpha'], para.loc[0, 'f_atm'], para.loc[0, 'f_ref'], para.loc[0, 'ssr'], para.loc[0, 'vol_ref'], para.loc[0, 'vcr'], para.loc[0, 'slope_ref'], para.loc[0, 'scr'], para.loc[0, 'dn_cf'], para.loc[0, 'up_cf'], para.loc[0, 'put_curv'], para.loc[0, 'call_curv'], para.loc[0, 'dn_sm'], para.loc[0, 'up_sm'], para.loc[0, 'dn_slope'], para.loc[0, 'up_slope']) #得到曲线 return tmp
def Activated(self): import Wing from Gui import WingDialog aviableAirfoils = [] for obj in FreeCAD.ActiveDocument.Objects: if(obj.Type == 'Part::FeaturePython'): if(obj.Proxy.__module__ == 'Airfoil'): aviableAirfoils.append(obj.Name) result = WingDialog.WingDialog.showDialog(aviableAirfoils,None) if(result == None): return elif(result == []): return objlist = [] for name in result: FreeCAD.ActiveDocument.getObject(name).ViewObject.Visibility = False objlist.append(FreeCAD.ActiveDocument.getObject(name)) Wing.makeWing(objlist)
def Activated(self): import Wing from Gui import WingDialog aviableAirfoils = [] for obj in FreeCAD.ActiveDocument.Objects: if (obj.Type == 'Part::FeaturePython'): if (obj.Proxy.__module__ == 'Airfoil'): aviableAirfoils.append(obj.Name) result = WingDialog.WingDialog.showDialog(aviableAirfoils, None) if (result == None): return elif (result == []): return objlist = [] for name in result: FreeCAD.ActiveDocument.getObject( name).ViewObject.Visibility = False objlist.append(FreeCAD.ActiveDocument.getObject(name)) Wing.makeWing(objlist)
def Activated(self): import RibbedWing from Gui import RibbedWingDialog wing = 0 sel = Draft.getSelection() #must be Wing if (len(sel) == 1): if (sel[0].Type == 'Part::FeaturePython'): if (sel[0].Proxy.__module__ == 'Wing'): RibbedWing.makeRibbedWing(sel[0]) #must be Airfoils elif (len(sel) > 1): Airfoils = [] for obj in sel: if (obj.Type == 'Part::FeaturePython'): if (obj.Proxy.__module__ == 'Airfoil'): Airfoils.append(obj.Shape) if (len(Airfoils) > 1): import Wing wing = Wing.makeWing(Airfoils) RibbedWing.makeRibbedWing(wing)
def Activated(self): import RibbedWing from Gui import RibbedWingDialog wing = 0 sel = Draft.getSelection() #must be Wing if(len(sel)==1): if(sel[0].Type == 'Part::FeaturePython'): if(sel[0].Proxy.__module__ == 'Wing'): RibbedWing.makeRibbedWing(sel[0]) #must be Airfoils elif(len(sel)>1): Airfoils = [] for obj in sel: if(obj.Type == 'Part::FeaturePython'): if(obj.Proxy.__module__ == 'Airfoil'): Airfoils.append(obj.Shape) if(len(Airfoils)>1): import Wing wing = Wing.makeWing(Airfoils) RibbedWing.makeRibbedWing(wing)
def computeloads(z): Sectioncenters = np.array([]) dLlist = np.array([]) dDlist = np.array([]) L = 0 D = 0 M = 0 L_moment = 0 D_moment = 0 Llist = np.array([]) Dlist = np.array([]) Lmomentlist = np.array([]) Dmomentlist = np.array([]) L_momentlist = np.array([]) zs = b - (sectionlength / 2) dL = Q_("0 N") dD = Q_("0 N") dM = Q_("0 N*m") while zs > z: #zs is measured is m from Areaofsection = sectionlength * Wing.length_chord(zs) Sectioncenters = np.append(Sectioncenters, zs) '''Lift drag and moment for the section''' dL = (cl * 0.5 * rho * (V**2) * Areaofsection).magnitude #lift of the section dD = (cd * 0.5 * rho * (V**2) * Areaofsection).magnitude #drag of the section dM = (cm * 0.5 * rho * (V**2) * Areaofsection * Wing.length_chord(zs)).magnitude #moment of the section dL *= Q_('kg * m / s**2') dD *= Q_('kg * m / s**2') dM *= Q_('kg * m**2 / s**2') if zs < Geometry.Fuselage.b_f * 0: dL = 0 dD = 0 dM = 0 dLlist = np.append(dLlist, dL) dDlist = np.append(dDlist, dD) '''Total lift, drag and moment for the wing''' L = L + dL # Total lift for one wing D = D + dD # Total drag for one wing M = M + dM # Total moment for one wing Llist = np.append(Llist, L) # put the values in a list so we can plot them Dlist = np.append(Dlist, D) zs = zs - sectionlength # Select other section for the next loop for i in range(0, len(Sectioncenters)): arm = (Sectioncenters[i] - z.magnitude) dLmoment = (arm * dLlist[i]) dDmoment = (arm * dDlist[i]) L_moment = L_moment + dLmoment D_moment = D_moment + dDmoment Lmomentlist = np.append(Lmomentlist, L_moment) Dmomentlist = np.append(Dmomentlist, D_moment) '''For the 20G manoeuver''' MTOW = Geometry.Masses.W_MTOW Max_20G_N = MTOW * 9.81 * 20 Tot_L = 2 * totallift if Tot_L.magnitude > 0.: fac_20G = Max_20G_N / Tot_L fac_20G = fac_20G.magnitude else: fac_20G = 0 L_moment = L_moment * fac_20G D_moment = D_moment * fac_20G L = L * fac_20G D = D * fac_20G M = M * fac_20G return L, D, M, L_moment, D_moment, dL, dD, dM
Lmomentlist = np.array([]) Dmomentlist = np.array([]) dLlist = np.array([]) dDlist = np.array([]) Llist = np.array([]) Dlist = np.array([]) Sectioncenters = np.array([]) sectionlength = (b.magnitude - 0 * Geometry.Fuselage.b_f.magnitude) / n * ureg.meter zs = b - (sectionlength / 2) while zs.magnitude > 0: # zs is measured is m from Areaofsection = sectionlength * Wing.length_chord(zs) Sectioncenters = np.append(Sectioncenters, zs) '''Lift drag and moment for the section''' dL = cl * 0.5 * rho * (V**2) * Areaofsection.magnitude * Q_( "m**2") # lift of the section if zs < Geometry.Fuselage.b_f * 0: dL = Q_('0 kg * m / s**2') '''Total lift, drag and moment for the wing''' L = L + dL # Total lift for one wing zs = zs - sectionlength # Select other section for the next loop totallift = L
"Wing.createWrapLeadingEdge()", "Wing")) FreeCADGui.addCommand( 'Wing_LeadingEdge', _CommandWing("LeadingEdge", "LeadingEdge-icon.svg", "Wing.createLeadingEdge()", "Wing")) FreeCADGui.addCommand( 'Wing_CutWire', _CommandWing("CutWire", "CutWire-icon.svg", "Wing.createCutWire()", "Wing")) FreeCADGui.addCommand( 'Wing_Section', _CommandWing("Section", "Section.svg", "Wing.createSection()", "Wing")) FreeCADGui.addCommand("WingDialog", WingDialogs.CommandWingDialog()) FreeCADGui.addCommand("SectionsDialog", WingDialogs.CommandSectionsDialog()) FreeCADGui.addCommand("RecomputeSelection", Wing.CommandRecompute()) class WingWorkbench(Workbench): '''Wing workbench object''' Icon = iconPath + 'Aile-icon.svg' MenuText = "Wing toolkit" ToolTip = "Create wing and nervures for aeromodels" def Initialize(self): "This function is executed when FreeCAD starts" self.appendToolbar("Wing", [ "Wing_ImportProfil", "Wing_Wing", "Wing_CoordSys", "Wing_Rod", "Wing_WrapLeadingEdge", 'Wing_LeadingEdge', "Wing_CutWire",