Skip to content

Commit b8637c8

Browse files
Alexander Brummersommer
Alexander Brummer
authored andcommitted
phy: add consideration of antenna patterns
1 parent 7461d7c commit b8637c8

19 files changed

+614
-55
lines changed

examples/veins/antenna.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<root>
3+
<Antenna type="SampledAntenna1D" id="monopole">
4+
<!-- monopole antenna on roof -->
5+
<!-- samples taken from "Effects of Antenna Characteristics and Placements on a Vehicle-to-Vehicle Channel Scenario" -->
6+
<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"/>
7+
</Antenna>
8+
<Antenna type="SampledAntenna1D" id="panorama">
9+
<!-- monopole antenna on panorama glass roof -->
10+
<!-- samples taken from "Influence of car panorama glass roofs on Car2Car communication" -->
11+
<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"/>
12+
</Antenna>
13+
<Antenna type="SampledAntenna1D" id="patch">
14+
<!-- patch antenna on side mirrors -->
15+
<!-- samples taken from "Effects of Antenna Characteristics and Placements on a Vehicle-to-Vehicle Channel Scenario" -->
16+
<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"/>
17+
</Antenna>
18+
</root>

examples/veins/omnetpp.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ sim-time-limit = 200s
6868
# #
6969
# NIC-Settings #
7070
##########################################################
71-
*.connectionManager.pMax = 20mW
72-
*.connectionManager.sat = -89dBm
73-
*.connectionManager.alpha = 2.0
74-
*.connectionManager.carrierFrequency = 5.890e9 Hz
7571
*.connectionManager.sendDirect = true
72+
*.connectionManager.maxInterfDist = 2600m
73+
*.connectionManager.drawMaxIntfDist = false
7674

7775
*.**.nic.mac1609_4.useServiceChannel = false
7876

@@ -87,6 +85,8 @@ sim-time-limit = 200s
8785
*.**.nic.phy80211p.analogueModels = xmldoc("config.xml")
8886
*.**.nic.phy80211p.usePropagationDelay = true
8987

88+
*.**.nic.phy80211p.antenna = xmldoc("antenna.xml", "/root/Antenna[@id='monopole']")
89+
9090
##########################################################
9191
# WaveAppLayer #
9292
##########################################################

src/veins/base/connectionManager/ConnectionManager.cc

+12-25
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,17 @@ Define_Module( ConnectionManager );
1212

1313
double ConnectionManager::calcInterfDist()
1414
{
15-
double interfDistance;
16-
17-
//the minimum carrier frequency for this cell
18-
double carrierFrequency = par("carrierFrequency").doubleValue();
19-
//maximum transmission power possible
20-
double pMax = par("pMax").doubleValue();
21-
if (pMax <=0) {
22-
error("Max transmission power is <=0!");
23-
}
24-
//minimum signal attenuation threshold
25-
double sat = par("sat").doubleValue();
26-
//minimum path loss coefficient
27-
double alpha = par("alpha").doubleValue();
28-
29-
double waveLength = (BaseWorldUtility::speedOfLight()/carrierFrequency);
30-
//minimum power level to be able to physically receive a signal
31-
double minReceivePower = pow(10.0, sat/10.0);
32-
33-
interfDistance = pow(waveLength * waveLength * pMax
34-
/ (16.0*M_PI*M_PI*minReceivePower),
35-
1.0 / alpha);
36-
37-
ccEV << "max interference distance:" << interfDistance << endl;
38-
39-
return interfDistance;
15+
/* With the introduction of antenna models, calculating the maximum
16+
* interference distance only based on free space loss doesn't make any sense
17+
* any more as it could also be much bigger due to positive antenna gains.
18+
* Therefore, the user has to provide a reasonable maximum interference
19+
* distance himself. */
20+
if (hasPar("maxInterfDist")) {
21+
double interfDistance = par("maxInterfDist").doubleValue();
22+
ccEV << "max interference distance:" << interfDistance << endl;
23+
return interfDistance;
24+
} else {
25+
throw cRuntimeError("ConnectionManager: No value for maximum interference distance (maxInterfDist) provided.");
26+
}
4027
}
4128

