satellite-stats-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Magister Solutions
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: Budiarto Herman <budiarto.herman@magister.fi>
19  *
20  */
21 
22 #ifndef SATELLITE_STATS_HELPER_H
23 #define SATELLITE_STATS_HELPER_H
24 
25 #include <ns3/attribute.h>
26 #include <ns3/net-device-container.h>
27 #include <ns3/object.h>
28 #include <ns3/ptr.h>
29 
30 #include <map>
31 
32 namespace ns3
33 {
34 
35 class SatHelper;
36 class Node;
37 class CollectorMap;
38 class DataCollectionObject;
39 
87 class SatStatsHelper : public Object
88 {
89  public:
90  // COMMON ENUM DATA TYPES ///////////////////////////////////////////////////
91 
96  typedef enum
97  {
108 
113  static std::string GetIdentifierTypeName(IdentifierType_t identifierType);
114 
119  typedef enum
120  {
125  OUTPUT_PDF_FILE, // probability distribution function
126  OUTPUT_CDF_FILE, // cumulative distribution function
130  OUTPUT_PDF_PLOT, // probability distribution function
131  OUTPUT_CDF_PLOT, // cumulative distribution function
132  } OutputType_t;
133 
138  static std::string GetOutputTypeName(OutputType_t outputType);
139 
140  // CONSTRUCTOR AND DESTRUCTOR ///////////////////////////////////////////////
141 
147  SatStatsHelper(Ptr<const SatHelper> satHelper);
148 
152  virtual ~SatStatsHelper();
153 
157  static TypeId GetTypeId();
158 
159  // PUBLIC METHODS ///////////////////////////////////////////////////////////
160 
167  void Install();
168 
169  // SETTER AND GETTER METHODS ////////////////////////////////////////////////
170 
174  void SetName(std::string name);
175 
179  std::string GetName() const;
180 
185  void SetIdentifierType(IdentifierType_t identifierType);
186 
191 
196  void SetOutputType(OutputType_t outputType);
197 
201  OutputType_t GetOutputType() const;
202 
206  bool IsInstalled() const;
207 
212  Ptr<const SatHelper> GetSatHelper() const;
213 
214  protected:
222  virtual void DoInstall() = 0;
223 
229  virtual std::string GetOutputPath() const;
230 
239  virtual std::string GetOutputFileName() const;
240 
246  virtual std::string GetIdentifierHeading(std::string dataLabel) const;
247 
253  virtual std::string GetTimeHeading(std::string dataLabel) const;
254 
260  virtual std::string GetDistributionHeading(std::string dataLabel) const;
261 
277  Ptr<DataCollectionObject> CreateAggregator(std::string aggregatorTypeId,
278  std::string n1 = "",
279  const AttributeValue& v1 = EmptyAttributeValue(),
280  std::string n2 = "",
281  const AttributeValue& v2 = EmptyAttributeValue(),
282  std::string n3 = "",
283  const AttributeValue& v3 = EmptyAttributeValue(),
284  std::string n4 = "",
285  const AttributeValue& v4 = EmptyAttributeValue(),
286  std::string n5 = "",
287  const AttributeValue& v5 = EmptyAttributeValue());
288 
301  uint32_t CreateCollectorPerIdentifier(CollectorMap& collectorMap) const;
302 
303  // IDENTIFIER RELATED METHODS ///////////////////////////////////////////////
304 
311  uint32_t GetUtUserId(Ptr<Node> utUserNode) const;
312 
319  uint32_t GetUtId(Ptr<Node> utNode) const;
320 
327  uint32_t GetGwId(Ptr<Node> gwNode) const;
328 
335  uint32_t GetSatId(Ptr<Node> satNode) const;
336 
341  uint32_t GetIdentifierForUtUser(Ptr<Node> utUserNode) const;
342 
347  uint32_t GetIdentifierForUt(Ptr<Node> utNode) const;
348 
353  uint32_t GetIdentifierForBeam(uint32_t satId, uint32_t beamId) const;
354 
359  uint32_t GetIdentifierForGroup(uint32_t groupId) const;
360 
365  uint32_t GetIdentifierForGw(Ptr<Node> gwNode) const;
366 
371  uint32_t GetIdentifierForSat(Ptr<Node> satNode) const;
372 
377  uint32_t GetIdentifierForIsl(Ptr<Node> satNodeSrc, Ptr<Node> satNodeDst) const;
378 
379  // DEVICE RETRIEVAL METHODS /////////////////////////////////////////////////
380 
384  static NetDeviceContainer GetGwSatNetDevice(Ptr<Node> gwNode);
385 
389  static Ptr<NetDevice> GetUtSatNetDevice(Ptr<Node> utNode);
390 
394  static Ptr<NetDevice> GetSatSatGeoNetDevice(Ptr<Node> satNode);
395 
396  private:
397  std::string m_name;
401  Ptr<const SatHelper> m_satHelper;
402 
403 }; // end of class SatStatsHelper
404 
405 } // end of namespace ns3
406 
407 #endif /* SATELLITE_STATS_HELPER_H */
Parent abstract class of all satellite statistics helpers.
Ptr< const SatHelper > m_satHelper
uint32_t GetIdentifierForBeam(uint32_t satId, uint32_t beamId) const
uint32_t GetIdentifierForGw(Ptr< Node > gwNode) const
uint32_t GetSatId(Ptr< Node > satNode) const
Ptr< const SatHelper > GetSatHelper() const
uint32_t GetIdentifierForUtUser(Ptr< Node > utUserNode) const
static NetDeviceContainer GetGwSatNetDevice(Ptr< Node > gwNode)
IdentifierType_t m_identifierType
void SetIdentifierType(IdentifierType_t identifierType)
void SetName(std::string name)
IdentifierType_t GetIdentifierType() const
virtual ~SatStatsHelper()
/ Destructor.
static std::string GetOutputTypeName(OutputType_t outputType)
SatStatsHelper(Ptr< const SatHelper > satHelper)
Creates a new helper instance.
static Ptr< NetDevice > GetSatSatGeoNetDevice(Ptr< Node > satNode)
virtual std::string GetIdentifierHeading(std::string dataLabel) const
virtual std::string GetOutputPath() const
static std::string GetIdentifierTypeName(IdentifierType_t identifierType)
Ptr< DataCollectionObject > CreateAggregator(std::string aggregatorTypeId, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue())
Create the aggregator according to the output type.
virtual std::string GetOutputFileName() const
Compute the path and file name where statistics output should be written to.
static TypeId GetTypeId()
inherited from ObjectBase base class
uint32_t GetIdentifierForGroup(uint32_t groupId) const
uint32_t GetUtId(Ptr< Node > utNode) const
void SetOutputType(OutputType_t outputType)
uint32_t CreateCollectorPerIdentifier(CollectorMap &collectorMap) const
Create one collector instance for each identifier in the simulation.
virtual void DoInstall()=0
Install the probes, collectors, and aggregators necessary to produce the statistics output.
OutputType_t
Possible types and formats of statistics output.
uint32_t GetIdentifierForSat(Ptr< Node > satNode) const
static Ptr< NetDevice > GetUtSatNetDevice(Ptr< Node > utNode)
void Install()
Install the probes, collectors, and aggregators necessary to produce the statistics output.
uint32_t GetIdentifierForIsl(Ptr< Node > satNodeSrc, Ptr< Node > satNodeDst) const
OutputType_t GetOutputType() const
uint32_t GetIdentifierForUt(Ptr< Node > utNode) const
IdentifierType_t
Possible categorization of statistics output.
uint32_t GetUtUserId(Ptr< Node > utUserNode) const
std::string GetName() const
uint32_t GetGwId(Ptr< Node > gwNode) const
virtual std::string GetTimeHeading(std::string dataLabel) const
virtual std::string GetDistributionHeading(std::string dataLabel) const
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.