changed files name
This commit is contained in:
1 parent
1c5d0040ed
commit
40fac426c7
4 files changed
-623
No files matched your search
@@ -1,100 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Giuseppe Piro <g.piro@poliba.it>
|
||||
*/
|
||||
|
||||
|
||||
#include <ns3/log.h>
|
||||
#include <ns3/simulator.h>
|
||||
#include "loss-model.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("DiscreteTimeLossModel");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (DiscreteTimeLossModel);
|
||||
|
||||
DiscreteTimeLossModel::DiscreteTimeLossModel ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
TypeId
|
||||
DiscreteTimeLossModel::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::DiscreteTimeLossModel")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<DiscreteTimeLossModel> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
DiscreteTimeLossModel::~DiscreteTimeLossModel ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiscreteTimeLossModel::SetLastUpdate (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_lastUpdate = Simulator::Now () ;
|
||||
}
|
||||
|
||||
|
||||
Time
|
||||
DiscreteTimeLossModel::GetLastUpdate (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_lastUpdate;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DiscreteTimeLossModel::SetSamplingPeriod (double sp)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << sp);
|
||||
m_samplingPeriod = sp;
|
||||
}
|
||||
|
||||
|
||||
double
|
||||
DiscreteTimeLossModel::GetSamplingPeriod (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_samplingPeriod;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
DiscreteTimeLossModel::NeedForUpdate (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
if (Simulator::Now ().GetSeconds () >= (GetLastUpdate ().GetSeconds () + GetSamplingPeriod ()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,92 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Giuseppe Piro <g.piro@poliba.it>
|
||||
*/
|
||||
|
||||
#ifndef DISCRETE_TIME_LOSS_MODEL_H
|
||||
#define DISCRETE_TIME_LOSS_MODEL_H
|
||||
|
||||
|
||||
#include <ns3/nstime.h>
|
||||
#include "ns3/object.h"
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
/**
|
||||
* \brief The DiscreteTimeLossModel class offers a basic implementation
|
||||
* for all propagation loss models used for LTE networks
|
||||
*/
|
||||
class DiscreteTimeLossModel : public Object
|
||||
{
|
||||
|
||||
public:
|
||||
DiscreteTimeLossModel ();
|
||||
virtual ~DiscreteTimeLossModel ();
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
/**
|
||||
* \brief Set the time in which the model has been
|
||||
* updated.
|
||||
* Each model can be updated every Sampling interval. Every time
|
||||
* the model is updated, the variable m_lastUpdate will be set to
|
||||
* the current simulation time.
|
||||
*/
|
||||
void SetLastUpdate (void);
|
||||
|
||||
/**
|
||||
* \brief Get the time in which the model has been
|
||||
* updated
|
||||
*
|
||||
* \return the time instant in which the model have been updated
|
||||
*/
|
||||
Time GetLastUpdate (void);
|
||||
|
||||
/**
|
||||
* \brief Set the time interval every time the model
|
||||
* should be updated
|
||||
*
|
||||
* \param sp the time interval
|
||||
*/
|
||||
void SetSamplingPeriod (double sp);
|
||||
|
||||
/**
|
||||
* \brief Get the time interval every time the model
|
||||
* should be updated
|
||||
*
|
||||
* \return the time interval
|
||||
*/
|
||||
double GetSamplingPeriod (void);
|
||||
|
||||
/**
|
||||
* \brief Check if the model should be updated
|
||||
*/
|
||||
bool NeedForUpdate (void);
|
||||
|
||||
|
||||
private:
|
||||
Time m_lastUpdate;
|
||||
double m_samplingPeriod;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif /* DISCRETE_TIME_LOSS_MODEL_H */
|
||||
@@ -1,330 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Giuseppe Piro <g.piro@poliba.it>
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <ns3/log.h>
|
||||
#include "multipath-loss-model.h"
|
||||
#include <ns3/simulator.h>
|
||||
#include <stdint.h>
|
||||
#include "stdlib.h"
|
||||
#include "lte-phy.h"
|
||||
#include <ns3/mobility-model.h>
|
||||
|
||||
#include "JakesTraces/multipath_v0_M6.h"
|
||||
#include "JakesTraces/multipath_v0_M8.h"
|
||||
#include "JakesTraces/multipath_v0_M10.h"
|
||||
#include "JakesTraces/multipath_v0_M12.h"
|
||||
|
||||
#include "JakesTraces/multipath_v3_M6.h"
|
||||
#include "JakesTraces/multipath_v3_M8.h"
|
||||
#include "JakesTraces/multipath_v3_M10.h"
|
||||
#include "JakesTraces/multipath_v3_M12.h"
|
||||
|
||||
#include "JakesTraces/multipath_v30_M6.h"
|
||||
#include "JakesTraces/multipath_v30_M8.h"
|
||||
#include "JakesTraces/multipath_v30_M10.h"
|
||||
#include "JakesTraces/multipath_v30_M12.h"
|
||||
|
||||
#include "JakesTraces/multipath_v120_M6.h"
|
||||
#include "JakesTraces/multipath_v120_M8.h"
|
||||
#include "JakesTraces/multipath_v120_M10.h"
|
||||
#include "JakesTraces/multipath_v120_M12.h"
|
||||
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("JakesFadingLossModel");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (JakesFadingLossModel);
|
||||
|
||||
JakesFadingLossModel::JakesFadingLossModel ()
|
||||
: m_nbOfPaths (1, 4),
|
||||
m_startJakes (1, 2000),
|
||||
m_phy (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetSamplingPeriod (0.5); // default value
|
||||
}
|
||||
|
||||
|
||||
TypeId
|
||||
JakesFadingLossModel::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::JakesFadingLossModel")
|
||||
.SetParent<DiscreteTimeLossModel> ()
|
||||
.AddConstructor<JakesFadingLossModel> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
JakesFadingLossModel::~JakesFadingLossModel ()
|
||||
{
|
||||
m_phy = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JakesFadingLossModel::SetPhy (Ptr<LtePhy> phy)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_phy = phy;
|
||||
|
||||
SetValue ();
|
||||
}
|
||||
|
||||
|
||||
Ptr<LtePhy>
|
||||
JakesFadingLossModel::GetPhy (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return m_phy;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JakesFadingLossModel::SetValue (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
m_multipath.clear ();
|
||||
|
||||
int downlinkSubChannels = GetPhy ()->GetDownlinkSubChannels ().size ();
|
||||
|
||||
Ptr<MobilityModel> mobility = GetPhy ()->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Vector speedVector = mobility->GetVelocity ();
|
||||
|
||||
double speed = sqrt (pow (speedVector.x,2) + pow (speedVector.y,2));
|
||||
|
||||
NS_LOG_FUNCTION (this << mobility << speedVector << speed);
|
||||
|
||||
|
||||
/*
|
||||
* Several 3GPP standards propose a simulation scenario to use duirng the
|
||||
* LTE performance evaluation. In particular they suggest to consider these
|
||||
* user speeds: 0, 3, 30, 120 km/h. To this aim, we should map user speed
|
||||
* into one of the suggested values.
|
||||
*/
|
||||
if (speed < 3.)
|
||||
{
|
||||
speed = 0;
|
||||
}
|
||||
else if (speed < 30.)
|
||||
{
|
||||
speed = 3.;
|
||||
}
|
||||
else if (speed < 120.)
|
||||
{
|
||||
speed = 30.;
|
||||
}
|
||||
else
|
||||
{
|
||||
speed = 120;
|
||||
}
|
||||
|
||||
NS_LOG_FUNCTION (this << mobility << speedVector << speed);
|
||||
|
||||
|
||||
/*
|
||||
* Jackes Model.
|
||||
* Jakes popularised a model for Rayleigh fading based on summing sinusoids
|
||||
* William C. Jakes, Editor (February 1, 1975).
|
||||
* Microwave Mobile Communications.
|
||||
* New York: John Wiley & Sons Inc. ISBN 0-471-43720-4
|
||||
*/
|
||||
|
||||
// number of path = M
|
||||
// x = 1 -> M=6, x = 2 -> M=8, x = 3 -> M=10, x = 4 -> M=12
|
||||
int x = m_nbOfPaths.GetValue ();
|
||||
|
||||
for (int i = 0; i < downlinkSubChannels; i++)
|
||||
{
|
||||
// StartJakes allow us to select a window of 0.5ms into the Jakes realization lasting 3s.
|
||||
int startJakes = m_startJakes.GetValue ();
|
||||
|
||||
MultipathForTimeDomain multipathForTimeDomain;
|
||||
|
||||
if (x == 1)
|
||||
{
|
||||
// SELECTED 6 MULTIPLE PATH FOR JAKES MODEL
|
||||
if (speed == 0)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M6_v_0 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 3)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M6_v_3 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 30)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M6_v_30 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 120)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M6_v_120 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (x == 2)
|
||||
{
|
||||
// SELECTED 6 MULTIPLE PATH FOR JAKES MODEL
|
||||
if (speed == 0)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M8_v_0 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 3)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M8_v_3 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 30)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M8_v_30 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 120)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M8_v_120 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (x == 3)
|
||||
{
|
||||
// SELECTED 6 MULTIPLE PATH FOR JAKES MODEL
|
||||
if (speed == 0)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M10_v_0 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 3)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M10_v_3 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 30)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M10_v_30 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 120)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M10_v_120 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (x == 4)
|
||||
{
|
||||
// SELECTED 6 MULTIPLE PATH FOR JAKES MODEL
|
||||
if (speed == 0)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M12_v_0 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 3)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M12_v_3 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 30)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M12_v_30 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
if (speed == 120)
|
||||
{
|
||||
for (int j = 0; j < 500; j++)
|
||||
{
|
||||
multipathForTimeDomain.push_back (multipath_M12_v_120 [j + startJakes]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << " ERROR: Jaks's Model, incorrect M value" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
m_multipath.push_back (multipathForTimeDomain);
|
||||
}
|
||||
|
||||
SetLastUpdate ();
|
||||
}
|
||||
|
||||
double
|
||||
JakesFadingLossModel::GetValue (int subChannel)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
if (NeedForUpdate ())
|
||||
{
|
||||
SetValue ();
|
||||
SetLastUpdate ();
|
||||
}
|
||||
|
||||
int now_ms = Simulator::Now ().GetSeconds () * 1000;
|
||||
int lastUpdate_ms = GetLastUpdate ().GetSeconds () * 1000;
|
||||
int index = now_ms - lastUpdate_ms;
|
||||
|
||||
NS_LOG_FUNCTION (this << subChannel << now_ms
|
||||
<< lastUpdate_ms << index << m_multipath.at (subChannel).at (index));
|
||||
|
||||
return m_multipath.at (subChannel).at (index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
@@ -1,101 +0,0 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Giuseppe Piro <g.piro@poliba.it>
|
||||
*/
|
||||
|
||||
#ifndef MULTIPATH_LOSS_MODEL_H
|
||||
#define MULTIPATH_LOSS_MODEL_H
|
||||
|
||||
|
||||
#include "loss-model.h"
|
||||
#include <list>
|
||||
#include <ns3/random-variable.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class LtePhy;
|
||||
|
||||
/**
|
||||
* \brief JakesFadingLossModel class implements a loss model due to the fast fading.
|
||||
* In particular, the fast fading is modeled using a Jakes Model
|
||||
*/
|
||||
class JakesFadingLossModel : public DiscreteTimeLossModel
|
||||
{
|
||||
|
||||
public:
|
||||
JakesFadingLossModel ();
|
||||
virtual ~JakesFadingLossModel ();
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
/**
|
||||
* \brief Set the value of the considered loss model
|
||||
*/
|
||||
void SetValue (void);
|
||||
/**
|
||||
* \brief Get the value for a particular sub channel
|
||||
* \param subChannel the sub channel for which a value is requested
|
||||
* \return the loss for a particular sub channel
|
||||
*/
|
||||
double GetValue (int subChannel);
|
||||
|
||||
/**
|
||||
* \brief Set the physical layer
|
||||
* \param phy the physical layer
|
||||
*/
|
||||
void SetPhy (Ptr<LtePhy> phy);
|
||||
/**
|
||||
* \brief Get the physical layer
|
||||
* \return the pointer to the physical layer
|
||||
*/
|
||||
Ptr<LtePhy> GetPhy (void);
|
||||
|
||||
|
||||
/*
|
||||
* In order to avoid to execute every TTI the Jakes Model, the value
|
||||
* of the multipath loss is stored into a matrix (MultipathForFrequencyDomain)
|
||||
* frequency x time.
|
||||
*
|
||||
* A MultipathForFrequencyDomain element is build in a way that
|
||||
* m_multipath.at(i).at(j) represents the loss at the frequency i and time j.
|
||||
*
|
||||
* The model is udated every samplingInterval (the default value is 0.5 ms)
|
||||
*/
|
||||
|
||||
/**
|
||||
* brief a list of multipath values for the time domain
|
||||
*/
|
||||
typedef std::vector<double> MultipathForTimeDomain;
|
||||
/**
|
||||
* brief a list of multipath values for the frequency domain
|
||||
*/
|
||||
typedef std::vector<MultipathForTimeDomain> MultipathForFrequencyDomain;
|
||||
|
||||
private:
|
||||
|
||||
MultipathForFrequencyDomain m_multipath;
|
||||
|
||||
UniformVariable m_nbOfPaths;
|
||||
UniformVariable m_startJakes;
|
||||
|
||||
Ptr<LtePhy> m_phy;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* MULTIPATH_LOSS_MODEL_H */
|
||||
Reference in new issue
Block a user