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 = &params; 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的更多相关文章

  1. CentOS 6.6下 BCM4312 802.11b/g无线网卡驱动安装

    1.目前www.broadcom.com网站上最新版本为hybrid-v35,但此版本与2.6.32不匹配,无法识别验证密码,搜索网上说是要求升级内核,后根据http://www.dadclab.co ...

  2. H3C 802.11b/g工作频段划分图

  3. WLAN 802.11 a/b/g PHY Specification and EDVT Measurement V

    Receive Minimum Input Level (Sensitivity) 测试方法: Receiver Adjacent Channel Rejection (ACR) -For IEEE8 ...

  4. 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 ...

  5. 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 ...

  6. 802.11协议帧格式、Wi-Fi连接交互过程、无线破解入门研究

    相关学习资料 Linux黑客大曝光: 第8章 无线网络 无线网络安全攻防实战进阶 无线网络安全 黑客大曝光 第2版 http://zh.wikipedia.org/wiki/IEEE_802.11 h ...

  7. IEEE 802.11 标准列表

    IEEE 802.11 标准列表 IEEE 802.11,1997年,原始标准(2Mbit/s,播在2.4GHz). IEEE 802.11a,1999年,物理层补充(54Mbit/s,播在5GHz) ...

  8. 802.11 wireless 四

    802.11 wireless 4spread spectrum(扩频 - 基于香农定理的算法)1.窄带和扩频是发送信号的两种不同方式2.扩频技术使用更小的能量在波峰3.带宽的需要,基于发送数据的量频 ...

  9. 802.11 wireless 二

    802.11 wireless 2wireless spectrum(无线频谱)1.无线网络使用RF(射频)信号2.无线电也是电磁波3.频谱基于波长被划分,归为多个类型4.无线网络被归为微波段(mic ...

随机推荐

  1. POJ 2679:Adventurous Driving(SPFA+DFS)

    http://poj.org/problem?id=2679 Adventurous Driving Time Limit: 1000MS   Memory Limit: 65536K Total S ...

  2. scrapy实战2分布式爬取lagou招聘(加入了免费的User-Agent随机动态获取库 fake-useragent 使用方法查看:https://github.com/hellysmile/fake-useragent)

    items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentati ...

  3. 02(b)多元无约束优化问题-最速下降法

    此部分内容接02(a)多元无约束优化问题的内容! 第一类:最速下降法(Steepest descent method) \[f({{\mathbf{x}}_{k}}+\mathbf{\delta }) ...

  4. 客户端持久化数据库---indexedDB使用

    _ 阅读目录 一:什么是indexedDB数据库? 二:IndexedDB数据库操作 2.1 打开或创建数据库 2.2 创建对象仓库(或叫创建表) 2.3 创建索引 2.4 新增数据 2.5 读取数据 ...

  5. 【深入浅出-JVM】(6):栈帧.

    代码 package com.mousycoder.mycode.happy_jvm; /** * @version 1.0 * @author: mousycoder * @date: 2019-0 ...

  6. c++小游戏——俄罗斯方块

    #include<cstdio> #include<windows.h> #include<ctime> int a[24][17],i,j,tim=800,ti= ...

  7. 个人永久性免费-Excel催化剂功能第33波-报表形式数据结构转标准数据源

    一般来说,如果有标准的数据源结构,对后续的分析工作将会带来极大的方便.但现实中,许多的原始数据并不预期那样,一个主题的数据已经干净地存放在一个工作表中.今天Excel催化剂再次送上批量化操作,将不规则 ...

  8. 小白开学Asp.Net Core《二》(补)

    小白开学Asp.Net Core<二>(补) ——数据仓储层(Repositroy).服务层(Service) -------------------------------------- ...

  9. 从后端到前端之Vue(四)小试牛刀——真实项目的应用(树、tab、数据列表和分页)

    学以致用嘛,学了这么多,在真实项目里面怎么应用呢?带着问题去学习才是最快的学习方式.还是以前的那个项目,前后端分离,现在把前端换成vue的,暂时采用脚本化的方式,然后在尝试工程化的方式. 现在先实现功 ...

  10. 基于ZK的 Dubbo-admin 与 Dubbo-monitor 搭建

    背景 最近项目中使用了 dubbo 在实现服务注册和发现,需要实现对服务提供者和调用者的监控,之前有研究过基于 redis作为注册中心的监控平台,不过本文基于 zk 作为注册中心,进行 dubbo-a ...