src/veins/base/connectionManager/ConnectionManager.h

-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ class MIXIM_API ConnectionManager : public BaseConnectionManager
2121
/**
2222
* @brief Calculate interference distance
2323
*
24-
* Calculation of the interference distance based on the transmitter
25-
* power, wavelength, pathloss coefficient and a threshold for the
26-
* minimal receive Power
27-
*
2824
* You may want to overwrite this function in order to do your own
2925
* interference calculation
3026
*/

src/veins/base/connectionManager/ConnectionManager.ned

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//***************************************************************************
22
// * file: ConnectionManager.ned
33
// *
4-
// * author: Steffen Sroka, Daniel Willkomm, Karl Wessel, Michael Swigulski
5-
// *
64
// * copyright: (C) 2004 Telecommunication Networks Group (TKN) at
75
// * Technische Universitaet Berlin, Germany.
86
// *
@@ -27,13 +25,11 @@ package org.car2x.veins.base.connectionManager;
2725
// periodically communicates with the mobility module and
2826
// ChannelAccess.
2927
//
30-
// The four parameters pMax, sat, alpha, and carrierFrequency are used
31-
// to calculate the interference distance between nodes. The values used
32-
// here in ConnectionManager are used to calculate the upper bound,
33-
// i.e. they can be redifined in the analogue models, but never such
28+
// The value maxInterfDist used here in ConnectionManager defines the upper bound of any transmission,
29+
// i.e. it can be redifined in the analogue models, but never such
3430
// that the maximal interference distance is exeeded.
3531
//
36-
// @author Steffen Sroka, Daniel Willkomm, Karl Wessel
32+
// @author Steffen Sroka, Daniel Willkomm, Karl Wessel, Alexander Brummer, Christoph Sommer
3733
// @see MobilityBase
3834
//
3935
simple ConnectionManager
@@ -43,14 +39,9 @@ simple ConnectionManager
4339
bool coreDebug;
4440
// send directly to the node or create separate gates for every connection
4541
bool sendDirect;
46-
// maximum sending power used for this network [mW]
47-
double pMax @unit(mW);
48-
// minimum signal attenuation threshold [dBm]
49-
double sat @unit(dBm);
50-
// minimum path loss coefficient
51-
double alpha;
52-
// minimum carrier frequency of the channel [Hz]
53-
double carrierFrequency @unit(Hz);
42+
// maximum interference distance [m]
43+
double maxInterfDist @unit(m);
44+
5445
// should the maximum interference distance be displayed for each node?
5546
bool drawMaxIntfDist = default(false);
5647

src/veins/base/messages/AirFrame.msg

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
cplusplus {{
33
#include "veins/base/phyLayer/Signal_.h"
4+
#include "veins/base/utils/POA.h"
45
}}
56

67
class noncobject Signal;
8+
class noncobject POA;
79

810
//
911
// Format of the packets that are sent to the channel
@@ -32,7 +34,10 @@ namespace Veins;
3234
packet AirFrame
3335
{
3436
Signal signal; // Contains the physical data of this AirFrame
35-
37+
38+
POA poa; // contains a POA object with the position, orientation and antenna (pointer)
39+
// of the sender
40+
3641
simtime_t duration; // time the AirFrames takes to be transmited (without propagation delay)
3742

3843
int state = 1; // state of the AirFrames, used by the physical layer

src/veins/base/modules/BaseMobility.cc

+8
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ void BaseMobility::initialize(int stage)
104104
if(y > -1) pos.y = y;
105105
if(!use2D && z > -1) pos.z = z;
106106

107+
if (!hasPar("xOrientation") || !hasPar("yOrientation")) {
108+
throw cRuntimeError("Orientation coordinates in x and y direction have to specified (necessary for antenna gain calculation)");
109+
} else {
110+
double zOrient = hasPar("zOrientation") ? par("zOrientation").doubleValue() : 0;
111+
Coord orient(par("xOrientation").doubleValue(), par("yOrientation").doubleValue(), zOrient);
112+
move.setOrientationByVector(orient);
113+
}
114+
107115
// set start-position and start-time (i.e. current simulation-time) of the Move
108116
move.setStart(pos);
109117
coreEV << "start pos: " << move.getStartPos().info() << endl;

src/veins/base/modules/BaseMobility.h

+8
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,18 @@ class MIXIM_API BaseMobility : public BatteryAccess
175175
return move.getStartPos();
176176
}
177177

