OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
| 4 * |
| 5 * This program is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 2 as |
| 7 * published by the Free Software Foundation; |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software |
| 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 * |
| 18 * Author: Giuseppe Piro <g.piro@poliba.it> |
| 19 */ |
| 20 |
| 21 |
| 22 #include <ns3/log.h> |
| 23 #include "shadowing-loss-model.h" |
| 24 |
| 25 NS_LOG_COMPONENT_DEFINE ("ShadowingLossModel"); |
| 26 |
| 27 namespace ns3 { |
| 28 |
| 29 |
| 30 NS_OBJECT_ENSURE_REGISTERED (ShadowingLossModel); |
| 31 |
| 32 ShadowingLossModel::ShadowingLossModel () |
| 33 { |
| 34 m_randVariable = new LogNormalVariable (.0, 8.); |
| 35 SetValue (m_randVariable->GetValue ()); |
| 36 SetLastUpdate (); |
| 37 SetSamplingPeriod (0.5); // defauld value |
| 38 } |
| 39 |
| 40 |
| 41 ShadowingLossModel::ShadowingLossModel (double mu, double sigma, double sampling
Period) |
| 42 { |
| 43 m_randVariable = new LogNormalVariable (mu, sigma); |
| 44 SetValue (m_randVariable->GetValue ()); |
| 45 SetLastUpdate (); |
| 46 SetSamplingPeriod (samplingPeriod); // defauld value |
| 47 } |
| 48 |
| 49 |
| 50 TypeId |
| 51 ShadowingLossModel::GetTypeId (void) |
| 52 { |
| 53 static TypeId tid = TypeId ("ns3::ShadowingLossModel") |
| 54 .SetParent<LossModel> () |
| 55 .AddConstructor<ShadowingLossModel> () |
| 56 ; |
| 57 return tid; |
| 58 } |
| 59 |
| 60 |
| 61 ShadowingLossModel::~ShadowingLossModel () |
| 62 { |
| 63 } |
| 64 |
| 65 |
| 66 void |
| 67 ShadowingLossModel::SetValue (double sh) |
| 68 { |
| 69 NS_LOG_FUNCTION (this << sh); |
| 70 m_shadowingValue = sh; |
| 71 } |
| 72 |
| 73 |
| 74 double |
| 75 ShadowingLossModel::GetValue (void) |
| 76 { |
| 77 NS_LOG_FUNCTION (this); |
| 78 if (NeedForUpdate ()) |
| 79 { |
| 80 double sh = m_randVariable->GetValue (); |
| 81 SetValue (sh); |
| 82 SetLastUpdate (); |
| 83 } |
| 84 |
| 85 return 0; // m_shadowingValue; XXX: LogNormalVariable doeas not work correctly |
| 86 } |
| 87 |
| 88 |
| 89 } // namespace ns3 |
OLD | NEW |