UeStatsCollector.h Source File

Simu5G: UeStatsCollector.h Source File
Simu5G
UeStatsCollector.h
1//
2// Simu5G
3//
4// Copyright (C) 2019-2021 Giovanni Nardini, Giovanni Stea, Antonio Virdis et al. (University of Pisa)
5// Copyright (C) 2022-2026 Giovanni Nardini, Giovanni Stea et al. (University of Pisa)
6//
7// This file is part of a software released under the license included in file
8// "license.pdf". Please read LICENSE and README files before using it.
9// The above files and the present reference are part of the software itself,
10// and cannot be removed from it.
11//
12
13#ifndef _LTE_UESTATSCOLLECTOR_H_
14#define _LTE_UESTATSCOLLECTOR_H_
15
16#include <inet/common/ModuleRefByPar.h>
17
18#include "simu5g/common/LteCommon.h"
19#include "simu5g/mec/utils/MecCommon.h"
20#include "simu5g/corenetwork/statsCollector/L2Measures/L2MeasBase.h"
21#include <string>
22#include "simu5g/corenetwork/statsCollector/UeStatsCollector.h"
23#include "simu5g/stack/mac/LteMacBase.h"
24#include "simu5g/stack/packetFlowObserver/PacketFlowObserverUe.h"
25// #include "simu5g/stack/pdcp/LtePdcp.h"
26
27namespace simu5g {
28
29using namespace inet;
30
39class UeStatsCollector : public cSimpleModule
40{
41 private:
42
43 std::string collectorType_; // ueCollectorStatsCollector or NRueCollectorStatsCollector
44
45 // Used by the RNI service
46 mec::AssociateId associateId_;
47
48 // LTE Nic layers
49 inet::ModuleRefByPar<LteMacBase> mac_;
50 inet::ModuleRefByPar<PacketFlowObserverUe> packetFlowObserver_;
51
52 // packet delay
53 L2MeasBase ul_nongbr_delay_ue;
54 L2MeasBase dl_nongbr_delay_ue;
55 // packet discard rate
56 L2MeasBase ul_nongbr_pdr_ue;
57 L2MeasBase dl_nongbr_pdr_ue;
58 // scheduled throughput
59 L2MeasBase ul_nongbr_throughput_ue;
60 L2MeasBase dl_nongbr_throughput_ue;
61 // data volume
62 L2MeasBase ul_nongbr_data_volume_ue;
63 L2MeasBase dl_nongbr_data_volume_ue;
64
65 // TODO insert signals for statistics
66
67 bool handover_ = false;
68
69 public:
70
71 // methods to update L2 measures
72
73 // packet delay
74 void add_ul_nongbr_delay_ue();
75 void add_dl_nongbr_delay_ue(double value); // called by the eNodeBCollector
76
77 // packet discard rate
78 void add_ul_nongbr_pdr_ue();
79 void add_dl_nongbr_pdr_ue(double value); // called by the eNodeBCollector
80
81 // throughput
82 void add_ul_nongbr_throughput_ue(double value);
83 void add_dl_nongbr_throughput_ue(double value);
84
85 // PDPC bytes
86 void add_ul_nongbr_data_volume_ue(unsigned int value); // called by the eNodeBCollector
87 void add_dl_nongbr_data_volume_ue(unsigned int value); // called by the eNodeBCollector
88
89 void resetDelayCounter(); // reset structures to calculate the measures
90
91 /* this method is used by the eNodeBStatsCollector to calculate
92 * packet discard rate per cell
93 */
94 DiscardedPkts getULDiscardedPkt();
95
96 // getters to retrieve L2 measures (e.g. from RNI service)
97
98 // packet delay getters
99 int get_ul_nongbr_delay_ue();
100 int get_dl_nongbr_delay_ue();
101
102 // packet discard rate getters
103 int get_ul_nongbr_pdr_ue();
104 int get_dl_nongbr_pdr_ue();
105
106 // throughput getters
107 int get_ul_nongbr_throughput_ue();
108 int get_dl_nongbr_throughput_ue();
109
110 // PDPC bytes getters
111 int get_ul_nongbr_data_volume_ue();
112 int get_dl_nongbr_data_volume_ue();
113
114 /* getters for GBR (Guaranteed Bit Rate) L2 measures.
115 * currently not implemented since the simulator does not
116 * handle them
117 */
118 int get_dl_gbr_delay_ue() { return -1; }
119 int get_ul_gbr_delay_ue() { return -1; }
120
121 int get_dl_gbr_pdr_ue() { return -1; }
122 int get_ul_gbr_pdr_ue() { return -1; }
123
124 int get_dl_gbr_throughput_ue() { return -1; }
125 int get_ul_gbr_throughput_ue() { return -1; }
126
127 int get_dl_gbr_data_volume_ue() { return -1; }
128 int get_ul_gbr_data_volume_ue() { return -1; }
129
130 void resetStats();
131
132 void setHandover(bool value)
133 {
134 handover_ = value;
135 }
136
137 mec::AssociateId getAssociateId() const
138 {
139 return associateId_;
140 }
141
142 protected:
143 void initialize(int stages) override;
144 int numInitStages() const override { return inet::NUM_INIT_STAGES; }
145 void handleMessage(cMessage *msg) override {}
146};
147
148} //namespace
149
150#endif //_LTE_ENOBSTATSCOLLECTOR_H_
Definition UeStatsCollector.h:40
Definition AlertReceiver.h:24