189double GET_BER_802_11_n(
double sinr,
double dBandwidth_MHz,
int MCS)
193 switch ((
int)dBandwidth_MHz)
196 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11n_20MHz))
198 if (sinr >= struPhyParameters_802_11n_20MHz[MCS].SINR)
205 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11n_40MHz))
207 if (sinr >= struPhyParameters_802_11n_40MHz[MCS].SINR)
214 fnNetSimError(
"Unknown channel bandwidth %lf in %s\n", dBandwidth_MHz, __FUNCTION__);
220double GET_BER_802_11_ac(
double sinr,
double dBandwidth_MHz,
int MCS)
223 switch ((
int)dBandwidth_MHz)
226 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ac_20MHz))
228 if (sinr >= struPhyParameters_802_11ac_20MHz[MCS].SINR)
235 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ac_40MHz))
237 if (sinr >= struPhyParameters_802_11ac_40MHz[MCS].SINR)
244 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ac_80MHz))
246 if (sinr >= struPhyParameters_802_11ac_80MHz[MCS].SINR)
253 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ac_160MHz))
255 if (sinr >= struPhyParameters_802_11ac_160MHz[MCS].SINR)
262 fnNetSimError(
"Unknown channel bandwidth %lf in %s\n", dBandwidth_MHz, __FUNCTION__);
269double GET_BER_802_11_ax(
double sinr,
double dBandwidth_MHz,
int MCS)
273 switch ((
int)dBandwidth_MHz)
276 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ax_20MHz))
278 if (sinr >= struPhyParameters_802_11ax_20MHz[MCS].SINR)
285 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ax_40MHz))
287 if (sinr >= struPhyParameters_802_11ax_40MHz[MCS].SINR)
294 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ax_80MHz))
296 if (sinr >= struPhyParameters_802_11ax_80MHz[MCS].SINR)
303 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ax_160MHz))
305 if (sinr >= struPhyParameters_802_11ax_160MHz[MCS].SINR)
312 fnNetSimError(
"Unknown channel bandwidth %lf in %s\n", dBandwidth_MHz, __FUNCTION__);
318double GET_BER(
double sinr,
int MCS,
double dBandwidth_MHz,
string protocol)
323 if (!_stricmp(protocol,
"IEEE_802_11b"))
325 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11b_20MHz))
327 if (sinr >= struPhyParameters_802_11b_20MHz[MCS].SINR)
333 else if ((!_stricmp(protocol,
"IEEE_802_11a")) || (!_stricmp(protocol,
"IEEE_802_11p")) || (!_stricmp(protocol,
"IEEE_802_11g")))
335 if (MCS >= 0 && MCS <
sizeof(struPhyParameters_802_11ag_20MHz))
337 if (sinr >= struPhyParameters_802_11ag_20MHz[MCS].SINR)
343 else if (!_stricmp(protocol,
"IEEE_802_11n"))
344 BER = GET_BER_802_11_n(sinr, dBandwidth_MHz, MCS);
345 else if (!_stricmp(protocol,
"IEEE_802_11ac"))
346 BER = GET_BER_802_11_ac(sinr, dBandwidth_MHz, MCS);
347 else if (!_stricmp(protocol,
"IEEE_802_11ax"))
348 BER = GET_BER_802_11_ax(sinr, dBandwidth_MHz, MCS);
351 NetSimxmlError(
"WLAN---PHY Protocol Configuration Unknown PHY STANDARD", NULL,NULL);
360_declspec(dllexport)
double calculate_BER_Using_Table(PHY_MODULATION modulation,
361 double dReceivedPower_dBm,
362 double dInterferencePower_dBm,
363 double dBandwidth_MHz,
367 double ldEbByN0 = calculate_sinr(dReceivedPower_dBm, dInterferencePower_dBm, dBandwidth_MHz);
369 BER = GET_BER(ldEbByN0, MCS, dBandwidth_MHz, Protocol);