Commit f822873f authored by Stephan Korsholm's avatar Stephan Korsholm
Browse files

Merge branch '253-event-results-enhancement-imt-2020-part2' into 'master'

Resolve "Event results enhancement - IMT-2020"

See merge request SEAM/seamcat!150
Showing with 149 additions and 32 deletions
+149 -32
......@@ -4,10 +4,7 @@ import static org.seamcat.model.mathematics.Mathematics.linear2dB;
import static org.seamcat.model.plugin.system.StandardResults.*;
import static org.seamcat.model.systems.imt2020downlink.IMT2020DownLinkSystemPlugin.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import org.seamcat.model.factory.Factory;
import org.seamcat.model.mathematics.Mathematics;
......@@ -35,10 +32,15 @@ class IMT2020DownLinkCalculations {
private final VectorDef AVG_INTER_SYSTEM_INTERFERENCE_ALL;
private final VectorDef AVG_ISI;
private final VectorDef interferedBitRateRefCell;
private final VectorDef interferedBitRateAll;
private final VectorDef nonInterferedSINRAllIntermediate;
private final VectorDef nonInterferedSINRAll;
private final VectorDef nonInterferedSINRRefCell;
private final VectorDef nonInterferedSINRRefCellIntermediate;
private final VectorDef nonInterferedBitrateAllIntermediate;
private final VectorDef nonInterferedBitrateAll;
private final VectorDef nonInterferedBitrateRefCell;
private final VectorDef nonInterferedBitrateRefCellIntermediate;
private static VectorDef iv(String name, Unit unit) {
return Factory.resultFactory().vector(null, name, unit, true);
}
......@@ -62,18 +64,62 @@ class IMT2020DownLinkCalculations {
AVG_ISI =
Factory.resultFactory().vector(ValueName.AVG_INTER_SYSTEM_INTERFERENCE_REF + siteName + ")", Unit.dBm);
this.interferedBitRateAll = Factory.resultFactory().vector(ValueName.BITRATE_ACHIEVED_ALL, Unit.kbps);
this.interferedBitRateRefCell = interferedBitRateRefCell;
this.nonInterferedBitrateRefCell = nonInterferedBitRateRefCell;
this.nonInterferedBitrateRefCellIntermediate =
iv(nonInterferedBitRateRefCell.name(), nonInterferedBitRateRefCell.unit());
this.nonInterferedBitrateAll = nonInterferedBitrateAll;
this.interferedBitRateRefCell = interferedBitRateRefCell;
this.nonInterferedBitrateAllIntermediate = iv(nonInterferedBitrateAll.name(), nonInterferedBitrateAll.unit());
this.nonInterferedSINRAll = Factory.resultFactory().vector(ValueName.NON_INTERFERED_SINR_ALL, Unit.dB);
this.nonInterferedSINRAllIntermediate = iv(ValueName.NON_INTERFERED_SINR_ALL, Unit.dB);
this.nonInterferedSINRAll = Factory.resultFactory().vector(ValueName.NON_INTERFERED_SINR_ALL, Unit.dBm);
this.nonInterferedSINRRefCell =
Factory.resultFactory().vector(ValueName.NON_INTERFERED_SINR_REF_CELL, Unit.dBm);
this.nonInterferedSINRRefCell = Factory.resultFactory().vector(ValueName.NON_INTERFERED_SINR_REF_CELL, Unit.dB);
this.nonInterferedSINRRefCellIntermediate = iv(ValueName.NON_INTERFERED_SINR_REF_CELL, Unit.dB);
}
void calculateVictimResults(IMT2020Settings settings, VictimResultCollector collector) {
LinkedHashMap<VectorDef, List<NamedDouble>> vectors = new LinkedHashMap<>();
settings.collectBitRates(AVGNonInterferedBitRateSystem, nonInterferedBitrateRefCell, collector);
double sumAchievedBitRateRefCell = 0;
double sumAchievedBitRateAll = 0;
double sumSINRRefCell = 0;
double sumSINRAll = 0;
double avgSINR_all;
double avgSINR_refCell;
int noOfVslRefCell = 0;
int noOfVslAll = 0;
//Set<Integer> uniqueBs = new HashSet<>();
for (Victim victim : collector.getVictims()) {
if (victim instanceof IMT2020DownLinkVictim) {
IMT2020DownLinkVictim v = (IMT2020DownLinkVictim) victim;
//uniqueBs.add(v.getBaseStationId());
v.calculateAchievedBitrate();
sumAchievedBitRateAll += v.getAchievedBitrate();
sumSINRAll += Mathematics.dB2Linear(v.getSinr());
noOfVslAll++;
if (v.isConnectedToReferenceCell()) {
sumAchievedBitRateRefCell += v.getAchievedBitrate();
sumSINRRefCell += Mathematics.dB2Linear(v.getSinr());
noOfVslRefCell++;
} else {
}
}
}
collector.add(AVGNonInterferedBitRateSystem, sumAchievedBitRateAll / noOfVslAll);
//collector.add(AVGNonInterferedBitRateSystem, sumAchievedBitRateAll / uniqueBs.size());
collector.add(nonInterferedBitrateAll, sumAchievedBitRateAll);
collector.add(nonInterferedBitrateRefCell, sumAchievedBitRateRefCell);
avgSINR_refCell = noOfVslRefCell == 0 ? 0 : sumSINRRefCell / noOfVslRefCell;
//collector.add(nonInterferedSINRRefCell, sumSINRRefCell / noOfVslRefCell);
collector.add(nonInterferedSINRRefCell, linear2dB(avgSINR_refCell));
avgSINR_all= noOfVslRefCell == 0 ? 0 : sumSINRAll / noOfVslAll;
//collector.add(nonInterferedSINRAll, sumSINRAll / noOfVslAll);
collector.add(nonInterferedSINRAll, linear2dB(avgSINR_all));
for (Victim victim : collector.getVictims()) {
if (victim instanceof IMT2020DownLinkVictim) {
......@@ -89,24 +135,25 @@ class IMT2020DownLinkCalculations {
if (victim.isConnectedToReferenceCell()) {
append(vectors, FREQUENCY, victim.getUEFrequency(), name);
append(vectors, RECEIVED_POWER, victim.getReceivePower(), name);
append(vectors, nonInterferedBitrateRefCell, victim.getAchievedBitrate(), name);
append(vectors, nonInterferedSINRRefCell, victim.getSinr(), name);
append(vectors, nonInterferedBitrateRefCellIntermediate, victim.getAchievedBitrate(), name);
append(vectors, nonInterferedSINRRefCellIntermediate, victim.getSinr(), name);
append(vectors, PATH_LOSS, victim.getLinkResult().getTxRxPathLoss(), name);
append(vectors, EFFECTIVE_PATH_LOSS, victim.getLinkResult().getEffectiveTxRxPathLoss(), name);
append(vectors, INTERFERENCE_POWER, victim.getInterferencePower(), name);
append(vectors, CURRENT_TRANSMIT_POWER, victim.getCurrentTransmitPower(), name);
append(vectors, INTER_SYSTEM_INTERFERENCE, victim.getInterSystemInterference(), name);
} else {
append(vectors, FREQUENCY_ALL, victim.getUEFrequency(), name);
append(vectors, RECEIVED_POWER_ALL, victim.getReceivePower(), name);
append(vectors, nonInterferedBitrateAll, victim.getAchievedBitrate(), name);
append(vectors, nonInterferedSINRAll, victim.getSinr(), name);
append(vectors, PATH_LOSS_ALL, victim.getLinkResult().getTxRxPathLoss(), name);
append(vectors, EFFECTIVE_PATH_LOSS_ALL, victim.getLinkResult().getEffectiveTxRxPathLoss(), name);
append(vectors, INTERFERENCE_POWER_ALL, victim.getInterferencePower(), name);
append(vectors, CURRENT_TRANSMIT_POWER_ALL, victim.getCurrentTransmitPower(), name);
append(vectors, INTER_SYSTEM_INTERFERENCE_ALL, victim.getInterSystemInterference(), name);
}
append(vectors, FREQUENCY_ALL, victim.getUEFrequency(), name);
append(vectors, RECEIVED_POWER_ALL, victim.getReceivePower(), name);
append(vectors, nonInterferedBitrateAllIntermediate, victim.getAchievedBitrate(), name);
append(vectors, nonInterferedSINRAllIntermediate, victim.getSinr(), name);
append(vectors, PATH_LOSS_ALL, victim.getLinkResult().getTxRxPathLoss(), name);
append(vectors, EFFECTIVE_PATH_LOSS_ALL, victim.getLinkResult().getEffectiveTxRxPathLoss(), name);
append(vectors, INTERFERENCE_POWER_ALL, victim.getInterferencePower(), name);
append(vectors, CURRENT_TRANSMIT_POWER_ALL, victim.getCurrentTransmitPower(), name);
append(vectors, INTER_SYSTEM_INTERFERENCE_ALL, victim.getInterSystemInterference(), name);
}
private static void append(Map<VectorDef, List<NamedDouble>> vectors, VectorDef def, double value, String name) {
......@@ -130,12 +177,14 @@ class IMT2020DownLinkCalculations {
int size = 0;
double dRSS = 0;
double ISI = 0;
double sumAchievedBitRateAll = 0;
for (Victim victim : collector.getVictims()) {
if (victim instanceof IMT2020DownLinkVictim) {
IMT2020DownLinkVictim v = (IMT2020DownLinkVictim) victim;
double sinrW = Mathematics.dB2Linear(v.getSinr());
sum += sinrW;
sumAchievedBitRateAll += v.getAchievedBitrate();
String name = String.format("%s -> %s", victim.getTxName(), victim.getRxName());
if (v.isConnectedToReferenceCell()) {
refSize++;
......@@ -146,9 +195,10 @@ class IMT2020DownLinkCalculations {
append(vectors, SINR_ACHIEVED, v.getSinr(), name);
} else {
append(vectors, BIT_RATE_ACHIEVED_ALL, v.getAchievedBitrate(), name);
append(vectors, SINR_ACHIEVED_ALL, v.getSinr(), name);
}
append(vectors, BIT_RATE_ACHIEVED_ALL, v.getAchievedBitrate(), name);
append(vectors, SINR_ACHIEVED_ALL, v.getSinr(), name);
size++;
}
}
......@@ -160,6 +210,7 @@ class IMT2020DownLinkCalculations {
collector.add(AVG_DRSS, Mathematics.linear2dB(dRSS));
ISI = refSize == 0 ? 0 : ISI / refSize;
collector.add(AVG_ISI, Mathematics.linear2dB(ISI));
collector.add(interferedBitRateAll, sumAchievedBitRateAll);
addVectorsToCollector(collector, vectors);
......
......@@ -226,21 +226,24 @@ public class IMT2020Settings {
public void collectBitRates(VectorDef system, VectorDef refCell, VictimResultCollector collector) {
double sumRefCell = 0;
double sum = 0;
int noOfVslAll = 0;
Set<Integer> uniqueBs = new HashSet<>();
//Set<Integer> uniqueBs = new HashSet<>();
for (Victim victim : collector.getVictims()) {
if (victim instanceof IMT2020DownLinkVictim) {
IMT2020DownLinkVictim v = (IMT2020DownLinkVictim) victim;
uniqueBs.add(v.getBaseStationId());
//uniqueBs.add(v.getBaseStationId());
v.calculateAchievedBitrate();
sum += v.getAchievedBitrate();
noOfVslAll++;
if (v.isConnectedToReferenceCell()) {
sumRefCell += v.getAchievedBitrate();
} else {
}
}
}
collector.add(system, sum / uniqueBs.size());
//collector.add(system, sum / uniqueBs.size());
collector.add(system, sum / noOfVslAll);
collector.add(refCell, sumRefCell);
}
......
......@@ -57,7 +57,7 @@ public class OFDMAUpLinkSystemPlugin extends SystemPluginBase implements SystemP
Factory.resultFactory().uniqueValue(ValueName.COUPLING_LOSS_PERCENTILE, Unit.none);
public static final UniqueValueDef SUB_CARRIER_RATIO =
Factory.resultFactory().uniqueValue(ValueName.SUB_CARRIER_RATIO, Unit.ratio);
public static final VectorDef SINRSystem = Factory.resultFactory().vector(ValueName.SINR_VICTIM_SYSTEM, Unit.dB);
public static final VectorDef SINRSystem = Factory.resultFactory().vector(ValueName.SINR_SYSTEM, Unit.dB);
public static final VectorDef AVGAchievedBitRateSystem =
Factory.resultFactory().vector(ValueName.AVG_NON_INTERFERED_BITRATE_SYSTEM, Unit.kbps);
public static final VectorDef avgInterferedBitRateSystem =
......
......@@ -14,6 +14,7 @@ import org.seamcat.model.engines.*;
import org.seamcat.model.factory.RandomAccessor;
import org.seamcat.model.mathematics.Mathematics;
import org.seamcat.model.simulation.result.EventResult;
import org.seamcat.model.simulation.result.SimulationResult;
import org.seamcat.model.types.result.Results;
import org.seamcat.model.types.result.VectorResultType;
import org.seamcat.model.workspace.Workspace;
......@@ -21,6 +22,7 @@ import org.seamcat.model.workspace.WorkspaceLoader;
public class DeterministicWorkspaceLoader {
protected Workspace workspace;
protected SimulationResult simulationResult;
List<String> failedLines = new ArrayList<>();
......@@ -109,7 +111,7 @@ public class DeterministicWorkspaceLoader {
pool = new SimulationPool();
}
beginSimulation.run();
engine.simulateInterference(pool);
simulationResult = engine.simulateInterference(pool);
return lastEvent[0];
}
......
......@@ -4,6 +4,7 @@ import static org.junit.Assert.*;
import static org.seamcat.model.engines.InterferenceCalculator.itUnwantedEmissions;
import java.util.List;
import java.util.Objects;
import org.junit.BeforeClass;
import org.junit.Test;
import org.seamcat.Seamcat;
......@@ -11,6 +12,7 @@ import org.seamcat.model.factory.RandomAccessor;
import org.seamcat.model.mathematics.Mathematics;
import org.seamcat.model.simulation.result.*;
import org.seamcat.model.types.result.Results;
import org.seamcat.model.types.result.VectorResultType;
import org.seamcat.model.workspace.result.CollectorImpl;
import org.seamcat.model.workspace.result.EventResultImpl;
......@@ -170,6 +172,66 @@ public class Imt2020fullTest extends DeterministicWorkspaceLoader {
}
}
@Test
public void testSimulationFinalResults() throws Exception {
loadWorkspace("/WS_IMT-2020_DL_-_PMSEHH_760_UT_2.sws");
// Verify that NON_INTERFERED_BITRATE_REF_CELL is available as a vector result in the following places:
// 1) As a vector result in each event (only checking for the last one).
// 2) As a vector result in the full simulation result. Length of vector should equal number of events
EventResultImpl lastEvent = (EventResultImpl) runSimulation(1);
// ad 1) above
VictimResultCollector victemResultCollector = lastEvent.getVictimResult();
VectorDef nonInterferedBitrateRefCell = TestUtil.getVectorDef(
((CollectorImpl) victemResultCollector).samples().keySet(), ValueName.NON_INTERFERED_BITRATE_REF_CELL);
assertNotNull(nonInterferedBitrateRefCell);
// ad 2) above
VectorResultType vectorResult = getVectorFromSimulationResult(ValueName.NON_INTERFERED_BITRATE_REF_CELL);
assertEquals(workspace.getNumberOfEvents(), Objects.requireNonNull(vectorResult).value().size());
// ad 1) above
VectorDef nonInterferedSINRRefCell = TestUtil.getVectorDef(
((CollectorImpl) victemResultCollector).samples().keySet(), ValueName.NON_INTERFERED_SINR_REF_CELL);
assertNotNull(nonInterferedSINRRefCell);
// ad 2) above
vectorResult = getVectorFromSimulationResult(ValueName.NON_INTERFERED_SINR_REF_CELL);
assertEquals(workspace.getNumberOfEvents(), Objects.requireNonNull(vectorResult).value().size());
// ad 1) above
VectorDef nonInterferedSINRAll = TestUtil.getVectorDef(
((CollectorImpl) victemResultCollector).samples().keySet(), ValueName.NON_INTERFERED_SINR_ALL);
assertNotNull(nonInterferedSINRAll);
// ad 2) above
vectorResult = getVectorFromSimulationResult(ValueName.NON_INTERFERED_SINR_ALL);
assertEquals(workspace.getNumberOfEvents(), Objects.requireNonNull(vectorResult).value().size());
// ad 1) above
VectorDef nonInterferedBitrateAll = TestUtil.getVectorDef(
((CollectorImpl) victemResultCollector).samples().keySet(), ValueName.NON_INTERFERED_BITRATE_ALL);
assertNotNull(nonInterferedBitrateAll);
// ad 2) above
vectorResult = getVectorFromSimulationResult(ValueName.NON_INTERFERED_BITRATE_ALL);
assertEquals(workspace.getNumberOfEvents(), Objects.requireNonNull(vectorResult).value().size());
// ad 2) above
vectorResult = getVectorFromSimulationResult(ValueName.BITRATE_ACHIEVED_ALL);
assertEquals(workspace.getNumberOfEvents(), Objects.requireNonNull(vectorResult).value().size());
}
private VectorResultType getVectorFromSimulationResult(String name) {
Results victimResults = simulationResult.getVictimResults();
for (VectorResultType vectorResult : victimResults.getVectorResultTypes()) {
if (vectorResult.def().name().equals(name)) {
return vectorResult;
}
}
return null;
}
private List<InterferenceLinkResult> getForFirst(EventResult event) {
return event.getInterferenceLinkResult(0);
}
......
File added
......@@ -18,7 +18,7 @@ public class ValueName {
public static final String AVERAGE_BITRATE_LOSS = "Average bitrate loss";
public static final String AVERAGE_BITRATE_LOSS_REF = "Average bitrate loss (ref. ";
public static final String AVERAGE_BITRATE_LOSS_REF_CELL = "Average bitrate loss (ref. cell)";
public static final String AVERAGE_BITRATE_LOSS_SYSTEM = "Average bitrate loss (system)";
public static final String AVERAGE_BITRATE_LOSS_SYSTEM = "Average bitrate loss (all)";
public static final String AVERAGE_CAPACITY_LOSS_REF = "Average capacity loss (ref. ";
public static final String AVERAGE_CAPACITY_LOSS_SYSTEM = "Average capacity loss (system)";
public static final String AVERAGE_NETWORK_NOISE_RISE_INITIAL = "Average network noise rise, (initial)";
......@@ -26,8 +26,8 @@ public class ValueName {
"Average network noise rise, (initial - no Ext. interference)";
public static final String AVERAGE_NETWORK_RISE_RESULTING = "Average network rise, (resulting)";
public static final String AVERAGE_NUMBER_OF_ACTIVE_UT = "Average number of active UT";
public static final String AVG_INTERFERED_BITRATE_SYSTEM = "Avg Interfered Bitrate (system)";
public static final String AVG_NON_INTERFERED_BITRATE_SYSTEM = "Avg Non Interfered Bitrate (system)";
public static final String AVG_INTERFERED_BITRATE_SYSTEM = "Avg Interfered Bitrate (all)";
public static final String AVG_NON_INTERFERED_BITRATE_SYSTEM = "Avg Non Interfered Bitrate (all)";
public static final String AZIMUTH = "Azimuth ";
public static final String AZIMUTHCORRECTED = "azimuthCorrected";
public static final String AZIMUTH_BORESIGHT_GLOBAL = "Azimuth boresight (global)";
......@@ -230,10 +230,9 @@ public class ValueName {
public static final String SINR_ACHIEVED_REF = "SINR achieved (ref. ";
public static final String SINR_REF = "Interfered SINR (ref. ";
public static final String SINR_REFERENCE_CELL = "Interfered SINR (ref. cell)";
public static final String SINR_SYSTEM = "Interfered SINR (system)";
public static final String SINR_SYSTEM = "Interfered SINR (all)";
public static final String SINR_VICTIM = "Interfered SINR";
public static final String SINR_VICTIM_REF = "SINR, Victim ref. ";
public static final String SINR_VICTIM_SYSTEM = "Interfered SINR (system)";
public static final String SORTED_SAMPLES_OF_THE_COUPLING_LOSS = "Sorted samples of the coupling loss";
public static final String SPEED = "Speed";
public static final String STATUS = "Status";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment