static const float INHG2PA = 3386.389;
static const float SLUG2KG = 14.59390;
-YASim::YASim(double dt)
+YASim::YASim(double dt) :
+ _simTime(0)
{
// set_delta_t(dt);
_fdm = new FGFDM();
// build the environment cache.
float vr = _fdm->getVehicleRadius();
vr += 2.0*FT2M*dt*Math::mag3(v);
- prepare_ground_cache_m( 0.0, xyz, vr );
+ prepare_ground_cache_m( _simTime, _simTime + dt, xyz, vr );
// Track time increments.
FGGround* gr
int i;
for(i=0; i<iterations; i++) {
- gr->setTimeOffset(i*_dt);
+ gr->setTimeOffset(_simTime + i*_dt);
copyToYASim(false);
_fdm->iterate(_dt);
copyFromYASim();
}
- // Reset the time increment.
- gr->setTimeOffset(0.0);
+ // Increment the local sim time
+ _simTime += dt;
+ gr->setTimeOffset(_simTime);
}
void YASim::copyToYASim(bool copyState)
_set_V_rel_wind(Math::mag3(v)*M2FT); // units?
float P = fgGetDouble("/environment/pressure-inhg") * INHG2PA;
- float T = fgGetDouble("/environment/temperature-degC") + 273.15;
+ float T = fgGetDouble("/environment/temperature-degc") + 273.15;
float D = fgGetFloat("/environment/density-slugft3")
*SLUG2KG * M2FT*M2FT*M2FT;
_set_V_equiv_kts(Atmosphere::calcVEAS(v[0], P, T, D)*MPS2KTS);
node->setFloatValue("caster-angle-deg", g->getCasterAngle() * RAD2DEG);
node->setFloatValue("rollspeed-ms", g->getRollSpeed());
node->setBoolValue("ground-is-solid", g->getGroundIsSolid()!=0);
+ node->setFloatValue("ground-friction-factor", g->getGroundFrictionFactor());
}
Hook* h = airplane->getHook();