Commit 0e073615 authored by rosemaryng's avatar rosemaryng
Browse files

[Retry Full] Fixed system retrial rate bug by adding AddMeasure in PAResults...

[Retry Full] Fixed system retrial rate bug by adding AddMeasure in PAResults Window and adding it to Inverse Measure. Retrial & system retrial rate works on both closed and open queue now. Also fixed waiting time. I'm so proud of myself
parent c5f5212c
......@@ -635,7 +635,6 @@ public class Queue extends InputSection {
} else {
putStrategies[job.getJobClass().getId()].put(job, jobsList, this);
setRenegingEvent(job);
nodeJobsList.addJobToPrimaryQueue(new JobInfo(job));
}
}
// sends an ACK backward
......
......@@ -396,10 +396,4 @@ public interface JobInfoList {
public abstract void setNetSystem(NetSystem netSystem);
public Map<Integer, JobInfo> getJobsInPrimaryQueue();
public Map<Integer, JobInfo> addJobToPrimaryQueue(JobInfo jobInfo);
public JobInfo updateJobInfo(Job oldJob);
}
......@@ -135,18 +135,6 @@ public class LinkedJobInfoList implements JobInfoList {
protected InverseMeasure throughputPerSinkPerClass[];
//Retrial group
protected Map<Integer, JobInfo> jobsInPrimaryQueue;
public Map<Integer, JobInfo> getJobsInPrimaryQueue() {
return jobsInPrimaryQueue;
}
public Map<Integer, JobInfo> addJobToPrimaryQueue(JobInfo jobInfo) {
jobsInPrimaryQueue.put(jobInfo.getJob().getId(), jobInfo);
return jobsInPrimaryQueue;
}
/** The number of servers to estimate Utilization measure on multiserver environments */
protected int numberOfServers = 1;
......@@ -173,8 +161,6 @@ public class LinkedJobInfoList implements JobInfoList {
lastJobRetrialTimePerClass = new double[numberOfJobClasses];
totalSojournTimePerClass = new double[numberOfJobClasses];
lastJobSojournTimePerClass = new double[numberOfJobClasses];
jobsInPrimaryQueue = new HashMap<>();
}
/**---------------------------------------------------------------------
......@@ -488,14 +474,6 @@ public class LinkedJobInfoList implements JobInfoList {
lastJobInTimePerClass[c] = getTime();
}
@Override
public JobInfo updateJobInfo(Job oldJob) {
remove(lookFor(oldJob));
JobInfo newJobInfo = new JobInfo(oldJob);
add(newJobInfo);
return newJobInfo;
}
public double getTime() {
return netSystem.getTime();
}
......@@ -593,7 +571,6 @@ public class LinkedJobInfoList implements JobInfoList {
list.remove(what);
break;
}
jobsInPrimaryQueue.remove(what.getJob().getId());
}
/**---------------------------------------------------------------------
......
......@@ -26,7 +26,7 @@ package jmt.engine.dataAnalysis;
* At the end the correct value is passed, since the "get" methods are overridden.
*/
public class InverseMeasure extends jmt.engine.dataAnalysis.Measure {
public class InverseMeasure extends Measure {
public InverseMeasure(String Name, double alfa, double precision, int maxData, boolean Verbose) {
super(Name, alfa, precision, maxData, Verbose, null);
......
......@@ -164,14 +164,16 @@ public abstract class EngineUtils {
|| measureType == SimConstants.DROP_RATE
|| measureType == SimConstants.RENEGING_RATE
|| measureType == SimConstants.BALKING_RATE
|| measureType == SimConstants.RETRIAL_RATE
|| measureType == SimConstants.SYSTEM_THROUGHPUT
|| measureType == SimConstants.SYSTEM_DROP_RATE
|| measureType == SimConstants.SYSTEM_RENEGING_RATE
|| measureType == SimConstants.SYSTEM_BALKING_RATE
|| measureType == SimConstants.SYSTEM_POWER
|| measureType == SimConstants.SYSTEM_RETRIAL_RATE
|| measureType == SimConstants.THROUGHPUT_PER_SINK
|| measureType == SimConstants.FIRING_THROUGHPUT
|| measureType == SimConstants.RETRIAL_RATE;
;
}
}
......@@ -132,6 +132,12 @@ public class PAResultsModel implements MeasureDefinition {
throughput.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_DR)) {
dropRate.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_R)) {
retrialRate.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_BR)) { // added BR and RR for PA
balkingRate.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_RR)) {
renegingRate.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_S_RP)) {
......@@ -146,6 +152,8 @@ public class PAResultsModel implements MeasureDefinition {
systemBalkingRate.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_S_P)) {
systemPower.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_S_R)) {
systemRetrialRate.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_RP_PER_SINK)) {
responseTimePerSink.add(new Integer(i));
} else if (measureType.equals(SimulationDefinition.MEASURE_X_PER_SINK)) {
......@@ -207,6 +215,8 @@ public class PAResultsModel implements MeasureDefinition {
renegingRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_BR)) {
balkingRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_R)) {
retrialRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_RP)) {
......@@ -221,6 +231,8 @@ public class PAResultsModel implements MeasureDefinition {
systemBalkingRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_P)) {
systemPower.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_R)) {
systemRetrialRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_RP_PER_SINK)) {
responseTimePerSink.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_X_PER_SINK)) {
......@@ -465,6 +477,10 @@ public class PAResultsModel implements MeasureDefinition {
return tmp;
}
/**
* Returns an array with the measureIndex of every retrial rate measure
* @return an array with measures' index
*/
@Override
public int[] getRetrialRateMeasures() {
int[] tmp = new int[retrialRate.size()];
......@@ -558,6 +574,10 @@ public class PAResultsModel implements MeasureDefinition {
return tmp;
}
/**
* Returns an array with the measureIndex of every system retrial rate measure
* @return an array with measures' index
*/
@Override
public int[] getSystemRetrialRateMeasures() {
int[] tmp = new int[systemRetrialRate.size()];
......
......@@ -575,6 +575,8 @@ public class StoredResultsModel implements MeasureDefinition {
renegingRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_BR)) {
balkingRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_R)) {
retrialRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_CN)) {
systemCustomerNumber.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_RP)) {
......@@ -589,6 +591,8 @@ public class StoredResultsModel implements MeasureDefinition {
systemBalkingRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_P)) {
systemPower.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_S_R)) {
systemRetrialRate.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_RP_PER_SINK)) {
responseTimePerSink.add(new Integer(measures.size() - 1));
} else if (type.equals(SimulationDefinition.MEASURE_X_PER_SINK)) {
......
......@@ -161,6 +161,7 @@ public class ResultsWindow extends JMTFrame implements ResultsConstants {
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RR, DESCRIPTION_SYSTEM_RENEGING_RATE, results.getSystemRenegingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_BR, DESCRIPTION_SYSTEM_BALKING_RATE, results.getSystemBalkingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_P, DESCRIPTION_SYSTEM_POWER, results.getSystemPowerMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_R, DESCRIPTION_SYSTEM_RETRIAL_RATE, results.getSystemRetrialRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RP_PER_SINK, DESCRIPTION_RESPONSE_TIME_PER_SINK, results.getResponsetimePerSinkMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_X_PER_SINK, DESCRIPTION_THROUGHPUT_PER_SINK, results.getThroughputPerSinkMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_FCR_TW, DESCRIPTION_FCR_TOTAL_WEIGHT, results.getFCRTotalWeightMeasures());
......
......@@ -158,11 +158,17 @@ public class PAResultsWindow extends JMTFrame implements ResultsConstants, Param
addTabPane(mainPanel, SimulationDefinition.MEASURE_U, DESCRIPTION_UTILIZATION, results.getUtilizationMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_X, DESCRIPTION_THROUGHPUT, results.getThroughputMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_DR, DESCRIPTION_DROP_RATE, results.getDropRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_BR, DESCRIPTION_BALKING_RATE, results.getBalkingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RR, DESCRIPTION_RENEGING_RATE, results.getRenegingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_R, DESCRIPTION_RETRIAL_RATE, results.getRetrialRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_CN, DESCRIPTION_SYSTEM_CUSTOMER_NUMBER, results.getSystemCustomerNumberMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RP, DESCRIPTION_SYSTEM_RESPONSE_TIME, results.getSystemResponseTimeMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_X, DESCRIPTION_SYSTEM_THROUGHPUT, results.getSystemThroughputMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_DR, DESCRIPTION_SYSTEM_DROP_RATE, results.getSystemDropRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_BR, DESCRIPTION_SYSTEM_BALKING_RATE, results.getSystemBalkingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_RR, DESCRIPTION_SYSTEM_RENEGING_RATE, results.getSystemRenegingRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_P, DESCRIPTION_SYSTEM_POWER, results.getSystemPowerMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_S_R, DESCRIPTION_SYSTEM_RETRIAL_RATE, results.getSystemRetrialRateMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_RP_PER_SINK, DESCRIPTION_RESPONSE_TIME_PER_SINK, results.getResponsetimePerSinkMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_X_PER_SINK, DESCRIPTION_THROUGHPUT_PER_SINK, results.getThroughputPerSinkMeasures());
addTabPane(mainPanel, SimulationDefinition.MEASURE_FCR_TW, DESCRIPTION_FCR_TOTAL_WEIGHT, results.getFCRTotalWeightMeasures());
......@@ -210,7 +216,10 @@ public class PAResultsWindow extends JMTFrame implements ResultsConstants, Param
suffix = " (s)";
} else if (measureType.equals(SimulationDefinition.MEASURE_X) || measureType.equals(SimulationDefinition.MEASURE_DR)
|| measureType.equals(SimulationDefinition.MEASURE_S_X) || measureType.equals(SimulationDefinition.MEASURE_S_DR)
|| measureType.equals(SimulationDefinition.MEASURE_X_PER_SINK)) {
|| measureType.equals(SimulationDefinition.MEASURE_X_PER_SINK) || measureType.equals(SimulationDefinition.MEASURE_S_R)
|| measureType.equals(SimulationDefinition.MEASURE_R) || measureType.equals(SimulationDefinition.MEASURE_RR)
|| measureType.equals(SimulationDefinition.MEASURE_BR) || measureType.equals(SimulationDefinition.MEASURE_S_RR)
|| measureType.equals(SimulationDefinition.MEASURE_S_BR)) {
suffix = " (j/s)";
} else if (measureType.equals(SimulationDefinition.MEASURE_S_P)) {
suffix = " (j/s^2)";
......
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