Permalink
Browse files

phy: add consideration of antenna patterns

  • Loading branch information...
1 parent 7461d7c commit b8637c811adaef95cd51f3b2e3dc45af0e08e463 Alexander Brummer committed with Nov 25, 2016
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root>
+ <Antenna type="SampledAntenna1D" id="monopole">
+ <!-- monopole antenna on roof -->
+ <!-- samples taken from "Effects of Antenna Characteristics and Placements on a Vehicle-to-Vehicle Channel Scenario" -->
+ <parameter name="samples" type="string" value="-0.888 -0.942 -1.109 -1.29 -1.543 -1.717 -1.898 -1.902 -1.979 -2.018 -2.18 -2.336 -2.354 -2.287 -2.181 -2.008 -1.837 -1.667 -1.538 -1.553 -1.687 -1.819 -1.921 -1.977 -1.902 -1.768 -1.672 -1.741 -1.888 -2.167 -2.304 -2.326 -2.114 -1.838 -1.53 -1.36 -1.275 -1.331 -1.524 -1.759 -2.046 -2.212 -2.251 -2.04 -1.732 -1.519 -1.476 -1.579 -1.713 -1.775 -1.73 -1.585 -1.423 -1.339 -1.263 -1.433 -1.62 -1.857 -1.973 -2.059 -2.114 -2.097 -1.991 -1.95 -1.865 -1.865 -1.736 -1.606 -1.371 -1.17 -0.986 -0.893"/>
+ </Antenna>
+ <Antenna type="SampledAntenna1D" id="panorama">
+ <!-- monopole antenna on panorama glass roof -->
+ <!-- samples taken from "Influence of car panorama glass roofs on Car2Car communication" -->
+ <parameter name="samples" type="string" value="-14.962 -14.531 -14.035 -15.912 -13.103 -11.064 -9.902 -4.728 -6.49 -4.516 -2.66 -0.206 -1.223 2.692 3.219 2.568 3.52 5.896 6.006 6.384 5.405 5.279 5.243 5.433 3.03 2.296 1.664 0.618 1.708 -0.457 1.822 -0.799 1.658 2.735 0.948 0.622 1.156 2.046 1.655 2.611 1.335 -0.108 1.857 0.207 1.221 1.316 2.706 3.575 5.188 7.051 5.599 6.507 7.22 6.805 6.252 6.154 4.16 2.247 3.291 2.866 -1.093 -0.769 -2.331 -4.004 -5.806 -4.79 -10.014 -12.566 -15.903 -14.306 -11.265 -14.368"/>
+ </Antenna>
+ <Antenna type="SampledAntenna1D" id="patch">
+ <!-- patch antenna on side mirrors -->
+ <!-- samples taken from "Effects of Antenna Characteristics and Placements on a Vehicle-to-Vehicle Channel Scenario" -->
+ <parameter name="samples" type="string" value="5.061 5.016 4.961 4.804 4.577 4.334 3.999 3.549 3.027 2.456 1.833 1.045 0.25 -0.579 -1.516 -2.48 -3.459 -4.348 -5.361 -6.195 -7.24 -8.236 -9.2 -10.345 -11.326 -12.302 -13.302 -13.833 -14.209 -14.186 -13.844 -13.361 -12.824 -12.239 -11.901 -11.588 -11.487 -11.523 -11.733 -12.162 -12.529 -13.15 -13.723 -14.141 -14.289 -14.069 -13.538 -12.537 -11.764 -10.582 -9.617 -8.646 -7.65 -6.601 -5.695 -4.599 -3.598 -2.608 -1.64 -0.741 0.079 0.958 1.62 2.36 2.911 3.515 3.962 4.313 4.593 4.808 4.957 5.041"/>
+ </Antenna>
+</root>
@@ -68,11 +68,9 @@ sim-time-limit = 200s
# #
# NIC-Settings #
##########################################################
-*.connectionManager.pMax = 20mW
-*.connectionManager.sat = -89dBm
-*.connectionManager.alpha = 2.0
-*.connectionManager.carrierFrequency = 5.890e9 Hz
*.connectionManager.sendDirect = true
+*.connectionManager.maxInterfDist = 2600m
+*.connectionManager.drawMaxIntfDist = false
*.**.nic.mac1609_4.useServiceChannel = false
@@ -87,6 +85,8 @@ sim-time-limit = 200s
*.**.nic.phy80211p.analogueModels = xmldoc("config.xml")
*.**.nic.phy80211p.usePropagationDelay = true
+*.**.nic.phy80211p.antenna = xmldoc("antenna.xml", "/root/Antenna[@id='monopole']")
+
##########################################################
# WaveAppLayer #
##########################################################
@@ -12,30 +12,17 @@ Define_Module( ConnectionManager );
double ConnectionManager::calcInterfDist()
{
- double interfDistance;
-
- //the minimum carrier frequency for this cell
- double carrierFrequency = par("carrierFrequency").doubleValue();
- //maximum transmission power possible
- double pMax = par("pMax").doubleValue();
- if (pMax <=0) {
- error("Max transmission power is <=0!");
- }
- //minimum signal attenuation threshold
- double sat = par("sat").doubleValue();
- //minimum path loss coefficient
- double alpha = par("alpha").doubleValue();
-
- double waveLength = (BaseWorldUtility::speedOfLight()/carrierFrequency);
- //minimum power level to be able to physically receive a signal
- double minReceivePower = pow(10.0, sat/10.0);
-
- interfDistance = pow(waveLength * waveLength * pMax
- / (16.0*M_PI*M_PI*minReceivePower),
- 1.0 / alpha);
-
- ccEV << "max interference distance:" << interfDistance << endl;
-
- return interfDistance;
+ /* With the introduction of antenna models, calculating the maximum
+ * interference distance only based on free space loss doesn't make any sense
+ * any more as it could also be much bigger due to positive antenna gains.
+ * Therefore, the user has to provide a reasonable maximum interference
+ * distance himself. */
+ if (hasPar("maxInterfDist")) {
+ double interfDistance = par("maxInterfDist").doubleValue();
+ ccEV << "max interference distance:" << interfDistance << endl;
+ return interfDistance;
+ } else {
+ throw cRuntimeError("ConnectionManager: No value for maximum interference distance (maxInterfDist) provided.");
+ }
}
@@ -21,10 +21,6 @@ class MIXIM_API ConnectionManager : public BaseConnectionManager
/**
* @brief Calculate interference distance
*
- * Calculation of the interference distance based on the transmitter
- * power, wavelength, pathloss coefficient and a threshold for the
- * minimal receive Power
- *
* You may want to overwrite this function in order to do your own
* interference calculation
*/
@@ -1,8 +1,6 @@
//***************************************************************************
// * file: ConnectionManager.ned
// *
-// * author: Steffen Sroka, Daniel Willkomm, Karl Wessel, Michael Swigulski
-// *
// * copyright: (C) 2004 Telecommunication Networks Group (TKN) at
// * Technische Universitaet Berlin, Germany.
// *
@@ -27,13 +25,11 @@ package org.car2x.veins.base.connectionManager;
// periodically communicates with the mobility module and
// ChannelAccess.
//
-// The four parameters pMax, sat, alpha, and carrierFrequency are used
-// to calculate the interference distance between nodes. The values used
-// here in ConnectionManager are used to calculate the upper bound,
-// i.e. they can be redifined in the analogue models, but never such
+// The value maxInterfDist used here in ConnectionManager defines the upper bound of any transmission,
+// i.e. it can be redifined in the analogue models, but never such
// that the maximal interference distance is exeeded.
//
-// @author Steffen Sroka, Daniel Willkomm, Karl Wessel
+// @author Steffen Sroka, Daniel Willkomm, Karl Wessel, Alexander Brummer, Christoph Sommer
// @see MobilityBase
//
simple ConnectionManager
@@ -43,14 +39,9 @@ simple ConnectionManager
bool coreDebug;
// send directly to the node or create separate gates for every connection
bool sendDirect;
- // maximum sending power used for this network [mW]
- double pMax @unit(mW);
- // minimum signal attenuation threshold [dBm]
- double sat @unit(dBm);
- // minimum path loss coefficient
- double alpha;
- // minimum carrier frequency of the channel [Hz]
- double carrierFrequency @unit(Hz);
+ // maximum interference distance [m]
+ double maxInterfDist @unit(m);
+
// should the maximum interference distance be displayed for each node?
bool drawMaxIntfDist = default(false);
@@ -1,9 +1,11 @@
cplusplus {{
#include "veins/base/phyLayer/Signal_.h"
+#include "veins/base/utils/POA.h"
}}
class noncobject Signal;
+class noncobject POA;
//
// Format of the packets that are sent to the channel
@@ -32,7 +34,10 @@ namespace Veins;
packet AirFrame
{
Signal signal; // Contains the physical data of this AirFrame
-
+
+ POA poa; // contains a POA object with the position, orientation and antenna (pointer)
+ // of the sender
+
simtime_t duration; // time the AirFrames takes to be transmited (without propagation delay)
int state = 1; // state of the AirFrames, used by the physical layer
@@ -104,6 +104,14 @@ void BaseMobility::initialize(int stage)
if(y > -1) pos.y = y;
if(!use2D && z > -1) pos.z = z;
+ if (!hasPar("xOrientation") || !hasPar("yOrientation")) {
+ throw cRuntimeError("Orientation coordinates in x and y direction have to specified (necessary for antenna gain calculation)");
+ } else {
+ double zOrient = hasPar("zOrientation") ? par("zOrientation").doubleValue() : 0;
+ Coord orient(par("xOrientation").doubleValue(), par("yOrientation").doubleValue(), zOrient);
+ move.setOrientationByVector(orient);
+ }
+
// set start-position and start-time (i.e. current simulation-time) of the Move
move.setStart(pos);
coreEV << "start pos: " << move.getStartPos().info() << endl;
@@ -175,10 +175,18 @@ class MIXIM_API BaseMobility : public BatteryAccess
return move.getStartPos();
}
+ virtual Coord getCurrentOrientation() const {
+ return move.getOrientation();
+ }
+
/** @brief Returns the current speed at the current simulation time. */
virtual Coord getCurrentSpeed() const {
return move.getDirection() * move.getSpeed();
}
+
+ virtual Coord getCurrentDirection() const {
+ return move.getDirection();
+ }
protected:
/**
* @brief Maps the passed icon size tag (is) to an actual size in pixels.
@@ -14,6 +14,9 @@ simple BaseMobility like IMobility
double x; // x coordinate of the nodes' position (-1 = random)
double y; // y coordinate of the nodes' position (-1 = random)
double z; // z coordinate of the nodes' position (-1 = random)
+ double xOrientation = default(1);
+ double yOrientation = default(0);
+ double zOrientation = default(0);
@signal[veinsmobilityStateChanged](type="BaseMobility");
@display("i=block/cogwheel");
}
@@ -0,0 +1,14 @@
+/*
+ * Antenna.cpp
+ *
+ * Created on: Jun 13, 2016
+ * Author: Alexander Brummer
+ */
+
+#include "veins/base/phyLayer/Antenna.h"
+
+double Antenna::getGain(Coord ownPos, Coord ownOrient, Coord otherPos) {
+ // as this base class represents an isotropic antenna, simply return 1.0
+ return 1.0;
+}
+
@@ -0,0 +1,52 @@
+/*
+ * Antenna.h
+ *
+ * Created on: Jun 13, 2016
+ * Author: Alexander Brummer
+ */
+
+#ifndef ANTENNA_H_
+#define ANTENNA_H_
+
+#include "veins/base/utils/Coord.h"
+
+/**
+ * @brief The Antenna class is the base class of all antenna models.
+ *
+ * The purpose of all Antenna classes is to calculate the antenna gain
+ * based on the current positions and orientations of the involved nodes.
+ *
+ * This base Antenna acts as an isotropic antenna, it always returns
+ * a gain of 1.0. It is assigned to all nodes if the user does not specify
+ * another antenna type.
+ *
+ * @author Alexander Brummer
+ */
+class Antenna {
+public:
+ Antenna() {};
+ virtual ~Antenna() {};
+
+ /**
+ * Calculates the antenna gain of the represented antenna.
+ *
+ * In the case of this class, a value of 1.0 is returned always,
+ * representing an isotropic radiator.
+ *
+ * Nevertheless, all Antenna subclasses' getGain() methods have to
+ * take the following three parameters as the gain depends on the angle
+ * of incidence in general.
+ *
+ * @param ownPos - states the position of this antenna
+ * @param ownOrient - the direction the antenna/the host is pointing in
+ * @param otherPos - the position of the other antenna which this antenna
+ * is sending to or receiving from
+ *
+ * @return Returns the gain in this specific direction.
+ */
+ virtual double getGain(Coord ownPos, Coord ownOrient, Coord otherPos);
+
+ virtual double getLastAngle(){return -1.0;};
+};
+
+#endif /* ANTENNA_H_ */
Oops, something went wrong.

0 comments on commit b8637c8

Please sign in to comment.