OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) Waterford Institute of Technology, 2013, Julien Mineraud, BioFI
NT. |
| 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: Julien Mineraud <julien.mineraud@gmail.com> |
| 19 * |
| 20 * Acknowledgements: |
| 21 * This work has received support from Science Foundation Ireland via the |
| 22 * "A Biologically inspired framework supporting network management for |
| 23 * the Future Internet" starting investigator award (grant no. 09/SIRG/I1643). |
| 24 */ |
| 25 |
| 26 #ifndef POWER_CONSUMPTION_MONITOR_HELPER_H_ |
| 27 #define POWER_CONSUMPTION_MONITOR_HELPER_H_ |
| 28 |
| 29 #include "ns3/attribute.h" |
| 30 #include "ns3/node-container.h" |
| 31 #include "ns3/power-consumption-monitor.h" |
| 32 #include "ns3/output-stream-wrapper.h" |
| 33 #include "ns3/object-factory.h" |
| 34 #include <map> |
| 35 |
| 36 /*! |
| 37 * \namespace ns3::pgbr |
| 38 * Namespace regrouping all objects and functions to run PGBR. |
| 39 */ |
| 40 namespace ns3 { |
| 41 namespace pgbr { |
| 42 |
| 43 /*! |
| 44 * \class PowerConsumptionMonitorHelper |
| 45 * \brief Helper for the installation of a power consumption monitor |
| 46 * |
| 47 * The helper also helps install the power manager on nodes |
| 48 */ |
| 49 class PowerConsumptionMonitorHelper |
| 50 { |
| 51 public: |
| 52 |
| 53 /*! |
| 54 * The constructor |
| 55 */ |
| 56 PowerConsumptionMonitorHelper (); |
| 57 |
| 58 /*! |
| 59 * \brief Set an attribute for the monitor |
| 60 * |
| 61 * \fn void SetMonitorAttribute (std::string n1, const AttributeValue &v1) |
| 62 * \param[in] n1 The attribute name |
| 63 * \param[in] v1 The attribute value |
| 64 */ |
| 65 void SetMonitorAttribute (std::string n1, const AttributeValue &v1); |
| 66 |
| 67 /*! |
| 68 * \brief Set an attribute for the power manager |
| 69 * |
| 70 * \fn void SetPowerManagerAttribute (std::string n1, const AttributeValue &v1
) |
| 71 * \param[in] n1 The attribute name |
| 72 * \param[in] v1 The attribute value |
| 73 */ |
| 74 void SetPowerManagerAttribute (std::string n1, const AttributeValue &v1); |
| 75 |
| 76 /*! |
| 77 * \brief Install power manager for every node in a node container, the nodes
may be on or off |
| 78 * |
| 79 * \fn Ptr<pgbr::PowerConsumptionMonitor> Install (NodeContainer nodes, bool a
wake) |
| 80 * \param[in] nodes The node container |
| 81 * \param[in] awake true if the nodes must be awake, false otherwise |
| 82 * \return The power consumption monitor that monitors the newly installed pow
er managers |
| 83 */ |
| 84 Ptr<PowerConsumptionMonitor> Install (NodeContainer nodes, bool awake); |
| 85 |
| 86 /*! |
| 87 * \brief Install power manager for a node, the node may be on or off |
| 88 * |
| 89 * \fn Ptr<pgbr::PowerConsumptionMonitor> Install (Ptr<Node> node, bool awake) |
| 90 * \param[in] node The node |
| 91 * \param[in] awake true if the nodes must be awake, false otherwise |
| 92 * \return The power consumption monitor that monitors the newly installed pow
er manager |
| 93 */ |
| 94 Ptr<PowerConsumptionMonitor> Install (Ptr<Node> node, bool awake); |
| 95 |
| 96 /*! |
| 97 * \brief Install power manager for every node, the nodes may be on or off |
| 98 * |
| 99 * \fn Ptr<pgbr::PowerConsumptionMonitor> InstallAll (bool awake) |
| 100 * \param[in] awake true if the nodes must be awake, false otherwise |
| 101 * \return The power consumption monitor that monitors the newly installed pow
er managers |
| 102 */ |
| 103 Ptr<PowerConsumptionMonitor> InstallAll (bool awake); |
| 104 |
| 105 /*! |
| 106 * \brief Return current power consumption monitor. Currently, the monitoring
is centralised (one monitor per simulation) |
| 107 * |
| 108 * \fn Ptr<pgbr::PowerConsumptionMonitor> GetMonitor () |
| 109 * \return The power consumption monitor |
| 110 */ |
| 111 Ptr<PowerConsumptionMonitor> GetMonitor (); |
| 112 |
| 113 /*! |
| 114 * \brief In some simulation, not all the nodes will be used (depending on the
traffic input), this function help |
| 115 * trimming the monitored topology to remove unused nodes. |
| 116 * |
| 117 * \fn static void TrimMonitoredTopology (std::vector<Ptr<Node> > egressNodes) |
| 118 * \param[in] The list of egress nodes (generating or receiving traffic) |
| 119 */ |
| 120 static void TrimMonitoredTopology (std::vector<Ptr<Node> > egressNodes); |
| 121 |
| 122 private: |
| 123 |
| 124 typedef std::pair<uint32_t, uint32_t> neighbour_t; //(nodeId, linkId) |
| 125 typedef std::vector<neighbour_t> neighbourList_t; |
| 126 typedef std::map<uint32_t, neighbourList_t> graph_t; |
| 127 |
| 128 ObjectFactory m_monitorFactory; /*!< The monitor factory */ |
| 129 ObjectFactory m_powerManagerFactory; /*!< The power manager factory */ |
| 130 Ptr<PowerConsumptionMonitor> m_monitor; /*!< The power monitor */ |
| 131 }; |
| 132 |
| 133 }} //namespace pgbr, ns3 |
| 134 |
| 135 #endif /* POWER_CONSUMPTION_MONITOR_HELPER_H_ */ |
OLD | NEW |