本文整理汇总了Python中MDOTools.OC.operating_condition.OperatingCondition类的典型用法代码示例。如果您正苦于以下问题:Python OperatingCondition类的具体用法?Python OperatingCondition怎么用?Python OperatingCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OperatingCondition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,Target_Lift, N = 10, verbose=0):
"""Initialization of DLLM component.
DLLM component use target lift capability of DLLM kernel
@param Target_Lift : the targeted lift value (float)
@param N : integer. Number of discrete section on 1/2 wing
@param verbose : integer : verbosity level
"""
try :
float(Target_Lift)
except:
raise ValueError('You MUST define a float target lift value, get '+str(Target_Lift)+' instead.')
self.Target_Lift = Target_Lift
self.N = N
self.OC = None
self.rtwist = np.zeros(N)
self.__display_wing_param = True
self.__verbose = verbose
self.__wing_param = None
super(DLLMOpenMDAOComponent, self).__init__()
self.OC = OperatingCondition(tag='DLLMOC', atmospheric_model='ISA')
self.__set_OC_values()
self.__set_wing_param()
self.__DLLM = DLLMTargetLift('test', self.__wing_param,
self.OC, verbose=self.__verbose)
self.__DLLM.set_target_Lift(Target_Lift)
self.__DLLM.run_direct()
self.__DLLM.run_post()
示例2:
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMTargetCl import DLLMTargetCl
from MDOTools.OC.operating_condition import OperatingCondition
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
import numpy
import sys
OC=OperatingCondition('cond1')
OC.set_Mach(0.3)
OC.set_AoA(0.)
OC.set_altitude(3000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',40.)
wing_param.set_value('sweep',0.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',1.0)
wing_param.set_value('break_chord',1.0)
示例3:
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from DLLM.DLLMGeom.wing_param import Wing_param
from MDOTools.OC.operating_condition import OperatingCondition
import numpy
import string
OC=OperatingCondition('cond1')
OC.set_altitude(3000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
nsect=50
wing_param=Wing_param('test_param',geom_type='Elliptic',n_sect=nsect)
wing_param.set_distrib_type('cos_law')
wing_param.build_wing()
wing_param.set_value('span',40.)
wing_param.set_value('root_chord',4.)
wing_param.set_value('root_height',0.0)
wing_param.set_value('tip_height',0.0)
示例4: __init_wing_param
def __init_wing_param(self):
OC=OperatingCondition('cond1')
OC.set_Mach(0.8)
OC.set_AoA(3.5)
OC.set_altitude(10000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_Broken('broken_wing',n_sect=20)
wing_param.import_BC_from_file('input_parameters.par')
wing_param.build_linear_airfoil(OC, AoA0=0.0, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()
return OC,wing_param
示例5: __init_wing_param
def __init_wing_param(self):
OC=OperatingCondition('cond1')
OC.set_Mach(0.7)
OC.set_AoA(3.0)
OC.set_altitude(5000.)
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',32.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',6.1)
wing_param.set_value('break_chord',4.6)
wing_param.set_value('tip_chord',1.5)
wing_param.set_value('root_height',1.28)
wing_param.set_value('break_height',0.97)
wing_param.set_value('tip_height',0.33)
wing_param.convert_to_design_variable('span',(10.,50.))
wing_param.convert_to_design_variable('sweep',(0.,40.))
wing_param.convert_to_design_variable('break_percent',(20.,40.))
wing_param.convert_to_design_variable('root_chord',(5.,7.))
wing_param.convert_to_design_variable('break_chord',(3.,5.))
wing_param.convert_to_design_variable('tip_chord',(1.,2.))
wing_param.convert_to_design_variable('root_height',(1.,1.5))
wing_param.convert_to_design_variable('break_height',(0.8,1.2))
wing_param.convert_to_design_variable('tip_height',(0.2,0.5))
wing_param.build_linear_airfoil(OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()
return wing_param
示例6: __init_OC
def __init_OC(self):
OC=OperatingCondition('cond1')
OC.set_Mach(0.7)
OC.set_AoA(3.0)
OC.set_altitude(5000.)
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
return OC
示例7:
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# https://github.com/matthieu-meaux/DLLM.git
#
# @author : Matthieu MEAUX
#
# Imports
from MDOTools.OC.operating_condition import OperatingCondition
from DLLM.DLLMGeom.wing_broken import Wing_Broken
from DLLM.DLLMKernel.DLLMTargetCl import DLLMTargetCl
OC=OperatingCondition('cond1', atmospheric_model='ISA')
OC.set_Mach(0.8)
OC.set_AoA(3.0)
OC.set_altitude(10000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_Broken('broken_wing',n_sect=20)
wing_param.import_BC_from_file('input_parameters.par')
wing_param.build_linear_airfoil(OC, AoA0=0.0, set_as_ref=True)
wing_param.build_airfoils_from_ref()
wing_param.update()
wing_param.plot()
示例8: MDOTools
# -*-mode: python; py-indent-offset: 4; tab-width: 8; coding: iso-8859-1 -*-
# MDOTools (Multi-disciplinary Optimization Tools, open source software)
#
# Copyright (C) 2013-2015 Airbus Group SAS
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
# @author : Matthieu Meaux
from MDOTools.OC.operating_condition import OperatingCondition
OC=OperatingCondition('cond_tuto1')
OC.plot_atmosphere()
示例9: OperatingCondition
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMSolver import DLLMSolver
from MDOTools.OC.operating_condition import OperatingCondition
import numpy
OC = OperatingCondition("cond1")
OC.set_Mach(0.8)
OC.set_AoA(3.5)
OC.set_altitude(10000.0)
OC.set_T0_deg(15.0)
OC.set_P0(101325.0)
OC.set_humidity(0.0)
OC.compute_atmosphere()
wing_param = Wing_param("test_param", geom_type="Broken", n_sect=20)
wing_param.build_wing()
wing_param.set_value("span", 34.1)
wing_param.set_value("sweep", 34.0)
wing_param.set_value("break_percent", 33.0)
wing_param.set_value("root_chord", 6.1)
wing_param.set_value("break_chord", 4.6)
示例10:
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from DLLM.DLLMGeom.wing_param import Wing_param
from DLLM.DLLMKernel.DLLMSolver import DLLMSolver
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
from MDOTools.OC.operating_condition import OperatingCondition
import numpy
OC=OperatingCondition('cond1')
OC.set_Mach(0.6) #.7
OC.set_AoA(6.0) #3.
OC.set_altitude(10000.) #5000
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',32.) #32.
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',5.4)#6.1
wing_param.set_value('break_chord',4.6)#4.6
示例11: DLLMOpenMDAOComponent
class DLLMOpenMDAOComponent(Component):
# set up interface to the framework
# pylint: disable-msg=E1101
# Outputs of lifting line problem
"""OpenMDAO component for DLLM implementation
"""
Lift = Float(iotype='out', desc='Lift')
Drag = Float(iotype='out', desc='Drag')
Drag_Pressure = Float(iotype='out', desc='Drag_Pressure')
Drag_Induced = Float(iotype='out', desc='Drag_Induced')
Drag_Wave = Float(iotype='out', desc='Drag_Wave')
Drag_Friction = Float(iotype='out', desc='Drag_Friction')
Cd = Float(iotype='out', desc='Cd')
Cdp = Float(iotype='out', desc='Cdp')
Cdi = Float(iotype='out', desc='Cdi')
Cdw = Float(iotype='out', desc='Cdw')
Cdf = Float(iotype='out', desc='Cdf')
Cl = Float(iotype='out', desc='Cl')
LoD = Float(iotype='out', desc='LoD')
Sref = Float(iotype='out', desc='Sref')
# Design variables of lifting line problem
rtwist = Array([], desc='rtwist', iotype="in")
span = Float(desc='span', default_value=34., iotype="in")
sweep = Float(desc='sweep', default_value=34., iotype="in")
break_percent = Float(desc='break_percent', default_value=33., iotype="in")
root_chord = Float(desc='root_chord', default_value=6.1, iotype="in")
break_chord = Float(desc='break_chord', default_value=4.6, iotype="in")
tip_chord = Float(desc='tip_chord', default_value=1.5, iotype="in")
root_height = Float(desc='root_height', default_value=1.28, iotype="in")
break_height = Float(desc='break_height', default_value=0.97, iotype="in")
tip_height = Float(desc='tip_height', default_value=0.33, iotype="in")
# Operating conditions variables
Mach = Float(iotype='in', default_value=0.7, desc='Mach')
altitude = Float(iotype='in', default_value=10000., desc='Altitude')
T0 = Float(iotype='in',default_value=OperatingCondition.T0,
desc='Ground ISA ref Temperature')
P0 = Float(iotype='in',default_value=OperatingCondition.P0,
desc='Ground ISA ref Pressure')
def __init__(self,Target_Lift, N = 10, verbose=0):
"""Initialization of DLLM component.
DLLM component use target lift capability of DLLM kernel
@param Target_Lift : the targeted lift value (float)
@param N : integer. Number of discrete section on 1/2 wing
@param verbose : integer : verbosity level
"""
try :
float(Target_Lift)
except:
raise ValueError('You MUST define a float target lift value, get '+str(Target_Lift)+' instead.')
self.Target_Lift = Target_Lift
self.N = N
self.OC = None
self.rtwist = np.zeros(N)
self.__display_wing_param = True
self.__verbose = verbose
self.__wing_param = None
super(DLLMOpenMDAOComponent, self).__init__()
self.OC = OperatingCondition(tag='DLLMOC', atmospheric_model='ISA')
self.__set_OC_values()
self.__set_wing_param()
self.__DLLM = DLLMTargetLift('test', self.__wing_param,
self.OC, verbose=self.__verbose)
self.__DLLM.set_target_Lift(Target_Lift)
self.__DLLM.run_direct()
self.__DLLM.run_post()
def __set_wing_param(self, wing_param_name='test_param'):
"""Method for wing parameters setting : design variables initial values and bounds
@param wing_param_name : wing parametrization names
"""
self.__set_wing_param_values(wing_param_name=wing_param_name)
self.__set_wing_param_bounds()
self.__wing_param.build_linear_airfoil(self.OC, AoA0=-2., Cm0=-0.1, set_as_ref=True)
self.__wing_param.build_airfoils_from_ref()
self.__wing_param.update()
if self.__display_wing_param:
self.__display_wing_param = False
print self.__wing_param
def __set_wing_param_values(self, wing_param_name='test_param'):
"""Method for wing parameters variables setting
@param wing_param_name : wing parametrization names
"""
self.__wing_param = Wing_param(wing_param_name,
geom_type='Broken', n_sect=self.N * 2)
self.__wing_param.build_wing()
for i in xrange(self.N):
self.__wing_param.set_value('rtwist%s' % i, 0.)
for param in Wing_param.DISCRETE_ATTRIBUTES_LIST:
self.__wing_param.set_value(param, getattr(self, param))
def __set_wing_param_bounds(self):
"""Method for desing variables bounds settings
Values are set to inf/-inf in DLLM component and their 'real' bounds
#.........这里部分代码省略.........
示例12:
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# http://github.com/TBD
#
from MDOTools.ValidGrad.FDValidGrad import FDValidGrad
from DLLM.DLLMGeom.wing_param import Wing_param
from MDOTools.OC.operating_condition import OperatingCondition
OC=OperatingCondition('cond1')
OC.set_Mach(0.7)
OC.set_AoA(3.0)
OC.set_altitude(5000.)
OC.set_T0_deg(20.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
wing_param=Wing_param('test_param',geom_type='Broken',n_sect=20)
wing_param.build_wing()
wing_param.set_value('span',34.1)
wing_param.set_value('sweep',32.)
wing_param.set_value('break_percent',33.)
wing_param.set_value('root_chord',6.1)
wing_param.set_value('break_chord',4.6)
示例13: RefCTAAirfoil
import numpy as np
from DLLM.polarManager.RefCTAAirfoil import RefCTAAirfoil
from MDOTools.OC.operating_condition import OperatingCondition
#Mach = 0.79
#Cl = 0.21
#Altitude 35000 ft
OC=OperatingCondition('Cond_RefCTA',atmospheric_model='ISA')
OC.set_Mach(0.79)
OC.set_AoA(3.5)
OC.set_altitude_feet(35000.)
OC.set_T0_deg(15.)
OC.set_P0(101325.)
OC.set_humidity(0.)
OC.compute_atmosphere()
print OC
RefCTA_AF = RefCTAAirfoil(OC)
RefCTA_AF.set_y_def_list([0.,1.520, 3.800, 6.080, 9.120, 12.160, 15.200, 18.240, 19.000])
RefCTA_AF.set_file_def_list(['section0.dat','section1.dat','section2.dat','section3.dat','section4.dat','section5.dat','section6.dat','section7.dat','section8.dat'])
RefCTA_AF.init_interpolators()
RefCTA_AF.set_y_pos(-5.1)
RefCTA_AF.init_interp_factors()
AoA = 2.*np.pi/180.
RefCTA_AF.compute(AoA, 0.79)
示例14: DLLMWrapper
#.........这里部分代码省略.........
self.__DLLM_solver.run_direct()
self.__DLLM_solver.run_post()
self.__DLLM_solver.run_adjoint()
F_list = self.__DLLM_solver.get_F_list()
F_list_grad=self.__DLLM_solver.get_dF_list_dchi()
self.__DLLM_solver.export_F_list()
self.__DLLM_solver.export_dF_list_dchi()
if self.__out_format == 'list':
F_list=F_list.tolist()
if self.__grad_format == 'numpy':
F_list_grad=numpy.array(F_list_grad)
self.__F_list = F_list
self.__F_list_grad = F_list_grad
return F_list,F_list_grad
def export_results(self):
fid=open(self.__tag+'.res.dat','w')
res=[self.__F_list,self.__F_list_grad]
cPickle.dump(res, fid)
fid.close()
def import_results(self):
fid=open(self.__tag+'.res.dat','r')
res=cPickle.load(fid)
fid.close()
self.__F_list=res[0]
self.__F_list_grad=res[1]
#-- Private methods
def __config_OC(self):
"""
Set up the
"""
self.__OC = OperatingCondition(self.__tag+'.OC')
self.__OC.config_from_dict(self.__config_dict)
def __config_param(self):
"""
Set up the __wing_param attribute.
-The class associated to __wing_param depends on the chosen parameterization type
-The method needs to be updated if a new parameterization is implemented
"""
input_keys=self.__config_dict.keys()
geom_type_key=self.__tag+'.param.geom_type'
if geom_type_key in input_keys:
geom_type = self.__config_dict[geom_type_key]
else:
geom_type= 'Broken'
n_sect_key=self.__tag+'.param.n_sect'
if n_sect_key in input_keys:
n_sect = self.__config_dict[n_sect_key]
else:
n_sect = 20
if geom_type == 'Broken':
self.__wing_param = Wing_Broken(self.__tag+'.param', n_sect=n_sect)
elif geom_type == 'Elliptic':
self.__wing_param = Wing_Elliptic(self.__tag+'.param', n_sect=n_sect)
elif geom_type == 'Straight':
self.__wing_param = Wing_Straight(self.__tag+'.param', n_sect=n_sect)
self.__wing_param.set_AoA_id(self.__AoA_id)
self.__wing_param.set_common_OC(self.__OC)
self.__wing_param.config_from_dict(self.__config_dict)
示例15: __config_OC
def __config_OC(self):
"""
Set up the
"""
self.__OC = OperatingCondition(self.__tag+'.OC')
self.__OC.config_from_dict(self.__config_dict)