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_throttle is 1.
|
||||||
global g_apoapsis is 80000.
|
global g_apoapsis is 80000.
|
||||||
global g_gt_angle is 10.
|
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_launch(g_direction, g_throttle).
|
||||||
man_gravity_turn(g_direction, g_gt_angle, g_gt_velocity, g_apoapsis).
|
man_gravity_turn(g_direction, g_gt_angle, g_gt_velocity, g_apoapsis).
|
||||||
release().
|
release().
|
||||||
|
wait until ship:altitude > 70000.
|
||||||
man_node_circularize("apo").
|
man_node_circularize("apo").
|
||||||
man_node_exec().
|
man_node_exec().
|
||||||
release().
|
release().
|
||||||
|
@ -21,6 +21,30 @@ global function man_get_dv_hohmann {
|
|||||||
return vf - vi.
|
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 {
|
global function man_node_circularize {
|
||||||
parameter p_pos.
|
parameter p_pos.
|
||||||
local dv is 0.
|
local dv is 0.
|
||||||
@ -33,38 +57,40 @@ global function man_node_circularize {
|
|||||||
set tn to time:seconds + ship:orbit:eta:periapsis.
|
set tn to time:seconds + ship:orbit:eta:periapsis.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print "=> Planning circularization maneuver : " + round(dv, 1) + " m/s".
|
||||||
add node(tn, 0, 0, dv).
|
add node(tn, 0, 0, dv).
|
||||||
}
|
}
|
||||||
|
|
||||||
global function man_node_exec {
|
global function man_node_exec {
|
||||||
local nd is nextNode.
|
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 steering to nd:burnvector.
|
||||||
|
|
||||||
lock accel to ship:maxthrust / ship:mass.
|
|
||||||
lock dur to nd:deltav:mag / accel.
|
|
||||||
|
|
||||||
wait until nd:eta <= (dur / 2).
|
wait until nd:eta <= (dur / 2).
|
||||||
|
print "=> Executing maneuver".
|
||||||
|
local ti is time:seconds.
|
||||||
|
local tf is ti + dur.
|
||||||
lock throttle to 1.
|
lock throttle to 1.
|
||||||
wait until dur < 0.5.
|
wait until tf - time:seconds < 0.25.
|
||||||
lock steering to ship:facing.
|
lock steering to ship:facing.
|
||||||
lock throttle to 0.25.
|
lock throttle to 0.25.
|
||||||
local dv is nd:deltav:mag.
|
set dur to man_get_duration(nd:deltav:mag, 0.25).
|
||||||
until nd:deltav:mag > dv {
|
set ti to time:seconds.
|
||||||
set dv to nd:deltav:mag.
|
set tf to ti + dur.
|
||||||
}
|
wait until tf - time:seconds <= 0.
|
||||||
lock throttle to 0.
|
lock throttle to 0.
|
||||||
|
|
||||||
unlock dur.
|
|
||||||
unlock accel.
|
|
||||||
|
|
||||||
remove nd.
|
remove nd.
|
||||||
}
|
}
|
||||||
|
|
||||||
global function man_launch {
|
global function man_launch {
|
||||||
parameter p_direction, p_throttle.
|
parameter p_direction, p_throttle.
|
||||||
print "=> man_launch".
|
print "=> Launch".
|
||||||
|
|
||||||
lock throttle to p_throttle.
|
lock throttle to p_throttle.
|
||||||
lock steering to ship:facing.
|
lock steering to ship:facing.
|
||||||
|
|
||||||
@ -73,29 +99,24 @@ global function man_launch {
|
|||||||
stage.
|
stage.
|
||||||
|
|
||||||
wait until ship:altitude >= 150.
|
wait until ship:altitude >= 150.
|
||||||
print " - Alignment...".
|
|
||||||
lock steering to heading(p_direction, 90).
|
lock steering to heading(p_direction, 90).
|
||||||
}
|
}
|
||||||
|
|
||||||
global function man_gravity_turn {
|
global function man_gravity_turn {
|
||||||
parameter p_direction, p_angle, p_velocity, p_apoapsis.
|
parameter p_direction, p_angle, p_velocity, p_apoapsis.
|
||||||
print "=> man_gravity_turn".
|
print "=> Gravity Turn".
|
||||||
|
|
||||||
wait until ship:velocity:surface:mag >= p_velocity.
|
wait until ship:velocity:surface:mag >= p_velocity.
|
||||||
print " - Rotation...".
|
|
||||||
local gt_start is heading(p_direction, 90 - p_angle).
|
local gt_start is heading(p_direction, 90 - p_angle).
|
||||||
lock steering to gt_start.
|
lock steering to gt_start.
|
||||||
|
|
||||||
wait until vang(ship:facing:vector, gt_start:vector) < 1.
|
wait until vang(ship:facing:vector, gt_start:vector) < 1.
|
||||||
wait until vang(ship:srfprograde:vector, ship:facing: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)).
|
lock steering to heading(p_direction, 90 - vang(ship:up:vector, ship:srfprograde:vector)).
|
||||||
|
|
||||||
wait until ship:orbit:apoapsis >= 0.95 * p_apoapsis.
|
wait until ship:orbit:apoapsis >= 0.95 * p_apoapsis.
|
||||||
lock throttle to 0.3.
|
lock throttle to 0.3.
|
||||||
wait until ship:orbit:apoapsis >= p_apoapsis.
|
wait until ship:orbit:apoapsis >= p_apoapsis.
|
||||||
print " - Apoapsis OK".
|
|
||||||
lock throttle to 0.
|
lock throttle to 0.
|
||||||
wait 1.
|
wait 1.
|
||||||
stage.
|
stage.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user