本文整理汇总了Python中model.Model.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python Model.initialize方法的具体用法?Python Model.initialize怎么用?Python Model.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Model
的用法示例。
在下文中一共展示了Model.initialize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import initialize [as 别名]
def initialize(self,inputParameterValues):
# Inputs
self.windVelNED = mat('0.0;0.0;0.0')
# Received via message
self.altitude = 0.0
self.dcmBodyFromNED = mat([[0.,0.,0.],[0.,0.,0.],[0.,0.,0.]])
self.velECEFinBody = mat('0.;0.;0.')
# Internal
self.vwindmag = 0.0
self.speedofsound = 0.0
# Outputs
self.mach = 0.0
self.alpha = 0.0
self.beta = 0.0
self.density = 0.0
self.pressure = 0.0
self.temperature = 0.0
self.uvw = mat('0.0;0.0;0.0')
self.qbar = 0.0
self.qalpha = 0.0
# Call the base class initialize function, which sets all the input params
Model.initialize(self,inputParameterValues)
示例2: initialize
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import initialize [as 别名]
def initialize(self,inputParameterValues):
# Inputs
self.isp = 0.0
self.thrustVac = 0.0
self.exitArea = 0.0
self.nozzleEfficiency = 1.0
self.attNozzleFromStation = mat('0.0;0.0;0.0')
self.posNozzleFromStation = mat('0.0;0.0;0.0')
self.onTimes = []
self.throttle = 0.0
# Received via messages
self.ambientPressure = 0.0
# Internal variables
self.thrustCurr = 0.0
self.dcmStationFromNozzle = eye(3,3)
self.tvcPitch = 0.0
self.tvcYaw = 0.0
# Outputs
self.mdot = 0.0
self.forceStation = mat('0.0;0.0;0.0')
self.momentStation = mat('0.0;0.0;0.0')
self.throttle = 0.0
# Call the base class initialize function, which sets all the input params
Model.initialize(self,inputParameterValues)
# Initialize DCM from Euler Angles
self.dcmStationFromNozzle = transpose( SpinCalc('EA321toDCM',self.attNozzleFromStation) )
示例3: initialize
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import initialize [as 别名]
def initialize(self,inputParameterValues):
# Inputs
self.timeOn = 0.0
self.timeOff = 0.0
self.forceStationInput = mat('0.0;0.0;0.0')
self.momentStationInput = mat('0.0;0.0;0.0')
self.forceStation = mat('0.0;0.0;0.0')
self.momentStation = mat('0.0;0.0;0.0')
# Call the base class initialize function, which sets all the input params
Model.initialize(self,inputParameterValues)
示例4: train_with_threads
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import initialize [as 别名]
def train_with_threads(environment_params, rl_params, bandit_params, model_params, epochs, num_of_threads, train=True,
display_state=False, use_processes=False):
start_time = time.time()
# Initialize statistics and model here and pass it as an argument
test = not train
model_params['base_folder_name'] = return_base_path(environment_params['env_name'])
model_params['actor_critic_model'] = rl_params['memory_structure_params'].get('actor_critic_method', False)
statistics = Statistics(base_folder_name=model_params['base_folder_name'], test=test)
env_name = 'non_atari' if environment_params['env_name'] == 'gridworld' else 'atari'
resume = model_params.get('resume', False)
if not use_processes:
model = Model(model_params)
model.initialize(test, resume)
actor_learner_threads = [
threading.Thread(target=play_with_environment_pong if env_name == 'atari' else play_with_environment, args=(
environment_params, model, statistics, rl_params, bandit_params, epochs, thread_id, train, display_state))
for
thread_id in xrange(1, num_of_threads + 1)]
# Multiprocessing process
else:
# We will need to register Model class if we want to share model object
ModelManager.register('Model', Model)
manager = ModelManager()
manager.start()
model = manager.Model(model_params)
model.initialize(test, resume)
actor_learner_threads = [
multiprocessing.Process(target=play_with_environment_pong if env_name == 'atari' else play_with_environment,
args=(
environment_params, model, statistics, rl_params, bandit_params, epochs, thread_id,
train, display_state)) for
thread_id in xrange(1, num_of_threads + 1)]
for t in actor_learner_threads:
t.start()
for t in actor_learner_threads:
t.join()
if train: model.finish()
# statistics.calculate_summary_statistics(model.return_model_class())
print "elapsed time:" + str(int(time.time() - start_time))
示例5: initialize
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import initialize [as 别名]
def initialize(self,inputParameterValues):
# Inputs
self.nActuators = 0
self.damping = mat()
self.naturalfreq = mat()
self.initPos = mat()
self.initVel = mat()
self.lowPosLimit = mat()
self.highPosLimit = mat()
self.lowVelLimit = mat()
self.highVelLimit = mat()
# Received via messages
self.actuatorCmds = mat()
# Internal variables
self.twoZetaWn = mat()
self.WnSquared = mat()
self.actuatorAccel = mat()
self.actuatorVel = mat()
self.actuatorPosError = mat()
# Outputs
self.actuatorPos = mat()
# Call the base class initialize function, which sets all the input params
Model.initialize(self,inputParameterValues)
# Calculate Constants
self.twoZetaWn = 2.0* self.damping * self.naturalfreq
self.WnSquared = multiply(self.naturalfreq,self.naturalfreq)
# Register Integrated States ------------------------------------------
self.clearIntegratedStates() # First clear out the states from the last initialization call
self.registerIntegratedState('actuatorVel', 'actuatorPos', self.actuatorVel, self.actuatorPos) # Vel --> Pos
self.registerIntegratedState('actuatorAccel', 'actuatorVel', self.actuatorAccel, self.actuatorVel) # Accel --> Vel
示例6: initialize
# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import initialize [as 别名]
def initialize(self,inputParameterValues):
# Member variables ----------------------------------------------------
# Inputs
self.sRef = 0.0
self.cRef = 0.0
self.bRef = 0.0
self.mrc = mat('0.0;0.0;0.0')
self.dimTable = {}
self.CX_body_coefficients = []
self.CY_body_coefficients = []
self.CZ_body_coefficients = []
self.Cl_body_coefficients = []
self.Cm_body_coefficients = []
self.Cn_body_coefficients = []
self.CL_stab_Coefficients = []
self.CS_stab_Coefficients = []
self.CD_stab_Coefficients = []
self.Cl_stab_Coefficients = []
self.Cm_stab_Coefficients = []
self.Cn_stab_Coefficients = []
self.CL_wind_coefficients = []
self.CS_wind_coefficients = []
self.CD_wind_coefficients = []
self.Cl_wind_coefficients = []
self.Cm_wind_coefficients = []
self.Cn_wind_coefficients = []
self.coeffList = {}
self.controlSurfaceNames = []
self.controlSurfaceInitPos = mat('0.0;0.0;0.0')
self.controlSurfaceLowerLimit = mat('0.0;0.0;0.0')
self.controlSurfaceUpperLimit = mat('0.0;0.0;0.0')
# Received via messages
self.alpha = 0.0
self.beta = 0.0
self.mach = 0.0
self.alt = 0.0
self.density = 0.0
self.vwindmag = 0.0
self.cgRelStation = mat('0.0;0.0;0.0')
self.p = 0.0
self.q = 0.0
self.r = 0.0
# Internal variables
self.qbar = 0.0
self.bi2vel = 0.0
self.ci2vel = 0.0
self.CX_body = 0.0
self.CY_body = 0.0
self.CZ_body = 0.0
self.Cl_body = 0.0
self.Cm_body = 0.0
self.Cn_body = 0.0
self.CL_stab = 0.0
self.CS_stab = 0.0
self.CD_stab = 0.0
self.Cl_stab = 0.0
self.Cm_stab = 0.0
self.Cn_stab = 0.0
self.CL_wind = 0.0
self.CS_wind = 0.0
self.CD_wind = 0.0
self.Cl_wind = 0.0
self.Cm_wind = 0.0
self.Cn_wind = 0.0
self.liftForce = 0.0
self.dragForce = 0.0
self.sideForce = 0.0
self.F_aerobody = mat('0.0;0.0;0.0')
self.M_mrc_aerobody = mat('0.0;0.0;0.0')
self.F_stability = mat('0.0;0.0;0.0')
self.M_mrc_stability = mat('0.0;0.0;0.0')
self.F_wind = mat('0.0;0.0;0.0')
self.M_mrc_wind = mat('0.0;0.0;0.0')
self.F_body = mat('0.0;0.0;0.0')
self.M_body = mat('0.0;0.0;0.0')
self.controlSurfaces = {}
self.factorNames = ['alpha','beta','mach','alt',
'CX_body','CY_body','CZ_body','Cl_body','Cm_body','Cn_body',
'CL_stab','CS_stab','CD_stab','Cl_stab','Cm_stab','Cn_stab',
'CL_wind','CS_wind','CD_wind','Cl_wind','Cm_wind','Cn_wind',
'p','q','r','density','bi2vel','ci2vel']
self.factors = {}
# Outputs
self.forceStation = mat('0.0;0.0;0.0')
self.momentStation = mat('0.0;0.0;0.0')
# Call the base class initialize function, which sets all the input params
Model.initialize(self,inputParameterValues)
# Instantiate the control surfaces (start from a clean slate each run)
self.controlSurfaces = {}
#.........这里部分代码省略.........