function [H_Channel,d_lp,h_vertical,LED_coord,testot ] = VLC_Ch_diffuse_4single(LED_ID,mode,h_receiver)
% VLC信道传输
% 信道模型,3*3*3室内模型,16*4LED
% 只考虑一次反射
%% 房间模型参数
% Radi_half = 30/180*pi;
% m = -1/log2(cos(Radi_half)); % 朗伯辐射系数2
m = 1; % LED朗伯系数,对应半功率角为60°
n = 1; % 室内墙面的漫反射朗伯系数,一般为1
p_wall = 0.6; % 墙壁平均反射系数
A_wall = 1e-2; % 每小块反射面积0.01m2
reflect_x = 0.2 : 0.10 : 2.8; % 反射点高度范围
reflect_y = 0.5 : 0.10 : 2.6; % 每堵墙反射点的坐标
H_led = 3.0;
%% 接收机位置
test_x = 0.45:0.15:2.55; % train 0.4:0.1:2.6 test 0.45:0.15:2.55
test_y = 0.45:0.15:2.55;
% [X,Y] = meshgrid(test_x,test_y);
la = length(test_x);
testot = zeros(la*la,2);
count = 1;
for i = 1:la
for j = 1:la
testot(count,1) = test_x(i);
testot(count,2) = test_y(j);
count = count + 1;
end
end
% h_receiver = 0.4;
h_vertical = H_led - h_receiver;
%% 发射机模型参数
LED_coord = [0.7,0.7; 0.7,2.2; 2.2,2.2; 2.2,0.7]; % LED中心坐标
Xl_1 = 0.65 : 0.05 : 0.85; % 每个大LED灯中,led间隔0.05m
Yl_1 = 0.65 : 0.05 : 0.85; % 10cm的筒灯
Xl_2 = 0.65 : 0.05 : 0.85;
Yl_2 = 2.15 : 0.05 : 2.35;
Xl_3 = 2.15 : 0.05 : 2.35;
Yl_3 = 2.15 : 0.05 : 2.35;
Xl_4 = 2.15 : 0.05 : 2.35;
Yl_4 = 0.65 : 0.05 : 0.85;
d_lp = zeros(la*la,1);
if LED_ID == 1
Xl = Xl_1; % 第一个大灯
Yl = Yl_1; % 每个包含25个灯珠
for i = 1:size(testot,1)
d_lp(i) = sqrt((testot(i,1) - LED_coord(LED_ID,1))^2 + (testot(i,2) - LED_coord(LED_ID,2))^2 + h_vertical^2); % 对应LED中心坐标到pd的距离
end
end
% Led_num = length(Xl)*length(Xl);
if LED_ID == 2
Xl = Xl_2; % 第er个大灯
Yl = Yl_2; % 每个包含25个灯珠
for i = 1:size(testot,1)
d_lp(i) = sqrt((testot(i,1) - LED_coord(LED_ID,1))^2 + (testot(i,2) - LED_coord(LED_ID,2))^2 + h_vertical^2);
end
% Led_num = length(Xl)*length(Xl);
end
if LED_ID == 3
Xl = Xl_3; % 第3个大灯
Yl = Yl_3; % 每个包含25个灯珠
for i = 1:size(testot,1)
d_lp(i) = sqrt((testot(i,1) - LED_coord(LED_ID,1))^2 + (testot(i,2) - LED_coord(LED_ID,2))^2 + h_vertical^2);
end
% Led_num = length(Xl)*length(Xl);
end
if LED_ID == 4
Xl = Xl_4; % 第4个大灯
Yl = Yl_4; % 每个包含25个灯珠
for i = 1:size(testot,1)
d_lp(i) = sqrt((testot(i,1) - LED_coord(LED_ID,1))^2 + (testot(i,2) - LED_coord(LED_ID,2))^2 + h_vertical^2);
end
end
% Led_num = length(Xl)*length(Xl);
% case LED_ID == 5
% Xl = [Xl_1 Xl_2 Xl_3 Xl_4]; % 4个大灯
% Yl = [Yl_1 Yl_2 Yl_3 Yl_4]; % 每个包含25*4个灯珠
% Led_num = (length(Xl)/4)^2*4;
Zl = H_led*ones(length(Xl));
% pt = 0.5; % LED功率W,总功率就是0.5*484W
Aeff = 1e-4; % 接收器有效面积cm
r = 1.5; % 接收器表面折射指数
Ts = 1; % 接收机光滤波器增益
FOV = 1*pi/4; % 接收机视角,45(半角)°;led辐射角60°
g = r^2/sin(FOV)^2; % 接收机光学集中器增益,当入射角小于FOV时为定值,否则为0
T = 0:0.1:25; %响应时间(ns),采样精度为0.1ns
c = 0.3; % 光速
% k = 0.95; %Nlos链路导致的功率损失
%% mode = 0,只考虑直射;mode = 1,考虑一次反射
if mode == 0
H_Channel = zeros(la^2,length(T));
%% 不考虑漫反射
for loop = 1:size(testot,1)
coordinate = [testot(loop,1) testot(loop,2) h_receiver]; % 接收机坐标
h0 = zeros(size(T));
f = zeros(size(T));
for i = 1 : length(Xl)
for j = 1 : length(Xl)
[d,cos_out,cos_in ] = DirectParameter(Xl(i),Yl(j),Zl(1),coordinate(1),coordinate(2),coordinate(3)); % 计算两点之间的距离及角度
for t = 1:length(T)
f(t) = Dirac(T(t) - round(10*d/c)/10);%单位冲激函数,其中对信号量化处理
end
temp = Aeff*(m+1)/(2*pi)*g*Ts*(cos_out).^m.*cos_in./d.^2*f;% 计算功率
if cos_in < cos(FOV)
temp = 0;%角度大于FOV,光学集中器增益为0
end
h0 = h0 + temp;
% [aaa I] = max(h0)
% figure
% plot(T,h0);
H_Channel(loop,:) = h0;
end
end
end
% figure(1)
% plot(T,h0);
% title('(任一点信道冲激响应(不考虑漫反射)')
% xlabel('时间');
% ylabel('幅度');
end
if mode ==1
docount = 0;
for loop = 1:size(testot,1)
coordinate = [testot(loop,1) testot(loop,2) h_receiver]; % 接收机坐标
%% 不考虑漫反射
h0 = zeros(size(T));
f = zeros(size(T));
for i = 1 : length(Xl)
for j = 1 : length(Xl)
[d,cos_out,cos_in ] = DirectParameter(Xl(i),Yl(j),Zl(1),coordinate(1),coordinate(2),coordinate(3)); % 计算两点之间的距离及角度
for t = 1:length(T)
f(t) = Dirac(T(t) - round(10*d/c)/10);%单位冲激函数,其中对信号量化处理
end
temp = Aeff*(m+1)/(2*pi)*g*Ts*(cos_out).^m.*cos_in./d.^2*f;% 计算功率
if cos_in < cos(FOV)
temp = 0;%角度大于FOV,光学集中器增益为0
end
h0 = h0 + temp;
end
end
% figure(1)
% plot(T,h0);
% title('(任一点信道冲激响应(不考虑漫反射)')
% xlabel('时间');
% ylabel('幅度');
%% 考虑漫反射
h2_e = zeros(length(t),length(t));
for i = 1 : length(Xl)
for j = 1 : length(Xl)
% 一次反射相关参数,发射机Xl(i),Yl(j),Zl(i),反射点(xp,yp,zp),接收机t(x),t(y),h_receiver
% d1为发射机到反射点距离
xp_e = 6; yp_e = reflect_x; zp_e = reflect_y;
for y = 1 : length(reflect_y)
for x = 1 : length(reflect_x)
[d1_e(x,y),angle_out1_e(x,y),angle_in1_e(x,y) ] = OneReflectParameter_in(Xl(i),Yl(j),Zl(i),xp_e,yp_e(x),zp_e(y)); % 计算两点之间的距离及角度
[d2_e(x,y),angle_out2_e(x,y),angle_in2_e(x,y) ] = OneReflectParameter_out(xp_e,yp_e(x),zp_e(y),coordinate(1),coordinate(2),coordinate(3)); % 计算两点之间的距离及角度
d_temp = d1_e(x,y) + d2_e(x,y);
for t = 1:length(T)
f(t) = Dirac(T(t) - round(10*d_temp/c)/10);%单位冲激函数,其中对信号量化处理
end
h1_e = A_wall*(m+1)/(2*pi)*(cos(angle_out1_e(x,y)/180*pi)).^m.*cos(angle_in1_e(x,y)/180*pi)./d1_e(x,y).^2;% 计算反射点的照度
h2_e_temp = f*Aeff*p_wall*(n+1)/(2*pi)*h1_e*g*Ts*(cos(angle_out2_e(x,y)/180*pi)).^n.*cos(angle_in2_e(x,y)/180*pi)./d2_e(x,y).^2;% 计算照度
if angle_in2_e(x,y)/180*pi > FOV
h2_e_temp = 0;
end
h2_e = h2_e + h2_e_temp;
end
end
end
end
% figure(2)
% plot(T,h2_e);
% title('(任一点信道冲激响应(考虑漫反射)')
% xlabel('时间');
% ylabel('幅度');
h2_w = zeros(length(t),length(t));
for i = 1 : length(Xl)
for j = 1 : length(Xl)
% 一次反射相关参数,发射机Xl(i),Yl(j),Zl(i),反射点(xp,yp,zp),接收机t(x),t(y),h_receiver
% d1为发射机到反射点距离
xp_w = 0; yp_w = reflect_x; zp_w = reflect_y;
for y = 1 : length(reflect_y)
for x = 1 : length(reflect_x)
[d1_w(x,y),angle_out1_w(x,y),angle_in1_w(x,y) ] = OneReflectParameter_in(Xl(i),Yl(j),Zl(i),xp_w,yp_w(x),zp_w(y)); % 计算两点之间的距离及角度
[d2_w(x,y),angle_out2_w(x,y),angle_in2_w(x,y) ] = OneReflectParameter_out(xp_w,yp_w(x),zp_w(y),coordinate(1),coordinate(2),coordinate(3)); % 计算两点之间的距离及�
阿__星
- 粉丝: 3771
- 资源: 10
最新资源
- c89d601238f853a62af1e46d9dca8505.docx
- opencv人脸检测识别
- 数据集-目标检测系列- 凤梨 菠萝 检测数据集 pineapple >> DataBall
- 最新程序员IT简历模板,.NET Java简历模板
- 数据集-目标检测系列- 火龙果 检测数据集 pitaya >> DataBall
- 金属表面缺陷检测相关论文一则
- java 音乐播放器 音乐系统 音乐网站平台 项目源码 web ssm jsp 【项目源码+数据库脚本+项目说明】(毕设)
- 数据集-目标检测系列- 草莓 检测数据集 Strawberry >> DataBall
- 数据集-目标检测系列- 西瓜 检测数据集 watermelon>> DataBall
- 双脉冲回路中计算寄生电感
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
前往页