A Discrete-Event Network Simulator
API
channel-condition-model.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2019 SIGNET Lab, Department of Information Engineering,
4 * University of Padova
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation;
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#ifndef CHANNEL_CONDITION_MODEL_H
21#define CHANNEL_CONDITION_MODEL_H
22
23#include "ns3/object.h"
24#include "ns3/random-variable-stream.h"
25#include "ns3/vector.h"
26#include "ns3/nstime.h"
27#include <unordered_map>
28
29namespace ns3 {
30
31class MobilityModel;
32
42{
43
44public:
49 {
53 LC_ND
54 };
55
60 {
64 O2I_ND
65 };
66
72 static TypeId GetTypeId (void);
73
78
84 ChannelCondition (LosConditionValue losCondition, O2iConditionValue o2iCondition = O2O);
85
89 virtual ~ChannelCondition ();
90
98
105 void SetLosCondition (LosConditionValue losCondition);
106
114
121 void SetO2iCondition (O2iConditionValue o2iCondition);
122
128 bool IsLos () const;
129
139 bool IsNlos () const;
140
146 bool IsNlosv () const;
147
153 bool IsO2i () const;
154
160 bool IsO2o () const;
161
167 bool IsI2i () const;
168
176 bool IsEqual (LosConditionValue losCondition, O2iConditionValue o2iCondition) const;
177
178private:
181
189 friend std::ostream& operator<< (std::ostream& os, LosConditionValue cond);
190
191};
192
202{
203public:
209 static TypeId GetTypeId (void);
210
215
219 virtual ~ChannelConditionModel ();
220
230
240 virtual int64_t AssignStreams (int64_t stream) = 0;
241
248
256};
257
264{
265public:
271 static TypeId GetTypeId (void);
272
277
282
291
298
306
316 virtual int64_t AssignStreams (int64_t stream) override;
317};
318
325{
326public:
332 static TypeId GetTypeId (void);
333
338
343
352
359
367
377 virtual int64_t AssignStreams (int64_t stream) override;
378};
379
386{
387public:
393 static TypeId GetTypeId (void);
394
399
404
413
420
428
438 virtual int64_t AssignStreams (int64_t stream) override;
439};
440
448{
449public:
455 static TypeId GetTypeId (void);
456
461
465 virtual ~ThreeGppChannelConditionModel () override;
466
479
489 virtual int64_t AssignStreams (int64_t stream) override;
490
491protected:
492 virtual void DoDispose () override;
493
498 {
502 INVALID
503 };
504
511 static double Calculate2dDistance (const Vector &a, const Vector &b);
512
514
515private:
525
534
543
551
555 struct Item
556 {
559 };
560
561 std::unordered_map<uint32_t, Item> m_channelConditionMap;
563};
564
574{
575public:
581 static TypeId GetTypeId (void);
582
587
591 virtual ~ThreeGppRmaChannelConditionModel () override;
592
593private:
602 virtual double ComputePlos (Ptr<const MobilityModel> a, Ptr<const MobilityModel> b) const override;
603};
604
614{
615public:
621 static TypeId GetTypeId (void);
622
627
631 virtual ~ThreeGppUmaChannelConditionModel () override;
632
633private:
642 virtual double ComputePlos (Ptr<const MobilityModel> a, Ptr<const MobilityModel> b) const override;
643};
644
654{
655public:
661 static TypeId GetTypeId (void);
662
667
672
673private:
682 virtual double ComputePlos (Ptr<const MobilityModel> a, Ptr<const MobilityModel> b) const override;
683};
684
694{
695public:
701 static TypeId GetTypeId (void);
702
707
712
713private:
722 virtual double ComputePlos (Ptr<const MobilityModel> a, Ptr<const MobilityModel> b) const override;
723};
724
734{
735public:
741 static TypeId GetTypeId (void);
742
747
752
753private:
762 virtual double ComputePlos (Ptr<const MobilityModel> a, Ptr<const MobilityModel> b) const override;
763};
764
765} // end ns3 namespace
766
767#endif /* CHANNEL_CONDITION_MODEL_H */
Models an always in-LoS condition model.
AlwaysLosChannelConditionModel & operator=(const AlwaysLosChannelConditionModel &)=delete
Copy constructor.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
AlwaysLosChannelConditionModel(const AlwaysLosChannelConditionModel &)=delete
Copy constructor.
static TypeId GetTypeId(void)
Get the type ID.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always LoS.
Carries information about the LOS/NLOS channel state.
LosConditionValue m_losCondition
contains the information about the LOS state of the channel
bool IsO2i() const
Return true if the channel is outdoor-to-indoor.
ChannelCondition()
Constructor for the ChannelCondition class.
void SetLosCondition(LosConditionValue losCondition)
Set the LosConditionValue with the information about the LOS/NLOS state of the channel.
LosConditionValue GetLosCondition() const
Get the LosConditionValue contaning the information about the LOS/NLOS state of the channel.
bool IsNlos() const
Return true if the channel condition is NLOS.
bool IsEqual(LosConditionValue losCondition, O2iConditionValue o2iCondition) const
Return true if this instance is equivalent to the one passed as argument.
O2iConditionValue m_o2iCondition
contains the information about the O2I state of the channel
bool IsNlosv() const
Return true if the channel condition is NLOSv.
bool IsLos() const
Return true if the channel condition is LOS.
void SetO2iCondition(O2iConditionValue o2iCondition)
Set the O2iConditionValue contaning the information about the O2I state of the channel.
static TypeId GetTypeId(void)
Get the type ID.
friend std::ostream & operator<<(std::ostream &os, LosConditionValue cond)
Prints a LosConditionValue to output.
bool IsO2o() const
Return true if the channel is outdoor-to-outdoor.
bool IsI2i() const
Return true if the channel is indoor-to-indoor.
virtual ~ChannelCondition()
Destructor for the ChannelCondition class.
O2iConditionValue
Possible values for Outdoor to Indoor condition.
@ O2I_ND
Outdoor to Indoor condition not defined.
@ O2O
Outdoor to Outdoor.
O2iConditionValue GetO2iCondition() const
Get the O2iConditionValue contaning the information about the O2I state of the channel.
LosConditionValue
Possible values for Line-of-Sight condition.
@ NLOSv
Non Line of Sight due to a vehicle.
@ LC_ND
Los condition not defined.
Models the channel condition.
virtual int64_t AssignStreams(int64_t stream)=0
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
ChannelConditionModel(const ChannelConditionModel &)=delete
Copy constructor.
ChannelConditionModel & operator=(const ChannelConditionModel &)=delete
Copy constructor.
ChannelConditionModel()
Constructor for the ChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Computes the condition of the channel between a and b.
virtual ~ChannelConditionModel()
Destructor for the ChannelConditionModel class.
Models a never in-LoS condition model.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always non-LoS.
NeverLosChannelConditionModel(const NeverLosChannelConditionModel &)=delete
Copy constructor.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
static TypeId GetTypeId(void)
Get the type ID.
NeverLosChannelConditionModel & operator=(const NeverLosChannelConditionModel &)=delete
Copy constructor.
Models a never in-LoS condition model caused by a blocking vehicle.
static TypeId GetTypeId(void)
Get the type ID.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b, that will be always NLOSv.
NeverLosVehicleChannelConditionModel(const NeverLosVehicleChannelConditionModel &)=delete
Copy constructor.
NeverLosVehicleChannelConditionModel & operator=(const NeverLosVehicleChannelConditionModel &)=delete
Copy constructor.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Base class for the 3GPP channel condition models.
virtual int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
virtual void DoDispose() override
Destructor implementation.
static uint32_t GetKey(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b)
Returns a unique and reciprocal key for the channel between a and b.
virtual Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Retrieve the condition of the channel between a and b.
virtual ~ThreeGppChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
VehicleDensity
Determine the density of vehicles in a V2V scenario.
static double Calculate2dDistance(const Vector &a, const Vector &b)
Computes the 2D distance between two 3D vectors.
virtual double ComputePnlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
Compute the NLOS probability.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const =0
Compute the LOS probability.
std::unordered_map< uint32_t, Item > m_channelConditionMap
map to store the channel conditions
Ptr< UniformRandomVariable > m_uniformVar
uniform random variable
ThreeGppChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
Ptr< ChannelCondition > ComputeChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const
This method computes the channel condition based on a probabilistic model that is specific for the sc...
Time m_updatePeriod
the update period for the channel condition
Computes the channel condition for the Indoor Mixed Office scenario.
ThreeGppIndoorMixedOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
virtual ~ThreeGppIndoorMixedOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorMixedOfficeChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Mixed Offi...
Computes the channel condition for the Indoor Open Office scenario.
ThreeGppIndoorOpenOfficeChannelConditionModel()
Constructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the Indoor Open Offic...
virtual ~ThreeGppIndoorOpenOfficeChannelConditionModel() override
Destructor for the ThreeGppIndoorOpenOfficeChannelConditionModel class.
Computes the channel condition for the RMa scenario.
virtual ~ThreeGppRmaChannelConditionModel() override
Destructor for the ThreeGppRmaChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the RMa scenario.
ThreeGppRmaChannelConditionModel()
Constructor for the ThreeGppRmaChannelConditionModel class.
static TypeId GetTypeId(void)
Get the type ID.
Computes the channel condition for the UMa scenario.
static TypeId GetTypeId(void)
Get the type ID.
ThreeGppUmaChannelConditionModel()
Constructor for the ThreeGppUmaChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMa scenario.
virtual ~ThreeGppUmaChannelConditionModel() override
Destructor for the ThreeGppUmaChannelConditionModel class.
Computes the channel condition for the UMi-Street canyon scenario.
ThreeGppUmiStreetCanyonChannelConditionModel()
Constructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
virtual ~ThreeGppUmiStreetCanyonChannelConditionModel() override
Destructor for the ThreeGppUmiStreetCanyonChannelConditionModel class.
virtual double ComputePlos(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Compute the LOS probability as specified in Table 7.4.2-1 of 3GPP TR 38.901 for the UMi-Street Canyon...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Struct to store the channel condition in the m_channelConditionMap.
Ptr< ChannelCondition > m_condition
the channel condition
Time m_generatedTime
the time when the condition was generated