From 9e30f25e2e76a790730832689c115ebd5adccb89 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Mon, 14 Nov 2011 10:59:56 +0100 Subject: [PATCH] spectrum API change (missing files) --- .../model/lte-spectrum-signal-parameters.cc | 49 ++++++++ .../model/lte-spectrum-signal-parameters.h | 61 ++++++++++ ...half-duplex-ideal-phy-signal-parameters.cc | 49 ++++++++ .../half-duplex-ideal-phy-signal-parameters.h | 61 ++++++++++ .../model/spectrum-signal-parameters.cc | 59 +++++++++ .../model/spectrum-signal-parameters.h | 113 ++++++++++++++++++ 6 files changed, 392 insertions(+) create mode 100644 src/lte/model/lte-spectrum-signal-parameters.cc create mode 100644 src/lte/model/lte-spectrum-signal-parameters.h create mode 100644 src/spectrum/model/half-duplex-ideal-phy-signal-parameters.cc create mode 100644 src/spectrum/model/half-duplex-ideal-phy-signal-parameters.h create mode 100644 src/spectrum/model/spectrum-signal-parameters.cc create mode 100644 src/spectrum/model/spectrum-signal-parameters.h diff --git a/src/lte/model/lte-spectrum-signal-parameters.cc b/src/lte/model/lte-spectrum-signal-parameters.cc new file mode 100644 index 000000000..14110603f --- /dev/null +++ b/src/lte/model/lte-spectrum-signal-parameters.cc @@ -0,0 +1,49 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 CTTC + * + * 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: Nicola Baldo + */ + +#include +#include +#include "lte-spectrum-signal-parameters.h" + + +NS_LOG_COMPONENT_DEFINE ("LteSpectrumSignalParameters"); + +namespace ns3 { + +LteSpectrumSignalParameters::LteSpectrumSignalParameters () +{ + NS_LOG_FUNCTION (this); +} + +LteSpectrumSignalParameters::LteSpectrumSignalParameters (const LteSpectrumSignalParameters& p) + : SpectrumSignalParameters (p) +{ + NS_LOG_FUNCTION (this << &p); + packetBurst = p.packetBurst->Copy (); +} + +Ptr +LteSpectrumSignalParameters::Copy () +{ + NS_LOG_FUNCTION (this); + return Create (*this); +} + +} // namespace ns3 diff --git a/src/lte/model/lte-spectrum-signal-parameters.h b/src/lte/model/lte-spectrum-signal-parameters.h new file mode 100644 index 000000000..a6905e49c --- /dev/null +++ b/src/lte/model/lte-spectrum-signal-parameters.h @@ -0,0 +1,61 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 CTTC + * + * 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: Nicola Baldo + */ + +#ifndef LTE_SPECTRUM_SIGNAL_PARAMETERS_H +#define LTE_SPECTRUM_SIGNAL_PARAMETERS_H + + +#include + +namespace ns3 { + +class PacketBurst; + +/** + * \ingroup lte + * + * Signal parameters for Lte + */ +struct LteSpectrumSignalParameters : public SpectrumSignalParameters +{ + + // inherited from SpectrumSignalParameters + virtual Ptr Copy (); + + /** + * default constructor + */ + LteSpectrumSignalParameters (); + + /** + * copy constructor + */ + LteSpectrumSignalParameters (const LteSpectrumSignalParameters& p); + + /** + * The packet burst being transmitted with this signal + */ + Ptr packetBurst; +}; + +} // namespace ns3 + + +#endif /* LTE_SPECTRUM_SIGNAL_PARAMETERS_H */ diff --git a/src/spectrum/model/half-duplex-ideal-phy-signal-parameters.cc b/src/spectrum/model/half-duplex-ideal-phy-signal-parameters.cc new file mode 100644 index 000000000..92be9a801 --- /dev/null +++ b/src/spectrum/model/half-duplex-ideal-phy-signal-parameters.cc @@ -0,0 +1,49 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 CTTC + * + * 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: Nicola Baldo + */ + +#include +#include +#include "half-duplex-ideal-phy-signal-parameters.h" + + +NS_LOG_COMPONENT_DEFINE ("HalfDuplexIdealPhySignalParameters"); + +namespace ns3 { + +HalfDuplexIdealPhySignalParameters::HalfDuplexIdealPhySignalParameters () +{ + NS_LOG_FUNCTION (this); +} + +HalfDuplexIdealPhySignalParameters::HalfDuplexIdealPhySignalParameters (const HalfDuplexIdealPhySignalParameters& p) + : SpectrumSignalParameters (p) +{ + NS_LOG_FUNCTION (this << &p); + data = p.data->Copy (); +} + +Ptr +HalfDuplexIdealPhySignalParameters::Copy () +{ + NS_LOG_FUNCTION (this); + return Create (*this); +} + +} // namespace ns3 diff --git a/src/spectrum/model/half-duplex-ideal-phy-signal-parameters.h b/src/spectrum/model/half-duplex-ideal-phy-signal-parameters.h new file mode 100644 index 000000000..a69db3ee6 --- /dev/null +++ b/src/spectrum/model/half-duplex-ideal-phy-signal-parameters.h @@ -0,0 +1,61 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2009 CTTC + * + * 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: Nicola Baldo + */ + +#ifndef HALF_DUPLEX_IDEAL_PHY_SPECTRUM_PARAMETERS_H +#define HALF_DUPLEX_IDEAL_PHY_SPECTRUM_PARAMETERS_H + + +#include + +namespace ns3 { + +class Packet; + +/** + * \ingroup spectrum + * + * Signal parameters for HalfDuplexIdealPhy + */ +struct HalfDuplexIdealPhySignalParameters : public SpectrumSignalParameters +{ + + // inherited from SpectrumSignalParameters + virtual Ptr Copy (); + + /** + * default constructor + */ + HalfDuplexIdealPhySignalParameters (); + + /** + * copy constructor + */ + HalfDuplexIdealPhySignalParameters (const HalfDuplexIdealPhySignalParameters& p); + + /** + * The data packet being transmitted with this signal + */ + Ptr data; +}; + +} // namespace ns3 + + +#endif /* HALF_DUPLEX_IDEAL_PHY_SPECTRUM_PARAMETERS_H */ diff --git a/src/spectrum/model/spectrum-signal-parameters.cc b/src/spectrum/model/spectrum-signal-parameters.cc new file mode 100644 index 000000000..5b7cc38e4 --- /dev/null +++ b/src/spectrum/model/spectrum-signal-parameters.cc @@ -0,0 +1,59 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 CTTC + * + * 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: Nicola Baldo + */ + + +#include +#include +#include +#include + + +NS_LOG_COMPONENT_DEFINE ("SpectrumSignalParameters"); + +namespace ns3 { + +SpectrumSignalParameters::SpectrumSignalParameters () +{ + NS_LOG_FUNCTION (this); +} + +SpectrumSignalParameters::~SpectrumSignalParameters () +{ + NS_LOG_FUNCTION (this); +} + +SpectrumSignalParameters::SpectrumSignalParameters (const SpectrumSignalParameters& p) +{ + NS_LOG_FUNCTION (this << &p); + psd = p.psd->Copy (); + duration = p.duration; + txPhy = p.txPhy; +} + +Ptr +SpectrumSignalParameters::Copy () +{ + NS_LOG_FUNCTION (this); + return Create (*this); +} + + + +} // namespace ns3 diff --git a/src/spectrum/model/spectrum-signal-parameters.h b/src/spectrum/model/spectrum-signal-parameters.h new file mode 100644 index 000000000..e99f616da --- /dev/null +++ b/src/spectrum/model/spectrum-signal-parameters.h @@ -0,0 +1,113 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 CTTC + * + * 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: Nicola Baldo + */ + + +#ifndef SPECTRUM_SIGNAL_PARAMETERS_H +#define SPECTRUM_SIGNAL_PARAMETERS_H + + +#include +#include +#include + + +namespace ns3 { + +class SpectrumPhy; +class SpectrumValue; + +/** + * This struct provides the generic signal representation to be used by + * all wireless technologies. Any specific wireless technology is + * allowed to define additional signal parameters by inheriting from this + * struct and providing additional member variables. This makes sure + * that a minimum set of parameters (in particular, the ones needed + * for interference calculation) is + * common across all wireless technologies, while at the same time + * allowing each technology to have its own specific signal parameters. + * + * Furthermore, since the signal parameters specific of every technology inherit + * directly from this struct, each PHY can test (by using a dynamic + * cast) if a signal being received belongs to a given technology or not. + * + * \note when inheriting from this class, make sure that the assignment operator and the copy constructor work properly, making deep copies if needed. + */ +struct SpectrumSignalParameters : public SimpleRefCount +{ + /** + * default constructor + */ + SpectrumSignalParameters (); + + /** + * destructor + */ + virtual ~SpectrumSignalParameters (); + + /** + * copy constructor + */ + SpectrumSignalParameters (const SpectrumSignalParameters& p); + + /** + * make a "virtual" copy of this class, where "virtual" refers to + * the fact that if the actual object is a derived class of + * SpectrumSignalParameters, then the copy is also a derived class + * of the same type. + * Each class inheriting from + * SpectrumSignalParameters should override this method and use it + * to call the copy constructor of the derived class. + * + * \return a copy of the (possibly derived) class + */ + virtual Ptr Copy (); + + /** + * The Power Spectral Density of the + * waveform, in linear units. The exact unit will depend on the + * type of transmission medium involved: W for radio communications, Pa for + * underwater acoustic communications. Other transmission media to + * be defined. + * + * \note when SpectrumSignalParameters is copied, only the pointer to the PSD will be copied. This is because SpectrumChannel objects normally overwrite the psd anyway, so there is no point in making a copy. + */ + Ptr psd; + + /** + * The duration of the packet transmission. It is + * assumed that the Power Spectral Density remains constant for the + * whole duration of the transmission. In other words, all waveform + * have a rect shape with respect to time. + */ + Time duration; + + /** + * The SpectrumPhy instance that is making the transmission + */ + Ptr txPhy; +}; + + +} + + + + +#endif /* SPECTRUM_SIGNAL_PARAMETERS_H */