A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
qkd-graph.h
Go to the documentation of this file.
1/*
2 * Copyright(c) 2020 DOTFEESA www.tk.etf.unsa.ba
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 *
7 *
8 * Author: Miralem Mehic <miralem.mehic@ieee.org>
9 */
10
11#ifndef QKD_GRAPH_H
12#define QKD_GRAPH_H
13
14#include <fstream>
15#include "ns3/object.h"
16#include "ns3/gnuplot.h"
17#include "ns3/core-module.h"
18#include "ns3/node-list.h"
19#include "qkd-control.h"
20#include "q-buffer.h"
21#include <sstream>
22
23namespace ns3 {
24
25 /**
26 * @ingroup qkd
27 * @class QKDGraph
28 * @brief QKD graphs are implemented to allow straightforward access to QKD buffers'
29 * state and convenient monitoring of key material consumption.
30 *
31 * @note QKD graph is associated with QKD buffer which allows plotting of graphs on each node with
32 * associated QKD link and QKD buffer. QKD Graph creates separate PLT and DAT files which are
33 * suitable for plotting using popular Gnuplot tool in PNG(default), SVG or EPSLATEX format.
34 * QKDNetSim supports plotting of QKD Total Graph which is used to show the overall consumption
35 * of key material in QKD Network. QKD Total Graph is updated each time when key material is
36 * generated or consumed on a network link.
37 */
38 class QKDGraph: public Object {
39 public:
40
41 /**
42 * @brief Get the type ID.
43 * @return the object TypeId
44 */
45 static TypeId GetTypeId();
46
47 /**
48 * @brief Constructor
49 * @param Ptr<QKDControl> control
50 * @param Ptr<Node> src
51 * @param Ptr<Node> dst
52 * @param uint32_t bufferID
53 * @param std::string graphTitle
54 * @param std::string graphType
55 */
57 Ptr < Node > src,
58 Ptr < Node > dst,
60 std::string graphTitle,
61 std::string graphType,
63 );
64
65 /**
66 * @brief Destructor
67 */
68 ~QKDGraph() override;
69
70 /**
71 * @brief Initialized function for total graph
72 */
73 void InitTotalGraph() const;
74
75 /**
76 * @brief Print the graph
77 */
78 void PrintGraph();
79
80 /**
81 * @brief MCurrent value of the QBuffer changed, so plot it on the graph
82 */
84
85 /**
86 * @brief The status of the QBuffer changed, so plot it on the graph
87 */
89
90 /**
91 * @brief The Mthr value of the QBuffer changed, so plot it on the graph
92 */
94
95 /**
96 * @brief Help function for detection of status change value
97 */
99
100 private:
101
102 Ptr < QBuffer > m_buffer; //!< QBuffer associated with the QKDGraph
103 Ptr < Node > m_src; //!< source node, info required for graph title
104 Ptr < Node > m_dst; //!< destination node, info required for graph title
105
106 uint32_t m_keymMin; //!< get some boundaries for the graph
107 uint32_t m_keymCurrent; //!< get some boundaries for the graph
108 uint32_t m_keymMax; //!< get some boundaries for the graph
109 uint32_t m_maxValueGraph; //!< get some boundaries for the graph
110 uint32_t m_keymThreshold; //!< get some boundaries for the graph
111
112 std::string m_plotFileName; //!< output filename
113 std::string m_plotFileType; //png or svg
114 double m_simulationTime; //!< time value, x-axis
115 uint32_t m_graphStatusEntry; //!< temp variable
116
117 Gnuplot m_gnuplot; //!< Gluplot object settings
127 };
128}
129
130#endif /* QKDGRAPH */
Class to represent a 2D points plot.
Definition gnuplot.h:105
a simple class to generate gnuplot-ready plotting commands from a set of datasets.
Definition gnuplot.h:360
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
QKD graphs are implemented to allow straightforward access to QKD buffers' state and convenient monit...
Definition qkd-graph.h:38
std::string m_plotFileType
Definition qkd-graph.h:113
Gnuplot2dDataset m_datasetWorkingState_3
Definition qkd-graph.h:123
uint32_t m_keymMax
get some boundaries for the graph
Definition qkd-graph.h:108
std::string m_plotFileName
output filename
Definition qkd-graph.h:112
uint32_t m_maxValueGraph
get some boundaries for the graph
Definition qkd-graph.h:109
Ptr< Node > m_src
source node, info required for graph title
Definition qkd-graph.h:103
~QKDGraph() override
Destructor.
Definition qkd-graph.cc:27
static TypeId GetTypeId()
Get the type ID.
Definition qkd-graph.cc:19
Gnuplot2dDataset m_datasetMaximum
Definition qkd-graph.h:126
Gnuplot2dDataset m_datasetWorkingState_Mthr
Definition qkd-graph.h:119
Gnuplot m_gnuplot
Gluplot object settings.
Definition qkd-graph.h:117
void ProcessMStatus(uint32_t value)
The status of the QBuffer changed, so plot it on the graph.
Definition qkd-graph.cc:290
void ProcessMStatusHelpFunction(double time, uint32_t newValue)
Help function for detection of status change value.
Definition qkd-graph.cc:255
uint32_t m_keymCurrent
get some boundaries for the graph
Definition qkd-graph.h:107
Gnuplot2dDataset m_datasetThreshold
Definition qkd-graph.h:124
uint32_t m_keymMin
get some boundaries for the graph
Definition qkd-graph.h:106
Gnuplot2dDataset m_datasetWorkingState_0
Definition qkd-graph.h:120
Ptr< QBuffer > m_buffer
QBuffer associated with the QKDGraph.
Definition qkd-graph.h:102
void InitTotalGraph() const
Initialized function for total graph.
Definition qkd-graph.cc:231
uint32_t m_keymThreshold
get some boundaries for the graph
Definition qkd-graph.h:110
Ptr< Node > m_dst
destination node, info required for graph title
Definition qkd-graph.h:104
void PrintGraph()
Print the graph.
Definition qkd-graph.cc:188
uint32_t m_graphStatusEntry
temp variable
Definition qkd-graph.h:115
Gnuplot2dDataset m_datasetWorkingState_1
Definition qkd-graph.h:121
void ProcessMCurrent(uint32_t value)
MCurrent value of the QBuffer changed, so plot it on the graph.
Definition qkd-graph.cc:237
double m_simulationTime
time value, x-axis
Definition qkd-graph.h:114
void ProcessMThrStatus(uint32_t value)
The Mthr value of the QBuffer changed, so plot it on the graph.
Definition qkd-graph.cc:247
Gnuplot2dDataset m_dataset
Definition qkd-graph.h:118
Gnuplot2dDataset m_datasetWorkingState_2
Definition qkd-graph.h:122
Gnuplot2dDataset m_datasetMinimum
Definition qkd-graph.h:125
a unique identifier for an interface.
Definition type-id.h:49
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static unsigned int value(char c)