CPD Results
The following document contains the results of PMD's CPD 7.17.0.
Duplications
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step06/DesQueueingModel6.java | 72 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step07/DesQueueingModel7.java | 81 |
this.tallyTimeInQueue = new SimTally<>("tQ", "Time in queue", this);
this.tallyTimeInSystem = new SimTally<>("tS", "Time in system", this);
this.persistentQueueLength = new SimPersistent<>("lQ", "Queue length", this);
this.persistentUtilization = new SimPersistent<>("Ut", "Server utilization", this);
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Generate an entity.
*/
protected void generate()
{
double time = getSimulator().getSimulatorTime();
Entity entity = new Entity(this.entityCounter++, time);
System.out.println(String.format("Time: %.3f. Generated entity %d", time, entity.getId()));
if (this.capacity - this.busy >= 1)
{
// process
this.tallyTimeInQueue.register(0.0); // no waiting
startProcess(entity);
}
else
{
// queue
this.queue.add(new QueueEntry<Entity>(entity, time));
this.persistentQueueLength.register(time, this.queue.size());
System.out.println(String.format("Time: %.3f. Entity %d entered the queue. Length: %d", time, entity.getId(),
this.queue.size()));
}
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Start the processing of an entity by the server.
* @param entity the entity to be processed
*/
protected void startProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy++;
this.persistentUtilization.register(time, this.busy);
this.simulator.scheduleEventRel(this.processingTime.draw(), () -> endProcess(entity));
}
/**
* End the processing of an entity by the server.
* @param entity the entity that is being processed, and should leave the server
*/
protected void endProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy--;
this.persistentUtilization.register(time, this.busy);
if (!this.queue.isEmpty())
{
QueueEntry<Entity> nextQueueEntry = this.queue.remove(0);
this.persistentQueueLength.register(time, this.queue.size());
this.tallyTimeInQueue.register(time - nextQueueEntry.getQueueInTime());
startProcess(nextQueueEntry.getEntity());
}
this.tallyTimeInSystem.register(time - entity.getCreateTime());
System.out.println(String.format("Time: %.3f. Entity %d left the system. Time in system: %.3f", time, entity.getId(),
time - entity.getCreateTime()));
}
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 113 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 114 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 114 |
this.tallyTimeInQueue = new SimTally<>("tQ", "Time in queue", this);
this.tallyTimeInSystem = new SimTally<>("tS", "Time in system", this);
this.persistentQueueLength = new SimPersistent<>("lQ", "Queue length", this);
this.persistentUtilization = new SimPersistent<>("Ut", "Server utilization", this);
this.persistentQueueLength.register(0.0, 0.0);
this.persistentUtilization.register(0.0, 0.0);
this.simulator.scheduleEventRel(startTime, () -> generate());
}
/**
* Generate one or more entities, based on batchSize.
*/
protected void generate()
{
double time = getSimulator().getSimulatorTime();
for (int i = 0; i < this.batchSize; i++)
{
Entity entity = new Entity(this.entityCounter++, time);
if (this.capacity - this.busy >= 1)
{
// process
this.tallyTimeInQueue.register(0.0); // no waiting
startProcess(entity);
}
else
{
// queue
this.queue.add(new QueueEntry<Entity>(entity, time));
this.persistentQueueLength.register(time, this.queue.size());
}
}
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Start the processing of an entity by the server.
* @param entity the entity to be processed
*/
protected void startProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy++;
this.persistentUtilization.register(time, this.busy);
this.simulator.scheduleEventRel(this.processingTime.draw(), () -> endProcess(entity));
}
/**
* End the processing of an entity by the server.
* @param entity the entity that is being processed, and should leave the server
*/
protected void endProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy--;
this.persistentUtilization.register(time, this.busy);
if (!this.queue.isEmpty())
{
QueueEntry<Entity> nextQueueEntry = this.queue.remove(0);
this.persistentQueueLength.register(time, this.queue.size());
this.tallyTimeInQueue.register(time - nextQueueEntry.getQueueInTime());
startProcess(nextQueueEntry.getEntity());
}
this.tallyTimeInSystem.register(time - entity.getCreateTime());
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentApplication.java | 54 |
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentStoppingApp.java | 63 |
new DesExperimentApplication();
}
@Override
public void notify(final Event event)
{
if (event.getType().equals(Replication.END_REPLICATION_EVENT))
{
reportStats();
}
else if (event.getType().equals(Experiment.END_EXPERIMENT_EVENT))
{
reportFinalStats();
}
}
/**
* Report statistics at the end of a replication.
*/
protected void reportStats()
{
this.model.getPersistentUtilization().endObservations(this.model.getSimulator().getReplication().getRunLength());
this.model.getPersistentQueueLength().endObservations(this.model.getSimulator().getReplication().getRunLength());
System.out.println("\nStatistics of replication : " + this.model.getSimulator().getReplication().getId());
System.out.println(SimTally.reportHeader());
System.out.println(this.model.getTallyTimeInQueue().reportLine());
System.out.println(this.model.getTallyTimeInSystem().reportLine());
System.out.println(SimTally.reportFooter());
System.out.println(SimPersistent.reportHeader());
System.out.println(this.model.getPersistentQueueLength().reportLine());
System.out.println(this.model.getPersistentUtilization().reportLine());
System.out.println(SimPersistent.reportFooter());
}
/**
* Report the final statistics
*/
protected void reportFinalStats()
{
System.out.println("\nFinal statistics:");
SortedMap<String, SortedMap<String, Tally>> stats = this.experiment.getSummaryStatistics();
for (String statMapKey : stats.keySet())
{
System.out.println("\nSummary statistic for: " + statMapKey);
System.out.println(Tally.reportHeader());
SortedMap<String, Tally> statMap = stats.get(statMapKey);
for (String statKey : statMap.keySet())
{
Tally stat = statMap.get(statKey);
System.out.println(stat.reportLine());
}
System.out.println(Tally.reportFooter());
}
}
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 68 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 68 |
public DesExperimentModel(final DevsSimulatorInterface<Double> simulator)
{
super(simulator);
try
{
InputParameterMap generatorMap = new InputParameterMap("generator", "Generator", "Generator", 1.0);
generatorMap
.add(new InputParameterDouble("intervalTime", "Average interval time", "Average interval time", 1.0, 1.0));
generatorMap.add(new InputParameterDouble("startTime", "Generator start time", "Generator start time", 0.0, 2.0));
generatorMap.add(new InputParameterInteger("batchSize", "Batch size", "batch size", 1, 3.0));
this.inputParameterMap.add(generatorMap);
InputParameterMap resourceMap = new InputParameterMap("resource", "Resource", "Resource", 2.0);
resourceMap.add(new InputParameterInteger("capacity", "Resource capacity", "Resource capacity", 1, 1.0));
resourceMap.add(new InputParameterDouble("serviceTime", "Average service time", "Average service time", 0.9, 2.0));
this.inputParameterMap.add(resourceMap);
}
catch (InputParameterException e)
{
throw new SimRuntimeException("Error defining parameters for the model", e);
}
}
@Override
public void constructModel() throws SimRuntimeException
{
double startTime = 0.0;
try
{
this.capacity = (Integer) getInputParameter("resource.capacity");
this.batchSize = (Integer) getInputParameter("generator.batchSize");
startTime = (Double) getInputParameter("generator.startTime");
double iat = (Double) getInputParameter("generator.intervalTime");
this.interArrivalTime = new DistExponential(getDefaultStream(), iat);
double st = (Double) getInputParameter("resource.serviceTime");
this.processingTime = new DistExponential(getDefaultStream(), st);
}
catch (InputParameterException e)
{
throw new SimRuntimeException("Error retrieving parameters for the model", e);
}
this.queue = new ArrayList<>(); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmCsvSwingApplication.java | 50 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmJsonSwingApplication.java | 50 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmYamlSwingApplication.java | 50 |
public OsmCsvSwingApplication(final String title, final DsolPanel panel, final DsolAnimationGisTab animationTab)
throws IllegalArgumentException, DsolException
{
super(panel, title, animationTab);
panel.enableSimulationControlButtons();
}
/**
* @param args arguments, expected to be empty
* @throws SimRuntimeException on error
* @throws RemoteException on error
* @throws NamingException on error
* @throws DsolException when simulator is not an animator
*/
public static void main(final String[] args) throws SimRuntimeException, RemoteException, NamingException, DsolException
{
DevsRealTimeAnimator.TimeDouble simulator = new DevsRealTimeAnimator.TimeDouble("sim", 0.001);
EmptyModel model = new EmptyModel(simulator);
Replication<Double> replication = new SingleReplication<Double>("rep1", 0.0, 0.0, 1000000.0);
simulator.initialize(model, replication);
DsolPanel panel = new DsolPanel(new RealTimeControlPanel.TimeDouble(model, simulator));
Bounds2d mapBounds = new Bounds2d(4.355, 4.386, 51.995, 52.005);
DsolAnimationGisTab animationTab = new DsolAnimationGisTab(mapBounds, simulator);
animationTab.getAnimationPanel().setRenderableScale(
new RenderableScale(Math.cos(Math.toRadians(mapBounds.midPoint().getY())), 1.0 / 111319.24));
animationTab.getAnimationPanel().setShowGrid(false);
animationTab.addAllToggleGISButtonText("MAP LAYERS", model.getOsmMap(), "hide or show this GIS layer");
new OsmCsvSwingApplication("OSMCsvSwingApplication", panel, animationTab); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 142 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 139 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 143 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 143 |
this.persistentQueueLength.register(time, this.queue.size());
}
}
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Start the processing of an entity by the server.
* @param entity the entity to be processed
*/
protected void startProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy++;
this.persistentUtilization.register(time, this.busy);
this.simulator.scheduleEventRel(this.processingTime.draw(), () -> endProcess(entity));
}
/**
* End the processing of an entity by the server.
* @param entity the entity that is being processed, and should leave the server
*/
protected void endProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy--;
this.persistentUtilization.register(time, this.busy);
if (!this.queue.isEmpty())
{
QueueEntry<Entity> nextQueueEntry = this.queue.remove(0);
this.persistentQueueLength.register(time, this.queue.size());
this.tallyTimeInQueue.register(time - nextQueueEntry.getQueueInTime());
startProcess(nextQueueEntry.getEntity());
}
this.tallyTimeInSystem.register(time - entity.getCreateTime()); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step05/DesQueueingModel5.java | 97 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step06/DesQueueingModel6.java | 100 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step07/DesQueueingModel7.java | 109 |
this.persistentQueueLength.register(time, this.queue.size());
}
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Start the processing of an entity by the server.
* @param entity the entity to be processed
*/
protected void startProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy++;
this.persistentUtilization.register(time, this.busy);
this.simulator.scheduleEventRel(this.processingTime.draw(), () -> endProcess(entity));
}
/**
* End the processing of an entity by the server.
* @param entity the entity that is being processed, and should leave the server
*/
protected void endProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy--;
this.persistentUtilization.register(time, this.busy);
if (!this.queue.isEmpty())
{
QueueEntry<Entity> nextQueueEntry = this.queue.remove(0);
this.persistentQueueLength.register(time, this.queue.size());
this.tallyTimeInQueue.register(time - nextQueueEntry.getQueueInTime());
startProcess(nextQueueEntry.getEntity());
}
this.tallyTimeInSystem.register(time - entity.getCreateTime()); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 144 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step05/DesQueueingModel5.java | 98 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 145 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 145 |
}
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Start the processing of an entity by the server.
* @param entity the entity to be processed
*/
protected void startProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy++;
this.persistentUtilization.register(time, this.busy);
this.simulator.scheduleEventRel(this.processingTime.draw(), () -> endProcess(entity));
}
/**
* End the processing of an entity by the server.
* @param entity the entity that is being processed, and should leave the server
*/
protected void endProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy--;
this.persistentUtilization.register(time, this.busy);
if (!this.queue.isEmpty())
{
QueueEntry<Entity> nextQueueEntry = this.queue.remove(0);
this.persistentQueueLength.register(time, this.queue.size());
this.tallyTimeInQueue.register(time - nextQueueEntry.getQueueInTime());
startProcess(nextQueueEntry.getEntity());
}
this.tallyTimeInSystem.register(time - entity.getCreateTime());
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 144 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step06/DesQueueingModel6.java | 101 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step07/DesQueueingModel7.java | 110 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 141 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 145 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 145 |
}
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Start the processing of an entity by the server.
* @param entity the entity to be processed
*/
protected void startProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy++;
this.persistentUtilization.register(time, this.busy);
this.simulator.scheduleEventRel(this.processingTime.draw(), () -> endProcess(entity));
}
/**
* End the processing of an entity by the server.
* @param entity the entity that is being processed, and should leave the server
*/
protected void endProcess(final Entity entity)
{
double time = getSimulator().getSimulatorTime();
this.busy--;
this.persistentUtilization.register(time, this.busy);
if (!this.queue.isEmpty())
{
QueueEntry<Entity> nextQueueEntry = this.queue.remove(0);
this.persistentQueueLength.register(time, this.queue.size());
this.tallyTimeInQueue.register(time - nextQueueEntry.getQueueInTime());
startProcess(nextQueueEntry.getEntity());
}
this.tallyTimeInSystem.register(time - entity.getCreateTime()); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/examples/dsol/animation/gis/EsriCsvSwingApplication.java | 50 |
| nl/tudelft/simulation/examples/dsol/animation/gis/EsriXmlSwingApplication.java | 50 |
public EsriCsvSwingApplication(final String title, final DsolPanel panel, final DsolAnimationGisTab animationTab)
throws IllegalArgumentException, DsolException
{
super(panel, title, animationTab);
panel.enableSimulationControlButtons();
}
/**
* @param args arguments, expected to be empty
* @throws SimRuntimeException on error
* @throws RemoteException on error
* @throws NamingException on error
* @throws DsolException when simulator is not an animator
*/
public static void main(final String[] args) throws SimRuntimeException, RemoteException, NamingException, DsolException
{
DevsRealTimeAnimator.TimeDouble simulator = new DevsRealTimeAnimator.TimeDouble("EsriSwingApplication", 0.001);
EmptyModel model = new EmptyModel(simulator);
Replication<Double> replication = new SingleReplication<Double>("rep1", 0.0, 0.0, 1000000.0);
simulator.initialize(model, replication);
DsolPanel panel = new DsolPanel(new RealTimeControlPanel.TimeDouble(model, simulator));
Bounds2d mapBounds = new Bounds2d(4.355, 4.386, 51.995, 52.005);
DsolAnimationGisTab animationTab = new DsolAnimationGisTab(mapBounds, simulator);
animationTab.getAnimationPanel().setRenderableScale(
new RenderableScale(Math.cos(Math.toRadians(mapBounds.midPoint().getY())), 1.0 / 111319.24));
animationTab.addAllToggleGISButtonText("MAP LAYERS", model.getGisMap(), "hide or show this GIS layer");
new EsriCsvSwingApplication("EsriSwingApplication", panel, animationTab); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 82 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 87 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 87 |
this.inputParameterMap.add(resourceMap);
}
catch (InputParameterException e)
{
throw new SimRuntimeException("Error defining parameters for the model", e);
}
}
@Override
public void constructModel() throws SimRuntimeException
{
double startTime = 0.0;
try
{
this.capacity = (Integer) getInputParameter("resource.capacity");
this.batchSize = (Integer) getInputParameter("generator.batchSize");
startTime = (Double) getInputParameter("generator.startTime");
double iat = (Double) getInputParameter("generator.intervalTime");
this.interArrivalTime = new DistExponential(getDefaultStream(), iat);
double st = (Double) getInputParameter("resource.serviceTime");
this.processingTime = new DistExponential(getDefaultStream(), st);
}
catch (InputParameterException e)
{
throw new SimRuntimeException("Error retrieving parameters for the model", e);
}
this.tallyTimeInQueue = new SimTally<>("tQ", "Time in queue", this);
this.tallyTimeInSystem = new SimTally<>("tS", "Time in system", this);
this.persistentQueueLength = new SimPersistent<>("lQ", "Queue length", this);
this.persistentUtilization = new SimPersistent<>("Ut", "Server utilization", this);
this.simulator.scheduleEventRel(startTime, () -> generate()); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step05/DesQueueingModel5.java | 61 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step06/DesQueueingModel6.java | 61 |
public DesQueueingModel5(final DevsSimulatorInterface<Double> simulator, final DistContinuous interArrivalTime,
final DistContinuous processingTime)
{
super(simulator);
this.interArrivalTime = interArrivalTime;
this.processingTime = processingTime;
}
@Override
public void constructModel()
{
this.tallyTimeInQueue = new SimTally<>("tQ", "Time in queue", this);
this.tallyTimeInSystem = new SimTally<>("tS", "Time in system", this);
this.persistentQueueLength = new SimPersistent<>("lQ", "Queue length", this);
this.persistentUtilization = new SimPersistent<>("Ut", "Server utilization", this);
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Generate an entity.
*/
protected void generate()
{
double time = getSimulator().getSimulatorTime();
Entity entity = new Entity(this.entityCounter++, time); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 68 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 72 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 72 |
public DesExperimentModel(final DevsSimulatorInterface<Double> simulator)
{
super(simulator);
try
{
InputParameterMap generatorMap = new InputParameterMap("generator", "Generator", "Generator", 1.0);
generatorMap
.add(new InputParameterDouble("intervalTime", "Average interval time", "Average interval time", 1.0, 1.0));
generatorMap.add(new InputParameterDouble("startTime", "Generator start time", "Generator start time", 0.0, 2.0));
generatorMap.add(new InputParameterInteger("batchSize", "Batch size", "batch size", 1, 3.0));
this.inputParameterMap.add(generatorMap);
InputParameterMap resourceMap = new InputParameterMap("resource", "Resource", "Resource", 2.0);
resourceMap.add(new InputParameterInteger("capacity", "Resource capacity", "Resource capacity", 1, 1.0));
resourceMap.add(new InputParameterDouble("serviceTime", "Average service time", "Average service time", 0.9, 2.0));
this.inputParameterMap.add(resourceMap); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 68 |
| nl/tudelft/simulation/dsol/demo/flow/mm1/MM1Model.java | 51 |
public DesExperimentModel(final DevsSimulatorInterface<Double> simulator)
{
super(simulator);
try
{
InputParameterMap generatorMap = new InputParameterMap("generator", "Generator", "Generator", 1.0);
generatorMap
.add(new InputParameterDouble("intervalTime", "Average interval time", "Average interval time", 1.0, 1.0));
generatorMap.add(new InputParameterDouble("startTime", "Generator start time", "Generator start time", 0.0, 2.0));
generatorMap.add(new InputParameterInteger("batchSize", "Batch size", "batch size", 1, 3.0));
this.inputParameterMap.add(generatorMap);
InputParameterMap resourceMap = new InputParameterMap("resource", "Resource", "Resource", 2.0);
resourceMap.add(new InputParameterInteger("capacity", "Resource capacity", "Resource capacity", 1, 1.0));
resourceMap.add(new InputParameterDouble("serviceTime", "Average service time", "Average service time", 0.9, 2.0));
this.inputParameterMap.add(resourceMap);
}
catch (InputParameterException e) | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 68 |
| nl/tudelft/simulation/dsol/demo/flow/mm1/MM1Model.java | 51 |
public DesQueueingModel8(final DevsSimulatorInterface<Double> simulator)
{
super(simulator);
try
{
InputParameterMap generatorMap = new InputParameterMap("generator", "Generator", "Generator", 1.0);
generatorMap
.add(new InputParameterDouble("intervalTime", "Average interval time", "Average interval time", 1.0, 1.0));
generatorMap.add(new InputParameterDouble("startTime", "Generator start time", "Generator start time", 0.0, 2.0));
generatorMap.add(new InputParameterInteger("batchSize", "Batch size", "batch size", 1, 3.0));
this.inputParameterMap.add(generatorMap);
InputParameterMap resourceMap = new InputParameterMap("resource", "Resource", "Resource", 2.0);
resourceMap.add(new InputParameterInteger("capacity", "Resource capacity", "Resource capacity", 1, 1.0));
resourceMap.add(new InputParameterDouble("serviceTime", "Average service time", "Average service time", 0.9, 2.0));
this.inputParameterMap.add(resourceMap);
}
catch (InputParameterException e) | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 72 |
| nl/tudelft/simulation/dsol/demo/flow/mm1/MM1Model.java | 51 |
public DesQueueingModel9(final DevsSimulatorInterface<Double> simulator)
{
super(simulator);
try
{
InputParameterMap generatorMap = new InputParameterMap("generator", "Generator", "Generator", 1.0);
generatorMap
.add(new InputParameterDouble("intervalTime", "Average interval time", "Average interval time", 1.0, 1.0));
generatorMap.add(new InputParameterDouble("startTime", "Generator start time", "Generator start time", 0.0, 2.0));
generatorMap.add(new InputParameterInteger("batchSize", "Batch size", "batch size", 1, 3.0));
this.inputParameterMap.add(generatorMap);
InputParameterMap resourceMap = new InputParameterMap("resource", "Resource", "Resource", 2.0);
resourceMap.add(new InputParameterInteger("capacity", "Resource capacity", "Resource capacity", 1, 1.0));
resourceMap.add(new InputParameterDouble("serviceTime", "Average service time", "Average service time", 0.9, 2.0));
this.inputParameterMap.add(resourceMap); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 72 |
| nl/tudelft/simulation/dsol/demo/flow/mm1/MM1Model.java | 51 |
public DesQueueingModel10(final DevsSimulatorInterface<Double> simulator)
{
super(simulator);
try
{
InputParameterMap generatorMap = new InputParameterMap("generator", "Generator", "Generator", 1.0);
generatorMap
.add(new InputParameterDouble("intervalTime", "Average interval time", "Average interval time", 1.0, 1.0));
generatorMap.add(new InputParameterDouble("startTime", "Generator start time", "Generator start time", 0.0, 2.0));
generatorMap.add(new InputParameterInteger("batchSize", "Batch size", "batch size", 1, 3.0));
this.inputParameterMap.add(generatorMap);
InputParameterMap resourceMap = new InputParameterMap("resource", "Resource", "Resource", 2.0);
resourceMap.add(new InputParameterInteger("capacity", "Resource capacity", "Resource capacity", 1, 1.0));
resourceMap.add(new InputParameterDouble("serviceTime", "Average service time", "Average service time", 0.9, 2.0));
this.inputParameterMap.add(resourceMap); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentModel.java | 82 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step09/DesQueueingModel9.java | 87 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step10/DesQueueingModel10.java | 87 |
this.inputParameterMap.add(resourceMap);
}
catch (InputParameterException e)
{
throw new SimRuntimeException("Error defining parameters for the model", e);
}
}
@Override
public void constructModel() throws SimRuntimeException
{
double startTime = 0.0;
try
{
this.capacity = (Integer) getInputParameter("resource.capacity");
this.batchSize = (Integer) getInputParameter("generator.batchSize");
startTime = (Double) getInputParameter("generator.startTime");
double iat = (Double) getInputParameter("generator.intervalTime");
this.interArrivalTime = new DistExponential(getDefaultStream(), iat);
double st = (Double) getInputParameter("resource.serviceTime");
this.processingTime = new DistExponential(getDefaultStream(), st);
}
catch (InputParameterException e)
{
throw new SimRuntimeException("Error retrieving parameters for the model", e);
}
this.queue = new ArrayList<>(); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step06/DesQueueingModel6.java | 86 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 125 |
Entity entity = new Entity(this.entityCounter++, time);
System.out.println(String.format("Time: %.3f. Generated entity %d", time, entity.getId()));
if (this.capacity - this.busy >= 1)
{
// process
this.tallyTimeInQueue.register(0.0); // no waiting
startProcess(entity);
}
else
{
// queue
this.queue.add(new QueueEntry<Entity>(entity, time));
this.persistentQueueLength.register(time, this.queue.size());
System.out.println(String.format("Time: %.3f. Entity %d entered the queue. Length: %d", time, entity.getId(),
this.queue.size()));
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step07/DesQueueingModel7.java | 95 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step08/DesQueueingModel8.java | 125 |
Entity entity = new Entity(this.entityCounter++, time);
System.out.println(String.format("Time: %.3f. Generated entity %d", time, entity.getId()));
if (this.capacity - this.busy >= 1)
{
// process
this.tallyTimeInQueue.register(0.0); // no waiting
startProcess(entity);
}
else
{
// queue
this.queue.add(new QueueEntry<Entity>(entity, time));
this.persistentQueueLength.register(time, this.queue.size());
System.out.println(String.format("Time: %.3f. Entity %d entered the queue. Length: %d", time, entity.getId(),
this.queue.size()));
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/examples/dsol/animation/gis/EsriCsvSwingApplication.java | 66 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmCsvSwingApplication.java | 66 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmJsonSwingApplication.java | 66 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmYamlSwingApplication.java | 66 |
DevsRealTimeAnimator.TimeDouble simulator = new DevsRealTimeAnimator.TimeDouble("EsriSwingApplication", 0.001);
EmptyModel model = new EmptyModel(simulator);
Replication<Double> replication = new SingleReplication<Double>("rep1", 0.0, 0.0, 1000000.0);
simulator.initialize(model, replication);
DsolPanel panel = new DsolPanel(new RealTimeControlPanel.TimeDouble(model, simulator));
Bounds2d mapBounds = new Bounds2d(4.355, 4.386, 51.995, 52.005);
DsolAnimationGisTab animationTab = new DsolAnimationGisTab(mapBounds, simulator);
animationTab.getAnimationPanel().setRenderableScale(
new RenderableScale(Math.cos(Math.toRadians(mapBounds.midPoint().getY())), 1.0 / 111319.24));
animationTab.addAllToggleGISButtonText("MAP LAYERS", model.getGisMap(), "hide or show this GIS layer"); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/examples/dsol/animation/gis/EsriXmlSwingApplication.java | 66 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmCsvSwingApplication.java | 66 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmJsonSwingApplication.java | 66 |
| nl/tudelft/simulation/examples/dsol/animation/gis/OsmYamlSwingApplication.java | 66 |
DevsRealTimeAnimator.TimeDouble simulator = new DevsRealTimeAnimator.TimeDouble("EsriSwingApplication", 0.001);
EmptyModel model = new EmptyModel(simulator);
Replication<Double> replication = new SingleReplication<Double>("rep1", 0.0, 0.0, 1000000.0);
simulator.initialize(model, replication);
DsolPanel panel = new DsolPanel(new RealTimeControlPanel.TimeDouble(model, simulator));
Bounds2d mapBounds = new Bounds2d(4.355, 4.386, 51.995, 52.005);
DsolAnimationGisTab animationTab = new DsolAnimationGisTab(mapBounds, simulator);
animationTab.getAnimationPanel().setRenderableScale(
new RenderableScale(Math.cos(Math.toRadians(mapBounds.midPoint().getY())), 1.0 / 111319.24));
animationTab.addAllToggleGISButtonText("MAP LAYERS", model.getGisMap(), "hide or show this GIS layer"); | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentApplication.java | 95 |
| nl/tudelft/simulation/dsol/demo/flow/mm1/MM1ExperimentApplication.java | 90 |
System.out.println("\nFinal statistics:");
SortedMap<String, SortedMap<String, Tally>> stats = this.experiment.getSummaryStatistics();
for (String statMapKey : stats.keySet())
{
System.out.println("\nSummary statistic for: " + statMapKey);
System.out.println(Tally.reportHeader());
SortedMap<String, Tally> statMap = stats.get(statMapKey);
for (String statKey : statMap.keySet())
{
Tally stat = statMap.get(statKey);
System.out.println(stat.reportLine());
}
System.out.println(Tally.reportFooter());
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/experiment/DesExperimentStoppingApp.java | 104 |
| nl/tudelft/simulation/dsol/demo/flow/mm1/MM1ExperimentApplication.java | 90 |
System.out.println("\nFinal statistics:");
SortedMap<String, SortedMap<String, Tally>> stats = this.experiment.getSummaryStatistics();
for (String statMapKey : stats.keySet())
{
System.out.println("\nSummary statistic for: " + statMapKey);
System.out.println(Tally.reportHeader());
SortedMap<String, Tally> statMap = stats.get(statMapKey);
for (String statKey : statMap.keySet())
{
Tally stat = statMap.get(statKey);
System.out.println(stat.reportLine());
}
System.out.println(Tally.reportFooter());
} | |
| File | Line |
|---|---|
| nl/tudelft/simulation/dsol/demo/des/mm1/step05/DesQueueingModel5.java | 72 |
| nl/tudelft/simulation/dsol/demo/des/mm1/step07/DesQueueingModel7.java | 81 |
this.tallyTimeInQueue = new SimTally<>("tQ", "Time in queue", this);
this.tallyTimeInSystem = new SimTally<>("tS", "Time in system", this);
this.persistentQueueLength = new SimPersistent<>("lQ", "Queue length", this);
this.persistentUtilization = new SimPersistent<>("Ut", "Server utilization", this);
this.simulator.scheduleEventRel(this.interArrivalTime.draw(), () -> generate());
}
/**
* Generate an entity.
*/
protected void generate()
{
double time = getSimulator().getSimulatorTime();
Entity entity = new Entity(this.entityCounter++, time); | |
