Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Shweta Shrivastava
openairinterface5G
Commits
f804214c
Commit
f804214c
authored
10 years ago
by
Byiringi
Browse files
Options
Downloads
Patches
Plain Diff
git-svn-id:
http://svn.eurecom.fr/openair4G/trunk@5626
818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent
19805966
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
targets/PROJECTS/CORRIDOR/log_read.m
+228
-28
228 additions, 28 deletions
targets/PROJECTS/CORRIDOR/log_read.m
with
228 additions
and
28 deletions
targets/PROJECTS/CORRIDOR/log_read.m
+
228
−
28
View file @
f804214c
top_dir
=
'E:\EMOS\corridor\trials2 train'
;
clear
all
close
all
top_dir
=
'P:\florian\CORRIDOR\trials2 train'
;
% needs to be updated according to your computer
d1
=
dir
(
fullfile
(
top_dir
,
'UHF'
,
'*.log'
));
d2
=
dir
(
fullfile
(
top_dir
,
'2.6GHz'
,
'*.log'
));
start_time
=
[
1.400489088000000e+09
1.400493112000000e+09
1.400499696000000e+09
1.400506864000000e+09
];
for
idx
=
1
:
length
(
d1
)
...
...
@@ -19,7 +24,7 @@ for idx=1:length(d1)
rtime1
=
data1
{
idx
}(:,
1
)
-
data1
{
idx
}(
1
,
1
);
rtime2
=
data2
{
idx
}(:,
1
)
-
data2
{
idx
}(
1
,
1
);
%% plot gps coordinates
figure
(
idx
*
10
+
1
);
hold
off
...
...
@@ -29,19 +34,8 @@ for idx=1:length(d1)
xlabel
(
'lat [deg]'
);
ylabel
(
'lon [deg]'
)
legend
(
'UHF'
,
'2.6GHz'
)
title
(
sprintf
(
'Run %d'
,
idx
));
%% compute distance
distances1
=
zeros
(
1
,
size
(
data1
{
idx
},
1
));
distances2
=
zeros
(
1
,
size
(
data2
{
idx
},
1
));
for
i
=
1
:
size
(
data1
{
idx
},
1
)
distances1
(
i
)
=
Dist_Calc_from_GPS
(
data1
{
idx
}(
i
,
7
),
data1
{
idx
}(
i
,
8
),
48.25073056
,
1.55481944
);
end
for
i
=
1
:
size
(
data2
{
idx
},
1
)
distances2
(
i
)
=
Dist_Calc_from_GPS
(
data2
{
idx
}(
i
,
7
),
data2
{
idx
}(
i
,
8
),
48.25073056
,
1.55481944
);
end
%% plot RSSI
% TODO: convert time (in unix epoch) into something more meaninful
figure
(
idx
*
10
+
2
);
...
...
@@ -56,26 +50,232 @@ for idx=1:length(d1)
ylabel
(
'RSSI [dBm]'
)
title
(
sprintf
(
'Run %d'
,
idx
));
%%
%% measured distance (km)
% We can get the distance between the base station and the RX antenna from the GPS coordinates
distances1
=
zeros
(
size
(
data1
{
idx
},
1
),
1
);
distances2
=
zeros
(
size
(
data2
{
idx
},
1
),
1
);
for
i
=
1
:
size
(
data1
{
idx
},
1
)
distances1
(
i
)
=
Dist_Calc_from_GPS
(
data1
{
idx
}(
i
,
7
),
data1
{
idx
}(
i
,
8
),
48.25073056
,
1.55481944
);
end
for
i
=
1
:
size
(
data2
{
idx
},
1
)
distances2
(
i
)
=
Dist_Calc_from_GPS
(
data2
{
idx
}(
i
,
7
),
data2
{
idx
}(
i
,
8
),
48.25073056
,
1.55481944
);
end
figure
(
100
+
idx
)
subplot
(
1
,
2
,
1
)
plot
(
rtime1
,
distances1
,
'r'
,
rtime1
,
smooth
(
data1
{
idx
}(:,
13
),
100
),
'b'
)
title
(
sprintf
(
'Run %d with the measured distance : UHF'
,
idx
));
xlabel
(
'time [s]'
);
legend
(
'distance [km]'
,
'RSSI [dBm]'
);
subplot
(
1
,
2
,
2
)
plot
(
rtime2
,
distances2
,
'r'
,
rtime2
,
smooth
(
data2
{
idx
}(:,
13
),
100
),
'b'
)
title
(
sprintf
(
'Run %d with the measured distance : 2.6GHz '
,
idx
));
xlabel
(
'time [s]'
);
legend
(
'distance [km]'
,
'RSSI [dBm]'
);
%% estimated distance under the assumption of a constant speed
% We assume that the TGV speed is constant and then we find the distances to the base station with the time vector
TGV_speed
=
82.5
;
%constant TGV speed in m/s
[
RSSI_max1
,
I_RSSI_max1
]
=
max
(
data1
{
idx
}(:,
13
));
%we find the index corresponding to the maximum of RSSI
time01
=
rtime1
(
I_RSSI_max1
)
*
ones
(
length
(
rtime1
),
1
);
%time corresponding to the maximim of RSSI
new_distances1
=
(
TGV_speed
*
abs
(
rtime1
-
time01
))/
1000
+
min
(
distances1
)
*
ones
(
length
(
rtime1
),
1
);
% new distance in km. is is minimum when the RSSI is maximum
[
RSSI_max2
,
I_RSSI_max2
]
=
max
(
data2
{
idx
}(:,
13
));
time02
=
rtime2
(
I_RSSI_max2
)
*
ones
(
length
(
rtime2
),
1
);
new_distances2
=
(
TGV_speed
*
abs
(
rtime2
-
time02
))/
1000
+
min
(
distances2
)
*
ones
(
length
(
rtime2
),
1
);
% distance in km
if
(
idx
==
2
)
%For Run 2, there is an anomalous peak for the RSSI at the end. Here we ignore it
[
RSSI_max2
,
I_RSSI_max2
]
=
max
(
data2
{
idx
}(
1
:
32900
,
13
));
time02
=
rtime2
(
I_RSSI_max2
)
*
ones
(
length
(
rtime2
),
1
);
new_distances2
=
(
TGV_speed
*
abs
(
rtime2
-
time02
))/
1000
+
min
(
distances2
)
*
ones
(
length
(
rtime2
),
1
);
% distance in km
end
figure
(
200
+
idx
)
subplot
(
1
,
2
,
1
)
plot
(
rtime1
,
new_distances1
,
'r'
,
rtime1
,
smooth
(
data1
{
idx
}(:,
13
),
100
),
'b'
)
title
(
sprintf
(
'Run %d with the estimated distance : UHF'
,
idx
));
xlabel
(
'time [s]'
);
legend
(
'distance [km]'
,
'RSSI [dBm]'
);
subplot
(
1
,
2
,
2
)
plot
(
rtime2
,
new_distances2
,
'r'
,
rtime2
,
smooth
(
data2
{
idx
}(:,
13
),
100
),
'b'
)
title
(
sprintf
(
'Run %d with the estimated distance : 2.6GHz '
,
idx
));
xlabel
(
'time [s]'
);
legend
(
'distance [km]'
,
'RSSI [dBm]'
);
%% rssi(dBm) versus distance (log scale)
% We will plot the rssi versus the distance with the data before the passing of the train, and with the data after the passingof the train
% we heuristically determine a starting point and a ending point for the linear fitting
if
idx
==
1
distance_before_break1_start
=
0.3913
;
%in km
distance_before_break1_end
=
27.71
;
distance_before_break2_start
=
0.3282
;
distance_before_break2_end
=
15.24
;
distance_after_break1_start
=
0.85
;
%in km
distance_after_break1_end
=
9
;
distance_after_break2_start
=
0.2911
;
distance_after_break2_end
=
9
;
end
if
idx
==
2
distance_before_break1_start
=
0.8468
;
%in km
distance_before_break1_end
=
9
;
distance_before_break2_start
=
0.4822
;
distance_before_break2_end
=
7.099
;
distance_after_break1_start
=
0.5812
;
%in km
distance_after_break1_end
=
18.76
;
distance_after_break2_start
=
0.4402
;
distance_after_break2_end
=
10
;
end
if
idx
==
3
distance_before_break1_start
=
4.258
;
%in km
distance_before_break1_end
=
29.46
;
distance_before_break2_start
=
8.375
;
distance_before_break2_end
=
29.66
;
distance_after_break1_start
=
2.274
;
%in km
distance_after_break1_end
=
5.376
;
distance_after_break2_start
=
5.996
;
distance_after_break2_end
=
7.613
;
end
if
idx
==
4
distance_before_break1_start
=
0.1176
;
%in km
distance_before_break1_end
=
3.489
;
distance_before_break2_start
=
0.1344
;
distance_before_break2_end
=
3.78
;
distance_after_break1_start
=
0.3793
;
%in km
distance_after_break1_end
=
9
;
distance_after_break2_start
=
0.5443
;
distance_after_break2_end
=
9
;
end
% indexes of the starting and ending points with the data before the passing of the
% train
index_break1_before_start
=
1
;
index_break2_before_start
=
1
;
index_break1_before_end
=
1
;
index_break2_before_end
=
1
;
% indexes of the starting and ending points with the data after the passing of the
% train
index_break1_after_start
=
I_RSSI_max1
;
index_break2_after_start
=
I_RSSI_max2
;
index_break1_after_end
=
I_RSSI_max1
;
index_break2_after_end
=
I_RSSI_max2
;
%starting points
while
(
index_break1_before_start
<
length
(
new_distances1
))
&&
(
new_distances1
(
index_break1_before_start
)
>
distance_before_break1_start
)
index_break1_before_start
=
index_break1_before_start
+
1
;
end
while
(
index_break2_before_start
<
length
(
new_distances2
))
&&
(
new_distances2
(
index_break2_before_start
)
>
distance_before_break2_start
)
index_break2_before_start
=
index_break2_before_start
+
1
;
end
%ending points
while
(
index_break1_before_end
<
length
(
new_distances1
))
&&
(
new_distances1
(
index_break1_before_end
)
>
distance_before_break1_end
)
index_break1_before_end
=
index_break1_before_end
+
1
;
end
while
(
index_break2_before_end
<
length
(
new_distances2
))
&&
(
new_distances2
(
index_break2_before_end
)
>
distance_before_break2_end
)
index_break2_before_end
=
index_break2_before_end
+
1
;
end
%starting points
while
(
index_break1_after_start
<
length
(
new_distances1
))
&&
(
new_distances1
(
index_break1_after_start
)
<
distance_after_break1_start
)
index_break1_after_start
=
index_break1_after_start
+
1
;
end
while
(
index_break2_after_start
<
length
(
new_distances2
))
&&
(
new_distances2
(
index_break2_after_start
)
<
distance_after_break2_start
)
index_break2_after_start
=
index_break2_after_start
+
1
;
end
%ending points
while
(
index_break1_after_end
<
length
(
new_distances1
))
&&
(
new_distances1
(
index_break1_after_end
)
<
distance_after_break1_end
)
index_break1_after_end
=
index_break1_after_end
+
1
;
end
while
(
index_break2_after_end
<
length
(
new_distances2
))
&&
(
new_distances2
(
index_break2_after_end
)
<
distance_after_break2_end
)
index_break2_after_end
=
index_break2_after_end
+
1
;
end
figure
(
idx
*
10
+
3
)
subplot
(
2
,
1
,
1
)
hold
off
plot
(
rtime1
,
distances1
,
'r'
)
linearCoef1_before
=
polyfit
(
10
*
log10
(
new_distances1
(
index_break1_before_end
:
index_break1_before_start
)),
data1
{
idx
}(
index_break1_before_end
:
index_break1_before_start
,
13
),
1
);
linearFit1_before
=
polyval
(
linearCoef1_before
,
10
*
log10
(
new_distances1
(
index_break1_before_end
:
index_break1_before_start
)));
semilogx
(
new_distances1
(
1
:
I_RSSI_max1
),
data1
{
idx
}(
1
:
I_RSSI_max1
,
13
),
'rx'
,
new_distances1
(
index_break1_before_end
:
index_break1_before_start
),
linearFit1_before
,
'r-'
)
display
(
sprintf
(
'Run %d :slope UHF before: %f'
,
idx
,
linearCoef1_before
(
1
)))
hold
on
plot
(
rtime2
,
distances2
,
'b'
)
xlabel
(
'time [seconds]'
)
ylabel
(
'dist [km]'
)
legend
(
'UHF'
,
'2.6GHz'
)
linearCoef2_before
=
polyfit
(
10
*
log10
(
new_distances2
(
index_break2_before_end
:
index_break2_before_start
)),
data2
{
idx
}(
index_break2_before_end
:
index_break2_before_start
,
13
),
1
);
linearFit2_before
=
polyval
(
linearCoef2_before
,
10
*
log10
(
new_distances2
(
index_break2_before_end
:
index_break2_before_start
)));
semilogx
(
new_distances2
(
1
:
I_RSSI_max2
),
data2
{
idx
}(
1
:
I_RSSI_max2
,
13
),
'bx'
,
new_distances2
(
index_break2_before_end
:
index_break2_before_start
),
linearFit2_before
,
'b-'
)
display
(
sprintf
(
'Run %d :slope 2.6GHz before: %f'
,
idx
,
linearCoef2_before
(
1
)))
title
(
sprintf
(
'Run %d: With the data before the passing of the train'
,
idx
))
legend
(
'UHF'
,
'UHF:linear fitting'
,
'2.6GHz card 1'
,
'2.6GHz card 1:linear fitting'
);
xlabel
(
'distance [km]'
)
ylabel
(
'RSSI [dBm]'
)
subplot
(
2
,
1
,
2
)
%%
figure
(
idx
*
10
+
4
)
hold
off
plot
(
distances1
,
data1
{
idx
}(:,
13
),
'rx'
)
linearCoef1_after
=
polyfit
(
10
*
log10
(
new_distances1
(
index_break1_after_start
:
index_break1_after_end
)),
data1
{
idx
}(
index_break1_after_start
:
index_break1_after_end
,
13
),
1
);
linearFit1_after
=
polyval
(
linearCoef1_after
,
10
*
log10
(
new_distances1
(
index_break1_after_start
:
index_break1_after_end
)));
semilogx
(
new_distances1
(
I_RSSI_max1
:
end
),
data1
{
idx
}(
I_RSSI_max1
:
end
,
13
),
'rx'
,
new_distances1
(
index_break1_after_start
:
index_break1_after_end
),
linearFit1_after
,
'r-'
)
display
(
sprintf
(
'Run %d :slope UHF after: %f'
,
idx
,
linearCoef1_after
(
1
)))
hold
on
plot
(
distances2
,
data2
{
idx
}(:,
13
),
'bx'
)
plot
(
distances2
,
data2
{
idx
}(:,
19
),
'cx'
)
plot
(
distances2
,
data2
{
idx
}(:,
25
),
'mx'
)
xlabel
(
'dist [km]'
)
linearCoef2_after
=
polyfit
(
10
*
log10
(
new_distances2
(
index_break2_after_start
:
index_break2_after_end
)),
data2
{
idx
}(
index_break2_after_start
:
index_break2_after_end
,
13
),
1
);
linearFit2_after
=
polyval
(
linearCoef2_after
,
10
*
log10
(
new_distances2
(
index_break2_after_start
:
index_break2_after_end
)));
semilogx
(
new_distances2
(
I_RSSI_max2
:
end
),
data2
{
idx
}(
I_RSSI_max2
:
end
,
13
),
'bx'
,
new_distances2
(
index_break2_after_start
:
index_break2_after_end
),
linearFit2_after
,
'b-'
)
display
(
sprintf
(
'Run %d :slope 2.6GHz after: %f'
,
idx
,
linearCoef2_after
(
1
)))
title
(
sprintf
(
'Run %d: With the data after the passing of the train'
,
idx
))
legend
(
'UHF'
,
'UHF:linear fitting'
,
'2.6GHz card 1'
,
'2.6GHz card 1:linear fitting'
);
xlabel
(
'distance [km]'
)
ylabel
(
'RSSI [dBm]'
)
legend
(
'UHF'
,
'2.6GHz card 1'
,
'2.6GHz card 2'
,
'2.6GHz card 3'
);
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment