Skip to content

Commit

Permalink
recorded
Browse files Browse the repository at this point in the history
  • Loading branch information
valery-labuzhsky committed Aug 13, 2017
1 parent 16fcac3 commit f488c03
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
10 changes: 5 additions & 5 deletions KSP/Script/compiled.ks
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ local compiled_list to lexicon().
set compiled_list["compile"] to 728.
set compiled_list["current"] to 476.
set compiled_list["funct"] to 30.
set compiled_list["lib_asc"] to 15526.
set compiled_list["lib_calc"] to 5360.
set compiled_list["lib_ctrl"] to 2913.
set compiled_list["lib_desc"] to 4856.
set compiled_list["lib_asc"] to 15698.
set compiled_list["lib_calc"] to 5393.
set compiled_list["lib_ctrl"] to 2912.
set compiled_list["lib_desc"] to 4884.
set compiled_list["lib_desc_"] to 10412.
set compiled_list["lib_funct"] to 555.
set compiled_list["lib_gt"] to 2648.
Expand All @@ -17,7 +17,7 @@ set compiled_list["lib_msmnt"] to 5335.
set compiled_list["lib_msmnt_thr"] to 1999.
set compiled_list["lib_rt"] to 392.
set compiled_list["lib_sac"] to 12801.
set compiled_list["lib_stage"] to 13233.
set compiled_list["lib_stage"] to 13477.
set compiled_list["lib_stat"] to 847.
set compiled_list["perf"] to 1858.
set compiled_list["stage"] to 489.
Expand Down
8 changes: 6 additions & 2 deletions KSP/Script/lib_asc.ks
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function asc_start {
if ship:altitude < cutoff_alt {
wait 5.
from {local c is 5.} until c = 0 step {set c to c - 1.} do {
HUDTEXT(c, 1, 2, 18, RGB(0.5,1.0,0.0), false).
//HUDTEXT(c, 1, 2, 18, RGB(0.5,1.0,0.0), false).
wait 1.
}
}
Expand Down Expand Up @@ -356,7 +356,7 @@ function asc_burn_2_orb_ap {
sac_start_following().
sac_start_following_toggle().

local state to 1. // TODO 0 is not needed
local state to 0. // TODO 0 is not needed

local tr0 to calc_abs(th).
local tr to tr0.
Expand Down Expand Up @@ -457,6 +457,10 @@ function asc_burn_2_orb_ap {
set thr to 0.
} else {
set thr to thr * (zdx - dx0)/(zdx - mdx).
if state = 0 {
if not conf_switch_active hud_text("Second engine startup (2)").
set state to 1.
}
}
} else { // overshoot
set ot to (mdx - dx0)/dv.
Expand Down
2 changes: 1 addition & 1 deletion KSP/Script/lib_calc.ks
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function calc_time_2_mean_ano {
parameter n.

local da to ma_to - ma_from.
//if da < 0 set da to pi2 + da.
//if da < 0 set da to pi2 + da. // TODO it spoils final maneuver
return da/n.
}

Expand Down
2 changes: 1 addition & 1 deletion KSP/Script/lib_ctrl.ks
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function start_throttle_dv {
} else if ctrl_dv <> 0 {
local cdv to ctrl_dv.
local tt to cdv/twr.
local th to tt/ctrl_dv_dt/16. // 16
local th to tt/ctrl_dv_dt/8. // 16
if th > ctrl_throt {
set th to ctrl_throt.
set ctrl_state to 0.
Expand Down
8 changes: 5 additions & 3 deletions KSP/Script/lib_desc.ks
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function desc_dist_time {

local s to sign(vh).
local a to sign(vv)*calc_true_ano(ap, pe, r).
local b to -calc_true_ano(ap, pe, ship:body:radius + base:TERRAINHEIGHT).
if a < 0 set a to pi2 + a.
local b to pi2-calc_true_ano(ap, pe, ship:body:radius + base:TERRAINHEIGHT).

local n to calc_mean_motion(ap, pe, body).
local ec to calc_ecc(ap, pe).
Expand All @@ -79,8 +80,7 @@ function desc_dist_time {
local eab to calc_ecc_ano(b, ec).

local t to calc_time_2_ecc_ano(eaa, eab, n, ec).
if a < 0 set a to pi2 + a.
local d to desc_dist_ang(s*desc_ang_dlt(a, pi2+b, s*ba, s*t)).
local d to desc_dist_ang(s*desc_ang_dlt(a, b, s*ba, s*t)).

ret(d, t).
}
Expand Down Expand Up @@ -137,8 +137,10 @@ function desc_dist_atm_newton {
if dd<>0 {
set ddv to -(d1+6+4)*ddv/(d2-d1). // TODO it's a little bit wrong
set dv to dv+ddv.
if false {
log_log("ddv = "+ddv).
log_log("dv = "+dv).
}
}

ret(dv, ddv, -z/t-vz, t).
Expand Down
16 changes: 13 additions & 3 deletions KSP/Script/lib_stage.ks
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if vectorangle(ship:facing:vector, ship:SRFRETROGRADE:vector) > vectorangle(ship
local dvz to 0.
until bdv < 0 {
sac_toggle(r(arctan2(dvz, bdv), (180-ba), 0)).
set_throttle_dv(bdv).
if set_throttle_dv(bdv) break.

desc_dist_newton3(base, bdv, torad(ba), {
parameter ndv.
Expand Down Expand Up @@ -221,7 +221,7 @@ until twr > calc_max_twr() {
sac_toggle(r(anz, an, 0)).
//sac_toggle(r(5, 0, 0)).

if true {
if false {
log_log("d = "+base_desc_dist()).
log_log("an = "+an).
//log_log("zdv = "+zdv).
Expand Down Expand Up @@ -346,17 +346,26 @@ function lift_twr_an {

sac_stop_following().

log_log("alt1 = "+base_alt()).

local h to base_alt().
until h < 1 {
set h to base_alt().
local v to ship:verticalspeed.
local v0 to -1.
local a to (v^2 - v0^2) / (2*h).
set twr to a + gt_g().
log_log("mtwr = "+calc_max_twr()).
log_log("twr = "+twr).
log_log("sp = "+ship:verticalspeed).
log_log("h = "+h).
log_log(" ").
set_throttle(twr/calc_max_twr()).
sac_target(HEADING3(90, 90, -90)*R(steer_south(), -steer_west(), 0)).
}

log_log("alt2 = "+base_alt()).

until ship:verticalspeed >= 0 {
set twr to gt_g() - ship:verticalspeed + 5.
set_throttle(twr/calc_max_twr()).
Expand Down Expand Up @@ -555,5 +564,6 @@ function steer {
}

function base_alt {
return ship:altitude - base:TERRAINHEIGHT - 10.
local alt to ship:altitude - base:TERRAINHEIGHT - 10.
return alt.
}

0 comments on commit f488c03

Please sign in to comment.