NetSim Source Code Help
Loading...
Searching...
No Matches
PropagationModel.h
Go to the documentation of this file.
1#pragma once
2/************************************************************************************
3* Copyright (C) 2020 *
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* Author: Shashi Kant Suman *
13* *
14* ---------------------------------------------------------------------------------*/
15
16#ifndef _NETSIM_PROPAGATION_MODEL_H_
17#define _NETSIM_PROPAGATION_MODEL_H_
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#define NEGATIVE_DBM -1000.0
23#define ZERO_MW 1.0e-100
24#define MW_TO_DBM(mw) (mw <= ZERO_MW?NEGATIVE_DBM:10.0*log10(mw))
25#define DBM_TO_MW(dbm) (dbm == NEGATIVE_DBM? 0.0: pow(10.0,dbm/10.0))
26
27#define HZ (1.0)
28#define KHZ (1000.0*HZ)
29#define MHZ (1000.0*KHZ)
30#define GHZ (1000.0*MHZ)
31
32#ifndef MAC_LAYER_PROTOCOL
33#define MAC_LAYER_PROTOCOL int
34#endif
35#ifndef __CALLBACK__
36#define __CALLBACK__
37#endif
38
39#define PROPAGATION_PROPAGATION_MEDIUM_DEFAULT _strdup("AIR")
40#define PROPAGATION_CHANNEL_CHARACTERISTICS_DEFAULT _strdup("FADING_AND_SHADOWING")
41#define PROPAGATION_PATHLOSS_MODEL_DEFAULT _strdup("Friis_Free_Space_propagation")
42#define PROPAGATION_FADING_MODEL_DEFAULT _strdup("NONE")
43#define PROPAGATION_SHADOWING_MODEL_DEFAULT _strdup("NONE")
44#define PROPAGATION_STANDARD_DEVIATION_DEFAULT 5.0
45#define PROPAGATION_PATHLOSS_EXPONENT_DEFAULT 2.0
46#define PROPAGATION_FADING_FIGURE_DEFAULT 1.0
47#define PROPAGATION_SHAPE_PARAMETER_DEFAULT 2.0
48#define PROPAGATION_OMEGA_DEFAULT 2.0
49#define PROPAGATION_THORP_SPREAD_COEFF_DEFAULT 2.0
50#define PROPAGATION_TEMPERATUREZONE_COUNT_DEFAULT 0
51#define PROPAGATION_Z_DEFAULT 0.0
52#define PROPAGATION_TEMPERATURE_DEFAULT 25.0 // in degree celcius
53#define PROPAGATION_SALINITY_DEFAULT 35
54#define PROPAGATION_WINDSPEED_DEFAULT 0 // In m/s
55#define PROPAGATION_SHIPPING_DEFAULT 0.5 // [0-1]
56
57 //Typedef's
60
61 typedef bool (*fnCheckInterface)(NETSIM_ID nTxId,
62 NETSIM_ID nTxInterface,
63 NETSIM_ID nRxId,
64 NETSIM_ID nRxInterface);
66 PRECV_POWER p);
67
68 typedef enum
69 {
75
76 typedef enum
77 {
93
94 typedef enum
95 {
102
103 typedef enum
104 {
109
110 typedef enum
111 {
115
116 typedef struct stru_pathloss_var
117 {
119 double d0;
120
121 //Throp Progation model
123
124 //Path loss matrix model
126
127 //Range Based model
128 double range;
130
131 /*
132 structure to store consineWaveOscillator
133*/
134 typedef struct stru_oscillator
135 {
136 double amplitude;
137 double phi;
138 double omega;
140
141 /*
142 structure to store complex number
143 */
144 typedef struct stru_complex
145 {
146 double real;
147 double img;
149
150 /*
151 structure to store complexOscillator
152 */
154 {
156 double phi;
157 double omega;
159
160 typedef struct stru_state_looParam
161 {
163
171
173
176 double sigma;
178
179 typedef struct stru_elevation
180 {
184
185 double** stateTransitionProbability; // [from state i][to state j]
186
189
191 {
194
197
198 typedef struct stru_fading_var
199 {
201
202 //Nakagami parameter
203 double shape_parameter; // Range: 0.5-9, default 2
204 double omega; // Range: 0.25-27, default 2
205
206 //Markov parameter
208
210
211 typedef struct stru_shadowloss_var
212 {
214 bool iSet;
215 double Gset;
217
219 {
220 double lDepth;
221 double hDepth;
222 double avgDepth;
223 double depth;
224 double temperature; // in degree celsius
226
228 {
229 double dWindSpeed; // In m/s
230 double dShipping; // [0,1]
231 double dSalinity;
235
237 {
239
241
244
247
250
253
255 {
256 double time;
257 double dRxPower_mw; // without fading loss
258 double dRxPower_dbm; // without fading loss
259
263 };
264
265 typedef struct stru_tx_info
266 {
267 double dCentralFrequency; // In mHz
270
271 double dTxGain; // In dBi
272 double dRxGain; // In dBi
273 double dTx_Rx_Distance; // In m
274 double dTxAntennaHeight; // In m
275 double dRxAntennaHeight; //In m
276
277 double d0; // In m
279
281 {
286 char* uniqueId;
287
289
291
293
294 fnCheckInterface fnpCheckInterface; /* Function pointer to check whether
295 * two device is interfering with each other or not
296 */
297 };
298
299 typedef void* PROPAGATION_HANDLE;
300
301 typedef void(*fnGetTxInfo)(NETSIM_ID nTxId,
302 NETSIM_ID nTxInterface,
303 NETSIM_ID nRxId,
304 NETSIM_ID nRxInterface,
305 PTX_INFO Txinfo);
307 NETSIM_ID i);
308
309
310 //Initialize the propagation module
311 _declspec(deprecated("This function is deprecated. Use propagation_create_propagation_info."))
314 __CALLBACK__ fnGetTxInfo fnpGetTxInfo,
315 __CALLBACK__ fnCheckInterface checkInterference);
316
317 //Init the custom propagation info
319 NETSIM_ID rxId, NETSIM_ID rxIf,
320 char* uniqueId, PTX_INFO txInfo,
321 PPROPAGATION propagation);
322
323 //Free the propagation module
325
326 //Calculate the received power due to path loss and shadow
328#define propagation_calculate_received_power(h,t,ti,r,ri,time) __pragma(message(__LOC__"propagation_calculate_received_power function is deprcated. Use _propagation_calculate_received_power")) _propagation_calculate_received_power(get_propagation_info(h,t,ti,r,ri),time)
329
330 //Calculate the log normal shadow loss
332 PRECV_POWER p);
333
334 _declspec(dllexport) double _propagation_calculate_lognormalshadow(double standardDeviation,
335 double* Gset, bool* iSet);
336
337 //Calculate the log distance path loss
339 PRECV_POWER p);
340
341 _declspec(dllexport) double _propagation_calculate_logdistancepathloss(double pathLossExponent,
342 double dTx_Rx_Distance, double dCentralFrequency, double d0);
343
344 //Calculate cost 231 hata path loss. Common for urban and suburban with only cm value changes
346 PRECV_POWER p,
347 double cm);
348
349 //Calculate hata suburban path loss.
351 PRECV_POWER p);
352 //Calculate Two Ray path loss
354 PRECV_POWER p);
355 //Calculate Range Based path loss
357 PRECV_POWER p);
358 //Calculate Matrix Model
360 //Calculate hata urban path loss.
362 PRECV_POWER p);
363 //Calculate the deterministic shadow loss
365 PRECV_POWER p);
366
367 //Calculate the Thorp path loss
369 PRECV_POWER p);
370
371 _declspec(deprecated("get_propagation_info is deprected."))
373 NETSIM_ID txid,
374 NETSIM_ID txif,
375 NETSIM_ID rxid,
376 NETSIM_ID rxif);
377
378 /// Used to get the transmitter info. will be used by user code to change the transmitter information at run time.
380#define get_tx_info(h,t,ti,r,ri) __pragma(message(__LOC__"get_tx_info function is deprcated. Use _get_tx_info")) _get_tx_info(get_propagation_info(h,t,ti,r,ri))
381
382 ///Used to the received power in dBm over time.
384#define propagation_get_received_power_dbm(h,t,ti,r,ri,time) __pragma(message(__LOC__"propagation_get_received_power_dbm function is deprcated. Use _propagation_get_received_power_dbm")) _propagation_get_received_power_dbm(get_propagation_info(h,t,ti,r,ri),time)
385
386 /// Used to calculate the fading loss. Fading model and parameter must be set in PROPAGATION structure within info.
388#define propagation_calculate_fadingloss(h,t,ti,r,ri) __pragma(message(__LOC__"propagation_calculate_fadingloss function is deprcated. Use _propagation_calculate_fadingloss")) _propagation_calculate_fadingloss(get_propagation_info(h,t,ti,r,ri))
389
390 //Propagation delay
392 NETSIM_ID rx,
393 PPROPAGATION propagation);
394
396 NETSIM_ID rx,
397 PPROPAGATION propagation);
398
399 //Noise
400 _declspec(dllexport) double propagation_acoutics_calculate_noise(double frequency_kHz,
401 double shipping,
402 double windSpeed);
403
404 //Loo fading
405 void initLoo(ptrMARLOVLOO_VAR markovLooVar);
407
408#ifndef _PROPAGATIONMODEL_
409#pragma deprecated(PROPAGATION_HANDLE)
410#endif
411
412#ifdef __cplusplus
413}
414#endif
415#endif //_NETSIM_PROPAGATION_MODEL_H_
unsigned int NETSIM_ID
Definition: Animation.h:45
static ANIM_HANDLE handle
Definition: BatteryModel.c:197
#define UINT
Definition: Linux.h:38
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
#define __CALLBACK__
double propagation_acoutics_calculate_noise(double frequency_kHz, double shipping, double windSpeed)
void(* fnGetTxInfo)(NETSIM_ID nTxId, NETSIM_ID nTxInterface, NETSIM_ID nRxId, NETSIM_ID nRxInterface, PTX_INFO Txinfo)
void propagation_calculate_Range_Based(PPROPAGATION_INFO pinfo, PRECV_POWER p)
struct stru_tx_info TX_INFO
struct stru_pathloss_var * PPATHLOSS_VAR
void propagation_calculate_hata_urban(PPROPAGATION_INFO pinfo, PRECV_POWER p)
struct stru_elevation * ptrELEVATION
struct stru_complexOscillator * ptrCOMPLEXOSCILLATOR
double propagation_acoutics_calculate_propagationDelay(NETSIM_ID tx, NETSIM_ID rx, PPROPAGATION propagation)
struct stru_fading_var FADING_VAR
PATHLOSS_MODEL
@ PATHLOSSMODEL_Indoor_Factory
@ PATHLOSSMODEL_Indoor_Home
@ PATHLOSSMODEL_MATRIX_MODEL
@ PATHLOSSMODEL_Indoor_Office
@ PATHLOSSMODEL_Cost_231_Hata_Urban
@ PATHLOSSMODEL_Friis_Free_Space
@ PATHLOSSMODEL_None
@ PATHLOSSMODEL_Log_Distance
@ PATHLOSSMODEL_TWO_RAY
@ PATHLOSSMODEL_THORP
@ PATHLOSSMODEL_Cost_231_Hata_SubUrban
@ PATHLOSSMODEL_Hata_SubUrban
@ PATHLOSSMODEL_Hata_Urban
@ PATHLOSSMODEL_RANGE_BASED
struct stru_elevation ELEVATION
struct stru_complex _COMPLEX
struct stru_acoutics_propagation_var ACOUTICSPROPVAR
double calculateLooFadingDB(PPROPAGATION_INFO info)
struct stru_state_looParam * ptrLOOPARAMS
struct stru_propagation_model * PPROPAGATION
struct stru_shadowloss_var * PSHADOW_VAR
void propagation_calculate_Matrix_Model(PPROPAGATION_INFO pinfo)
struct stru_fading_var * PFADING_VAR
double _propagation_calculate_lognormalshadow(double standardDeviation, double *Gset, bool *iSet)
void _propagation_calculate_received_power(PPROPAGATION_INFO info, double time)
double _propagation_calculate_logdistancepathloss(double pathLossExponent, double dTx_Rx_Distance, double dCentralFrequency, double d0)
SHADOW_MODEL
@ SHADOWMODEL_LOGNORMAL
@ SHADOWMODEL_CONSTANT
@ SHADOWMODEL_NONE
PPROPAGATION_INFO get_propagation_info(PROPAGATION_HANDLE handle, NETSIM_ID txid, NETSIM_ID txif, NETSIM_ID rxid, NETSIM_ID rxif)
PROPAGATION_MODEL
@ PROPAGATIONMODEL_PATHLOSS_ONLY
@ PROPAGATIONMODEL_PATHLOSS_AND_SHADOWING
@ PROPAGATIONMODEL_PATHLOSS_AND_FADING_AND_SHADOWING
@ PROPAGATIONMODEL_NO_PATHLOSS
struct stru_recvpower * PRECV_POWER
struct stru_oscillator OSCILLATOR
double _propagation_get_received_power_dbm(PPROPAGATION_INFO info, double time)
Used to the received power in dBm over time.
struct stru_tx_info * PTX_INFO
void(* fnUserPathlossModel)(PPROPAGATION_INFO pinfo, PRECV_POWER p)
struct stru_complexOscillator COMPLEXOSCILLATOR
struct stru_temperature_zone * ptrTEMPERATUREZONE
void initLoo(ptrMARLOVLOO_VAR markovLooVar)
struct stru_marko_loo_fading_var * ptrMARLOVLOO_VAR
double propagation_air_calculate_propagationDelay(NETSIM_ID tx, NETSIM_ID rx, PPROPAGATION propagation)
struct stru_pathloss_var PATHLOSS_VAR
struct stru_temperature_zone TEMPERATUREZONE
void propagation_calculate_thorpPathLoss(PPROPAGATION_INFO pinfo, PRECV_POWER p)
void propagation_calculate_Two_Ray(PPROPAGATION_INFO pinfo, PRECV_POWER p)
bool(* fnCheckInterface)(NETSIM_ID nTxId, NETSIM_ID nTxInterface, NETSIM_ID nRxId, NETSIM_ID nRxInterface)
void * PROPAGATION_HANDLE
double _propagation_calculate_fadingloss(PPROPAGATION_INFO info)
Used to calculate the fading loss. Fading model and parameter must be set in PROPAGATION structure wi...
struct stru_marko_loo_fading_var MARKOVLOO_VAR
void propagation_calculate_deterministicshadow(PPROPAGATION_INFO pinfo, PRECV_POWER p)
struct stru_oscillator * ptrOSCILLATOR
struct stru_propagation_info * PPROPAGATION_INFO
void propagation_calculate_hata_Suburban(PPROPAGATION_INFO pinfo, PRECV_POWER p)
PROP_MEDIUM
@ PROPMEDIUM_ACOUSTICS
@ PROPMEDIUM_AIR
void propagation_calculate_lognormalshadow(PPROPAGATION_INFO pinfo, PRECV_POWER p)
FADING_MODEL
@ FADINGMODEL_RAYLEIGH
@ FADINGMODEL_NONE
@ FADINGMODEL_MARKOV_LOO
@ FADINGMODEL_RICIAN
@ FADINGMODEL_NAKAGAMI
struct stru_propagation_model PROPAGATION
struct stru_acoutics_propagation_var * ptrACOUTICSPROPVAR
struct stru_state_looParam LOOPARAMS
void propagation_finish(PROPAGATION_HANDLE handle)
void propagation_calculate_cost231hata(PPROPAGATION_INFO pinfo, PRECV_POWER p, double cm)
struct stru_complex * _ptrCOMPLEX
PROPAGATION_HANDLE propagation_init(MAC_LAYER_PROTOCOL protocol, __CALLBACK__ check_protocol_configure check, __CALLBACK__ fnGetTxInfo fnpGetTxInfo, __CALLBACK__ fnCheckInterface checkInterference)
struct stru_shadowloss_var SHADOW_VAR
PPROPAGATION_INFO propagation_create_propagation_info(NETSIM_ID txId, NETSIM_ID txIf, NETSIM_ID rxId, NETSIM_ID rxIf, char *uniqueId, PTX_INFO txInfo, PPROPAGATION propagation)
bool(* check_protocol_configure)(NETSIM_ID d, NETSIM_ID i)
PTX_INFO _get_tx_info(PPROPAGATION_INFO info)
Used to get the transmitter info. will be used by user code to change the transmitter information at ...
void propagation_calculate_logdistancepathloss(PPROPAGATION_INFO pinfo, PRECV_POWER p)
enum enum_MACProtocol MAC_LAYER_PROTOCOL
Definition: main.h:134
ptrTEMPERATUREZONE tempratureZone
double ** stateTransitionProbability
ptrLOOPARAMS * looParams
ptrMARLOVLOO_VAR markovLooVar
fnCheckInterface fnpCheckInterface
PROPAGATION_MODEL model
ptrACOUTICSPROPVAR acouticsPropVar
PATHLOSS_MODEL pathloss_model
struct stru_recvpower * next
ptrCOMPLEXOSCILLATOR multipathOscillators
ptrOSCILLATOR directSignalOscillators
double dTxAntennaHeight
double dTx_Rx_Distance
double dCentralFrequency
double dRxAntennaHeight