A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
propagation-delay-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006,2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8#ifndef PROPAGATION_DELAY_MODEL_H
9#define PROPAGATION_DELAY_MODEL_H
10
11#include "ns3/nstime.h"
12#include "ns3/object.h"
13#include "ns3/ptr.h"
14#include "ns3/random-variable-stream.h"
15
16namespace ns3
17{
18
19class MobilityModel;
20
21/**
22 * \ingroup propagation
23 *
24 * \brief calculate a propagation delay.
25 */
27{
28 public:
29 /**
30 * \brief Get the type ID.
31 * \return the object TypeId
32 */
33 static TypeId GetTypeId();
34 ~PropagationDelayModel() override;
35 /**
36 * \param a the source
37 * \param b the destination
38 * \returns the calculated propagation delay
39 *
40 * Calculate the propagation delay between the specified
41 * source and destination.
42 */
44 /**
45 * If this delay model uses objects of type RandomVariableStream,
46 * set the stream numbers to the integers starting with the offset
47 * 'stream'. Return the number of streams (possibly zero) that
48 * have been assigned.
49 *
50 * \param stream first stream index to use
51 * \return the number of stream indices assigned by this model
52 */
53 int64_t AssignStreams(int64_t stream);
54
55 protected:
56 /**
57 * Assign a fixed random variable stream number to the random variables used by this model.
58 *
59 * Subclasses must implement this; those not using random variables
60 * can return zero.
61 *
62 * \param stream first stream index to use
63 * \return the number of stream indices assigned by this model
64 */
65 virtual int64_t DoAssignStreams(int64_t stream) = 0;
66};
67
68/**
69 * \ingroup propagation
70 *
71 * \brief the propagation delay is random
72 */
74{
75 public:
76 /**
77 * \brief Get the type ID.
78 * \return the object TypeId
79 */
80 static TypeId GetTypeId();
81
82 /**
83 * Use the default parameters from PropagationDelayRandomDistribution.
84 */
88
89 private:
90 int64_t DoAssignStreams(int64_t stream) override;
92};
93
94/**
95 * \ingroup propagation
96 *
97 * \brief the propagation speed is constant
98 */
100{
101 public:
102 /**
103 * \brief Get the type ID.
104 * \return the object TypeId
105 */
106 static TypeId GetTypeId();
107
108 /**
109 * Use the default parameters from PropagationDelayConstantSpeed.
110 */
113 /**
114 * \param speed the new speed (m/s)
115 */
116 void SetSpeed(double speed);
117 /**
118 * \returns the current propagation speed (m/s).
119 */
120 double GetSpeed() const;
121
122 private:
123 int64_t DoAssignStreams(int64_t stream) override;
124 double m_speed; //!< speed
125};
126
127} // namespace ns3
128
129#endif /* PROPAGATION_DELAY_MODEL_H */
Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
ConstantSpeedPropagationDelayModel()
Use the default parameters from PropagationDelayConstantSpeed.
A base class which provides memory management and object aggregation.
Definition object.h:78
calculate a propagation delay.
static TypeId GetTypeId()
Get the type ID.
virtual int64_t DoAssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model.
int64_t AssignStreams(int64_t stream)
If this delay model uses objects of type RandomVariableStream, set the stream numbers to the integers...
virtual Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const =0
Smart pointer class similar to boost::intrusive_ptr.
the propagation delay is random
RandomPropagationDelayModel()
Use the default parameters from PropagationDelayRandomDistribution.
Ptr< RandomVariableStream > m_variable
random generator
static TypeId GetTypeId()
Get the type ID.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Time GetDelay(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.