Skip to content

Commit

Permalink
Merge pull request #105 from Sonohi/issue99LivePlotting
Browse files Browse the repository at this point in the history
Fixed plotting
  • Loading branch information
jakthra authored Aug 29, 2019
2 parents d4f439c + 8bed824 commit 9c7e5f9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 25 deletions.
18 changes: 16 additions & 2 deletions Monster.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@

obj.Logger.log('(MONSTER - run) downlink UE data decoding', 'DBG');
obj.downlinkUeDataDecoding();


obj.Logger.log('(MONSTER - run) plotting constellation diagrams and spectrums', 'DBG');
obj.plotRuntime();

obj.Logger.log('(MONSTER - run) uplink scheduling', 'DBG');
obj.scheduleUL();

Expand Down Expand Up @@ -331,6 +334,17 @@
%
arrayfun(@(x)x.uplinkDataDecoding(obj.Users, obj.Config), obj.Cells);

end
end

function obj = plotRuntime(obj)
% plotRuntime executes the runtime plots
%
% :obj: Monster instance
%
plotSpectrums(obj.Users, obj.Cells, obj.Config);
plotConstDiagramDL(obj.Cells, obj.Users, obj.Config);
%plotLinks(obj.Users, obj.Cells, obj.Config.Plot.LayoutAxes, 'downlink');
plotAssociationTable(obj.Users, obj.Cells, obj.Config);
end
end
end
3 changes: 2 additions & 1 deletion enb/EvolvedNodeB.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@
end

function [indPdsch, info] = getPDSCHindicies(obj)
enbObj = obj;
enb = struct(obj);
% get PDSCH indexes
[indPdsch, info] = ltePDSCHIndices(enb, enb.Tx.PDSCH, enb.Tx.PDSCH.PRBSet);
[indPdsch, info] = ltePDSCHIndices(enb, enbObj.Tx.PDSCH, enbObj.Tx.PDSCH.PRBSet);
end

function [minMCS, varargout] = getMCSDL(obj, ue)
Expand Down
7 changes: 0 additions & 7 deletions setup/MonsterConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,6 @@

% Properties related to plotting
Plot = struct();
if obj.SimulationPlot.runtimePlot
Plot.Layout = '';
Plot.LayoutFigure = '';
Plot.LayoutAxes = axes;
Plot.PHYFigure = '';
Plot.PHYAxes = axes;
end
obj.Plot = Plot;
end

Expand Down
29 changes: 16 additions & 13 deletions utils/plotlib/NetworkLayout.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,22 @@ function drawScenario(obj, Config, Sites)
[yc - siteImgLenghY yc + siteImgLenghY], siteImg);
set(f, 'AlphaData', siteImgAlpha);

% Now draw the cells boundaries for the site
theta = pi/cellsPerSite;
xyHex = zeros(7,2);
for i=1:cellsPerSite
cHex = [(xc + cellRadius * cos((i-1)*2*theta)) ...
(yc + cellRadius * sin((i-1)*2*theta))];
for j=1:7
xyHex(j,1) = cHex(1) + cellRadius*cos(j*theta);
xyHex(j,2) = cHex(2) + cellRadius*sin(j*theta);
end
l = line(Config.Plot.LayoutAxes,xyHex(:,1),xyHex(:,2), 'Color', 'k');
set(get(get(l,'Annotation'),'LegendInformation'),'IconDisplayStyle','off')
end
% Now draw the cells boundaries for the site (only if macro
% site)
if strcmp(Sites(iSite).Class, 'macro')
theta = pi/cellsPerSite;
xyHex = zeros(7,2);
for i=1:cellsPerSite
cHex = [(xc + cellRadius * cos((i-1)*2*theta)) ...
(yc + cellRadius * sin((i-1)*2*theta))];
for j=1:7
xyHex(j,1) = cHex(1) + cellRadius*cos(j*theta);
xyHex(j,2) = cHex(2) + cellRadius*sin(j*theta);
end
l = line(Config.Plot.LayoutAxes,xyHex(:,1),xyHex(:,2), 'Color', 'k');
set(get(get(l,'Annotation'),'LegendInformation'),'IconDisplayStyle','off')
end
end
end

end
Expand Down
46 changes: 46 additions & 0 deletions utils/plotlib/plotAssociationTable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
function plotAssociationTable(Users, Cells, Config)
LayoutFigure = Config.Plot.LayoutFigure;
%clear table if present
tableAssociation = findobj(LayoutFigure, 'Tag', 'table');
if ~isempty(tableAssociation)
delete(tableAssociation);
end

%New table
tableAssociation = cell(Config.Ue.number ,3);
tIndex= 1;
for iCell = 1:length(Cells)
Cell = Cells(iCell);
% Find all scheduled users in DL

scheduledusers = [Cell.ScheduleDL.UeId];
scheduledusers = unique(scheduledusers(scheduledusers ~= -1));

for user = 1:length(scheduledusers)
rxObj = Users(find([Users.NCellID] == scheduledusers(user)));
tableAssociation{tIndex,1} = strcat('UE ', num2str(rxObj.NCellID));
tableAssociation{tIndex,2} = 'Scheduled at';
tableAssociation{tIndex,3} = strcat('BS ', num2str(Cell.NCellID));
tIndex = tIndex+1;
end

% Plot all associated users (available in Users)
associatedusers = [Cell.Users.UeId];
associatedusers = associatedusers(associatedusers ~= -1);
if ~isempty(associatedusers)
associatedusers = associatedusers(~ismember(associatedusers,scheduledusers));
for user = 1:length(associatedusers)
rxObj = Users(find([Users.NCellID] == associatedusers(user)));
tableAssociation{tIndex,1} = strcat('UE ', num2str(rxObj.NCellID));
tableAssociation{tIndex,2} = 'Associated to';
tableAssociation{tIndex,3} = strcat('BS ', num2str(Cell.NCellID));
tIndex = tIndex+1;
end
end
end
uit = uitable(LayoutFigure);
uit.Tag = 'table';
uit.Data = tableAssociation;
uit.Position = [700 100 300 300];

end
5 changes: 3 additions & 2 deletions utils/plotlib/plotSpectrums.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ function plotSpectrums(Users,Cells, Config)
end


Cell = Cells([Cells.NCellID] == Users(user).ENodeBID);
if checkUserSchedule(Users(user),Cell)
Cell = Cells([Cells.NCellID] == Users(user).NCellID);

if ~isempty(Users(user).Rx.Waveform)
Fs = Cells([Cells.NCellID] == Users(user).ENodeBID).Tx.WaveformInfo.SamplingRate;
sig = setPower(Users(user).Rx.Waveform,Users(user).Rx.RxPwdBm);
F = fft(sig)./length(sig);
Expand Down

0 comments on commit 9c7e5f9

Please sign in to comment.