First release
[sim/ns3-o-ran-e2.git] / helper / mmwave-indication-message-helper.cc
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2022 Northeastern University
4  * Copyright (c) 2022 Sapienza, University of Rome
5  * Copyright (c) 2022 University of Padova
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation;
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  * Author: Andrea Lacava <thecave003@gmail.com>
21  *                 Tommaso Zugno <tommasozugno@gmail.com>
22  *                 Michele Polese <michele.polese@gmail.com>
23  */
24
25 #include <ns3/mmwave-indication-message-helper.h>
26
27 namespace ns3 {
28
29 MmWaveIndicationMessageHelper::MmWaveIndicationMessageHelper (IndicationMessageType type,
30                                                               bool isOffline, bool reducedPmValues)
31     : IndicationMessageHelper (type, isOffline, reducedPmValues)
32 {
33 }
34
35 void
36 MmWaveIndicationMessageHelper::AddCuUpUePmItem (std::string ueImsiComplete,
37                                                 long txPdcpPduBytesNrRlc, long txPdcpPduNrRlc)
38 {
39   Ptr<MeasurementItemList> ueVal = Create<MeasurementItemList> (ueImsiComplete);
40   if (!m_reducedPmValues)
41     {
42       // UE-specific PDCP PDU volume transmitted to NR gNB (Unit is Kbits)
43       ueVal->AddItem<long> ("QosFlow.PdcpPduVolumeDL_Filter.UEID", txPdcpPduBytesNrRlc);
44
45       // UE-specific number of PDCP PDUs split with NR gNB
46       ueVal->AddItem<long> ("DRB.PdcpPduNbrDl.Qos.UEID", txPdcpPduNrRlc);
47     }
48
49   m_msgValues.m_ueIndications.insert (ueVal);
50 }
51
52 void
53 MmWaveIndicationMessageHelper::FillCuUpValues (std::string plmId)
54 {
55   FillBaseCuUpValues (plmId);
56 }
57
58 void
59 MmWaveIndicationMessageHelper::FillCuCpValues (uint16_t numActiveUes)
60 {
61   FillBaseCuCpValues (numActiveUes);
62 }
63
64 void
65 MmWaveIndicationMessageHelper::FillDuValues (std::string cellObjectId)
66 {
67   m_msgValues.m_cellObjectId = cellObjectId;
68   m_msgValues.m_pmContainerValues = m_duValues;
69 }
70
71 void
72 MmWaveIndicationMessageHelper::AddDuUePmItem (
73     std::string ueImsiComplete, long macPduUe, long macPduInitialUe, long macQpsk, long mac16Qam,
74     long mac64Qam, long macRetx, long macVolume, long macPrb, long macMac04, long macMac59,
75     long macMac1014, long macMac1519, long macMac2024, long macMac2529, long macSinrBin1,
76     long macSinrBin2, long macSinrBin3, long macSinrBin4, long macSinrBin5, long macSinrBin6,
77     long macSinrBin7, long rlcBufferOccup, double drbThrDlUeid)
78 {
79
80   Ptr<MeasurementItemList> ueVal = Create<MeasurementItemList> (ueImsiComplete);
81   if (!m_reducedPmValues)
82     {
83       ueVal->AddItem<long> ("TB.TotNbrDl.1.UEID", macPduUe);
84       ueVal->AddItem<long> ("TB.TotNbrDlInitial.UEID", macPduInitialUe);
85       ueVal->AddItem<long> ("TB.TotNbrDlInitial.Qpsk.UEID", macQpsk);
86       ueVal->AddItem<long> ("TB.TotNbrDlInitial.16Qam.UEID", mac16Qam);
87       ueVal->AddItem<long> ("TB.TotNbrDlInitial.64Qam.UEID", mac64Qam);
88       ueVal->AddItem<long> ("TB.ErrTotalNbrDl.1.UEID", macRetx);
89       ueVal->AddItem<long> ("QosFlow.PdcpPduVolumeDL_Filter.UEID", macVolume);
90       ueVal->AddItem<long> ("RRU.PrbUsedDl.UEID", (long) std::ceil (macPrb));
91       ueVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin1.UEID", macMac04);
92       ueVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin2.UEID", macMac59);
93       ueVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin3.UEID", macMac1014);
94       ueVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin4.UEID", macMac1519);
95       ueVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin5.UEID", macMac2024);
96       ueVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin6.UEID", macMac2529);
97       ueVal->AddItem<long> ("L1M.RS-SINR.Bin34.UEID", macSinrBin1);
98       ueVal->AddItem<long> ("L1M.RS-SINR.Bin46.UEID", macSinrBin2);
99       ueVal->AddItem<long> ("L1M.RS-SINR.Bin58.UEID", macSinrBin3);
100       ueVal->AddItem<long> ("L1M.RS-SINR.Bin70.UEID", macSinrBin4);
101       ueVal->AddItem<long> ("L1M.RS-SINR.Bin82.UEID", macSinrBin5);
102       ueVal->AddItem<long> ("L1M.RS-SINR.Bin94.UEID", macSinrBin6);
103       ueVal->AddItem<long> ("L1M.RS-SINR.Bin127.UEID", macSinrBin7);
104       ueVal->AddItem<long> ("DRB.BufferSize.Qos.UEID", rlcBufferOccup);
105     }
106
107   // This value is not requested anymore, so it has been removed from the delivery, but it will be still logged;
108   // ueVal->AddItem<double> ("DRB.UEThpDlPdcpBased.UEID", drbThrDlPdcpBasedUeid);
109   
110   ueVal->AddItem<double> ("DRB.UEThpDl.UEID", drbThrDlUeid);
111
112   m_msgValues.m_ueIndications.insert (ueVal);
113 }
114
115 void
116 MmWaveIndicationMessageHelper::AddDuCellPmItem (
117     long macPduCellSpecific, long macPduInitialCellSpecific, long macQpskCellSpecific,
118     long mac16QamCellSpecific, long mac64QamCellSpecific, double prbUtilizationDl,
119     long macRetxCellSpecific, long macVolumeCellSpecific, long macMac04CellSpecific,
120     long macMac59CellSpecific, long macMac1014CellSpecific, long macMac1519CellSpecific,
121     long macMac2024CellSpecific, long macMac2529CellSpecific, long macSinrBin1CellSpecific,
122     long macSinrBin2CellSpecific, long macSinrBin3CellSpecific, long macSinrBin4CellSpecific,
123     long macSinrBin5CellSpecific, long macSinrBin6CellSpecific, long macSinrBin7CellSpecific,
124     long rlcBufferOccupCellSpecific, long activeUeDl)
125 {
126   Ptr<MeasurementItemList> cellVal = Create<MeasurementItemList> ();
127
128   if (!m_reducedPmValues)
129     {
130       cellVal->AddItem<long> ("TB.TotNbrDl.1", macPduCellSpecific);
131       cellVal->AddItem<long> ("TB.TotNbrDlInitial", macPduInitialCellSpecific);
132     }
133
134   cellVal->AddItem<long> ("TB.TotNbrDlInitial.Qpsk", macQpskCellSpecific);
135   cellVal->AddItem<long> ("TB.TotNbrDlInitial.16Qam", mac16QamCellSpecific);
136   cellVal->AddItem<long> ("TB.TotNbrDlInitial.64Qam", mac64QamCellSpecific);
137   cellVal->AddItem<long> ("RRU.PrbUsedDl", (long) std::ceil (prbUtilizationDl));
138
139   if (!m_reducedPmValues)
140     {
141       cellVal->AddItem<long> ("TB.ErrTotalNbrDl.1", macRetxCellSpecific);
142       cellVal->AddItem<long> ("QosFlow.PdcpPduVolumeDL_Filter", macVolumeCellSpecific);
143       cellVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin1", macMac04CellSpecific);
144       cellVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin2", macMac59CellSpecific);
145       cellVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin3", macMac1014CellSpecific);
146       cellVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin4", macMac1519CellSpecific);
147       cellVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin5", macMac2024CellSpecific);
148       cellVal->AddItem<long> ("CARR.PDSCHMCSDist.Bin6", macMac2529CellSpecific);
149       cellVal->AddItem<long> ("L1M.RS-SINR.Bin34", macSinrBin1CellSpecific);
150       cellVal->AddItem<long> ("L1M.RS-SINR.Bin46", macSinrBin2CellSpecific);
151       cellVal->AddItem<long> ("L1M.RS-SINR.Bin58", macSinrBin3CellSpecific);
152       cellVal->AddItem<long> ("L1M.RS-SINR.Bin70", macSinrBin4CellSpecific);
153       cellVal->AddItem<long> ("L1M.RS-SINR.Bin82", macSinrBin5CellSpecific);
154       cellVal->AddItem<long> ("L1M.RS-SINR.Bin94", macSinrBin6CellSpecific);
155       cellVal->AddItem<long> ("L1M.RS-SINR.Bin127", macSinrBin7CellSpecific);
156       cellVal->AddItem<long> ("DRB.BufferSize.Qos", rlcBufferOccupCellSpecific);
157     }
158
159   cellVal->AddItem<long> ("DRB.MeanActiveUeDl",activeUeDl);
160
161   m_msgValues.m_cellMeasurementItems = cellVal;
162 }
163
164 void
165 MmWaveIndicationMessageHelper::AddDuCellResRepPmItem (Ptr<CellResourceReport> cellResRep)
166 {
167   m_duValues->m_cellResourceReportItems.insert (cellResRep);
168 }
169
170 void
171 MmWaveIndicationMessageHelper::AddCuCpUePmItem (std::string ueImsiComplete, long numDrb,
172                                                 long drbRelAct,
173                                                 Ptr<L3RrcMeasurements> l3RrcMeasurementServing,
174                                                 Ptr<L3RrcMeasurements> l3RrcMeasurementNeigh)
175 {
176
177   Ptr<MeasurementItemList> ueVal = Create<MeasurementItemList> (ueImsiComplete);
178   if (!m_reducedPmValues)
179     {
180       ueVal->AddItem<long> ("DRB.EstabSucc.5QI.UEID", numDrb);
181       ueVal->AddItem<long> ("DRB.RelActNbr.5QI.UEID", drbRelAct); // not modeled in the simulator
182     }
183
184   ueVal->AddItem<Ptr<L3RrcMeasurements>> ("HO.SrcCellQual.RS-SINR.UEID", l3RrcMeasurementServing);
185   ueVal->AddItem<Ptr<L3RrcMeasurements>> ("HO.TrgtCellQual.RS-SINR.UEID", l3RrcMeasurementNeigh);
186
187   m_msgValues.m_ueIndications.insert (ueVal);
188 }
189
190 MmWaveIndicationMessageHelper::~MmWaveIndicationMessageHelper ()
191 {
192 }
193
194 } // namespace ns3