// antenna.cxx -- implementation of FGRadioAntenna
// Class to represent a virtual radio antenna properties
-// Written by Adrian Musceac, started December 2011.
+// Written by Adrian Musceac YO8RZZ, started December 2011.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
_mirror_y = 1; // normally we want to mirror these axis because the pattern is simetric
_mirror_z = 1;
- _invert_ground = 0;
- load_antenna_pattern(type);
+ _invert_ground = 0; // TODO: use for inverting the antenna ground, for instance aircraft body reflection
+ load_NEC_antenna_pattern(type);
}
FGRadioAntenna::~FGRadioAntenna() {
delete point_gain;
}
_pattern.clear();
-
}
+// WIP
double FGRadioAntenna::calculate_gain(double bearing, double angle) {
// TODO: what if the pattern is assimetric?
azimuth += azimuth % 2;
int elevation = (int)floor(angle);
elevation += elevation % 2;
- cerr << "Bearing: " << bearing << " angle: " << angle << " azimuth: " << azimuth << " elevation: " << elevation << endl;
+ //cerr << "Bearing: " << bearing << " angle: " << angle << " azimuth: " << azimuth << " elevation: " << elevation << endl;
for (unsigned i =0; i < _pattern.size(); i++) {
AntennaGain *point_gain = _pattern[i];
}
-
-/*** load external plot file generated by NEC2
-***/
-void FGRadioAntenna::load_antenna_pattern(string type) {
+void FGRadioAntenna::load_NEC_antenna_pattern(string type) {
- SGPath pattern_file(fgGetString("/sim/fg-home"));
- pattern_file.append("antennas");
+ //SGPath pattern_file(globals->get_fg_home());
+ SGPath pattern_file(globals->get_fg_root());
+ pattern_file.append("Navaids/Antennas");
pattern_file.append(type + ".txt");
if (!pattern_file.exists()) {
return;
//cerr << "head: " << heading << " elev: " << elevation << " gain: " << gain << endl;
AntennaGain *datapoint = new AntennaGain;
datapoint->azimuth = heading;
- datapoint->elevation = 90.0 - fabs(elevation);
+ datapoint->elevation = 90.0 - abs(elevation);
datapoint->gain = gain;
_pattern.push_back(datapoint);
}
-
-
}