Loading...
Searching...
No Matches
satellite-phy-rx-carrier.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Magister Solutions Ltd.
4 * Copyright (c) 2018 CNES
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 * Author: Jani Puttonen <jani.puttonen@magister.fi>
20 * Author: Mathias Ettinger <mettinger@toulouse.viveris.fr>
21 */
22
23#ifndef SATELLITE_PHY_RX_CARRIER_H
24#define SATELLITE_PHY_RX_CARRIER_H
25
26#include "satellite-enums.h"
30#include "satellite-phy-rx.h"
31#include "satellite-phy.h"
32#include "satellite-utils.h"
34
35#include "ns3/mac48-address.h"
36#include "ns3/object.h"
37#include "ns3/ptr.h"
38#include "ns3/traced-callback.h"
39
40#include <deque>
41#include <list>
42#include <map>
43#include <stdint.h>
44#include <utility>
45#include <vector>
46
47namespace ns3
48{
49
50class Address;
51class SatPhy;
53class SatLinkResults;
55class SatNodeInfo;
56
62class SatPhyRxCarrier : public Object
63{
64 public:
68 typedef struct
69 {
70 Ptr<SatSignalParameters> rxParams;
71 Mac48Address destAddress;
72 Mac48Address sourceAddress;
73 Mac48Address finalDestAddress;
74 Mac48Address finalSourceAddress;
75 Ptr<SatInterference::InterferenceChangeEvent> interferenceEvent;
76 } rxParams_s;
77
86 typedef void (*LinkBudgetTraceCallback)(Ptr<SatSignalParameters> rxParams,
87 Mac48Address receiverAddress,
88 Mac48Address destinationAddress,
89 double interference,
90 double sinr);
91
97 typedef void (*RxPowerTraceCallback)(double rxPower, const Address& utAddress);
98
104 typedef void (*LinkSinrTraceCallback)(double sinr, const Address& utAddress);
105
113 typedef void (*PhyRxErrorCallback)(uint32_t nPackets, const Address& utAddress, bool isError);
114
122 typedef void (*PhyRxCollisionCallback)(uint32_t nPackets,
123 const Address& utAddress,
124 bool isCollided);
125
133 SatPhyRxCarrier(uint32_t carrierId,
134 Ptr<SatPhyRxCarrierConf> carrierConf,
135 Ptr<SatWaveformConf> waveformConf,
136 bool isRandomAccessEnabled);
137
141 virtual ~SatPhyRxCarrier();
142
146 enum State
147 {
150 };
151
163
168 static TypeId GetTypeId(void);
169
174 void SetPhy(Ptr<SatPhy> phy);
175
180 inline void SetSatId(uint32_t satId)
181 {
182 m_satId = satId;
183 }
184
189 inline uint32_t GetSatId()
190 {
191 return m_satId;
192 }
193
198 inline void SetBeamId(uint32_t beamId)
199 {
200 m_beamId = beamId;
201 }
202
207 inline uint32_t GetBeamId()
208 {
209 return m_beamId;
210 }
211
216 void SetNodeInfo(const Ptr<SatNodeInfo> nodeInfo);
217
223 virtual bool StartRx(Ptr<SatSignalParameters> rxParams);
224
229 {
230 return BASE;
231 }
232
236 virtual void BeginEndScheduling();
237
239
245
251
258
263 {
264 return m_rxTemperatureK;
265 }
266
267 protected:
273 inline virtual const bool GetDefaultReceiveMode()
274 {
275 return false;
276 }
277
283 {
285 }
286
291 inline Ptr<SatInterference> GetInterferenceModel()
292 {
293 return m_satInterference;
294 }
295
300 inline Ptr<SatInterferenceElimination> GetInterferenceEliminationModel()
301 {
303 }
304
311 virtual Ptr<SatInterference::InterferenceChangeEvent> CreateInterference(
312 Ptr<SatSignalParameters> rxParams,
313 Address rxAddress) = 0;
314
318
325 std::pair<bool, SatPhyRxCarrier::rxParams_s> GetReceiveParams(
326 Ptr<SatSignalParameters> rxParams);
327
329 inline rxParams_s GetStoredRxParams(uint32_t key)
330 {
331 return m_rxParamsMap[key];
332 }
333
335 inline void StoreRxParams(uint32_t key, rxParams_s rxParams)
336 {
337 m_rxParamsMap[key] = rxParams;
338 }
339
341 inline void RemoveStoredRxParams(uint32_t key)
342 {
343 m_rxParamsMap.erase(key);
344 }
345
350 inline Mac48Address GetOwnAddress()
351 {
352 return m_ownAddress;
353 }
354
359 inline Ptr<SatNodeInfo> GetNodeInfo()
360 {
361 return m_nodeInfo;
362 }
363
368 void DoCompositeSinrOutputTrace(double cSinr);
369
377 virtual void DoCreateInterferenceModel(Ptr<SatPhyRxCarrierConf> carrierConf,
378 uint32_t carrierId,
379 double rxBandwidthHz);
380
387 virtual void DoCreateInterferenceEliminationModel(Ptr<SatPhyRxCarrierConf> carrierConf,
388 uint32_t carrierId,
389 Ptr<SatWaveformConf> waveformConf);
390
397 {
398 return m_channelType;
399 }
400
406 {
407 m_channelType = channelType;
408 }
409
418
424 {
425 m_linkRegenerationMode = linkRegenerationMode;
426 }
427
432 void ChangeState(State newState);
433
439 {
440 return m_state;
441 }
442
449 bool CheckAgainstLinkResults(double cSinr, Ptr<SatSignalParameters> rxParams);
450
455 virtual void EndRxData(uint32_t key) = 0;
456
461
465 virtual void DoDispose();
466
477 double CalculateSinr(double rxPowerW,
478 double ifPowerW,
479 double rxNoisePowerW,
480 double rxAciIfPowerW,
481 double rxExtNoisePowerW,
482 double otherInterference);
483
492 double CalculateSinr(double sinr, double otherInterference);
493
500 double CalculateCompositeSinr(double sinr1, double sinr2);
501
508 double GetWorstSinr(double sinr1, double sinr2);
509
515
521
525 void CheckRxStateSanity();
526
531 inline uint32_t GetCarrierId() const
532 {
533 return m_carrierId;
534 }
535
541 inline Ptr<SatLinkResults> GetLinkResults()
542 {
543 return m_linkResults;
544 }
545
550 inline Ptr<SatWaveformConf> GetWaveformConf()
551 {
552 return m_waveformConf;
553 }
554
559 inline Ptr<SatChannelEstimationErrorContainer> GetChannelEstimationErrorContainer()
560 {
562 }
563
568 {
570 }
571
578 inline double GetUniformRandomValue(double min, double max)
579 {
580 return m_uniformVariable->GetValue(min, max);
581 }
582
584
588
593
598
603
608
613
615
620 TracedCallback<Ptr<SatSignalParameters>, // RX signalling parameters
621 Mac48Address, // receiver address
622 Mac48Address, // packet destination address
623 double, // interference power
624 double // composite SINR
625 >
627
632 TracedCallback<double, const Address&> m_rxPowerTrace;
633
641 TracedCallback<double, const Address&> m_sinrTrace;
642
647 TracedCallback<double, const Address&> m_linkSinrTrace;
648
650
661 TracedCallback<uint32_t, const Address&, bool> m_daRxTrace;
662
663 TracedCallback<uint32_t, const Address&> m_daRxCarrierIdTrace;
664
669
674
679
684
685 private:
692 bool CheckAgainstLinkResultsErrorModelAvi(double cSinr, Ptr<SatSignalParameters> rxParams);
693
694 State m_state; //< Current state of the carrier
695 uint32_t m_satId; //< Satellite ID
696 uint32_t m_beamId; //< Beam ID
697 uint32_t m_carrierId; //< Carrier ID
698 bool m_receivingDedicatedAccess; //< Is the carrier receiving a dedicated access packet
699 Ptr<SatInterference> m_satInterference; //< Interference model
700 Ptr<SatInterferenceElimination> m_satInterferenceElimination; //< Interference model
701 bool m_enableCompositeSinrOutputTrace; //< Enable composite SINR output tracing
702
707
712
713 std::map<uint32_t, rxParams_s> m_rxParamsMap; //< Storage for Rx parameters by ID
714 Mac48Address m_ownAddress; //< Carrier address
715 Ptr<SatNodeInfo> m_nodeInfo; //< NodeInfo of the node where carrier is attached
717 Ptr<SatLinkResults> m_linkResults; //< Link results from the carrier configuration
718 Ptr<SatWaveformConf> m_waveformConf; //< Waveform configuration
719 Ptr<UniformRandomVariable> m_uniformVariable; //< Uniform helper random variable
721 double m_constantErrorRate; //< Error rate for constant error model
722
726 Ptr<SatChannelEstimationErrorContainer> m_channelEstimationError;
727};
728
729} // namespace ns3
730
731#endif /* SATELLITE_PHY_RX_CARRIER_H */
SatChannelEstimationErrorContainer is responsible of adding a channel estimation error on top of raw ...
ChannelType_t
Types of channel.
PacketType_t
Packet types.
RegenerationMode_t
The regeneration mode used in satellites.
The SatNodeInfo implements a container for all needed node related information.
The SatPhy models the basic physical layer of the satellite system.
Callback< void, uint32_t, uint32_t, Address, Address, double, bool > CnoCallback
Callback< void, uint32_t, uint32_t, uint32_t, uint8_t, double > AverageNormalizedOfferedLoadCallback
Callback< double > AdditionalInterferenceCallback
Callback to get additional interference from PHY layer.
void SetPhy(Ptr< SatPhy > phy)
Function for setting the SatPhy module.
SatPhy::AverageNormalizedOfferedLoadCallback m_avgNormalizedOfferedLoadCallback
Average normalized offered load callback.
Ptr< SatLinkResults > GetLinkResults()
Get pointer to the link results given by the carrier creation configuration.
void SetNodeInfo(const Ptr< SatNodeInfo > nodeInfo)
Function for setting the node info class.
void DoCompositeSinrOutputTrace(double cSinr)
Function for composite SINR output tracing.
void RemoveStoredRxParams(uint32_t key)
Remove stored rxParams under a key.
double m_rxExtNoisePowerW
External noise power system RX noise.
Ptr< SatInterferenceElimination > GetInterferenceEliminationModel()
Get pointer to the current interference elimination model.
void SetLinkRegenerationMode(SatEnums::RegenerationMode_t linkRegenerationMode)
Set the link regeneration mode.
void CheckRxStateSanity()
Function for checking the Rx state sanity.
void SetCnoCb(SatPhyRx::CnoCallback cb)
Function for settign the C/NO callback.
TracedCallback< double, const Address & > m_linkSinrTrace
A callback for link specific SINR in dB.
Ptr< SatInterferenceElimination > m_satInterferenceElimination
static TypeId GetTypeId(void)
Function for gettign the NS-3 type ID.
Ptr< SatChannelEstimationErrorContainer > GetChannelEstimationErrorContainer()
Get a pointer to the channel estimation error container of the carrier.
TracedCallback< uint32_t, const Address & > m_daRxCarrierIdTrace
TracedCallback< Ptr< SatSignalParameters >, Mac48Address, Mac48Address, double, double > m_linkBudgetTrace
The trace source on packet receptiong.
void SetAverageNormalizedOfferedLoadCallback(SatPhyRx::AverageNormalizedOfferedLoadCallback callback)
Function for setting the AverageNormalizedOfferedLoadCallback callback.
SatPhyRxCarrierConf::AdditionalInterferenceCallback m_additionalInterferenceCallback
Callback to get additional interference.
TracedCallback< double, const Address & > m_rxPowerTrace
A callback for received signal power in dBW.
uint32_t GetCarrierId() const
Get the ID of the carrier.
void DecreaseNumOfRxState(SatEnums::PacketType_t packetType)
Function for decreasing the number of ongoing transmissions.
virtual SatEnums::RegenerationMode_t GetLinkRegenerationMode()
Get the link regeneration mode.
void SetBeamId(uint32_t beamId)
Function for setting the beam id for all the transmissions from this SatPhyTx.
Ptr< SatWaveformConf > m_waveformConf
CarrierType
Possible carrier types.
Ptr< SatLinkResults > m_linkResults
virtual SatEnums::ChannelType_t GetChannelType()
Get the channel type.
bool IsCompositeSinrOutputTraceEnabled() const
Check if composite SINR output trace is enabled.
uint32_t GetBeamId()
Get ID the ID of the beam this carrier is attached to.
virtual void DoCreateInterferenceEliminationModel(Ptr< SatPhyRxCarrierConf > carrierConf, uint32_t carrierId, Ptr< SatWaveformConf > waveformConf)
Create an interference cancelation model for this carrier.
Ptr< SatNodeInfo > GetNodeInfo()
Get the satellite node info.
std::map< uint32_t, rxParams_s > m_rxParamsMap
double CalculateSinr(double rxPowerW, double ifPowerW, double rxNoisePowerW, double rxAciIfPowerW, double rxExtNoisePowerW, double otherInterference)
Function for calculating the SINR.
SatPhyRx::ReceiveCallback m_rxCallback
The upper layer package receive callback.
TracedCallback< uint32_t, const Address &, bool > m_daRxTrace
DaRx trace source.
double m_rxAciIfPowerW
RX Adjacent channel interference.
void(* RxPowerTraceCallback)(double rxPower, const Address &utAddress)
Callback signature for RxPowerTrace trace source.
virtual bool StartRx(Ptr< SatSignalParameters > rxParams)
Function for starting packet reception from the SatChannel.
TracedCallback< double, const Address & > m_sinrTrace
A callback for transmission composite SINR at UT (BBFrame) or GW (time slot).
void(* PhyRxCollisionCallback)(uint32_t nPackets, const Address &utAddress, bool isCollided)
Common callback signature for trace sources related to packets reception by PHY and its collision.
Ptr< SatChannelEstimationErrorContainer > m_channelEstimationError
Channel estimation error container.
rxParams_s GetStoredRxParams(uint32_t key)
Get stored rxParams under a key.
bool IsReceivingDedicatedAccess()
Check if the carrier is receiving a dedicated access packet.
Ptr< SatWaveformConf > GetWaveformConf()
Get pointer to the waveform configuration.
void SetReceiveCb(SatPhyRx::ReceiveCallback cb)
Function for setting the receive callback.
bool CheckAgainstLinkResults(double cSinr, Ptr< SatSignalParameters > rxParams)
Function for checking the SINR against the link results.
SatPhy::CnoCallback m_cnoCallback
The upper layer C/N0 receive callback.
bool CheckAgainstLinkResultsErrorModelAvi(double cSinr, Ptr< SatSignalParameters > rxParams)
Function for checking the SINR against the link results.
virtual void DoCreateInterferenceModel(Ptr< SatPhyRxCarrierConf > carrierConf, uint32_t carrierId, double rxBandwidthHz)
Create an interference model for this carrier.
double CalculateCompositeSinr(double sinr1, double sinr2)
Function for calculating the composite SINR.
double GetWorstSinr(double sinr1, double sinr2)
Function for calculating the worst sinr between uplink and downlink.
SatPhyRxCarrierConf::ErrorModel m_errorModel
uint32_t m_numOfOngoingRx
Contains information about how many ongoing Rx events there are.
const bool m_randomAccessEnabled
Is random access enabled for this carrier.
virtual void BeginEndScheduling()
Function for initializing the frame/window end scheduling.
virtual void DoDispose()
Dispose.
Ptr< SatInterference > GetInterferenceModel()
Get pointer to the current interference model.
double GetUniformRandomValue(double min, double max)
A helper method for getting values form a uniform random variable in child classes.
void(* LinkBudgetTraceCallback)(Ptr< SatSignalParameters > rxParams, Mac48Address receiverAddress, Mac48Address destinationAddress, double interference, double sinr)
Callback signature for LinkBudgetTrace trace source.
void ChangeState(State newState)
Function for changing the receiver state.
SatPhyRxCarrier(uint32_t carrierId, Ptr< SatPhyRxCarrierConf > carrierConf, Ptr< SatWaveformConf > waveformConf, bool isRandomAccessEnabled)
Constructor.
void SetChannelType(SatEnums::ChannelType_t channelType)
Set the channel type for the carrier.
void SetSatId(uint32_t satId)
Function for setting the satellite id for all the transmissions from this SatPhyTx.
virtual CarrierType GetCarrierType()
Method for querying the type of the carrier.
Ptr< UniformRandomVariable > m_uniformVariable
Ptr< SatInterference > m_satInterference
SatEnums::RegenerationMode_t m_linkRegenerationMode
Link regeneration mode.
virtual const bool GetDefaultReceiveMode()
Get the default receive mode for the carrier.
std::pair< bool, SatPhyRxCarrier::rxParams_s > GetReceiveParams(Ptr< SatSignalParameters > rxParams)
Rx parameter storage methods.
virtual void EndRxData(uint32_t key)=0
Function for ending the packet reception from the SatChannel.
void IncreaseNumOfRxState(SatEnums::PacketType_t packetType)
Function for increasing the number of ongoing transmissions.
uint32_t m_rxPacketCounter
Running counter for received packets.
virtual ~SatPhyRxCarrier()
Destructor.
virtual Ptr< SatInterference::InterferenceChangeEvent > CreateInterference(Ptr< SatSignalParameters > rxParams, Address rxAddress)=0
Create an interference event based on Rx parameters and address.
double GetRxTemperatureK()
Method for querying the temperature of the carrier.
uint32_t GetSatId()
Get ID the ID of the satellite this carrier is attached to.
SatEnums::ChannelType_t m_channelType
void(* PhyRxErrorCallback)(uint32_t nPackets, const Address &utAddress, bool isError)
Common callback signature for trace sources related to packets reception by PHY and its error.
double m_rxBandwidthHz
RX Bandwidth in Hz.
State GetState()
Get the state of the carrier.
void(* LinkSinrTraceCallback)(double sinr, const Address &utAddress)
Callback signature for LinkSinrTrace trace source.
void StoreRxParams(uint32_t key, rxParams_s rxParams)
Store rxParams under a key.
Mac48Address GetOwnAddress()
Get the MAC address of the carrier.
double m_rxTemperatureK
RX noise temperature in K.
Callback< void, uint32_t, uint32_t, Address, Address, double, bool > CnoCallback
Callback< void, Ptr< SatSignalParameters >, bool > ReceiveCallback
Callback< void, uint32_t, uint32_t, uint32_t, uint8_t, double > AverageNormalizedOfferedLoadCallback
Actual physical layer transmission container.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for storing the packet specific Rx parameters.
Ptr< SatInterference::InterferenceChangeEvent > interferenceEvent