Исследование движения центра масс межпланетных космических аппаратов

Страница 15

int sim;

if ((t-Tkor) < 2500)

{

cout << "Не корректировать!";

return;

}

Tkor = t;

real R_t = sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2]);

real V_t = sqrt(f[3]*f[3]+f[4]*f[4]+f[5]*f[5]);

real R_n = parn[0];

if (Fl_a)

{

dRa = R_t-R_n;

dRp = par[2]*(1-par[1])-R_n;

cout << "Апоцентр dRp:" << dRp << "м \n";

cout << "dRa:" << dRa << "м \n";

cout << "w=" << par[5]*r_g << "u=" << par[7]*r_g << '\n';

real l,ln;

l = -(w_z-w_s)*par[6];

ln = -(w_z-w_s)*parn[6];

dl = -(w_z-w_s)*(par[6]-parn[6]);

cout << "T=" << par[6] << "Тном=" << parn[6] << " T-Tном="

<< par[6]-parn[6] << '\n' << "l=" << l*r_g << "lном="

<< ln*r_g << "l-lном=" << (l-ln)*r_g << "dl=" << dl

<< '\n';

if (dRp > 0)

Sig_a = -1;

else

Sig_a = 1;

cout << "Знак ускорения:" << Sig_a << '\n';

clrscr();

real Rp = par[2]*(1-par[1]);

real Ra_p = par[2]*(1+par[1]);

real Rp_p2 = Rp;

real Ra_p2 = R_t;

cout << "Rp=" << Rp_p2 << "Ra=" << Ra_p2 << '\n';

cout << "Ra_p=" << Ra_p << "\n Rt=" << R_t << '\n';

if (fabs(Rp - R_n) < 500)

{

Fl_kp = 0;

Fl_ka = 1;

cout << "Закончить коррекцию в апоцентре \n" << "dRp=" << Rp-R_n

<< "dRa=" << dRa << "t=" << t << '\n';

cout << "Параметры орбиты: \n" << "Rp=" << par[2]*(1-par[1])

<< "Ra=" << par[2]*(1+par[1]) << "\n p=" << par[0]

<< "a=" << par[2] << "e=" << par[1] << "\n T="

<< par[6] << "w=" << par[5]*r_g << "u=" << par[7]*r_g

<< '\n';

cout << "Суммарный импульс для коррекции перицентра=" << dV_ps << '\n';

clrscr();

}

else

{

if (R_t > R_n)

{

Rp_p = R_n;

Ra_p = R_t;

a_p = (Ra_p+Rp_p)/2.;

e_p = 1-Rp_p/a_p;

p_p = a_p*(1-e_p*e_p);

Vk = sqrt(mu_z/p_p)*(1-e_p);

}

else

{

Rp_p = R_t;

Ra_p = R_n;

a_p = (Ra_p+Rp_p)/2.;

e_p = 1-Rp_p/a_p;

p_p = a_p*(1-e_p*e_p);

Vk = sqrt(mu_z/p_p)*(1+e_p);

}

real dV = Vk-V_t;

real dVmax = 20*25./m;

cout << "\n dVтреб=" << dV << "dVmax за 20 сек=" << dVmax;

if (fabs(dV) > dVmax)

{

akor[0] = Sig_a*(25./m)*f[3]/V_t;

akor[1] = Sig_a*(25./m)*f[4]/V_t;

akor[2] = Sig_a*(25./m)*f[5]/V_t;

cout << "\n dV=" << dV << "dVmax=" << dVmax;

cout << "\n Корректирующее ускорение:" << akor[0] << '\t' << akor[1]

<< '\t' << akor[2] << '\t' <<

sqrt(akor[0]*akor[0]+akor[1]*akor[1]+akor[2]*akor[2]) << '\n';

dV_ps = dV_ps+dVmax;

cout << "Суммарный импульс=" << dV_ps << '\n';

}

else

{

akor[0] = Sig_a*(fabs(dV)/dVmax)*(25./m)*f[3]/V_t;

akor[1] = Sig_a*(fabs(dV)/dVmax)*(25./m)*f[4]/V_t;

akor[2] = Sig_a*(fabs(dV)/dVmax)*(25./m)*f[5]/V_t;

cout << "\n dV=" << dV << "dVmax=" << dVmax;

cout << "\n Корректирующее ускорение:" << akor[0] << '\t' << akor[1]

<< '\t' << akor[2] << '\t' <<

sqrt(akor[0]*akor[0]+akor[1]*akor[1]+akor[2]*akor[2]) << '\n';

dV_ps = dV_ps+fabs(dV);

cout << "Суммарный импульс=" << dV_ps << '\n';

}

if (dVmax > fabs(dV))

{

dVmax = fabs(dV);

real Vk_r = Sig_a*dVmax+V_t;

real Ra_r = R_t;

real e_r = -(Vk_r*Vk_r*Ra_r/mu_z)+1;

real a_r = Ra_r/(1+e_r);

real p_r = a_r*(1-e_r*e_r);

real Rp_r = a_r*(1-e_r);

cout << "Параметры орбиты: \n" << " Rp_r = " << Rp_r

<< " Ra_r = " << Ra_r << "\n p_r = " << p_r << " a_r = "

<< a_r << " e_r = " << e_r << '\n';

}

else

{

real Vk_r = Sig_a*dVmax+V_t;

real Ra_r = R_t;

real e_r = -(Vk_r*Vk_r*Ra_r/mu_z)+1;

real a_r = Ra_r/(1+e_r);

real p_r = a_r*(1-e_r*e_r);

real Rp_r = a_r*(1-e_r);

cout << "Параметры орбиты: \n" << " Rp_r = " << Rp_r

<< " Ra_r = " << Ra_r << "\n p_r = " << p_r << " a_r = "

<< a_r << " e_r = " << e_r << '\n';

}

T_vd = t;

cout << "Вкл.дв. t=" << T_vd << '\n';

}

}

