task2 cleanup
This commit is contained in:
parent
f10041eac2
commit
eaf6065153
47
ovm/task2.c
47
ovm/task2.c
@ -100,7 +100,6 @@ static void run(task_t *task, gpointer userdata) {
|
||||
start_hohmann = starttime ;
|
||||
if (sat.move.v.x * S_Y > 0.0 && sat.move.v.y * S_X < 0.0) target_v = -target_v;
|
||||
printf("Vorsprung für Target: %u (Winkel: %14.3f)\n", start_hohmann, (180.0*phi/M_PI));
|
||||
// printf("T: %14.3f\n", 2*M_PI*target_sat.rad*sqrt(target_sat.rad/(G*Me)));
|
||||
} else if (start_hohmann == task->timestamp) {
|
||||
satellite_update_move(&sat);
|
||||
DV_X = sat.move.v.x * (dv / sat.move.v_abs);
|
||||
@ -122,49 +121,13 @@ static void run(task_t *task, gpointer userdata) {
|
||||
printf("Dv: %f / %f\n", DV_X, DV_Y);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
} else if (DISTANCE > 400) {
|
||||
gdouble dx = task->out[4], dy = task->out[5];
|
||||
#endif
|
||||
#if 0
|
||||
} else if (DISTANCE > 500.0) {
|
||||
gdouble phidiff = 180.0*(atan2(S_Y, S_X) - atan2(T_Y, T_X))/M_PI;
|
||||
gdouble target_rad = target_sat.rad - sat.rad;
|
||||
/* gdouble tar_dv_x = -target_v * S_Y / sat.rad;
|
||||
gdouble tar_dv_y = target_v * S_X / sat.rad;*/
|
||||
satellite_update_move(&sat);
|
||||
printf("Distance: %14.3f\n", phidiff);
|
||||
if (phidiff < 0 || phidiff > 180.0) { /* slow down */
|
||||
target_rad += 20.0;
|
||||
} else { /* speed up */
|
||||
target_rad -= 20.0;
|
||||
}
|
||||
target_rad = fmax(-5.0, fmin(5.0, target_rad));
|
||||
DV_X = /*tar_dv_x - sat.move.v.x*/ + target_rad * S_X / sat.rad;
|
||||
DV_Y = /*tar_dv_y - sat.move.v.y*/ + target_rad * S_Y / sat.rad;
|
||||
printf("v: %f / %f\n", sat.move.v.x, sat.move.v.y);
|
||||
printf("Dv: %f / %f\n", DV_X, DV_Y);
|
||||
debug(task);
|
||||
#endif
|
||||
} else if (!outoffuel) {
|
||||
/* target_v is clockwise */
|
||||
gdouble tar_dv_x = -target_v * S_Y / sat.rad;
|
||||
gdouble tar_dv_y = target_v * S_X / sat.rad;
|
||||
satellite_update_move(&sat);
|
||||
if (FALSE && fabs(sat.rad - target_sat.rad) > 3) {
|
||||
gdouble tar_dv_x = -target_v * S_Y / sat.rad;
|
||||
gdouble tar_dv_y = target_v * S_X / sat.rad;
|
||||
gdouble target_rad = target_sat.rad - sat.rad;
|
||||
target_rad = fmax(-10.0, fmin(10.0, target_rad));
|
||||
DV_X = tar_dv_x - sat.move.v.x + target_rad * S_X / sat.rad;
|
||||
DV_Y = tar_dv_y - sat.move.v.y + target_rad * S_Y / sat.rad;
|
||||
printf("-- orbit correction\n");
|
||||
printf("v: %f / %f\n", sat.move.v.x, sat.move.v.y);
|
||||
printf("Dv: %f / %f\n", DV_X, DV_Y);
|
||||
} else {
|
||||
/* target_v is clockwise */
|
||||
gdouble tar_dv_x = -target_v * S_Y / sat.rad;
|
||||
gdouble tar_dv_y = target_v * S_X / sat.rad;
|
||||
DV_X = tar_dv_x - sat.move.v.x;
|
||||
DV_Y = tar_dv_y - sat.move.v.y;
|
||||
}
|
||||
DV_X = tar_dv_x - sat.move.v.x;
|
||||
DV_Y = tar_dv_y - sat.move.v.y;
|
||||
if (DV_X*DV_X + DV_Y*DV_Y > FUEL*FUEL) {
|
||||
printf("-- Out of fuel\n");
|
||||
printf("v: %f / %f\n", sat.move.v.x, sat.move.v.y);
|
||||
|
Loading…
Reference in New Issue
Block a user