This possibility is needed for the types of spectrum propagation models that need to have a pointer to the TX and RX antenna arrays to perform calculations, such as e.g., ThreeGppSpectrumPropagationLossModel, which currently has hard limitation of having a maximum of 1 antenna array instance per device. ThreeGppSpectrumPropagationLossModel now inherits a new class PhasedArraySpectrumPropagationLossModel. Its DoCalcRxPowerSpectralDensity function has now two additional parameters: TX and RX antenna arrays. Also, AddDevice function is removed from ThreeGppSpectrumPropagationLossModel, because it is not anymore needed to specify for each device its TX/RX antenna, since these are now passed as parameters. Hence, to use ThreeGppSpectrumPropagationLossModel, when implementing Spectrum PHY features, modules should implement the function of SpectrumPhy GetAntenna to return the instance of PhasedArrayModel of that SpectrumPhy. These instances will be passed by MultiModelSpectrumChannel (one of the core classes in the spectrum module) to propagation classes, children of PhasedArraySpectrumPropagationLossModel, when it is necessary to DoCalcRxPowerSpectralDensity to callculate the propagation loss. Additionally: Fixed pair key generation for 3gpp channel model: Previous implementation was using a cantor function of two integer of 32 bits and as a results was giving a unique representatio of 32 bits. This is wrong, because such function needed even more than 64 bits to represent that value. Even if in ns-3 simulation we are not going to have such large node numbers, we should fix this. Instead of just changing 64 bits from cantor function, I propose to replace the cantor function with just simple concatenation of two 32 bits. I also propose moving min and max inside of the function, to prevent some eventual future errors in using GetKey, because with the previous implementation there was assumption that who calls GetKey will previously sort its parameters, and first provide the min value, and then the max value, and this was not even documented.
121 lines
4.1 KiB
C++
121 lines
4.1 KiB
C++
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
/*
|
|
* Copyright (c) 2021 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
|
|
*
|
|
*/
|
|
|
|
#ifndef PHASED_ARRAY_SPECTRUM_PROPAGATION_LOSS_MODEL_H
|
|
#define PHASED_ARRAY_SPECTRUM_PROPAGATION_LOSS_MODEL_H
|
|
|
|
|
|
#include <ns3/object.h>
|
|
#include <ns3/mobility-model.h>
|
|
#include <ns3/spectrum-value.h>
|
|
#include <ns3/phased-array-model.h>
|
|
|
|
namespace ns3 {
|
|
|
|
|
|
/**
|
|
* \ingroup spectrum
|
|
*
|
|
* \brief spectrum-aware propagation loss model that is
|
|
* compatible with PhasedArrayModel type of ns-3 antenna
|
|
*
|
|
* Interface for propagation loss models to be adopted when
|
|
* transmissions are modeled with a power spectral density by means of
|
|
* the SpectrumValue class, and when PhasedArrayModel type of atenna
|
|
* is being used for TX and RX.
|
|
*
|
|
*/
|
|
class PhasedArraySpectrumPropagationLossModel : public Object
|
|
{
|
|
public:
|
|
PhasedArraySpectrumPropagationLossModel ();
|
|
virtual ~PhasedArraySpectrumPropagationLossModel ();
|
|
|
|
/**
|
|
* \brief Get the type ID.
|
|
* \return the object TypeId
|
|
*/
|
|
static TypeId GetTypeId ();
|
|
|
|
/**
|
|
* Used to chain various instances of PhasedArraySpectrumPropagationLossModel
|
|
*
|
|
* @param next
|
|
*/
|
|
void SetNext (Ptr<PhasedArraySpectrumPropagationLossModel> next);
|
|
|
|
/**
|
|
* This method is to be called to calculate
|
|
*
|
|
* @param txPsd the SpectrumValue representing the power spectral
|
|
* density of the transmission. Watt units are to be used for radio
|
|
* communications, and Pascal units for acoustic communications
|
|
* (e.g., underwater).
|
|
*
|
|
* @param a sender mobility
|
|
* @param b receiver mobility
|
|
* @param aPhasedArrayModel the instance of the phased antenna array of the sender
|
|
* @param bPhasedArrayModel the instance of the phased antenna array of the receiver
|
|
*
|
|
* @return set of values Vs frequency representing the received
|
|
* power in the same units used for the txPower parameter.
|
|
*/
|
|
Ptr<SpectrumValue> CalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
|
|
Ptr<const MobilityModel> a,
|
|
Ptr<const MobilityModel> b,
|
|
Ptr<const PhasedArrayModel> aPhasedArrayModel,
|
|
Ptr<const PhasedArrayModel> bPhasedArrayModel) const;
|
|
|
|
protected:
|
|
virtual void DoDispose ();
|
|
|
|
|
|
private:
|
|
/**
|
|
*
|
|
* @param txPsd set of values Vs frequency representing the
|
|
* transmission power. See SpectrumChannel for details.
|
|
* @param a sender mobility
|
|
* @param b receiver mobility
|
|
* @param aPhasedArrayModel the instance of the phased antenna array of the sender
|
|
* @param bPhasedArrayModel the instance of the phased antenna array of the receiver
|
|
*
|
|
* @return set of values Vs frequency representing the received
|
|
* power in the same units used for the txPower parameter.
|
|
*/
|
|
virtual Ptr<SpectrumValue> DoCalcRxPowerSpectralDensity (Ptr<const SpectrumValue> txPsd,
|
|
Ptr<const MobilityModel> a,
|
|
Ptr<const MobilityModel> b,
|
|
Ptr<const PhasedArrayModel> aPhasedArrayModel,
|
|
Ptr<const PhasedArrayModel> bPhasedArrayModel) const = 0;
|
|
|
|
Ptr<PhasedArraySpectrumPropagationLossModel> m_next; //!< PhasedArraySpectrumPropagationLossModel chained to this one.
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace ns3
|
|
|
|
#endif /* PHASED_ARRAY_SPECTRUM_PROPAGATION_LOSS_MODEL_H */
|
|
|
|
|