src/lte/model/lte-common.cc
changeset 7947 4ed7cfac199d
parent 7938 7c5f7e3b4054
child 7971 3cc205853837
--- a/src/lte/model/lte-common.cc	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-common.cc	Wed Apr 06 12:13:10 2011 +0200
@@ -16,10 +16,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * Author: Manuel Requena <manuel.requena@cttc.es>
+ * Author: Marco Miozzo <marco.miozzo@cttc.es>
  */
 
 #include "lte-common.h"
+#include <ns3/log.h>
 
+NS_LOG_COMPONENT_DEFINE ("LteFfConverter");
 
 namespace ns3 {
 
@@ -47,5 +50,31 @@
 }
 
 
+uint16_t
+LteFfConverter::double2fpS11dot3(double val)
+{
+  // convert from double to fixed point notation Sxxxxxxxxxxx.xxx
+ 	int16_t valFp = (int16_t)(val * pow (2, 3));
+ 	return (valFp);	
+}
+
+double
+LteFfConverter::fpS11dot3toDouble(uint16_t val)
+{
+	// convert from fixed point notation Sxxxxxxxxxxx.xxx to double
+  double valD = ((int16_t)val) / pow (2, 3);
+  return (valD);
+}
+
+double 
+LteFfConverter::getMinFpS11dot3Value ()
+{
+	return (-4096);  // -4096 = 0x8000 = 1000 0000 0000 0000 b
+}
+
+//static double g_lowestFpS11dot3Value = -4096; // 0x8001 (1000 0000 0000 0000)
+
+
+
 }; // namespace ns3