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.
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;
_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);