Browse Source

add more detailed logging to applyManeuver()

main
cinnaboot 4 years ago
parent
commit
6591b094ac
  1. 22
      src/game.cpp
  2. 2
      src/game.h

22
src/game.cpp

@ -211,23 +211,33 @@ testManeuverStep(const ManeuverNode& maneuver,
} }
void void
applyManeuver(GameOrbit* orbit) applyManeuver(GameOrbit* orbit, double previous_true_anomaly)
{ {
LOGF(Debug, "applying maneuver\n"); const ManeuverNode& node = orbit->maneuver;
TwoBodySystem& sys = orbit->system;
LOGF(Debug, "applying maneuver,\n"
"theta: %f\n,"
"dv: %f,\n"
"sat.theta: %f,\n"
"previous theta: %f\n",
node.true_anomaly,
node.impulse_delta_v,
sys.sat.theta,
previous_true_anomaly);
// FIXME: assuming prograde impulse vector // FIXME: assuming prograde impulse vector
assert(orbit->maneuver.impulse_type == ImpulseType::PROGRADE); assert(node.impulse_type == ImpulseType::PROGRADE);
// re-calculate state vectors at the maneuver node // re-calculate state vectors at the maneuver node
TwoBodySystem& sys = orbit->system; double theta = node.true_anomaly;
double theta = orbit->maneuver.true_anomaly;
double mu = sys.body.mu; double mu = sys.body.mu;
double r = orbitGetRadialDistance(sys.ep.e, sys.ep.p, theta); double r = orbitGetRadialDistance(sys.ep.e, sys.ep.p, theta);
double v = orbitGetVelocity(sys.epsilon, mu, r); double v = orbitGetVelocity(sys.epsilon, mu, r);
double gamma = orbitGetFlightPathAngle(sys.ep.e, theta); double gamma = orbitGetFlightPathAngle(sys.ep.e, theta);
// calculate new satellite state vectors // calculate new satellite state vectors
v += orbit->maneuver.impulse_delta_v; // prograde only v += node.impulse_delta_v; // prograde only
// get new angular momentum and specific orbital energy // get new angular momentum and specific orbital energy
double h = orbitGetAngularMomentumFromStateVectors(r, v, gamma); double h = orbitGetAngularMomentumFromStateVectors(r, v, gamma);

2
src/game.h

@ -98,4 +98,4 @@ bool testManeuverStep(const ManeuverNode& maneuver,
double previous_theta, double previous_theta,
double next_theta); double next_theta);
void applyManeuver(GameOrbit* orbit); void applyManeuver(GameOrbit* orbit, double previous_true_anomaly);

Loading…
Cancel
Save