1
0
Fork 0

DME units report a distance based on the assumption that the ground station

will delay it's reply by 50ms.  The ground station can change it's reply delay
to trick the airborn dme unit into reporting a distance that is offset from
the true distance by some constant value.  In FG we model this by subtracting
a fixed distance from the actual distance.

It is thus possible in our implimentation for the displayed distance to become
negative.  This patch clamp DME distance to a minimum value of 0.00 so it can
never go negative.
This commit is contained in:
curt 2004-06-09 20:21:18 +00:00
parent 225298a09e
commit 6c8f7fab01
2 changed files with 8 additions and 1 deletions

View file

@ -161,6 +161,9 @@ FGDME::update(double dt)
station = Point3D( x, y, z );
dist = aircraft.distance3D( station ) * SG_METER_TO_NM;
dist -= bias;
if ( dist < 0.0 ) {
dist = 0.0;
}
current_time.stamp();
long dMs = (current_time - last_time) / 1000;

View file

@ -128,7 +128,11 @@ DME::update (double delta_time_sec)
_last_distance_nm = distance_nm;
_in_range_node->setBoolValue(true);
_distance_node->setDoubleValue(distance_nm - _transmitter_bias);
double tmp_dist = distance_nm - _transmitter_bias;
if ( tmp_dist < 0.0 ) {
tmp_dist = 0.0;
}
_distance_node->setDoubleValue( tmp_dist );
_speed_node->setDoubleValue(speed_kt);
_time_node->setDoubleValue(distance_nm/speed_kt*60.0);