NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
LTENR_PHY.h
1#pragma once
2/************************************************************************************
3* Copyright (C) 2023 *
4* TETCOS, Bangalore. India *
5* *
6* Tetcos owns the intellectual property rights in the Product and its content. *
7* The copying, redistribution, reselling or publication of any or all of the *
8* Product or its content without express prior written consent of Tetcos is *
9* prohibited. Ownership and / or any other right relating to the software and all *
10* intellectual property rights therein shall remain at all times with Tetcos. *
11* *
12* This source code is licensed per the NetSim license agreement. *
13* *
14* No portion of this source code may be used as the basis for a derivative work, *
15* or used, for any purpose other than its intended use per the NetSim license *
16* agreement. *
17* *
18* This source code and the algorithms contained within it are confidential trade *
19* secrets of TETCOS and may not be used as the basis for any other software, *
20* hardware, product or service. *
21* *
22* Author: Shashi Kant Suman *
23* *
24* ----------------------------------------------------------------------------------*/
25#ifndef _NETSIM_LTENR_PHY_H_
26#define _NETSIM_LTENR_PHY_H_
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#pragma region HEADER_FILES
32#include "LTENR_Spectrum.h"
33#include "LTENR_PropagationModel.h"
34#include "LTENR_AntennaModel.h"
35#include "LTENR_Multiplexing.h"
36#include "LTENR_HARQ.h"
37#include "NTN.h"
38#pragma endregion
39
40
41
42#pragma region PROPAGATION_INFO
44 {
45 __IN__ NETSIM_ID gnbId;
46 __IN__ NETSIM_ID gnbIf;
47 __IN__ NETSIM_ID ueId;
48 __IN__ NETSIM_ID ueIf;
49 __IN__ NetSim_COORDINATES gnbPos;
50 __IN__ NetSim_COORDINATES uePos;
51 __IN__ double centralFrequency_MHz;
52 __IN__ double centralFrequency_GHz;
53 __IN__ double bandwidth_MHz;
54 __IN__ ptrLTENR_PROPAGATIONCONFIG propagationConfig;
55
56 __OUT__ double dTotalLoss;
57 __OUT__ double dPathLoss;
58 __OUT__ double dShadowFadingLoss;
59 __OUT__ double dClutterLoss;
60 __OUT__ double dO2ILoss;
61 __OUT__ double dAdditionalLoss;
62
63 // Additonal NTN Antenna parameters
64 UINT selectedBeamId;
65 double theta_rad;
66 double netAntennaGain_dB;
67 double angularAntennaGain_dB;
68
69 double rxG_T; // dB/K
70 double noiseFigure; // dB
71
72 double slantHeight;
73 double elevationAngle_rad;
74
75 //Will be calculated based on input and output
77 {
78 __IN__ UINT layerCount;
79 __IN__ UINT txAntennaCount;
80 __IN__ UINT rxAntennaCount;
81 __IN__ double txPower_dbm; //layerwise Tx power
82 __IN__ double totaltxpower_dbm;
83
84 double thermalNoise;
85
86 double* rxPower_dbm;
87 double* EB_by_N0;
88 double* SNR_db;
89 double* SINR_db;
90 double* InterferencePower_dbm;
91 double* spectralEfficiency;
92 //Sector Antenna
93 __OUT__ double antennaGain;
94 //Analog Beamforming on DL Broadcast Channel (SSB/PBCH)
95 //Total TX power will be used and no layerwise split
96 double SSB_rxPower_dBm;
97 double SSB_EB_by_N0;
98 __OUT__ double SSB_SNR_dB;
99 __OUT__ double SSB_AnalogBeamformingGain_dB;
100 //Digital Beamforming on Data Channel (PDSCH/PUSCH)
101 __OUT__ double* beamFormingGain;
102 __OUT__ double ArrayGain;
103 void* beamformingHandle;
104 UINT* beamFormingIndex;
105 }uplink, downlink;
106
107 //Local to Propagation model
108 struct {
109 bool isConstructiveShadow;
110 double Gset;
111 double Iset;
112 }SHADOWVAR;
113
114 LTENR_LOCATION uePosition;
115 LTENR_LOCATION gnbPosition;
116
117 double frequency_gHz;
118
119 LTENR_SCENARIO currentScenario;
120 double dist2D;
121 double dist3D;
122 double dist2Dindoor;
123 double dist2Doutdoor;
124
125 }LTENR_PROPAGATIONINFO, * ptrLTENR_PROPAGATIONINFO;
126#pragma endregion
127
128#pragma region UE_PHY
129 typedef struct stru_LTENR_UEPHY
130 {
131 NETSIM_ID ueId;
132 NETSIM_ID ueIf;
133 NETSIM_ID gnBId;
134 NETSIM_ID gnbIf;
135
136 ptrLTENR_PROPAGATIONCONFIG propagationConfig;
137 ptrLTENR_ANTENNA antenna;
138 double ueRxAntennaGain;
139 bool isBWPEnabled;
140 __IN__ UINT default_bwp_id;
141 __IN__ UINT first_active_bwp_id;
142 }LTENR_UEPHY, * ptrLTENR_UEPHY;
143 ptrLTENR_UEPHY LTENR_UEPHY_NEW(NETSIM_ID ueId, NETSIM_ID ueIf);
144#pragma endregion
145
146#pragma region ASSOC_UE_PHY_INFO
148 {
149 NETSIM_ID ueId;
150 NETSIM_ID ueIf;
151 bool isAssociated;
152 //bool isActive;
153
154 ptrLTENR_AMCINFO* uplinkAMCInfo[MAX_CA_COUNT];
155 ptrLTENR_AMCINFO* downlinkAMCInfo[MAX_CA_COUNT];
156
157 ptrLTENR_PROPAGATIONINFO propagationInfo[MAX_CA_COUNT];
158
159 ptrLTENR_HARQ_VAR harq;
160
161 void* OLLAContainer;
162
163 _ptr_ele ele;
164 };
165#define LTENR_ASSOCIATEDUEPHYINFO_ALLOC() (list_alloc(sizeof(LTENR_ASSOCIATEDUEPHYINFO),offsetof(LTENR_ASSOCIATEDUEPHYINFO,ele)))
166#define LTENR_ASSOCIATEDUEPHYINFO_ADD(phy,info) (LIST_ADD_LAST(&(phy)->associatedUEPhyInfo,(info)))
167#define LTENR_ASSOCIATEDUEPHYINFO_NEXT(info) ((info) = LIST_NEXT((info)))
168#define LTENR_ASSOCIATEDUEPHYINFO_REMOVE(phy,info) (LIST_FREE(&(phy)->associatedUEPhyInfo,(info)))
169#pragma endregion
170
171#pragma region FRAME_INFO
172 typedef struct stru_LTENR_FrameInfo
173 {
174 UINT frameId;
175 double frameStartTime;
176 double frameEndTime;
177
178 UINT subFrameId;
179 double subFrameStartTime;
180 double subFrameEndTime;
181
182 UINT slotId;
183 double slotStartTime;
184 double slotEndTime;
185
186 LTENR_SLOTTYPE slotType;
187 LTENR_SLOTTYPE prevSlotType;
188
189 UINT Current_CA_ID;
190 }LTENR_FRAMEINFO, * ptrLTENR_FRAMEINFO;
191#pragma endregion
192
193#pragma region GNB_PHY
195 {
196 NETSIM_ID gnbId;
197 NETSIM_ID gnbIf;
198
199 ptrLTENR_SPECTRUMCONFIG spectrumConfig;
200
201 //config parameter -- PDSCHConfig
203 {
204 void* mcsTable;
205 UINT xOverhead;
206 }PDSCHConfig;
207
208 //config parameter -- PUSCHConfig
210 {
211 void* mcsTable;
212 bool isTransformPrecoding;
213 }PUSCHConfig;
214
215 //config parameter -- CSI-Reporting
217 {
218 UINT tableId;
219 void* cqiTable;
220 }CSIReportConfig;
221
222 bool isBLEREnable;
223
224 ptrLTENR_PROPAGATIONCONFIG propagationConfig;
225
226 ptrLTENR_PRB prbList;
227
228 ptrLTENR_FRAMEINFO frameInfo[MAX_CA_COUNT];
229
230 ptrLTENR_FRAMEINFO currentFrameInfo;
231
232 UINT associatedUECount;
233 ptrLTENR_ASSOCIATEDUEPHYINFO associatedUEPhyInfo;
234
235 bool isBWPEnabled;
236
237 UINT old_ca_count;
238 UINT ca_count;
239 UINT bwp_count;
240 char* ca_type;
241 char* ca_configuration;
242
243 ptrLTENR_ANTENNA antenna;
244 };
245#define LTENR_GNBPHY_GETCURRENTCAID(d,in) ((ptrLTENR_GNBPHY)LTENR_GNBPHY_GET(d, in))->currentFrameInfo->Current_CA_ID
246#pragma endregion
247
248#pragma region FUN_DEF
249 //LTENR-Interference
250 void LTENR_Calculate_Interference(ptrLTENR_PROPAGATIONINFO info, double rxPower_dbm, double* Interference,int layerId, int CA_ID, bool isDownlink);
251 ptrLTENR_ASSOCIATEDUEPHYINFO LTENR_ASSOCIATEDUEPHYINFO_GET(NETSIM_ID gnbId, NETSIM_ID gnbIf,NETSIM_ID ueId, NETSIM_ID ueIf);
252 ptrLTENR_GNBPHY LTENR_GNBPHY_NEW(NETSIM_ID gnbId, NETSIM_ID gnbIf);
253
254 //LTENR-AMC
255 void LTENR_SetCQITable(ptrLTENR_GNBPHY phy, char* table);
256 void LTENR_SetPDSCHMCSIndexTable(ptrLTENR_GNBPHY phy, char* table);
257 void LTENR_SetPUSCHMCSIndexTable(ptrLTENR_GNBPHY phy, char* table);
258
259 //Spectrum config
260#define LTENR_PHY_GET_SPECTRUMCONFIG(d,in) (((ptrLTENR_GNBPHY)LTENR_GNBPHY_GET((d),(in)))->spectrumConfig)
261 void LTENR_PHY_GET_OH(ptrLTENR_SPECTRUMCONFIG sc,
262 double* dlOH,
263 double* ulOH);
264
265 //Propagation model prototypes
266 _declspec(dllexport) void LTENR_Propagation_TotalLoss(ptrLTENR_PROPAGATIONINFO info);
267 double LTENR_PHY_Send_SINR_to_RRC(ptrLTENR_GNBPHY phy);
268 double LTENR_PHY_Send_RSRP_to_RRC(ptrLTENR_GNBPHY phy);
269 void LTENR_PHY_ASSOCIATION(NETSIM_ID gnbId, NETSIM_ID gnbIf,
270 NETSIM_ID ueId, NETSIM_ID ueIf,
271 bool isAssociated);
272 double LTENR_PHY_RRC_RSRP_SINR(NETSIM_ID gnbId, NETSIM_ID gnbIf,
273 NETSIM_ID ueId, NETSIM_ID ueIf);
274 double LTENR_PHY_GetDownlinkSpectralEfficiency(ptrLTENR_PROPAGATIONINFO info, int layerId,int CA_ID);
275 double LTENR_PHY_GetUplinkSpectralEfficiency(ptrLTENR_PROPAGATIONINFO info, int layerId,int CA_ID);
276
277 //Matlab
278 void netsim_matlab_configure_loss_model(ptrLTENR_PROPAGATIONCONFIG config, void* xmlNetSimNode);
279 double netsim_matlab_calculate_loss(ptrLTENR_PROPAGATIONINFO info);
280
281 //BeamForming
282 void LTENR_BeamForming_InitCoherenceTimer(ptrLTENR_GNBPHY phy);
283 void LTENR_BeamForming_Init(ptrLTENR_PROPAGATIONINFO propagation);
284#define LTENR_BeamForming_Uplink_GetValue(info,layerId) (info->uplink.beamFormingGain? info->uplink.beamFormingGain[layerId]:0)
285#define LTENR_BeamForming_Downlink_GetValue(info,layerId) (info->downlink.beamFormingGain? info->downlink.beamFormingGain[layerId]:0)
286 // Antenna
287 _declspec(dllexport) double LTENR_PHY_GetAntennaGain(ptrLTENR_PROPAGATIONINFO info, ptrLTENR_ANTENNA antenna);
288
289 // NTN Mac Events
290 void SendToNTNReceiver(NETSIM_ID gnbId, NETSIM_ID gnbIf, ptrLTENR_ASSOCIATEDUEPHYINFO info, bool isUplink, NetSim_PACKET* packet);
291 ptrBeamNode addBeamCenters(UINT beamCount);
292 void setNTNpropagationInfo(ptrNTN_PROPAGATIONCONFIG propagation);
293 ptrNTN_PROPAGATIONCONFIG getNTN_PropInfo();
294 void NTN_BestBeamSelectionAlgorithm(ptrLTENR_PROPAGATIONINFO propInfo, int CA_ID, UINT layerId);
295 double NTN_GetUplinkSpectralEfficiency(ptrLTENR_PROPAGATIONINFO info, int layerId, int CA_ID);
296 double NTN_GetDownlinkSpectralEfficiency(ptrLTENR_PROPAGATIONINFO info, int layerId, int CA_ID);
297 void NTNRadioMeasurementLog(ptrLTENR_GNBPHY phy, int CA_ID, ptrLTENR_ASSOCIATEDUEPHYINFO info);
298#pragma endregion
299
300#ifdef __cplusplus
301}
302#endif
303#endif /* _NETSIM_LTENR_PHY_H_ */