Add function to calculate polarization loss
This function is reliable only for vertical polarization
This commit is contained in:
parent
7e2391dceb
commit
e3e23b0915
5 changed files with 92 additions and 7 deletions
|
@ -1,11 +1,13 @@
|
||||||
include(FlightGearComponent)
|
include(FlightGearComponent)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
antenna.cxx
|
||||||
radio.cxx
|
radio.cxx
|
||||||
itm.cpp
|
itm.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
|
antenna.hxx
|
||||||
radio.hxx
|
radio.hxx
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -15,3 +15,37 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <Scenery/scenery.hxx>
|
||||||
|
#include "antenna.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
FGRadioAntenna::FGRadioAntenna() {
|
||||||
|
|
||||||
|
_mirror_y = 1;
|
||||||
|
_mirror_z = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FGRadioAntenna::~FGRadioAntenna() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double FGRadioAntenna::calculate_gain(double azimuth, double theta) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void FGRadioAntenna::_load_antenna_pattern() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -15,3 +15,39 @@
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
#ifndef __cplusplus
|
||||||
|
# error This library requires C++
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <simgear/compiler.h>
|
||||||
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
#include <Main/fg_props.hxx>
|
||||||
|
|
||||||
|
#include <simgear/math/sg_geodesy.hxx>
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
|
class FGRadioAntenna
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void _load_antenna_pattern();
|
||||||
|
int _mirror_y;
|
||||||
|
int _mirror_z;
|
||||||
|
double _heading;
|
||||||
|
struct AntennaGain {
|
||||||
|
double azimuth;
|
||||||
|
double elevation_angle;
|
||||||
|
double gain;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<AntennaGain> AntennaPattern;
|
||||||
|
AntennaPattern _pattern;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
FGRadioAntenna();
|
||||||
|
~FGRadioAntenna();
|
||||||
|
double calculate_gain(double azimuth, double theta);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
|
@ -357,13 +357,6 @@ double FGRadioTransmission::ITM_calculate_attenuation(SGGeod pos, double freq, i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double max_alt_between=0.0;
|
|
||||||
for( deque<double>::size_type i = 0; i < _elevations.size(); i++ ) {
|
|
||||||
if (_elevations[i] > max_alt_between) {
|
|
||||||
max_alt_between = _elevations[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
double num_points= (double)_elevations.size();
|
double num_points= (double)_elevations.size();
|
||||||
|
|
||||||
_elevations.push_front(point_distance);
|
_elevations.push_front(point_distance);
|
||||||
|
@ -875,4 +868,23 @@ double FGRadioTransmission::LOS_calculate_attenuation(SGGeod pos, double freq, i
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*** calculate loss due to polarization mismatch
|
||||||
|
* this function is only reliable for vertical polarization
|
||||||
|
* due to the V-shape of horizontally polarized antennas
|
||||||
|
***/
|
||||||
|
double FGRadioTransmission::polarization_loss() {
|
||||||
|
|
||||||
|
double theta_deg;
|
||||||
|
double roll = fgGetDouble("/orientation/roll-deg");
|
||||||
|
double pitch = fgGetDouble("/orientation/pitch-deg");
|
||||||
|
double theta = acos( sqrt( cos(roll) * cos(roll) + cos(pitch) * cos(pitch) ));
|
||||||
|
if (_polarization == 1)
|
||||||
|
theta_deg = 90.0 - theta;
|
||||||
|
else
|
||||||
|
theta_deg = theta;
|
||||||
|
if (fabs(theta_deg) > 85.0) // we don't want to converge into infinity
|
||||||
|
theta_deg = 85.0;
|
||||||
|
return 10 * log10(cos(theta_deg) * cos(theta_deg));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ private:
|
||||||
std::map<string, double[2]> _mat_database;
|
std::map<string, double[2]> _mat_database;
|
||||||
|
|
||||||
int _propagation_model; /// 0 none, 1 round Earth, 2 ITM
|
int _propagation_model; /// 0 none, 1 round Earth, 2 ITM
|
||||||
|
double polarization_loss();
|
||||||
double ITM_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air);
|
double ITM_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air);
|
||||||
double LOS_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air);
|
double LOS_calculate_attenuation(SGGeod tx_pos, double freq, int ground_to_air);
|
||||||
void clutterLoss(double freq, double distance_m, double itm_elev[], std::deque<string> materials,
|
void clutterLoss(double freq, double distance_m, double itm_elev[], std::deque<string> materials,
|
||||||
|
|
Loading…
Add table
Reference in a new issue