OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 Andrea Sacco | 3 * Copyright (c) 2010 Andrea Sacco |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 &PrintCellInfo, | 56 &PrintCellInfo, |
57 es); | 57 es); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 int | 61 int |
62 main (int argc, char **argv) | 62 main (int argc, char **argv) |
63 { | 63 { |
64 CommandLine cmd; | 64 CommandLine cmd; |
65 cmd.Parse (argc, argv); | 65 cmd.Parse (argc, argv); |
66 | 66 |
67 // uncomment below to see the energy consumption details | 67 // uncomment below to see the energy consumption details |
68 // LogComponentEnable ("LiIonEnergySource", LOG_LEVEL_DEBUG); | 68 // LogComponentEnable ("LiIonEnergySource", LOG_LEVEL_DEBUG); |
69 | 69 |
70 Ptr<Node> node = CreateObject<Node> (); | 70 Ptr<Node> node = CreateObject<Node> (); |
71 | 71 |
72 Ptr<SimpleDeviceEnergyModel> sem = CreateObject<SimpleDeviceEnergyModel> (); | 72 Ptr<SimpleDeviceEnergyModel> sem = CreateObject<SimpleDeviceEnergyModel> (); |
73 Ptr<EnergySourceContainer> esCont = CreateObject<EnergySourceContainer> (); | 73 Ptr<EnergySourceContainer> esCont = CreateObject<EnergySourceContainer> (); |
74 Ptr<LiIonEnergySource> es = CreateObject<LiIonEnergySource> (); | 74 Ptr<LiIonEnergySource> es = CreateObject<LiIonEnergySource> (); |
75 esCont->Add (es); | 75 esCont->Add (es); |
76 es->SetNode (node); | 76 es->SetNode (node); |
77 sem->SetEnergySource (es); | 77 sem->SetEnergySource (es); |
(...skipping 19 matching lines...) Expand all Loading... |
97 | 97 |
98 Simulator::Stop (now); | 98 Simulator::Stop (now); |
99 Simulator::Run (); | 99 Simulator::Run (); |
100 Simulator::Destroy (); | 100 Simulator::Destroy (); |
101 | 101 |
102 // the cell voltage should be under 3.3v | 102 // the cell voltage should be under 3.3v |
103 DoubleValue v; | 103 DoubleValue v; |
104 es->GetAttribute ("ThresholdVoltage", v); | 104 es->GetAttribute ("ThresholdVoltage", v); |
105 NS_ASSERT (es->GetSupplyVoltage () <= v.Get ()); | 105 NS_ASSERT (es->GetSupplyVoltage () <= v.Get ()); |
106 } | 106 } |
OLD | NEW |