if (Fl_p)

{

dRp = R_t-R_n;

dRa = par[2]*(1+par[1])-R_n;

cout << " Перицентра - dRp:" << dRp << "м \n";

cout << "dRa:" << dRa << "м. \n";

cout << "w=" << par[5]*r_g << "u=" << par[7]*r_g << '\n';

real l,ln;

l = -(w_z-w_s)*par[6];

ln = -(w_z-w_s)*parn[6];

dl = -(w_z-w_s)*(par[6]-parn[6]);

cout << "T=" << par[6] << "Tном=" << parn[6] << "T-Tном="

<< par[6]-parn[6] << '\n' << "l=" << l*r_g << "lном="

<< ln*r_g << "l-lном=" << (l-ln)*r_g << "dl=" << dl << '\n';

if (dRa > 0)

Sig_a = -1;

else

Sig_a = 1;

cout << "Знак ускорения:" << Sig_a << '\n';

clrscr();

real Ra = par[2]*(1+par[1]);

real Rp_p1 = R_t;

real Ra_p1 = Ra;

cout << "Rp=" << Rp_p1 << "Ra=" << Ra_p1 << '\n';

if ((fabs(Ra-R_n) < 500) || (fabs(dl*r_g) < .0001))

{

cout << "Закончить коррекцию в перицентре \n" << "dRa="

<< Ra-R_n << "dRp=" << dRp << "t=" << t << '\n';

cout << "Параметры орбиты: \n " << "Rp="

<< par[2]*(1-par[1]) << "Ra=" << par[2]*(1+par[1])

<< " \n p=" << par[0] << "a=" << par[2] << "e="

<< par[1] << " \n T=" << par[6] << "w=" << par[5]*r_g

<< "u=" << par[7]*r_g << '\n';

cout << "Суммарный импульс для коррекции перицентра=" << dV_as << '\n';

clrscr();

Fl_ka = 0;

Fl_ki = 1;

}

else

{

if (R_t > R_n)

{

Rp_p = R_n;

Ra_p = R_t;

a_p = (Ra_p+Rp_p)/2.;

e_p = 1-Rp_p/a_p;

p_p = a_p*(1-e_p*e_p);

Vk = sqrt(mu_z/p_p)*(1-e_p);

}

else

{

Rp_p = R_t;

Ra_p = R_n;

a_p = (Ra_p+Rp_p)/2.;

e_p = 1-Rp_p/a_p;

p_p = a_p*(1-e_p*e_p);

Vk = sqrt(mu_z/p_p)*(1+e_p);

}

real dV = Vk-V_t;

real dVmax = 20*25./m;

cout << "\n dVнадо=" << dV << " dVmax за 20 сек=" << dVmax;

if (fabs(dV) > dVmax)

{

akor[0] = Sig_a*(25./m)*f[3]/V_t;

akor[1] = Sig_a*(25./m)*f[4]/V_t;