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 ...
随机推荐
- 剑指offer第二版-10.斐波那契数列
面试题10:斐波那契数列 题目要求: 求斐波那契数列的第n项的值.f(0)=0, f(1)=1, f(n)=f(n-1)+f(n-2) n>1 思路:使用循环从下往上计算数列. 考点:考察对递归 ...
- EnjoyingSoft之Mule ESB开发教程第二篇:Mule ESB基本概念
目录 1. 使用Anypoint Studio开发 2. Mule ESB Application Structure - Mule ESB应用程序结构 3. Mule ESB Application ...
- Balking设计模式
import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayLi ...
- Java编程思想:为什么要使用内部类
public class Test { public static void main(String[] args) { Callbacks.test(); } } /* 为什么需要内部类: 1.可以 ...
- PipelineDB Install and Test
Installation Prerequisites: CentOS Linux release 7.2.1511 (Core) Download [root@citus1 ~]# wget http ...
- 手机web app开发笔记
各位朋友好,最近自学开发了一个手机Web APP,“编程之路”,主要功能包括文章的展示,留言,注册登录,音乐播放等.为了记录学习心得,提高自己的编程水平,也许对其他朋友有点启发,特整理开发笔记如下. ...
- FC游戏修改教程(hack)小白文。
FC(NES)红白机Family Computer(简称FAMICOM)(或Nintendo Entertainment System)是任天堂公司发行的第一代家用游戏机. 修改FC游戏需要的工具有 ...
- UVA101 The Blocks Problem 题解
题目链接:https://www.luogu.org/problemnew/show/UVA101 这题码量稍有点大... 分析: 这道题模拟即可.因为考虑到所有的操作vector可最快捷的实现,所以 ...
- springboot简单入门笔记
一.Spring Boot 入门 1.Spring Boot 简介 简化Spring应用开发的一个框架: 整个Spring技术栈的一个大整合: J2EE开发的一站式解决方案: 2.微服务 2014,m ...
- 「Sqlserver」数据分析师有理由爱Sqlserver之一-好用的插件工具推荐
在此系列中,笔者为大家带来一些以数据分析师视角去使用Sqlserver的系列文章,希望笔者走过的路能够给后来者带来一些便利. 背景介绍 在数据分析师的角色下,使用数据库更多的是为了从数据库中获取数据, ...