- Joined
- Feb 2, 2012
- Messages
- 1,664
- Reaction score
- 115
- Points
- 78
Hi all,
I'm facing something here that I'm not capable to understand and therefore to avoid.
The new algorithm I developed for gravity turn evaluation works quite fine, but only if I write the variables to the log at the end of every loop...
in particular this:
doesn't work, while this:
works perfectly.... how can this be possible???? how can I avoid it?? I already tried to change the name of vel but doesn't change.... I can't understand the meaning of this...:compbash:
Thanks in advance for any help!:sos:
Fred
I'm facing something here that I'm not capable to understand and therefore to avoid.
The new algorithm I developed for gravity turn evaluation works quite fine, but only if I write the variables to the log at the end of every loop...
in particular this:
Code:
while((t0<500)&&(psi0<80*RAD)){
double grel= mu/((rt+y0)*(rt+y0))-(vel*vel/(rt+y0));
double n=GetProperNforCGTE(t0);
absacc=n*g0;
hacc=absacc*sin(psi0);
vacc=absacc*cos(psi0)-grel;
x=x0+hvel*deltaT+0.5*hacc*deltaT*deltaT;
y=y0+vvel*deltaT+0.5*vacc*deltaT*deltaT;
hvel+=hacc*deltaT;
vvel+=vacc*deltaT;
vel=sqrt(hvel*hvel+vvel*vvel);
t0+=deltaT;
deltax=x-x0;
deltay=y-y0;
x0=x;
y0=y;
v0=vel;
modspost=sqrt(deltax*deltax+deltay*deltay);
normx=deltax/modspost;
normy=deltay/modspost;
psi=0.5*PI-atan2(normy,normx);
if(psi>psi0){
psi0=psi;
}
if(y0>altsteps[3]){return true;}
}
doesn't work, while this:
Code:
while((t0<500)&&(psi0<80*RAD)){
double grel= mu/((rt+y0)*(rt+y0))-(vel*vel/(rt+y0));
double n=GetProperNforCGTE(t0);
absacc=n*g0;
hacc=absacc*sin(psi0);
vacc=absacc*cos(psi0)-grel;
x=x0+hvel*deltaT+0.5*hacc*deltaT*deltaT;
y=y0+vvel*deltaT+0.5*vacc*deltaT*deltaT;
hvel+=hacc*deltaT;
vvel+=vacc*deltaT;
vel=sqrt(hvel*hvel+vvel*vvel);
t0+=deltaT;
deltax=x-x0;
deltay=y-y0;
x0=x;
y0=y;
v0=vel;
modspost=sqrt(deltax*deltax+deltay*deltay);
normx=deltax/modspost;
normy=deltay/modspost;
psi=0.5*PI-atan2(normy,normx);
if(psi>psi0){
psi0=psi;
}
[color="red"][B][U]sprintf(logbuff,"%.3f",vel);[/U]
[U]oapiWriteLog(logbuff);[/U][/B][/color]
if(y0>altsteps[3]){return true;}
}
works perfectly.... how can this be possible???? how can I avoid it?? I already tried to change the name of vel but doesn't change.... I can't understand the meaning of this...:compbash:
Thanks in advance for any help!:sos:
Fred