-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatlab_longley_rice_angles_rev2.m
More file actions
203 lines (165 loc) · 6.49 KB
/
matlab_longley_rice_angles_rev2.m
File metadata and controls
203 lines (165 loc) · 6.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
function [dBloss,prop_mode]=matlab_longley_rice_angles_rev2(app,sim_array_list_bs,sim_pt,reliability,confidence,FreqMHz,parallel_flag)
if parallel_flag==0
disp_progress(app,strcat('Starting Matlab Longley Rice. . . '))
end
%%%%%%%%%%%%%%%%%%%%%%Matlab TIREM and Longly Rice
FreqHz=FreqMHz*1000000; %%%%%Hz
[num_bs,~]=size(sim_array_list_bs);
num_rel=length(reliability);
% % if isdeployed==1
% % NET.addAssembly(which('SEADLib.dll'));
% % else
% % NET.addAssembly(fullfile('C:\USGS', 'SEADLib.dll'));
% % end
% %
% % itmp=ITMAcs.ITMP2P;
% % TerHandler=int32(1); % 0 for GLOBE, 1 for USGS
% % TerDirectory='C:\USGS\';
%%%%%Mode of Variability (MDVAR) 13 (broadcast p2p)
%Climate Derived by using ITU-R.P.617
%%%Persisent Load
retry_load=1;
while(retry_load==1) %%%This will continue to pin the move_list_function
try
load('TropoClim.mat','TropoClim')
retry_load=0;
catch
retry_load=1;
if parallel_flag==0
disp_progress(app,strcat('Error in ITM --> Loading TropoClim'))
end
error=NaN(1);
save(strcat('ERROR_LOAD_TropoClim',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'error')
pause(1)
end
end
TropoClim_data=int32(TropoClim);
try
%Calculate Radar Radio Climate
tropo_value_radar=get_txt_value_GUI(app,sim_pt(1),sim_pt(2),TropoClim_data); %Gets the Climate of each point
catch
tropo_value_radar=int32(7);
% 1 Equatorial, 2 Continental Subtorpical, 3 Maritime Tropical, 4 Desert, 5 Continental Temperate, 6 Maritime Over Land, 7 Maritime Over Sea
save(strcat('ERROR_tropo_value_radar_',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'tropo_value_radar')
end
%%%Surface refractivity: Derived by using ITU-R.P.452
%%%Persisent Load
retry_load=1;
while(retry_load==1) %%%This will continue to pin the move_list_function
try
load('data_N050.mat','data_N050')
retry_load=0;
catch
retry_load=1;
if parallel_flag==0
disp_progress(app,strcat('Error in ITM --> Loading data_N050'))
end
error=NaN(1);
save(strcat('ERROR_LOAD_data_N050',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'error')
pause(1)
end
end
data_N050_data=data_N050;
Dielectric=25.0;
Conduct=0.02;
ConfPct=confidence/100;
RelPct=reliability/100;
RxHtm=sim_pt(3);
RxLat=sim_pt(1);
RxLon=sim_pt(2);
%%%%Preallocate
dBloss=NaN(num_bs,num_rel);
prop_mode=cell(num_bs,1);
for i=1:num_bs %%%%For Now, send in CBSD one at a time
if parallel_flag==0
disp_progress(app,strcat('Matlab Longley Rice:',num2str(i/num_bs*100),'%'))
end
TxLat=sim_array_list_bs(i,1);
TxLon=sim_array_list_bs(i,2);
TxHtm=sim_array_list_bs(i,3);
try
%Calculate Radio Climate
tropo_value=find_tropo_itu617_parfor_GUI(app,sim_array_list_bs(i,1:2),TropoClim_data,tropo_value_radar);
RadClim=int32(tropo_value); % 1 Equatorial, 2 Continental Subtorpical, 3 Maritime Tropical, 4 Desert, 5 Continental Temperate, 6 Maritime Over Land, 7 Maritime Over Sea
catch
RadClim=int32(5);
save(strcat('ERROR_RadClim_CBSDnum',num2str(i),'_',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'RadClim')
end
try
%Calculate Refractivity
Refrac=find_refrac_itu452_par_GUI(app,sim_array_list_bs(i,1:2),sim_pt,data_N050_data);
catch
Refrac=301;
save(strcat('ERROR_Refrac_CBSDnum',num2str(i),'_',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'Refrac')
end
%%%%%%%%%% 1 Equatorial, 2 Continental Subtorpical, 3 Maritime Tropical, 4 Desert, 5 Continental Temperate, 6 Maritime Over Land, 7 Maritime Over Sea
if RadClim==1
str_climate="equatorial";
elseif RadClim==2
str_climate="continental-subtropical";
elseif RadClim==3
str_climate="maritime-subtropical";
elseif RadClim==4
str_climate="desert";
elseif RadClim==5
str_climate="continental-temperate";
elseif RadClim==6
str_climate="maritime-over-land";
elseif RadClim==7
str_climate="maritime-over-sea";
else
str_climate="continental-temperate";
end
tx = txsite('Name','Tx','Latitude',TxLat,'Longitude',TxLon,'TransmitterFrequency',FreqHz,'AntennaHeight',TxHtm);
rx = rxsite('Name','Rx','Latitude',RxLat,'Longitude',RxLon,'AntennaHeight',RxHtm);
try
clear temp_dBloss;
pm_itm=propagationModel('longley-rice','AntennaPolarization','vertical','TimeVariabilityTolerance',0.50,'AtmosphericRefractivity',Refrac,'ClimateZone',str_climate);
[temp_dBloss,itm_info]= pathloss(pm_itm,rx,tx);
% % [temp_dBloss,propmodeary]=itmp.ITMp2pAryRels(TxHtm,RxHtm,Refrac,Conduct,Dielectric,FreqMHz,RadClim,Tpol,ConfPct,RelPct,TxLat,TxLon,RxLat,RxLon,TerHandler,TerDirectory);
% % prop_mode(i)=double(propmodeary);
catch
temp_dBloss=1000;
itm_info='Error';
save(strcat('ERROR_NaN_prop_CBSDnum',num2str(i),'_',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'temp_dBloss')
% % % 'ITM Error'
% % % pause;
end
dBloss(i,:)=temp_dBloss;
prop_mode{i}=itm_info;
% % % %%%%%%%%%%%%%%Debug Code
% % % TxHtm
% % % RxHtm
% % % Refrac
% % % Conduct
% % % Dielectric
% % % FreqMHz
% % % RadClim
% % % Tpol
% % % ConfPct
% % % RelPct
% % % TxLat
% % % TxLon
% % % RxLat
% % % RxLon
% % % TerHandler
% % % TerDirectory
% % % [temp_dBloss]=itmp.ITMp2pAryRels(TxHtm,RxHtm,Refrac,Conduct,Dielectric,FreqMHz,RadClim,Tpol,ConfPct,RelPct,TxLat,TxLon,RxLat,RxLon,TerHandler,TerDirectory)
% % % %%%%%%%%%%%%%%%Debug Code
% % try
% % clear temp_dBloss;
% % [temp_dBloss,propmodeary]=itmp.ITMp2pAryRels(TxHtm,RxHtm,Refrac,Conduct,Dielectric,FreqMHz,RadClim,Tpol,ConfPct,RelPct,TxLat,TxLon,RxLat,RxLon,TerHandler,TerDirectory);
% % prop_mode(i)=double(propmodeary);
% %
% % %%%% 0 LOS, 4 Single Horizon, 5 Difraction Double Horizon, 8 Double Horizon, 9 Difraction Single Horizon, 6 Troposcatter Single Horizon, 10 Troposcatter Double Horizon, 333 Error
% % catch
% % temp_dBloss=1000;
% % prop_mode(i)=999;
% % save(strcat('ERROR_NaN_prop_CBSDnum',num2str(i),'_',num2str(sim_pt(1)),'_',num2str(sim_pt(2)),'.mat'),'temp_dBloss')
% %
% % % % % 'ITM Error'
% % % % % pause;
% % end
% % dBloss(i,:)=double(temp_dBloss);
end
end