Merge branch 'attenuation' into navaids-radio
Conflicts: src/Radio/radio.cxx
This commit is contained in:
commit
8a61ad0fc9
5 changed files with 59 additions and 15 deletions
|
@ -3198,6 +3198,30 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Lib_Radio"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\src\Radio\antenna.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\Radio\antenna.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\Radio\radio.cxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\Radio\radio.hxx"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\src\Radio\itm.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Lib_Scenery"
|
||||
>
|
||||
|
|
|
@ -524,7 +524,9 @@ void FGKR_87::search() {
|
|||
xyz = adf->cart();
|
||||
|
||||
if ( _sgr->exists( "adf-ident" ) ) {
|
||||
_sgr->remove( "adf-ident" );
|
||||
// stop is required! -- remove alone wouldn't stop immediately
|
||||
_sgr->stop( "adf-ident" );
|
||||
_sgr->remove( "adf-ident" );
|
||||
}
|
||||
SGSoundSample *sound;
|
||||
sound = FGMorse::instance()->make_ident( trans_ident, FGMorse::LO_FREQUENCY );
|
||||
|
|
|
@ -1000,7 +1000,7 @@ double avar(double zzt, double zzl, double zzc, prop_type &prop, propv_type &pro
|
|||
kdv = propv.mdvar;
|
||||
no_situation_variability = kdv >= 20;
|
||||
if (no_situation_variability)
|
||||
no_situation_variability -= 20;
|
||||
kdv -= 20;
|
||||
|
||||
no_location_variability = kdv >= 10;
|
||||
if (no_location_variability)
|
||||
|
@ -1378,7 +1378,7 @@ double dlthx(double pfl[], const double &x1, const double &x2)
|
|||
n = 10 * ka - 5;
|
||||
kb = n - ka + 1;
|
||||
sn = n - 1;
|
||||
assert((s = new double[n+2]) != 0);
|
||||
s = new double[n+2];
|
||||
s[0] = sn;
|
||||
s[1] = 1.0;
|
||||
xb = (xb - xa) / sn;
|
||||
|
|
|
@ -236,7 +236,7 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
|||
double own_alt= own_alt_ft * SG_FEET_TO_METER;
|
||||
|
||||
|
||||
//cerr << "ITM:: pilot Lat: " << own_lat << ", Lon: " << own_lon << ", Alt: " << own_alt << endl;
|
||||
|
||||
|
||||
SGGeod own_pos = SGGeod::fromDegM( own_lon, own_lat, own_alt );
|
||||
SGGeod max_own_pos = SGGeod::fromDegM( own_lon, own_lat, SG_MAX_ELEVATION_M );
|
||||
|
@ -253,7 +253,7 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
|||
sender_alt = sender_alt_ft * SG_FEET_TO_METER;
|
||||
SGGeod max_sender_pos = SGGeod::fromGeodM( pos, SG_MAX_ELEVATION_M );
|
||||
SGGeoc sender_pos_c = SGGeoc::fromGeod( sender_pos );
|
||||
//cerr << "ITM:: sender Lat: " << parent->getLatitude() << ", Lon: " << parent->getLongitude() << ", Alt: " << sender_alt << endl;
|
||||
|
||||
|
||||
double point_distance= _terrain_sampling_distance;
|
||||
double course = SGGeodesy::courseRad(own_pos_c, sender_pos_c);
|
||||
|
@ -361,15 +361,20 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
|||
|
||||
double num_points= (double)elevations.size();
|
||||
|
||||
elevations.push_front(point_distance);
|
||||
elevations.push_front(num_points -1);
|
||||
int size = elevations.size();
|
||||
double itm_elev[size];
|
||||
for(int i=0;i<size;i++) {
|
||||
itm_elev[i]=elevations[i];
|
||||
//cerr << "ITM:: itm_elev: " << elevations[i] << endl;
|
||||
}
|
||||
|
||||
_elevations.push_front(point_distance);
|
||||
_elevations.push_front(num_points -1);
|
||||
|
||||
int size = _elevations.size();
|
||||
double *itm_elev;
|
||||
itm_elev = new double[size];
|
||||
|
||||
for(int i=0;i<size;i++) {
|
||||
itm_elev[i]=_elevations[i];
|
||||
|
||||
|
||||
}
|
||||
|
||||
if((transmission_type == 3) || (transmission_type == 4)) {
|
||||
// the sender and receiver roles are switched
|
||||
point_to_point(itm_elev, receiver_height, transmitter_height,
|
||||
|
@ -430,8 +435,12 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
|||
_root_node->setDoubleValue("station[0]/field-strength-uV", field_strength_uV);
|
||||
_root_node->setDoubleValue("station[0]/signal", signal);
|
||||
_root_node->setDoubleValue("station[0]/tx-erp", tx_erp);
|
||||
|
||||
//_root_node->setDoubleValue("station[0]/tx-pattern-gain", tx_pattern_gain);
|
||||
//_root_node->setDoubleValue("station[0]/rx-pattern-gain", rx_pattern_gain);
|
||||
|
||||
delete[] itm_elev;
|
||||
|
||||
return signal;
|
||||
|
||||
}
|
||||
|
@ -947,7 +956,7 @@ double FGRadioTransmission::watt_to_dbm(double power_watt) {
|
|||
}
|
||||
|
||||
double FGRadioTransmission::dbm_to_watt(double dbm) {
|
||||
return exp( (dbm-30) * log(10) / 10); // returns Watts
|
||||
return exp( (dbm-30) * log(10.0) / 10.0); // returns Watts
|
||||
}
|
||||
|
||||
double FGRadioTransmission::dbm_to_microvolt(double dbm) {
|
||||
|
|
|
@ -70,7 +70,15 @@ void AudioIdent::setVolumeNorm( double volumeNorm )
|
|||
|
||||
void AudioIdent::setIdent( const std::string & ident, double volumeNorm )
|
||||
{
|
||||
if( _ident == ident ) {
|
||||
// Signal may flicker very frequently (due to our realistic newnavradio...).
|
||||
// Avoid recreating identical sound samples all the time, instead turn off
|
||||
// volume when signal is lost, and save the most recent sample.
|
||||
if (ident.empty())
|
||||
volumeNorm = 0;
|
||||
|
||||
if(( _ident == ident )||
|
||||
(volumeNorm == 0)) // don't bother with sounds when volume is OFF anyway...
|
||||
{
|
||||
if( false == _ident.empty() )
|
||||
setVolumeNorm( volumeNorm );
|
||||
return;
|
||||
|
@ -88,6 +96,7 @@ void AudioIdent::setIdent( const std::string & ident, double volumeNorm )
|
|||
sound->set_volume( volumeNorm );
|
||||
if (!_sgr->add( sound, _fx_name )) {
|
||||
SG_LOG(SG_SOUND, SG_WARN, "Failed to add sound '" << _fx_name << "' for ident '" << ident << "'" );
|
||||
delete sound;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue