A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-error-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 CTTC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#ifndef SPECTRUM_ERROR_MODEL_H
21#define SPECTRUM_ERROR_MODEL_H
22
23#include "spectrum-value.h"
24
25#include <ns3/nstime.h>
26#include <ns3/object.h>
27#include <ns3/packet.h>
28#include <ns3/ptr.h>
29
30namespace ns3
31{
32
33/**
34 * \ingroup spectrum
35 *
36 */
38{
39 public:
40 /**
41 * Register this type.
42 * \return The TypeId.
43 */
44 static TypeId GetTypeId();
45 ~SpectrumErrorModel() override;
46
47 /**
48 * Start a packet reception
49 * \param p the packet
50 */
51 virtual void StartRx(Ptr<const Packet> p) = 0;
52
53 /**
54 * Evaluates a chunk
55 * \param sinr the SpectrumValue experienced by the Chunk
56 * \param duration the Chunk length
57 */
58 virtual void EvaluateChunk(const SpectrumValue& sinr, Time duration) = 0;
59
60 /**
61 * Checks if the packet being received is correct
62 * \returns true if the packet is correct.
63 */
64 virtual bool IsRxCorrect() = 0;
65};
66
67/**
68 * \ingroup spectrum
69 *
70 * This class implements the error model described in this paper:
71 * N. Baldo and M. Miozzo, "Spectrum-aware Channel and PHY layer modeling
72 * for ns3", in Proceedings of International Workshop on Network
73 * Simulation Tools (NSTOOLS 2009), 19 October 2009, Pisa (Italy).
74 */
76{
77 protected:
78 void DoDispose() override;
79
80 public:
81 /**
82 * Register this type.
83 * \return The TypeId.
84 */
85 static TypeId GetTypeId();
86 // inherited from SpectrumErrorModel
87 void StartRx(Ptr<const Packet> p) override;
88 void EvaluateChunk(const SpectrumValue& sinr, Time duration) override;
89 bool IsRxCorrect() override;
90
91 private:
92 uint32_t m_bytes; //!< Length of the packet being received
93 uint32_t m_deliverableBytes; //!< Bytes that can be received according to the Shnanon's formula
94};
95
96} // namespace ns3
97
98#endif /* SPECTRUM_ERROR_MODEL_H */
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This class implements the error model described in this paper: N.
void StartRx(Ptr< const Packet > p) override
Start a packet reception.
uint32_t m_bytes
Length of the packet being received.
void EvaluateChunk(const SpectrumValue &sinr, Time duration) override
Evaluates a chunk.
bool IsRxCorrect() override
Checks if the packet being received is correct.
uint32_t m_deliverableBytes
Bytes that can be received according to the Shnanon's formula.
static TypeId GetTypeId()
Register this type.
void DoDispose() override
Destructor implementation.
virtual void StartRx(Ptr< const Packet > p)=0
Start a packet reception.
static TypeId GetTypeId()
Register this type.
virtual bool IsRxCorrect()=0
Checks if the packet being received is correct.
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)=0
Evaluates a chunk.
Set of values corresponding to a given SpectrumModel.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.