ns3 802.11b PHY model
I use the ubuntu and do not install the chinse input.
The Code: c file requires gnu gsl library, it can be installed easily because many tutorial.
Although the code style is poor, it can be clear for you to read and can be copy to your edit tool.
gcc -Wall -I/usr/local/include -c 80211b.c
gcc -Wall -L/usr/local/lib 80211b.o lgsl 0lgslcblas -lm -o 80211b
./80211b >80211b.txt
// Copyright 2009, The Boeing Company #include "math.h"
#include "stdlib.h"
#include "stdio.h" #include <gsl/gsl_math.h>
#include <gsl/gsl_integration.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_sf_bessel.h> #define min(a,b) ((a)<(b) ? (a) : (b))
#define max(a,b) ((a)>(b) ? (a) : (b))
//page 67 802.15 that pdf kanghl
#define WLAN_SIR_perfect 10.0 // if SIR > 10dB, perfect reception
#define WLAN_SIR_impossible 0.1 // if SIR < -10dB, impossible to receive typedef struct fn_parameter_t
{
double beta;
double n;
}fn_parameters; double QFunction (double x)
{
return 0.5 * erfc(x/sqrt(2.0));
}
//not understand
double f(double x, void *params)
{
double beta = ((fn_parameters *) params)->beta;
double n = ((fn_parameters *) params)->n;
double f = pow( *gsl_cdf_ugaussian_P (x+ beta) - , n-)
* exp (-x*x/2.0) / sqrt (2.0 * M_PI); return f;
} double p_e2(double e2)
{
double sep;
double error; fn_parameters params;
params.beta = sqrt (2.0*e2);
params.n = 8.0; gsl_integration_workspace * w = gsl_integration_workspace_alloc (); gsl_function F;
F.function = &f;
F.params = ¶ms; gsl_integration_qagiu(&F,-params.beta,
, 1e-, , w, &sep, &error);
gsl_integration_workspace_free (w);
if (error == 0.0) sep = 1.0; return 1.0 - sep;
} double p_e1(double e1)
{
return 1.0 - pow( 1.0 - p_e2 (e1/2.0), 2.0);
} double DbToNoneDb (double x)
{
return pow(10.0, x/10.0);
} double NoneDbToDb (double x)
{
return 10.0 * log10 (x) ;
} double DQPSKFunction (double x)
{
double pi = acos (-1.0);
return ( (sqrt(2.0) + 1.0) / sqrt(8.0*pi*sqrt(2.0)))
*(1.0/sqrt(x))
*exp( - (2.0 - sqrt(2.0)) * x) ;
}
//P1MBPS-SYMBOL BER=SER
double Get80211bDsssDbpskBerIeee(double EcNc)
{
double ber;
if(EcNc > WLAN_SIR_perfect) ber = ;
else if(EcNc < WLAN_SIR_impossible) ber = 0.5;
else
ber = min(QFunction(sqrt(11.0*EcNc)),0.5);
return ber;
} double Get80211bDsssDbpskBer(double sinr)
{
double EbN0 = sinr * 22000000.0 / 1000000.0;
double ber = 0.5 * exp(-EbN0);
return ber;
} double Get80211bDsssDqpskBerIeee(double EcNc)
{
double ber;
if (EcNc > WLAN_SIR_perfect) ber = ;
else if(EcNc < WLAN_SIR_impossible) ber = 0.5;
else
ber = min(QFunction(sqrt(5.5*EcNc)),0.5);
return ber;
} double Get80211bDsssDqpskBer(double sinr)
{
// 2 bits per symbol, 1 MSPS
double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0;
double ber = DQPSKFunction(EbN0);
return ber;
} double Get80211bDsssDqpskCCK5_5BerIeee(double EcNc)
{
double ber;
if(EcNc > WLAN_SIR_perfect) ber = 0.0 ;
else if(EcNc < WLAN_SIR_impossible) ber = 0.5;
else
{
double pew = 14.0*QFunction(sqrt(EcNc*8.0)) + QFunction(sqrt(EcNc*16.0));
pew = min(pew, 0.99999);
ber = 8.0/15.0 * pew;
}
return ber;
} double Get80211bDsssDqpskCCK11BerIeee(double EcNc)
{
double ber;
if(EcNc > WLAN_SIR_perfect) ber = 0.0 ;
else if(EcNc < WLAN_SIR_impossible) ber = 0.5;
else
{
double pew = 24.0*QFunction(sqrt(EcNc*4.0)) +
16.0*QFunction(sqrt(EcNc*6.0)) +
174.0*QFunction(sqrt(EcNc*8.0)) +
16.0*QFunction(sqrt(EcNc*10.0)) +
24.0*QFunction(sqrt(EcNc*12.0)) +
QFunction(sqrt(EcNc*16.0));
pew = min(pew, 0.99999);
ber = 128.0/255.0 * pew;
}
return ber;
} int main (int argc, char *argv[])
{
double rss, sinr;
double totalPkt = 200.0;
//double noise = 1.552058;
double noise = ;
double EcNc, EbN01, EbN02, EbN05, EbN011;
double ieee1,ieee2,ieee5,ieee11;
double numBits = (. + . + .) * .;
double dbpsk,dqpsk,cck16,cck256,sepcck16,sepcck256; noise = DbToNoneDb(noise) * 1.3803e-23 * 290.0 * ;
for (rss=-102.0; rss <= -80.0; rss += 0.1)
{
sinr = DbToNoneDb(rss)/1000.0/noise;
EcNc = sinr * 22000000.0 / 11000000.0; // IEEE sir
EbN01 = sinr * 22000000.0 / 1000000.0;
// 2 bits per symbol, 1 MSPS
EbN02 = sinr * 22000000.0 / 1000000.0 / 2.0;
EbN05 = sinr * 22000000.0 / 1375000.0 / 4.0;
EbN011 = sinr * 22000000.0 / 1375000.0 / 8.0;
// 1=rss, 2=EcNc, 3=EbN01, 4=EbN02, 5=EBN05, 6=EbN011
printf("%g %g %g %g %g %g ", rss, NoneDbToDb(EcNc),
NoneDbToDb(EbN01),NoneDbToDb(EbN02),
NoneDbToDb(EbN05),NoneDbToDb(EbN011)); ieee1 = Get80211bDsssDbpskBerIeee (EcNc);
ieee2 = Get80211bDsssDqpskBerIeee (EcNc);
ieee5 = Get80211bDsssDqpskCCK5_5BerIeee (EcNc);
ieee11 = Get80211bDsssDqpskCCK11BerIeee (EcNc);
// 7=ber_ieee1, 8=ber_ieee2, 9=ber_ieee5, 10=ber_ieee11
printf(" %g %g %g %g ", ieee1, ieee2,ieee5,ieee11); ieee1 = totalPkt*pow(-ieee1, numBits);
ieee2 = totalPkt*pow(-ieee2, numBits);
ieee5 = totalPkt*pow(-ieee5, numBits);
ieee11 = totalPkt*pow(-ieee11, numBits);
// 11=pkt_ieee1, 12=pkt_ieee2, 13=pkt_ieee5, 14=pkt_ieee11
printf(" %g %g %g %g ", ieee1, ieee2,ieee5,ieee11); dbpsk = Get80211bDsssDbpskBer (sinr);
dqpsk = Get80211bDsssDqpskBer (sinr);
cck16 = max(, 8.0/15.0*p_e2(4.0*EbN05/2.0));
cck256 = max(, 128.0/255.0*p_e1(8.0*EbN011/2.0));
// 15=ber_dbpsk, 16=ber_dqpsk, 17=ber_cck16, 18=ber_cck256
printf(" %g %g %g %g ", dbpsk, dqpsk,cck16,cck256); dbpsk = totalPkt*pow(-dbpsk,numBits);
dqpsk = totalPkt*pow(-dqpsk,numBits);
sepcck16 = p_e2(4.0*EbN05/2.0);
sepcck256 = p_e1(8.0*EbN011/2.0);
cck16 = totalPkt*pow(1.0-sepcck16,numBits/4.0);
cck256 = totalPkt*pow(1.0-sepcck256,numBits/8.0);
// 19=pkt_dbpsk, 20=pkt_dqpsk, 21=pkt_cck16, 22=pkt_cck256
printf(" %g %g %g %g ", dbpsk, dqpsk,cck16,cck256);
// 23=sinr
printf(" %g \n",NoneDbToDb(sinr));
}
return ;
}
80211b.c
gnuplot code
set term postscript eps color enh "Times-BoldItalic"
set output '80211b.ieee.pkt.eps'
set xlabel "RSS (dBm)"
set ylabel "Packet Received"
set yrange [:]
set xrange [-:-]
plot "80211b.txt" using : title '1M IEEE', \
"80211b.txt" using : title '2M IEEE', \
"80211b.txt" using : title '5.5M IEEE', \
"80211b.txt" using : title '11M IEEE'
set term postscript eps color enh "Times-BoldItalic"
set output '80211b.ns3.pkt.eps'
set xlabel "RSS (dBm)"
set ylabel "Packet Received"
set yrange [:]
set xrange [-:-]
plot "80211b.txt" using : title '1M DBPSK', \
"80211b.txt" using : title '2M DQPSK', \
"80211b.txt" using : title '5.5M CCK16', \
"80211b.txt" using : title '11M CCK256'
set term postscript eps color enh "Times-BoldItalic"
set output '80211b.ieee.sir.eps'
set xlabel "SIR"
set ylabel "BER"
set yrange [10e-:]
set xrange [-:]
set logscale y
plot "80211b.txt" using : title '1M IEEE', \
"80211b.txt" using : title '2M IEEE', \
"80211b.txt" using : title '5.5M IEEE', \
"80211b.txt" using : title '11M IEEE'
plot80211b



