Apply /sim/speed-up to general subsystem dt
- consistent with pause (freeze), /sim/speed-up is now applied to the dt value for all subsystems, not just the FDM and some instruments. For example AI traffic can now be sped-up or slowed down. - requires both an FGData and Simgear update.
This commit is contained in:
parent
540d4c2111
commit
52f39abc6b
8 changed files with 11 additions and 35 deletions
|
@ -451,7 +451,7 @@ FGReplay::update( double dt )
|
|||
}
|
||||
else
|
||||
{
|
||||
current_time += dt * speed_up->getDoubleValue();
|
||||
current_time += dt;
|
||||
was_finished_already = false;
|
||||
}
|
||||
replay_time->setDoubleValue(current_time);
|
||||
|
@ -478,7 +478,7 @@ FGReplay::update( double dt )
|
|||
return;
|
||||
|
||||
{
|
||||
double new_sim_time = sim_time + dt * speed_up->getDoubleValue();
|
||||
double new_sim_time = sim_time + dt;
|
||||
// don't record multiple records with the same timestamp (or go backwards in time)
|
||||
if (new_sim_time <= sim_time)
|
||||
{
|
||||
|
|
|
@ -62,19 +62,13 @@ FGInterface::~FGInterface() {
|
|||
}
|
||||
|
||||
int
|
||||
FGInterface::_calc_multiloop (double dt)
|
||||
FGInterface::_calc_multiloop (double)
|
||||
{
|
||||
// Since some time the simulation time increments we get here are
|
||||
// already a multiple of the basic update frequency.
|
||||
// So, there is no need to do our own multiloop rounding with all bad
|
||||
// roundoff problems when we already have nearly accurate values.
|
||||
// Only the speedup thing must be still handled here
|
||||
int hz = fgGetInt("/sim/model-hz");
|
||||
double speedup = fgGetDouble("/sim/speed-up");
|
||||
double loops = dt * hz * speedup + delta_loops;
|
||||
int iloops = SGMiscd::roundToInt(loops);
|
||||
delta_loops = loops-iloops; // delta_loops required for speed-ups < 1 (to do one iteration every n-th step)
|
||||
return iloops;
|
||||
// this method is now obsolete - multiloop is handled by
|
||||
// SGSubsystemGroup; the FDM group operates with a fixed time interval
|
||||
// (defined by /sim/model-hz), so at this level we always want to run
|
||||
// exactly one FDM iteration
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,8 +116,6 @@ FGInterface::_setup ()
|
|||
_state.climb_rate=0;
|
||||
_state.altitude_agl=0;
|
||||
_state.track=0;
|
||||
|
||||
delta_loops = 0.0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -136,8 +136,6 @@ private:
|
|||
// Have we bound to the property system
|
||||
bool bound;
|
||||
|
||||
double delta_loops;
|
||||
|
||||
// periodic update management variable. This is a scheme to run
|
||||
// the fdm with a fixed delta-t. We control how many iteration of
|
||||
// the fdm to run with the fixed dt based on the elapsed time from
|
||||
|
|
|
@ -179,8 +179,6 @@ void InstVerticalSpeedIndicator::init ()
|
|||
fgGetNode("/environment/pressure-inhg", true);
|
||||
_sea_node =
|
||||
fgGetNode("/environment/pressure-sea-level-inhg", true);
|
||||
_speed_up_node =
|
||||
fgGetNode("/sim/speed-up", true);
|
||||
_speed_node =
|
||||
node->getNode("indicated-speed-fps", true);
|
||||
_speed_min_node =
|
||||
|
@ -205,14 +203,7 @@ void InstVerticalSpeedIndicator::update (double dt)
|
|||
{
|
||||
double pressure_inhg = _pressure_node->getDoubleValue();
|
||||
double sea_inhg = _sea_node->getDoubleValue();
|
||||
double speed_up = _speed_up_node->getDoubleValue();
|
||||
|
||||
// must work by speed up
|
||||
if( speed_up > 1 )
|
||||
{
|
||||
dt *= speed_up;
|
||||
}
|
||||
|
||||
|
||||
// limit effect of external environment
|
||||
double rate_sea_inhg_per_s = ( sea_inhg - _internal_sea_inhg ) / dt;
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ class SGInterpTable;
|
|||
* /instrumentation/inst-vertical-speed-indicator/serviceable
|
||||
* /environment/pressure-inhg
|
||||
* /environment/pressure-sea-level-inhg
|
||||
* /sim/speed-up
|
||||
* /sim/freeze/master
|
||||
*
|
||||
* Output properties:
|
||||
|
|
|
@ -50,7 +50,6 @@ VerticalSpeedIndicator::init ()
|
|||
_speed_fpm_node = node->getChild("indicated-speed-fpm", 0, true);
|
||||
_speed_mps_node = node->getChild("indicated-speed-mps", 0, true);
|
||||
_speed_kts_node = node->getChild("indicated-speed-kts", 0, true);
|
||||
_speed_up_node = fgGetNode("/sim/speed-up", true);
|
||||
|
||||
reinit();
|
||||
}
|
||||
|
@ -74,11 +73,8 @@ VerticalSpeedIndicator::update (double dt)
|
|||
if (_serviceable_node->getBoolValue()) {
|
||||
double pressure_inHg = _pressure_node->getDoubleValue() ;
|
||||
double pressure_Pa = pressure_inHg * SG_INHG_TO_PA;
|
||||
double speed_up = _speed_up_node->getDoubleValue();
|
||||
double Fsign = 0.;
|
||||
double orifice_mach = 0.0;
|
||||
if( speed_up > 1 )
|
||||
dt *= speed_up;
|
||||
|
||||
// This is a thermodynamically correct model of a mechanical vertical speed indicator:
|
||||
// It represents an aneroid in a closed (constant volume) casing with the aneroid internal pressure = static pressure
|
||||
|
|
|
@ -61,7 +61,6 @@ private:
|
|||
SGPropertyNode_ptr _speed_fpm_node;
|
||||
SGPropertyNode_ptr _speed_mps_node;
|
||||
SGPropertyNode_ptr _speed_kts_node;
|
||||
SGPropertyNode_ptr _speed_up_node;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -227,7 +227,8 @@ void TimeManager::computeTimeDeltas(double& simDt, double& realDt)
|
|||
if (_clockFreeze->getBoolValue() || wait_for_scenery) {
|
||||
simDt = 0;
|
||||
} else {
|
||||
simDt = dt;
|
||||
// sim time can be scaled
|
||||
simDt = dt * fgGetDouble("/sim/speed-up");
|
||||
}
|
||||
|
||||
_lastStamp = currentStamp;
|
||||
|
|
Loading…
Add table
Reference in a new issue