add circularization maneuver
This commit is contained in:
parent
337a85cc77
commit
15f1f1ed54
@ -12,11 +12,12 @@ global g_direction is 90.
|
||||
global g_throttle is 1.
|
||||
global g_apoapsis is 80000.
|
||||
global g_gt_angle is 10.
|
||||
global g_gt_velocity is 60.
|
||||
global g_gt_velocity is 53.
|
||||
|
||||
man_launch(g_direction, g_throttle).
|
||||
man_gravity_turn(g_direction, g_gt_angle, g_gt_velocity, g_apoapsis).
|
||||
release().
|
||||
wait until ship:altitude > 70000.
|
||||
man_node_circularize("apo").
|
||||
man_node_exec().
|
||||
release().
|
||||
|
@ -21,6 +21,30 @@ global function man_get_dv_hohmann {
|
||||
return vf - vi.
|
||||
}
|
||||
|
||||
global function man_get_duration {
|
||||
parameter p_dv, p_throttle.
|
||||
local total_thrust is 0.
|
||||
local total_isp is 0.
|
||||
local engs_count is 0.
|
||||
list engines in engs.
|
||||
|
||||
for eng in engs {
|
||||
if eng:ignition = true and eng:flameout = false {
|
||||
set total_thrust to total_thrust + eng:availablethrust * p_throttle.
|
||||
set total_isp to total_isp + eng:isp.
|
||||
set engs_count to engs_count + 1.
|
||||
}
|
||||
}
|
||||
|
||||
local f is total_thrust * 1000.
|
||||
local m is ship:mass * 1000.
|
||||
local e is constant():e.
|
||||
local p is total_isp / engs_count.
|
||||
local g is 9.80665.
|
||||
|
||||
return g * m * p * (1 - e ^ (-p_dv / (g * p))) / f.
|
||||
}
|
||||
|
||||
global function man_node_circularize {
|
||||
parameter p_pos.
|
||||
local dv is 0.
|
||||
@ -33,38 +57,40 @@ global function man_node_circularize {
|
||||
set tn to time:seconds + ship:orbit:eta:periapsis.
|
||||
}
|
||||
|
||||
print "=> Planning circularization maneuver : " + round(dv, 1) + " m/s".
|
||||
add node(tn, 0, 0, dv).
|
||||
}
|
||||
|
||||
global function man_node_exec {
|
||||
local nd is nextNode.
|
||||
|
||||
print "=> Preparing maneuver".
|
||||
|
||||
local dur is man_get_duration(nd:deltav:mag, 1).
|
||||
|
||||
wait until nd:eta <= (dur / 2) + 60.
|
||||
lock steering to nd:burnvector.
|
||||
|
||||
lock accel to ship:maxthrust / ship:mass.
|
||||
lock dur to nd:deltav:mag / accel.
|
||||
|
||||
wait until nd:eta <= (dur / 2).
|
||||
|
||||
print "=> Executing maneuver".
|
||||
local ti is time:seconds.
|
||||
local tf is ti + dur.
|
||||
lock throttle to 1.
|
||||
wait until dur < 0.5.
|
||||
wait until tf - time:seconds < 0.25.
|
||||
lock steering to ship:facing.
|
||||
lock throttle to 0.25.
|
||||
local dv is nd:deltav:mag.
|
||||
until nd:deltav:mag > dv {
|
||||
set dv to nd:deltav:mag.
|
||||
}
|
||||
set dur to man_get_duration(nd:deltav:mag, 0.25).
|
||||
set ti to time:seconds.
|
||||
set tf to ti + dur.
|
||||
wait until tf - time:seconds <= 0.
|
||||
lock throttle to 0.
|
||||
|
||||
unlock dur.
|
||||
unlock accel.
|
||||
|
||||
remove nd.
|
||||
}
|
||||
|
||||
global function man_launch {
|
||||
parameter p_direction, p_throttle.
|
||||
print "=> man_launch".
|
||||
|
||||
print "=> Launch".
|
||||
lock throttle to p_throttle.
|
||||
lock steering to ship:facing.
|
||||
|
||||
@ -73,29 +99,24 @@ global function man_launch {
|
||||
stage.
|
||||
|
||||
wait until ship:altitude >= 150.
|
||||
print " - Alignment...".
|
||||
lock steering to heading(p_direction, 90).
|
||||
}
|
||||
|
||||
global function man_gravity_turn {
|
||||
parameter p_direction, p_angle, p_velocity, p_apoapsis.
|
||||
print "=> man_gravity_turn".
|
||||
|
||||
print "=> Gravity Turn".
|
||||
wait until ship:velocity:surface:mag >= p_velocity.
|
||||
print " - Rotation...".
|
||||
local gt_start is heading(p_direction, 90 - p_angle).
|
||||
lock steering to gt_start.
|
||||
|
||||
wait until vang(ship:facing:vector, gt_start:vector) < 1.
|
||||
wait until vang(ship:srfprograde:vector, ship:facing:vector) < 1.
|
||||
|
||||
print " - Follow prograde...".
|
||||
lock steering to heading(p_direction, 90 - vang(ship:up:vector, ship:srfprograde:vector)).
|
||||
|
||||
wait until ship:orbit:apoapsis >= 0.95 * p_apoapsis.
|
||||
lock throttle to 0.3.
|
||||
wait until ship:orbit:apoapsis >= p_apoapsis.
|
||||
print " - Apoapsis OK".
|
||||
lock throttle to 0.
|
||||
wait 1.
|
||||
stage.
|
||||
|
Loading…
x
Reference in New Issue
Block a user