reference: http://www.nsnam.org/~pei/80211b.pdf
ns3 802.11b PHY model的更多相关文章
- CentOS 6.6下 BCM4312 802.11b/g无线网卡驱动安装
1.目前www.broadcom.com网站上最新版本为hybrid-v35,但此版本与2.6.32不匹配,无法识别验证密码,搜索网上说是要求升级内核,后根据http://www.dadclab.co ...
- H3C 802.11b/g工作频段划分图
- WLAN 802.11 a/b/g PHY Specification and EDVT Measurement V
Receive Minimum Input Level (Sensitivity) 测试方法: Receiver Adjacent Channel Rejection (ACR) -For IEEE8 ...
- 2019.1.3 WLAN 802.11 a/b/g PHY Specification and EDVT Measurement II - Transmit Spectrum Mask & Current Consumption
Transmit Spectrum Mask Specification – 802.11b SpecificationFor 802.11b 18.4.7.3The transmitted spec ...
- 2019.1.3 WLAN 802.11 a/b/g PHY Specification and EDVT Measurement I - Transmit Power Level
This lecture provides the WLAN hardware engineer the essential knowledge of IEEE 802.11 a/b/g physic ...
- 802.11协议帧格式、Wi-Fi连接交互过程、无线破解入门研究
相关学习资料 Linux黑客大曝光: 第8章 无线网络 无线网络安全攻防实战进阶 无线网络安全 黑客大曝光 第2版 http://zh.wikipedia.org/wiki/IEEE_802.11 h ...
- IEEE 802.11 标准列表
IEEE 802.11 标准列表 IEEE 802.11,1997年,原始标准(2Mbit/s,播在2.4GHz). IEEE 802.11a,1999年,物理层补充(54Mbit/s,播在5GHz) ...
- 802.11 wireless 四
802.11 wireless 4spread spectrum(扩频 - 基于香农定理的算法)1.窄带和扩频是发送信号的两种不同方式2.扩频技术使用更小的能量在波峰3.带宽的需要,基于发送数据的量频 ...
- 802.11 wireless 二
802.11 wireless 2wireless spectrum(无线频谱)1.无线网络使用RF(射频)信号2.无线电也是电磁波3.频谱基于波长被划分,归为多个类型4.无线网络被归为微波段(mic ...
随机推荐
- .Net之Layui多图片上传
前言: 多图上传在一些特殊的需求中我们经常会遇到,其实多图上传的原理大家都有各自的见解.对于Layui多图上传和我之前所说的通过js获取文本框中的文件数组遍历提交的原理一样,只不过是Layui中的up ...
- CentOS 操作防火墙
1:查看防火状态 systemctl status firewalld 2:暂时关闭防火墙 systemctl stop firewalld 3:永久关闭防火墙 systemctl disable f ...
- 基于SpringBoot的Web API快速开发基础框架
其实还是很因为懒,才会有这个案例项目的产生,每次开启一个终端的小服务都要整理一次框架,造成重复的.不必要的.缺乏创造性的劳动,SO,本着可以用.用着简单的原则上传代码到Github,希望有需要的朋友直 ...
- Spring Boot + Elasticsearch 实现索引批量写入
在使用Eleasticsearch进行索引维护的过程中,如果你的应用场景需要频繁的大批量的索引写入,再使用上篇中提到的维护方法的话显然效率是低下的,此时推荐使用bulkIndex来提升效率.批写入数据 ...
- Java SpringBoot 如何使用 IdentityServer4 作为验证学习笔记
这边记录下如何使用IdentityServer4 作为 Java SpringBoot 的 认证服务器和令牌颁发服务器.本人也是新手,所以理解不足的地方请多多指教.另外由于真的很久没有写中文了,用词不 ...
- vmware的卸载
vmware出了点问题,在控制面板里或者是360都没法删除干净.在网上搜了点资料,找到一些删除的方法,参考链接如下: http://zhidao.baidu.com/question/30902992 ...
- Java编程思想:利用内部类实现的工厂模式
public class Test { public static void main(String[] args) { Factories.test(); } } /* 设计模式之禅中的工厂模式是这 ...
- 记录一次pycharm中,引入其他类可用,下面总是有波浪线,而且Ctrl+b 无法查看类函数的源码
最近在玩python,发现引入其他的函数们总是有波浪线,但是能够使用,crtl+b却无法看到,非常尴尬,然后查看了原因,记录如下: This inspection detects names that ...
- Excel催化剂开源第13波-VSTO开发之DataGridView控件几个小坑
Excel催化剂内部大量使用了DataGridView,这其中有一些小坑,花了力气才解决的,在此给广大开发者作简单分享. 为何要使用DataGridView而不是其他控件如ListBox.ListVi ...
- 【干货干货】hyperledger fabric 之动态添加组织/修改配置 (Fabric-java-sdk) 下
我们接着上一节来讲: 在熟悉动态增加组织或修改配置的步骤后,我们就可以使用java的api来完成动态增加组织或修改配置了: 废话不多说,直接上干货: 1,预制条件 org3的证书以及组织3的MSP详情 ...