merge ns-3-lena-dev and ns-3-antenna
authorNicola Baldo <nbaldo@cttc.es>
Wed, 11 Apr 2012 11:00:27 +0200
changeset 8701 865f750a6b63
parent 8700 5191f846022e (current diff)
parent 7843 1cc2ff632220 (diff)
child 8702 d3e7f0d5e378
merge ns-3-lena-dev and ns-3-antenna
--- a/src/antenna/model/angles.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/model/angles.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -20,7 +20,7 @@
 
 
 #include <ns3/log.h>
-#include <math.h>
+#include <cmath>
 #include "angles.h"
 
 
@@ -46,6 +46,17 @@
   return os;
 }
 
+std::istream &operator >> (std::istream &is, Angles &a)
+{
+  char c;
+  is >> a.phi >> c >> a.theta;
+  if (c != ':')
+    {
+      is.setstate (std::ios_base::failbit);
+    }
+  return is;
+}
+
   
 Angles::Angles ()
   : phi (0),
--- a/src/antenna/model/angles.h	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/model/angles.h	Wed Apr 11 11:00:27 2012 +0200
@@ -49,7 +49,11 @@
  * 
  * struct holding the azimuth and inclination angles of spherical
  * coordinates. The notation is the one used in  "Antenna Theory - Analysis
- * and Design", C.A. Balanis, Wiley, 2nd Ed., section 2.2 "Radiation pattern".
+ * and Design", C.A. Balanis, Wiley, 2nd Ed., section 2.2 "Radiation
+ * pattern".
+ * This notation corresponds to the standard spherical coordinates, with phi
+ * measured counterclockwise in the x-y plane off the x-axis, and
+ * theta measured off the z-axis. 
  * 
  *          ^
  *        z | 
@@ -67,7 +71,7 @@
 struct Angles
 {
   /** 
-   * default constructor, will inizialize phi and theta to zero
+   * default constructor, will initialize phi and theta to zero
    * 
    */
   Angles ();
@@ -124,7 +128,16 @@
  * \return a reference to the output stream
  */
 std::ostream& operator<< ( std::ostream& os, const Angles& a);
-
+  
+/** 
+ * initialize a struct Angles from input
+ * 
+ * \param is the input stream
+ * \param a the Angles struct
+ * 
+ * \return a reference to the input stream
+ */
+std::istream &operator >> (std::istream &is, Angles &a);
 
 } // namespace ns3
 
--- a/src/antenna/model/antenna-model.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/model/antenna-model.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -20,7 +20,7 @@
 
 
 #include <ns3/log.h>
-#include <math.h>
+#include <cmath>
 #include "antenna-model.h"
 
 
--- a/src/antenna/model/antenna-model.h	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/model/antenna-model.h	Wed Apr 11 11:00:27 2012 +0200
@@ -34,10 +34,10 @@
  * 
  * This class provides an interface for the definition of antenna
  * radiation pattern models. This interface is based on the use of
- * spherical coordinates, in particolar of the azimuth and inclination
+ * spherical coordinates, in particular of the azimuth and inclination
  * angles. This choice is the one proposed "Antenna Theory - Analysis
  * and Design", C.A. Balanis, Wiley, 2nd Ed., see in particular
- *  section 2.2 "Radiation pattern".
+ * section 2.2 "Radiation pattern".
  * 
  *
  */
@@ -59,7 +59,10 @@
    * \param the spherical angles at which the radiation pattern should
    * be evaluated
    * 
-   * \return the gain in dB of the antenna radiation pattern at the specified angles
+   * \return the power gain in dBi of the antenna radiation pattern at
+   * the specified angles; dBi means dB with respect to the gain of an
+   * isotropic radiator. Since a power gain is used, the efficiency of
+   * the antenna is expected to be included in the gain value. 
    */
   virtual double GetGainDb (Angles a) = 0;
 
--- a/src/antenna/model/cosine-antenna-model.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/model/cosine-antenna-model.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -21,7 +21,7 @@
 
 #include <ns3/log.h>
 #include <ns3/double.h>
-#include <math.h>
+#include <cmath>
 
 #include "antenna-model.h"
 #include "cosine-antenna-model.h"
@@ -112,7 +112,7 @@
   double ef = pow (cos (phi / 2.0), m_exponent);
   
   // the array factor is not considered. Note that if we did consider
-  // the array factor, the actual beawidth would change, and in
+  // the array factor, the actual beamwidth would change, and in
   // particular it would be different from the one specified by the
   // user. Hence it is not desirable to use the array factor, for the
   // ease of use of this model.  
--- a/src/antenna/model/parabolic-antenna-model.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/model/parabolic-antenna-model.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -21,7 +21,7 @@
 
 #include <ns3/log.h>
 #include <ns3/double.h>
-#include <math.h>
+#include <cmath>
 
 #include "antenna-model.h"
 #include "parabolic-antenna-model.h"
--- a/src/antenna/test/test-angles.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/test/test-angles.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -21,7 +21,7 @@
 #include <ns3/log.h>
 #include <ns3/test.h>
 #include <ns3/antenna-model.h>
-#include <math.h>
+#include <cmath>
 #include <string>
 #include <iostream>
 #include <sstream>
--- a/src/antenna/test/test-cosine-antenna.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/test/test-cosine-antenna.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -23,7 +23,7 @@
 #include <ns3/double.h>
 #include <ns3/cosine-antenna-model.h>
 #include <ns3/simulator.h>
-#include <math.h>
+#include <cmath>
 #include <string>
 #include <iostream>
 #include <sstream>
--- a/src/antenna/test/test-degrees-radians.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/test/test-degrees-radians.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -21,7 +21,7 @@
 #include <ns3/log.h>
 #include <ns3/test.h>
 #include <ns3/antenna-model.h>
-#include <math.h>
+#include <cmath>
 #include <string>
 #include <iostream>
 #include <sstream>
--- a/src/antenna/test/test-isotropic-antenna.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/test/test-isotropic-antenna.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -21,7 +21,7 @@
 #include <ns3/log.h>
 #include <ns3/test.h>
 #include <ns3/isotropic-antenna-model.h>
-#include <math.h>
+#include <cmath>
 #include <string>
 #include <iostream>
 #include <sstream>
--- a/src/antenna/test/test-parabolic-antenna.cc	Tue Apr 03 15:21:40 2012 +0200
+++ b/src/antenna/test/test-parabolic-antenna.cc	Wed Apr 11 11:00:27 2012 +0200
@@ -23,7 +23,7 @@
 #include <ns3/double.h>
 #include <ns3/parabolic-antenna-model.h>
 #include <ns3/simulator.h>
-#include <math.h>
+#include <cmath>
 #include <string>
 #include <iostream>
 #include <sstream>