diff --git a/Monster.m b/Monster.m index ea865a45..279a51b2 100644 --- a/Monster.m +++ b/Monster.m @@ -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(); @@ -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 \ No newline at end of file diff --git a/enb/EvolvedNodeB.m b/enb/EvolvedNodeB.m index aebcc939..295731d0 100644 --- a/enb/EvolvedNodeB.m +++ b/enb/EvolvedNodeB.m @@ -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) diff --git a/setup/MonsterConfig.m b/setup/MonsterConfig.m index 8cef8561..5de2f77a 100644 --- a/setup/MonsterConfig.m +++ b/setup/MonsterConfig.m @@ -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 diff --git a/utils/plotlib/NetworkLayout.m b/utils/plotlib/NetworkLayout.m index 0e83bed5..7e7ff8da 100644 --- a/utils/plotlib/NetworkLayout.m +++ b/utils/plotlib/NetworkLayout.m @@ -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 diff --git a/utils/plotlib/plotAssociationTable.m b/utils/plotlib/plotAssociationTable.m new file mode 100644 index 00000000..50895afb --- /dev/null +++ b/utils/plotlib/plotAssociationTable.m @@ -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 \ No newline at end of file diff --git a/utils/plotlib/plotSpectrums.m b/utils/plotlib/plotSpectrums.m index cdcd1337..8ce2cf10 100644 --- a/utils/plotlib/plotSpectrums.m +++ b/utils/plotlib/plotSpectrums.m @@ -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);