1
0
Fork 0

rename FGRadio to FGRadioTransmission, add RX and TX antenna heights

This commit is contained in:
adrian 2011-11-28 10:38:58 +02:00
parent 6be68f475d
commit a6b9beca9d
3 changed files with 20 additions and 11 deletions

View file

@ -746,7 +746,7 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
if( fgGetBool( "/sim/radio/use-itm-attenuation", false ) ) { if( fgGetBool( "/sim/radio/use-itm-attenuation", false ) ) {
//cerr << "Using ITM radio propagation" << endl; //cerr << "Using ITM radio propagation" << endl;
FGRadio* radio = new FGRadio(); FGRadioTransmission* radio = new FGRadioTransmission();
SGGeod sender_pos; SGGeod sender_pos;
double sender_alt_ft, sender_alt; double sender_alt_ft, sender_alt;
if(ground_to_air) { if(ground_to_air) {

View file

@ -33,7 +33,7 @@
#include "itm.cpp" #include "itm.cpp"
FGRadio::FGRadio() { FGRadioTransmission::FGRadioTransmission() {
/** radio parameters (which should probably be set for each radio) */ /** radio parameters (which should probably be set for each radio) */
@ -53,6 +53,10 @@ FGRadio::FGRadio() {
**/ **/
_transmitter_power = 43.0; _transmitter_power = 43.0;
_tx_antenna_height = 2.0; // TX antenna height above ground level
_rx_antenna_height = 2.0; // RX antenna height above ground level
/** pilot plane's antenna gain + AI aircraft antenna gain /** pilot plane's antenna gain + AI aircraft antenna gain
* real-life gain for conventional monopole/dipole antenna * real-life gain for conventional monopole/dipole antenna
**/ **/
@ -66,7 +70,7 @@ FGRadio::~FGRadio()
} }
double FGRadio::getFrequency(int radio) { double FGRadioTransmission::getFrequency(int radio) {
double freq = 118.0; double freq = 118.0;
switch (radio) { switch (radio) {
case 1: case 1:
@ -84,13 +88,13 @@ double FGRadio::getFrequency(int radio) {
/*** TODO: receive multiplayer chat message and voice /*** TODO: receive multiplayer chat message and voice
***/ ***/
void FGRadio::receiveChat(SGGeod tx_pos, double freq, string text, int ground_to_air) { void FGRadioTransmission::receiveChat(SGGeod tx_pos, double freq, string text, int ground_to_air) {
} }
/*** TODO: receive navaid /*** TODO: receive navaid
***/ ***/
double FGRadio::receiveNav(SGGeod tx_pos, double freq, int transmission_type) { double FGRadioTransmission::receiveNav(SGGeod tx_pos, double freq, int transmission_type) {
// typical VOR/LOC transmitter power appears to be 200 Watt ~ 53 dBm // typical VOR/LOC transmitter power appears to be 200 Watt ~ 53 dBm
// vor/loc typical sensitivity between -107 and -101 dBm // vor/loc typical sensitivity between -107 and -101 dBm
@ -108,7 +112,7 @@ double FGRadio::receiveNav(SGGeod tx_pos, double freq, int transmission_type) {
/*** Receive ATC radio communication as text /*** Receive ATC radio communication as text
***/ ***/
void FGRadio::receiveATC(SGGeod tx_pos, double freq, string text, int ground_to_air) { void FGRadioTransmission::receiveATC(SGGeod tx_pos, double freq, string text, int ground_to_air) {
double comm1 = getFrequency(1); double comm1 = getFrequency(1);
@ -193,7 +197,7 @@ void FGRadio::receiveATC(SGGeod tx_pos, double freq, string text, int ground_to_
/*** Implement radio attenuation /*** Implement radio attenuation
based on the Longley-Rice propagation model based on the Longley-Rice propagation model
***/ ***/
double FGRadio::ITM_calculate_attenuation(SGGeod pos, double freq, int transmission_type) { double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, int transmission_type) {
@ -407,7 +411,7 @@ double FGRadio::ITM_calculate_attenuation(SGGeod pos, double freq, int transmiss
* We are only worried about clutter loss, terrain influence * We are only worried about clutter loss, terrain influence
* on the first Fresnel zone is calculated in the ITM functions * on the first Fresnel zone is calculated in the ITM functions
***/ ***/
void FGRadio::clutterLoss(double freq, double distance_m, double itm_elev[], deque<string> materials, void FGRadioTransmission::clutterLoss(double freq, double distance_m, double itm_elev[], deque<string> materials,
double transmitter_height, double receiver_height, int p_mode, double transmitter_height, double receiver_height, int p_mode,
double horizons[], double &clutter_loss) { double horizons[], double &clutter_loss) {
@ -701,7 +705,7 @@ void FGRadio::clutterLoss(double freq, double distance_m, double itm_elev[], deq
* height: median clutter height * height: median clutter height
* density: radiowave attenuation factor * density: radiowave attenuation factor
***/ ***/
void FGRadio::get_material_properties(string mat_name, double &height, double &density) { void FGRadioTransmission::get_material_properties(string mat_name, double &height, double &density) {
if(mat_name == "Landmass") { if(mat_name == "Landmass") {
height = 15.0; height = 15.0;
@ -814,7 +818,7 @@ void FGRadio::get_material_properties(string mat_name, double &height, double &d
/*** implement simple LOS propagation model (WIP) /*** implement simple LOS propagation model (WIP)
***/ ***/
double FGRadio::LOS_calculate_attenuation(SGGeod pos, double freq, int transmission_type) { double FGRadioTransmission::LOS_calculate_attenuation(SGGeod pos, double freq, int transmission_type) {
double frq_mhz; double frq_mhz;
if( (freq < 118.0) || (freq > 137.0) ) if( (freq < 118.0) || (freq > 137.0) )
frq_mhz = 125.0; // sane value, middle of bandplan frq_mhz = 125.0; // sane value, middle of bandplan

View file

@ -33,7 +33,7 @@
using std::string; using std::string;
class FGRadio class FGRadioTransmission
{ {
private: private:
bool isOperable() const bool isOperable() const
@ -42,6 +42,8 @@ private:
double _receiver_sensitivity; double _receiver_sensitivity;
double _transmitter_power; double _transmitter_power;
double _tx_antenna_height;
double _rx_antenna_height;
double _antenna_gain; double _antenna_gain;
std::map<string, double[2]> _mat_database; std::map<string, double[2]> _mat_database;
@ -62,6 +64,9 @@ public:
void setFrequency(double freq, int radio); void setFrequency(double freq, int radio);
double getFrequency(int radio); double getFrequency(int radio);
void setTxPower(double txpower) { _transmitter_power = txpower; }; void setTxPower(double txpower) { _transmitter_power = txpower; };
void setRxSensitivity(double sensitivity) { _receiver_sensitivity = sensitivity; };
void setTxAntennaHeight(double tx_antenna_height) { _tx_antenna_height = tx_antenna_height; };
void setRxAntennaHeight(double rx_antenna_height) { _rx_antenna_height = rx_antenna_height; };
void setPropagationModel(int model) { _propagation_model = model; }; void setPropagationModel(int model) { _propagation_model = model; };
// transmission_type: 0 for air to ground 1 for ground to air, 2 for air to air, 3 for pilot to ground, 4 for pilot to air // transmission_type: 0 for air to ground 1 for ground to air, 2 for air to air, 3 for pilot to ground, 4 for pilot to air
void receiveATC(SGGeod tx_pos, double freq, string text, int transmission_type); void receiveATC(SGGeod tx_pos, double freq, string text, int transmission_type);