本文整理汇总了Python中PyKEP.lambert_problem方法的典型用法代码示例。如果您正苦于以下问题:Python PyKEP.lambert_problem方法的具体用法?Python PyKEP.lambert_problem怎么用?Python PyKEP.lambert_problem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyKEP
的用法示例。
在下文中一共展示了PyKEP.lambert_problem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: search_min_dv_to_body
# 需要导入模块: import PyKEP [as 别名]
# 或者: from PyKEP import lambert_problem [as 别名]
def search_min_dv_to_body(body, departure_date, departure_position, host_velocity, min_time_of_flight, time_delta, number):
time_range = [min_time_of_flight + time_delta*i for i in xrange(number)]
body_positions = [body.eph(time + departure_date.mjd2000)[0] for time in time_range]
departure_velocities = [pk.lambert_problem(departure_position, pos, time*pk.DAY2SEC, pk.MU_SUN, False, 0).get_v1()[0] for pos, time in zip(body_positions, time_range)]
deltaV = [np.linalg.norm(np.array(velocity)-host_velocity) for velocity in departure_velocities]
index_min = np.array(deltaV).argmin()
return index_min, departure_velocities[index_min]
示例2: lambert_leg
# 需要导入模块: import PyKEP [as 别名]
# 或者: from PyKEP import lambert_problem [as 别名]
def lambert_leg(P1, P2, i, j, t1, t2, tof, vrel=None, dv_launch=0.):
"""Compute a lambert leg from planet to planet.
Arguments:
p1 -- starting planet (str or PyKEP.planet object)
p2 -- final planet (str or PyKEP.planet object)
t0 -- start time of leg in MJD2000
tof -- time of flight in days
Keyword arguments:
vrel -- caresian coordinates of the relative velocity before the flyby at p1
dv_launch -- dv discounted at lunch (i.e. if vrel is None)
rendezvous -- add final dv
Returns:
dV, vrel_out, where vrel_out is the relative velocity at the end of the leg at p2
"""
ast1 = ASTEROIDS[P1]
ast2 = ASTEROIDS[P2]
r1 = state_asteroids.EPH[i][t1][0]
v1 = state_asteroids.EPH[i][t1][1]
r2 = state_asteroids.EPH[j][t2][0]
v2 = state_asteroids.EPH[j][t2][1]
lambert = kep.lambert_problem(r1, r2, tof * kep.DAY2SEC, ast1.mu_central_body, False, 0)
vrel_in = tuple(map(lambda x, y: x - y, lambert.get_v1()[0], v1))
vrel_out = tuple(map(lambda x, y: x - y, lambert.get_v2()[0], v2))
dv_lambert = np.linalg.norm(vrel_out) + np.linalg.norm(vrel_in)
a, _, _, dv_damon = kep.damon(vrel_in, vrel_out, tof*kep.DAY2SEC)
m_star = kep.max_start_mass(np.linalg.norm(a), dv_damon, T_max, Isp)
return dv_lambert, dv_damon, m_star
示例3: lambert_leg
# 需要导入模块: import PyKEP [as 别名]
# 或者: from PyKEP import lambert_problem [as 别名]
def lambert_leg(P1, P2, t0, tof):
ast1 = ASTEROIDS[P1]
ast2 = ASTEROIDS[P2]
r1, v1 = ast1.eph(kep.epoch(t0))
r2, v2 = ast2.eph(kep.epoch(t0 + tof))
lambert = kep.lambert_problem(r1, r2, tof * kep.DAY2SEC, ast1.mu_central_body)
vrel_in = tuple(map(lambda x, y: -x + y, lambert.get_v1()[0], v1))
vrel_out = tuple(map(lambda x, y: -x + y, lambert.get_v2()[0], v2))
dv_lambert = np.linalg.norm(vrel_out) + np.linalg.norm(vrel_in)
a, _, _, dv_damon = kep.damon(vrel_in, vrel_out, tof*kep.DAY2SEC)
m_star = kep.max_start_mass(np.linalg.norm(a), dv_damon, T_max, Isp)
return dv_lambert, dv_damon, m_star
示例4: lambert_leg
# 需要导入模块: import PyKEP [as 别名]
# 或者: from PyKEP import lambert_problem [as 别名]
def lambert_leg(P1, P2, i, j, t1, t2, tof, vrel=None, dv_launch=0., rendezvous=False):
"""Compute a lambert leg from planet to planet.
Arguments:
p1 -- starting planet (str or PyKEP.planet object)
p2 -- final planet (str or PyKEP.planet object)
t0 -- start time of leg in MJD2000
tof -- time of flight in days
Keyword arguments:
vrel -- caresian coordinates of the relative velocity before the flyby at p1
dv_launch -- dv discounted at lunch (i.e. if vrel is None)
rendezvous -- add final dv
Returns:
dV, vrel_out, where vrel_out is the relative velocity at the end of the leg at p2
"""
p1 = PLANETS[str(P1)]
p2 = PLANETS[str(P2)]
r1 = state_rosetta.EPH[i][t1][0]
v1 = state_rosetta.EPH[i][t1][1]
r2 = state_rosetta.EPH[j][t2][0]
v2 = state_rosetta.EPH[j][t2][1]
lambert = kep.lambert_problem(r1, r2, tof * kep.DAY2SEC, p1.mu_central_body, False, 0)
vrel_in = tuple(map(lambda x, y: x - y, lambert.get_v1()[0], v1))
vrel_out = tuple(map(lambda x, y: x - y, lambert.get_v2()[0], v2))
if vrel is None:
# launch
dv = max(np.linalg.norm(vrel_in) - dv_launch, 0)
else:
# flyby
#print p1.name, p2.name, np.linalg.norm(vrel_in), np.linalg.norm(vrel_out)
dv = kep.fb_vel(vrel, vrel_in, p1)
if rendezvous:
dv += np.linalg.norm(vrel_out)
return dv, vrel_out