Yes, you need to manually move the airfoils in exactly the opposite direction of ShiftCG.
How? So if the shiftcg is (0,-4,0). Shifts the cg -4 in the y direction. The craft should tilt that way
Yes, you need to manually move the airfoils in exactly the opposite direction of ShiftCG.
void VLiftCoeff(double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
static const double step = RAD*15.0;
static const double istep = 1.0 / step;
static const int nabsc = 25;
static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
static const double CM[nabsc] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// lift and moment coefficients from -180 to 180 in 15 degree steps.
// This uses a documented lift slope of 0.0437/deg, everything else is rather ad-hoc
aoa += PI;
int idx = max(0, min(23, (int)(aoa*istep)));
double d = aoa*istep - idx;
*cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
*cm = CM[idx] + (CM[idx + 1] - CM[idx])*d;
*cd = 0.06 + oapiGetInducedDrag(*cl, 2.266, 0.6);
}
// 2. horizontal lift component (vertical stabiliser and body)
void HLiftCoeff(double beta, double M, double Re, double *cl, double *cm, double *cd)
{
static const double step = RAD*22.5;
static const double istep = 1.0 / step;
static const int nabsc = 17;
static const double CL[nabsc] = { 0, 0.2, 0.3, 0.2, 0, -0.2, -0.3, -0.2, 0, 0.2, 0.3, 0.2, 0, -0.2, -0.3, -0.2, 0 };
beta += PI;
int idx = max(0, min(15, (int)(beta*istep)));
double d = beta*istep - idx;
*cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
*cm = 0.0;
*cd = 0.02 + oapiGetInducedDrag(*cl, 1.5, 0.6);
}
CreateAirfoil(LIFT_VERTICAL, _V(0, 0.01, 0.1), VLiftCoeff, 5.5, 0, 1.27);
CreateAirfoil(LIFT_HORIZONTAL, _V(0, 0, 0.01), HLiftCoeff, 5.5, 0, 1.27);
Thanks. Any suggestion, then?
void VLiftCoeff (double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
static const double step = RAD*30.0;
static const double istep = 1.0/step;
static const int nabsc = 13;
// Angle of attack -180 -150 -120 -90 -60 -30 0 30 60 90 120 150 180
static const double CL[nabsc] = { 0, -0.12, -0.1, 0, 0, 0, 0, 0, 0, 0, 0.1, 0.12, 0};
static const double CM[nabsc] = { 0, -0.0002,-0.0004, -0.0004,-0.0003,-0.0002, 0, 0.0002, 0.0003, 0.0004, 0.0004,0.0002, 0};
// lift and moment coefficients from -180 to 180 in 30 degree steps.
aoa += PI;
int idx = max (0, min (11, (int)(aoa*istep)));
double d = aoa*istep - idx;
*cl = CL[idx] + (CL[idx+1]-CL[idx])*d;
*cm = ( CM[idx] + (CM[idx+1]-CM[idx])*d ) / 10;
*cd = 0.25 + oapiGetInducedDrag (*cl, 1.27, 0.3);
}
Thanks. confused:huh:
here the aoa is aoa += PI;
This is what it looks like entering earth.
static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
static const double CM[nabsc] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// -180, -165, -150, -135, -120, -105, -90, -75, -60, -45, -30, -15, 0, 15, 30, 45,
aoa -= desired_trim_angle;
void VLiftCoeff(double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
static const double step = RAD*15.0;
static const double istep = 1.0 / step;
static const int nabsc = 25;
// static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
static const double CM[nabsc] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// -180, -165, -150, -135, -120, -105, -90, -75, -60, -45, -30, -15, 0, 15, 30, 45,
// static const double CM[nabsc] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// lift and moment coefficients from -180 to 180 in 15 degree steps.
// This uses a documented lift slope of 0.0437/deg, everything else is rather ad-hoc
aoa -= -20;
//aoa += PI*2;
int idx = max(0, min(23, (int)(aoa*istep)));
double d = aoa*istep - idx;
*cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
*cm = CM[idx] + (CM[idx + 1] - CM[idx])*d;
*cd = 0.06 + oapiGetInducedDrag(*cl, 2.266, 0.6);
}
CreateAirfoil(LIFT_VERTICAL, _V(0, -0.01, -0.1), VLiftCoeff, 5.5, 0, 1.27);
CreateAirfoil(LIFT_HORIZONTAL, _V(0, 0, 0.01), HLiftCoeff, 5.5, 0, 1.27);
Can the I change the desired trim angle change? Because was the chute deploys now it should be level or 90 degrees pitch.
void VLiftCoeff(double aoa, double M, double Re, double *cl, double *cm, double *cd, double desired_trim_angle)
{
// ...
aoa -= desired_trim_angle;
// ...
}
void VLiftCoeffAoA0(double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
VLiftCoeff(aoa, M, Re, cl, cm, cd, 0.0);
}
void VLiftCoeffAoA20(double aoa, double M, double Re, double *cl, double *cm, double *cd)
{
VLiftCoeff(aoa, M, Re, cl, cm, cd, -20.0 * PI / 180.0);
}
void VLiftCoeff(double aoa, double M, double Re, double *cl, double *cm, double *cd, double desired_trim_angle)
{
static const double step = RAD*15.0;
static const double istep = 1.0 / step;
static const int nabsc = 25;
// static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
static const double CL[nabsc] = { 0.1, 0.17, 0.2, 0.2, 0.17, 0.1, 0, -0.11, -0.24, -0.38, -0.5, -0.5, -0.02, 0.6355, 0.63, 0.46, 0.28, 0.13, 0.0, -0.16, -0.26, -0.29, -0.24, -0.1, 0.1 };
static const double CM[nabsc] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// -180, -165, -150, -135, -120, -105, -90, -75, -60, -45, -30, -15, 0, 15, 30, 45,
// static const double CM[nabsc] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.002, 0.004, 0.0025, 0.0012, 0, -0.0012, -0.0007, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// lift and moment coefficients from -180 to 180 in 15 degree steps.
// This uses a documented lift slope of 0.0437/deg, everything else is rather ad-hoc
aoa -= desired_trim_angle;
//aoa += PI*2;
int idx = max(0, min(23, (int)(aoa*istep)));
double d = aoa*istep - idx;
*cl = CL[idx] + (CL[idx + 1] - CL[idx])*d;
*cm = CM[idx] + (CM[idx + 1] - CM[idx])*d;
*cd = 0.06 + oapiGetInducedDrag(*cl, 2.266, 0.6);
}
CreateAirfoil(LIFT_VERTICAL, _V(0, -0.01, -0.1), VLiftCoeff, 5.5, 0, 1.27);
So we are on the same page. When the desired trim angle is -20. The craft should pitch to -20.?
I did this:
void VLiftCoeff(double aoa, double M, double Re, double *cl, double *cm, double *cd, double desired_trim_angle)
{
// ...
aoa -= desired_trim_angle;
// ...
}
CreateAirfoil(LIFT_VERTICAL, _V(0, -0.01, -0.1), VLiftCoeffAoA0, 5.5, 0, 1.27);
// or
CreateAirfoil(LIFT_VERTICAL, _V(0, -0.01, -0.1), VLiftCoeffAoA20, 5.5, 0, 1.27);
And I am not quite sure, but I guess the trim angle should be in radians, right?
So 20° AoA would be 20°/180*PI = 0.349 rad.