#include "itm.cpp"
-FGRadio::FGRadio() {
+FGRadioTransmission::FGRadioTransmission() {
/** radio parameters (which should probably be set for each radio) */
**/
_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
* real-life gain for conventional monopole/dipole antenna
**/
}
-double FGRadio::getFrequency(int radio) {
+double FGRadioTransmission::getFrequency(int radio) {
double freq = 118.0;
switch (radio) {
case 1:
/*** 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
***/
-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
// vor/loc typical sensitivity between -107 and -101 dBm
/*** 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);
/*** Implement radio attenuation
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) {
* We are only worried about clutter loss, terrain influence
* 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 horizons[], double &clutter_loss) {
* height: median clutter height
* 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") {
height = 15.0;
/*** 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;
if( (freq < 118.0) || (freq > 137.0) )
frq_mhz = 125.0; // sane value, middle of bandplan
using std::string;
-class FGRadio
+class FGRadioTransmission
{
private:
bool isOperable() const
double _receiver_sensitivity;
double _transmitter_power;
+ double _tx_antenna_height;
+ double _rx_antenna_height;
double _antenna_gain;
std::map<string, double[2]> _mat_database;
void setFrequency(double freq, int radio);
double getFrequency(int radio);
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; };
// 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);