178+
virtual Coord getCurrentOrientation() const {
179+
return move.getOrientation();
180+
}
181+
178182
/** @brief Returns the current speed at the current simulation time. */
179183
virtual Coord getCurrentSpeed() const {
180184
return move.getDirection() * move.getSpeed();
181185
}
186+
187+
virtual Coord getCurrentDirection() const {
188+
return move.getDirection();
189+
}
182190
protected:
183191
/**
184192
* @brief Maps the passed icon size tag (is) to an actual size in pixels.

src/veins/base/modules/BaseMobility.ned

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ simple BaseMobility like IMobility
1414
double x; // x coordinate of the nodes' position (-1 = random)
1515
double y; // y coordinate of the nodes' position (-1 = random)
1616
double z; // z coordinate of the nodes' position (-1 = random)
17+
double xOrientation = default(1);
18+
double yOrientation = default(0);
19+
double zOrientation = default(0);
1720
@signal[veinsmobilityStateChanged](type="BaseMobility");
1821
@display("i=block/cogwheel");
1922
}

src/veins/base/phyLayer/Antenna.cc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Antenna.cpp
3+
*
4+
* Created on: Jun 13, 2016
5+
* Author: Alexander Brummer
6+
*/
7+
8+
#include "veins/base/phyLayer/Antenna.h"
9+
10+
double Antenna::getGain(Coord ownPos, Coord ownOrient, Coord otherPos) {
11+
// as this base class represents an isotropic antenna, simply return 1.0
12+
return 1.0;
13+
}
14+

src/veins/base/phyLayer/Antenna.h

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Antenna.h
3+
*
4+
* Created on: Jun 13, 2016
5+
* Author: Alexander Brummer
6+
*/
7+
8+
#ifndef ANTENNA_H_
9+
#define ANTENNA_H_
10+
11+
#include "veins/base/utils/Coord.h"
12+
13+
/**
14+
* @brief The Antenna class is the base class of all antenna models.
15+
*
16+
* The purpose of all Antenna classes is to calculate the antenna gain
17+
* based on the current positions and orientations of the involved nodes.
18+
*
19+
* This base Antenna acts as an isotropic antenna, it always returns
20+
* a gain of 1.0. It is assigned to all nodes if the user does not specify
21+
* another antenna type.
22+
*
23+
* @author Alexander Brummer
24+
*/
25+
class Antenna {
26+
public:
27+
Antenna() {};
28+
virtual ~Antenna() {};
29+
30+
/**
31+
* Calculates the antenna gain of the represented antenna.
32+
*
33+
* In the case of this class, a value of 1.0 is returned always,
34+
* representing an isotropic radiator.
35+
*
36+
* Nevertheless, all Antenna subclasses' getGain() methods have to
37+
* take the following three parameters as the gain depends on the angle
38+
* of incidence in general.
39+
*
40+
* @param ownPos - states the position of this antenna
41+
* @param ownOrient - the direction the antenna/the host is pointing in
42+
* @param otherPos - the position of the other antenna which this antenna
43+
* is sending to or receiving from
44+
*
45+
* @return Returns the gain in this specific direction.
46+
*/
47+
virtual double getGain(Coord ownPos, Coord ownOrient, Coord otherPos);
48+
49+
virtual double getLastAngle(){return -1.0;};
50+
};
51+
52+
#endif /* ANTENNA_H_ */

0 commit comments

Comments
 (0)