Commit 5a33a8e1 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Fixed again wrong equations in ECOM2 model.

parent c589ab9e
......@@ -165,13 +165,13 @@ public class ECOM2 extends AbstractRadiationForceModel {
// Compute B(u)
double b_u = parameters[0];
for (int i = 1; i < nB + 1; i++) {
final SinCos sc = FastMath.sinCos(2 * i * delta_u);
final SinCos sc = FastMath.sinCos((2 * i - 1) * delta_u);
b_u += parameters[i] * sc.cos() + parameters[i + nB] * sc.sin();
}
// Compute D(u)
double d_u = parameters[2 * nB + 1];
for (int i = 1; i < nD + 1; i++) {
final SinCos sc = FastMath.sinCos((2 * i - 1) * delta_u);
final SinCos sc = FastMath.sinCos(2 * i * delta_u);
d_u += parameters[2 * nB + 1 + i] * sc.cos() + parameters[2 * nB + 1 + i + nD] * sc.sin();
}
// Return acceleration
......@@ -199,14 +199,14 @@ public class ECOM2 extends AbstractRadiationForceModel {
// Compute B(u)
T b_u = parameters[0];
for (int i = 1; i < nB + 1; i++) {
final FieldSinCos<T> sc = FastMath.sinCos(delta_u.multiply(2 * i));
final FieldSinCos<T> sc = FastMath.sinCos(delta_u.multiply(2 * i - 1));
b_u = b_u.add(sc.cos().multiply(parameters[i])).add(sc.sin().multiply(parameters[i + nB]));
}
// Compute D(u)
T d_u = parameters[2 * nB + 1];
for (int i = 1; i < nD + 1; i++) {
final FieldSinCos<T> sc = FastMath.sinCos(delta_u.multiply(2 * i - 1));
final FieldSinCos<T> sc = FastMath.sinCos(delta_u.multiply(2 * i));
d_u = d_u.add(sc.cos().multiply(parameters[2 * nB + 1 + i])).add(sc.sin().multiply(parameters[2 * nB + 1 + i + nD]));
}
// Return the acceleration
......
......@@ -237,11 +237,11 @@ public class ECOM2Test extends AbstractForceModelTest {
//Compare state derivatives with finite-difference ones.
for (int i = 0; i < 6; i++) {
final double errorX = (accX[i + 1] - refDeriv[0][i]) / refDeriv[0][i];
Assert.assertEquals(0, errorX, 1e-10);
Assert.assertEquals(0, errorX, 1.0e-10);
final double errorY = (accY[i + 1] - refDeriv[1][i]) / refDeriv[1][i];
Assert.assertEquals(0, errorY, 1e-10);
Assert.assertEquals(0, errorY, 1.1e-10);
final double errorZ = (accZ[i + 1] - refDeriv[2][i]) / refDeriv[2][i];
Assert.assertEquals(0, errorZ, 1e-10);
Assert.assertEquals(0, errorZ, 1.0e-10);
}
}
......@@ -504,7 +504,7 @@ public class ECOM2Test extends AbstractForceModelTest {
final double alpha = FastMath.toDegrees(FastMath.atan2(dey, dex));
Assert.assertTrue(alpha > 100.0);
Assert.assertTrue(alpha < 112.0);
checkRadius(FastMath.sqrt(dex * dex + dey * dey), 0.003482, 0.003525);
checkRadius(FastMath.sqrt(dex * dex + dey * dey), 0.003482, 0.003544);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment