diff options
Diffstat (limited to 'ns3-simulator/modules/energy.cc')
| -rw-r--r-- | ns3-simulator/modules/energy.cc | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/ns3-simulator/modules/energy.cc b/ns3-simulator/modules/energy.cc index b37cbf0..f1e4b83 100644 --- a/ns3-simulator/modules/energy.cc +++ b/ns3-simulator/modules/energy.cc @@ -7,16 +7,16 @@ void setupCellEnergy(Cell cell){ // Install energy source BasicEnergySourceHelper edgeBasicSourceHelper; - edgeBasicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (2.9009)); - edgeBasicSourceHelper.Set ("BasicEnergySupplyVoltageV", DoubleValue (3.3)); + edgeBasicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (BASICENERGYSOURCEINITIALENERGYJ)); + edgeBasicSourceHelper.Set ("BasicEnergySupplyVoltageV", DoubleValue (BASICENERGYSUPPLYVOLTAGEV)); EnergySourceContainer apEdgeNodesSources = edgeBasicSourceHelper.Install (cell.first.first); EnergySourceContainer wifiEdgeNodesSources = edgeBasicSourceHelper.Install (cell.first.second); // Install device energy model WifiRadioEnergyModelHelper radioEnergyHelper; - radioEnergyHelper.Set ("TxCurrentA", DoubleValue (0.38)); - radioEnergyHelper.Set ("RxCurrentA", DoubleValue (0.313)); - radioEnergyHelper.Set ("IdleCurrentA", DoubleValue (0.273)); + radioEnergyHelper.Set ("TxCurrentA", DoubleValue (TXCURRENTA)); + radioEnergyHelper.Set ("RxCurrentA", DoubleValue (RXCURRENTA)); + radioEnergyHelper.Set ("IdleCurrentA", DoubleValue (IDLECURRENTA)); DeviceEnergyModelContainer edgeApDeviceModels = radioEnergyHelper.Install (cell.second.first, apEdgeNodesSources); DeviceEnergyModelContainer edgeDeviceModels = radioEnergyHelper.Install (cell.second.second, wifiEdgeNodesSources); @@ -32,17 +32,11 @@ void setupCellEnergy(Cell cell){ i++; } - - - - // Ptr<BasicEnergySource> basicSourcePtr0 = DynamicCast<BasicEnergySource> (wifiEdgeNodesSources.Get (0)); - + // Ptr<BasicEnergySource> basicSourcePtr0 = DynamicCast<BasicEnergySource> (wifiEdgeNodesSources.Get (0)); // //basicSourcePtr0->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy)); // //device energy model - // Ptr<DeviceEnergyModel> basicRadioModelPtr0 = // basicSourcePtr0->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (0); - // NS_ASSERT (basicRadioModelPtr0 != NULL); // basicRadioModelPtr0->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy)); @@ -53,17 +47,17 @@ void setupCloudEnergy(CloudInfos cloudInfos){ // Install basic energy ns3::BasicNodeEnergyHelper basicNodeEnergy; - basicNodeEnergy.Set("OnConso", ns3::DoubleValue (0.0)); - basicNodeEnergy.Set("OffConso", ns3::DoubleValue (0.0)); + basicNodeEnergy.Set("OnConso", ns3::DoubleValue (ONCONSO)); + basicNodeEnergy.Set("OffConso", ns3::DoubleValue (OFFCONSO)); basicNodeEnergy.Install (cloudNodes); ns3::CompleteNetdeviceEnergyHelper completeNetdeviceEnergy; - completeNetdeviceEnergy.Set ("OffConso", ns3::DoubleValue (0)); - completeNetdeviceEnergy.Set ("IdleConso", ns3::DoubleValue (0)); - completeNetdeviceEnergy.Set ("RecvByteEnergy", ns3::DoubleValue (10)); - completeNetdeviceEnergy.Set ("SentByteEnergy", ns3::DoubleValue (10)); - completeNetdeviceEnergy.Set ("RecvPktEnergy", ns3::DoubleValue (10)); - completeNetdeviceEnergy.Set ("SentPktEnergy", ns3::DoubleValue (10)); + completeNetdeviceEnergy.Set ("OffConso", ns3::DoubleValue (OFFCONSO)); + completeNetdeviceEnergy.Set ("IdleConso", ns3::DoubleValue (IDLECONSO)); + completeNetdeviceEnergy.Set ("RecvByteEnergy", ns3::DoubleValue (RECVBYTEENERGY)); + completeNetdeviceEnergy.Set ("SentByteEnergy", ns3::DoubleValue (SENTBYTEENERGY)); + completeNetdeviceEnergy.Set ("RecvPktEnergy", ns3::DoubleValue (RECVPKTENERGY)); + completeNetdeviceEnergy.Set ("SentPktEnergy", ns3::DoubleValue (SENTPKTENERGY)); completeNetdeviceEnergy.Install(cloudNodes); ns3::ConsumptionLogger conso; |
