NetSim Source Code Help
Loading...
Searching...
No Matches
IEEE802_11_Phy.h
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2021 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* This source code is licensed per the NetSim license agreement. *
12* *
13* No portion of this source code may be used as the basis for a derivative work, *
14* or used, for any purpose other than its intended use per the NetSim license *
15* agreement. *
16* *
17* This source code and the algorithms contained within it are confidential trade *
18* secrets of TETCOS and may not be used as the basis for any other software, *
19* hardware, product or service. *
20* *
21* Author: Shashi Kant Suman *
22* *
23* ----------------------------------------------------------------------------------*/
24#ifndef _NETSIM_IEEE802_11_PHY_H_
25#define _NETSIM_IEEE802_11_PHY_H_
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30#include "IEEE802_11.h"
31#include "ErrorModel.h"
32
33 //Default Battery config parameter
34#define BATTERY_RECHARGING_CURRENT_MA_DEFAULT 0
35#define BATTERY_VOLTAGE_V_DEFAULT 0
36#define BATTERY_INITIAL_ENERGY_DEFAULT 0
37#define BATTERY_TRANSMITTING_CURRENT_MA_DEFAULT 0
38#define BATTERY_RECEIVING_CURRENT_MA_DEFAULT 0
39#define BATTERY_IDLEMODE_CURRENT_MA_DEFAULT 0
40#define BATTERY_SLEEPMODE_CURRENT_MA_DEFAULT 0
41
42#define CSRANGEDIFF 0 //db
43
44#include "IEEE802_11_HTPhy.h"
45
46 typedef enum
47 {
51 OFDM = 04,
52 DSSS = 05,
53 ERP = 06,
54 HT = 07,
55 VHT = 8,
57
58 /// Enumeration to represent the DSSS rate
60 {
61 Rate_1Mbps = 0x0A,
62 Rate_2Mbps = 0x14,
66
68 {
69 double dDataRate;
71 double dCodeRate;
75
77 {
78 double dDataRate;
81 int nNBPSC;
82 int nNCBPS;
83 int nNDBPS;
85
86 /**
87 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88 ********** PHY layer ************
89 Page-1514 IEEE Std 802.11 2012 Table 16-2 DS PHY characteristics
90 Page-1623 IEEE Std 802.11-2012 Table 18-17—OFDM PHY characteristics
91 Page-361 6.5.4.2 Semantics of the service primitive
92 PLME-CHARACTERISTICS
93 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 */
96 {
118#define getSlotTime(phy) (phy->plmeCharacteristics.aSlotTime)
119#define getSIFSTime(phy) (phy->plmeCharacteristics.aSIFSTime)
120
122 {
128
129 typedef struct stru_802_11_Phy_Var
130 {
131 //Config variable
141
142 //For HT/VHT config variable
146
148
149 //Rate adaptation
151
152 //Data Rate
155
156 //CCA
159
160 //Radio
162
163 //IFS
170
171 //Power
173
174 //Phy type
175 union{
181
182 //MIMO
184 unsigned int NSS; // Number of spatial streams
185 unsigned int NSTS; // Number of space-time streams
186 unsigned int N_HT_DLTF; // Number of Data HT Long Training fields
187 unsigned int NESS; // Number of extension spatial streams
188 unsigned short int nN_HT_DLTF; // Number of Data HT Long Training fields
189 unsigned int N_HT_ELTF; // Number of Extension HT Long Training fields
190 unsigned int N_HT_LTF; // Number of HT Long Training fields (see 20.3.9.4.6)
191 unsigned int MCS;
192 unsigned int NES; // Number of BCC encoders for the Data field
193
195
196 double d0;
197 double pld0;
198
199 //Battery
201 void* battery;
202
204
207
208#define IEEE802_11_CURR_PHY IEEE802_11_PHY(pstruEventDetails->nDeviceId,pstruEventDetails->nInterfaceId)
209
210 //Propagation macro
211 double GET_RX_POWER_dbm(NETSIM_ID tx, NETSIM_ID txi, NETSIM_ID rx, NETSIM_ID rxi, double time);
212#define GET_RX_POWER_mw(tx, txi, rx, rxi, time) (DBM_TO_MW(GET_RX_POWER_dbm(tx, txi, rx, rxi, time)))
213
214 //Function Prototype
215 int fn_NetSim_IEEE802_11_PHY_Init(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
217 void fn_NetSim_IEEE802_11_Add_Phy_Header(NetSim_PACKET* packet, UINT64* transmissionId);
221 bool fn_NetSim_IEEE802_11_TransmitFrame(NetSim_PACKET* pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId);
222 bool fn_NetSim_IEEE802_11_TransmitBroadcastFrame(NetSim_PACKET* pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId);
224 NETSIM_ID rxId, NETSIM_ID rxIf,
225 NetSim_PACKET* packet, double time);
228 int fn_NetSim_IEEE802_11_PropagationModel(NETSIM_ID nodeId, double time);
229 double fn_NetSim_IEEE802_11_CalculateTransmissionTime(double size, NETSIM_ID nDevId, NETSIM_ID nInterfaceId);
232
233 //Radio
236 NETSIM_ID in,
237 PHY_TX_STATUS state,
238 NETSIM_ID peerId,
239 UINT64 transmissionId);
242 bool CheckFrequencyInterfrence(double dFrequency1,double dFrequency2,double bandwidth);
243
244 //IEEE802.11b
247 int fn_NetSim_IEEE802_11_DSSSPhy_DataRate(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID nReceiverId,NetSim_PACKET* packet,double time);
248 unsigned int get_dsss_phy_max_index();
249 unsigned int get_dsss_phy_min_index();
250 void get_dsss_phy_all_rate(double* rate, UINT* len);
251
252 //IEEE802.11a/g/p
255 int fn_NetSim_IEEE802_11_OFDMPhy_DataRate(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID nReceiverId,NetSim_PACKET* packet,double time);
256 unsigned int get_ofdm_phy_max_index();
257 unsigned int get_ofdm_phy_min_index();
258 void get_ofdm_phy_all_rate(int bandwidth_MHz, double* rate, UINT* len);
259
260 //IEEE802.11n
263 void fn_NetSim_IEEE802_11n_OFDM_MIMO_init(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
266 int fn_NetSim_IEEE802_11_HTPhy_DataRate(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID nReceiverId,NetSim_PACKET* packet,double time);
267 unsigned int get_ht_phy_max_index(IEEE802_11_PROTOCOL protocol,UINT);
268 unsigned int get_ht_phy_min_index(IEEE802_11_PROTOCOL protocol,UINT);
269
270 //IEEE802.11ac
271 void fn_NetSim_IEEE802_11ac_OFDM_MIMO_init(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
273 double fn_NetSim_IEEE802_11ac_TxTimeCalculation(NetSim_PACKET *pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId);
274 struct stru_802_11_Phy_Parameters_HT* get_phy_parameter_HT(double dChannelBandwidth,UINT NSS);
275
276 //IEEE1609 Interface
277 PIEEE802_11_PHY_VAR IEEE802_11_PHY(NETSIM_ID ndeviceId, NETSIM_ID nInterfaceId);
278 void SET_IEEE802_11_PHY(NETSIM_ID ndeviceId, NETSIM_ID nInterfaceId, PIEEE802_11_PHY_VAR phy);
279
280#ifdef __cplusplus
281}
282#endif
283#endif //_NETSIM_IEEE802_11_PHY_H_
unsigned int NETSIM_ID
Definition: Animation.h:45
HT
Definition: CLI.h:31
bool isMediumIdle()
Definition: CSMACD_Phy.c:17
#define GET_RX_POWER_dbm(tx, rx, time)
IEEE802_11_CCAMODE
page-1534 16.4.8.5 CCA, and 17.4.8.5 CCA IEEE802.11-2012
Definition: IEEE802_11.h:77
IEEE802_11_PROTOCOL
Enumeration for WLAN PHY protocols.
Definition: IEEE802_11.h:65
struct stru_802_11_phy_radio * ptrIEEE802_11_RADIO
void free_ieee802_11_phy_header(NetSim_PACKET *packet)
IEEE802_11_PHY_TYPE
@ FHSS_2_4_GHz
@ IR_Baseband
@ ERP
@ DSSS_2_4_GHz
@ OFDM
@ VHT
@ DSSS
PHY_TX_STATUS get_radio_state(PIEEE802_11_PHY_VAR phy)
void get_ofdm_phy_all_rate(int bandwidth_MHz, double *rate, UINT *len)
unsigned int get_dsss_phy_min_index()
struct stru_802_11_Phy_Var * PIEEE802_11_PHY_VAR
bool is_radio_idle(PIEEE802_11_PHY_VAR phy)
struct stru_802_11_phy_radio IEEE802_11_RADIO
double get_11ac_preamble_time(PIEEE802_11_PHY_VAR phy)
Definition: IEEE802_11ac.c:180
bool set_radio_state(NETSIM_ID d, NETSIM_ID in, PHY_TX_STATUS state, NETSIM_ID peerId, UINT64 transmissionId)
int fn_NetSim_IEEE802_11_SetDataRate(NETSIM_ID txId, NETSIM_ID txIf, NETSIM_ID rxId, NETSIM_ID rxIf, NetSim_PACKET *packet, double time)
void fn_NetSim_IEEE802_11_HTPhy_SetEDThreshold(PIEEE802_11_PHY_VAR phy)
int fn_NetSim_IEEE802_11_HTPhy_DataRate(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID nReceiverId, NetSim_PACKET *packet, double time)
enum_802_11_DSSS_PLCP_SIGNAL_Field
Enumeration to represent the DSSS rate
@ Rate_1Mbps
@ Rate_2Mbps
@ Rate_5dot5Mbps
@ Rate_11Mbps
bool fn_NetSim_IEEE802_11_TransmitBroadcastFrame(NetSim_PACKET *pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId)
struct stru_802_11_PHY_PLME_characteristics PLME_CHARACTERISTICS
PIEEE802_11_PHY_VAR IEEE802_11_PHY(NETSIM_ID ndeviceId, NETSIM_ID nInterfaceId)
int fn_NetSim_IEEE802_11_DSSSPhy_DataRate(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID nReceiverId, NetSim_PACKET *packet, double time)
struct stru_IEEE802_11_OFDM_Phy IEEE802_11_OFDM_PHY
unsigned int get_ht_phy_max_index(IEEE802_11_PROTOCOL protocol, UINT)
double fn_NetSim_IEEE802_11_CalculateTransmissionTime(double size, NETSIM_ID nDevId, NETSIM_ID nInterfaceId)
struct stru_802_11_Phy_Parameters_HT * get_phy_parameter_HT(double dChannelBandwidth, UINT NSS)
struct stru_IEEE802_11_DSSS_Phy IEEE802_11_DSSS_PHY
int fn_NetSim_IEEE802_11_PropagationModel(NETSIM_ID nodeId, double time)
int fn_NetSim_IEEE802_11_PhyOut()
double fn_NetSim_IEEE802_11n_TxTimeCalculation(NetSim_PACKET *pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId)
void fn_NetSim_IEEE802_11n_OFDM_MIMO_init(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId)
Definition: IEEE802_11n.c:35
unsigned int get_ht_phy_min_index(IEEE802_11_PROTOCOL protocol, UINT)
void fn_NetSim_IEEE802_11_OFDMPhy_SetEDThreshold(PIEEE802_11_PHY_VAR phy)
int fn_NetSim_IEEE802_11_OFDMPhy_DataRate(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID nReceiverId, NetSim_PACKET *packet, double time)
int fn_NetSim_IEEE802_11_HTPhy_UpdateParameter()
struct stru_IEEE802_11_DSSS_Phy * PIEEE802_11_DSSS_PHY
int fn_NetSim_IEEE802_11_PHY_Init(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId)
unsigned int get_ofdm_phy_min_index()
void fn_NetSim_IEEE802_11_DSSPhy_SetEDThreshold(PIEEE802_11_PHY_VAR phy)
bool fn_NetSim_IEEE802_11_TransmitFrame(NetSim_PACKET *pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId)
int fn_NetSim_IEEE802_11_OFDMPhy_UpdateParameter()
void fn_NetSim_IEEE802_11_Add_Phy_Header(NetSim_PACKET *packet, UINT64 *transmissionId)
struct stru_802_11_PHY_PLME_characteristics * PPLME_CHARACTERISTICS
void copy_ieee802_11_phy_header(NetSim_PACKET *d, NetSim_PACKET *s)
int fn_NetSim_IEEE802_11_DSSPhy_UpdateParameter()
enum enum_802_11_DSSS_PLCP_SIGNAL_Field IEEE802_11_DSSS_PLCP_SIGNAL
Enumeration to represent the DSSS rate
struct stru_IEEE802_11_OFDM_Phy * PIEEE802_11_OFDM_PHY
void SET_IEEE802_11_PHY(NETSIM_ID ndeviceId, NETSIM_ID nInterfaceId, PIEEE802_11_PHY_VAR phy)
unsigned int get_dsss_phy_max_index()
double get_11n_preamble_time(PIEEE802_11_PHY_VAR phy)
Definition: IEEE802_11n.c:113
double fn_NetSim_IEEE802_11_GetMinRxSensitivity(NETSIM_ID txId, NETSIM_ID txIf)
void fn_NetSim_IEEE802_11ac_OFDM_MIMO_init(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId)
Definition: IEEE802_11ac.c:25
unsigned int get_ofdm_phy_max_index()
void get_dsss_phy_all_rate(double *rate, UINT *len)
int fn_NetSim_IEEE802_11_PhyIn()
double get_preamble_time(PIEEE802_11_PHY_VAR phy)
void set_mac_state_after_txend(PIEEE802_11_MAC_VAR mac)
double fn_NetSim_IEEE802_11_HTPhy_getCtrlFrameDataRate(PIEEE802_11_PHY_VAR pstruPhy)
double fn_NetSim_IEEE802_11ac_TxTimeCalculation(NetSim_PACKET *pstruPacket, NETSIM_ID nDevId, NETSIM_ID nInterfaceId)
Definition: IEEE802_11ac.c:140
bool CheckFrequencyInterfrence(double dFrequency1, double dFrequency2, double bandwidth)
struct stru_802_11_Phy_Var IEEE802_PHY_VAR
#define UINT64
Definition: Linux.h:37
#define UINT
Definition: Linux.h:38
#define UINT16
Definition: Linux.h:33
enum enum_tx_status PHY_TX_STATUS
enum enum_Modulation PHY_MODULATION
enum enum_PacketStatus PACKET_STATUS
Definition: main.h:128
Table 20-5—Timing-related constants and Table 20-6—Frequently used parameters.
Data structure for physical layer parameters.
double dCurrentRxSensitivity_dbm
IEEE802_11_PHY_TYPE PhyType
IEEE802_11_OFDM_MIMO ofdmPhy_11n
IEEE802_11_RADIO radio
union stru_802_11_Phy_Var::@4 PHY_TYPE
IEEE802_11_DSSS_PHY dsssPhy
PACKET_STATUS firstpacketstatus
IEEE802_11_PROTOCOL PhyProtocol
IEEE802_11_CCAMODE ccaMode
unsigned int N_HT_LTF
IEEE802_11_OFDM_PHY ofdmPhy
unsigned int N_HT_DLTF
ptrpropagation_info_for_list propagation_info_list
unsigned short int nN_HT_DLTF
IEEE802_11_OFDM_MIMO ofdmPhy_11ac
PLME_CHARACTERISTICS plmeCharacteristics
unsigned int N_HT_ELTF
PHY_TX_STATUS radioState
IEEE802_11_DSSS_PLCP_SIGNAL dsssrate
PHY_MODULATION modulation
PHY_MODULATION modulation