ns-3 PLC model
|
00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ 00002 /* 00003 * Copyright (c) 2012 University of British Columbia, Vancouver 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License version 2 as 00007 * published by the Free Software Foundation; 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 * 00018 * Author: Alexander Schloegl <alexander.schloegl@gmx.de> 00019 */ 00020 00021 #ifndef PLC_INTERFERENCE_H_ 00022 #define PLC_INTERFERENCE_H_ 00023 00024 #include <ns3/nstime.h> 00025 #include <ns3/spectrum-value.h> 00026 #include <ns3/traced-value.h> 00027 #include <ns3/trace-source-accessor.h> 00028 00029 namespace ns3 { 00030 00035 class PLC_Interference : public Object 00036 { 00037 public: 00038 static TypeId GetTypeId(void); 00039 00040 PLC_Interference(); 00041 00042 void SetNoiseFloor(Ptr<const SpectrumValue> noiseFloor); 00043 Ptr<const SpectrumValue> GetNoiseFloor(void) { return m_noiseFloor; } 00044 00045 void StartRx (Ptr<const SpectrumValue> rxPsd); 00046 void AlterRxSignal (Ptr<const SpectrumValue> rxSignal); 00047 void EndRx(void); 00048 00049 void AddInterferenceSignal (Ptr<const SpectrumValue> spd); 00050 void RemoveInterferenceSignal (Ptr<const SpectrumValue> spd); 00051 00052 Ptr<SpectrumValue> GetSinr(void); 00053 double GetTotalRxPower(void); 00054 double GetTotalNoisePower(void); 00055 00056 void SetSinrBase(Ptr<const SpectrumValue> baseSinr); 00057 Ptr<const SpectrumValue> GetSinrBase(void); 00058 00059 private: 00060 void DoDispose (); 00061 00062 void CalcSinr(void); 00063 00064 bool m_receiving; 00065 00066 Ptr<SpectrumValue> m_allSignals; 00067 Ptr<const SpectrumValue> m_rxSignal; 00068 Ptr<SpectrumValue> m_noiseSignals; 00069 Ptr<const SpectrumValue> m_noiseFloor; 00070 Ptr<SpectrumValue> m_sinr; 00071 Ptr<const SpectrumValue> m_sinr_base; 00072 00073 TracedCallback<Time, Ptr<const SpectrumValue> > m_sumSignalTracer; 00074 TracedCallback<Time, Ptr<const SpectrumValue> > m_rxSignalTracer; 00075 TracedCallback<Time, Ptr<const SpectrumValue> > m_noiseSignalTracer; 00076 TracedCallback<Time, Ptr<const SpectrumValue> > m_SinrTracer; 00077 }; 00078 00079 } 00080 00081 #endif /* PLC_INTERFERENCE_H_ */