package nl.tudelft.simulation.examples.dsol.mm1queue; import java.rmi.RemoteException; import javax.naming.NamingException; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.experiment.Replication; import nl.tudelft.simulation.dsol.experiment.ReplicationMode; import nl.tudelft.simulation.dsol.model.inputparameters.InputParameterException; import nl.tudelft.simulation.dsol.simtime.SimTimeDouble; import nl.tudelft.simulation.dsol.simulators.DEVSSimulator; import nl.tudelft.simulation.dsol.swing.gui.DSOLApplication; import nl.tudelft.simulation.dsol.swing.gui.DSOLPanel; import nl.tudelft.simulation.dsol.swing.gui.TablePanel; import nl.tudelft.simulation.dsol.swing.gui.inputparameters.TabbedParameterDialog; /** *

* Copyright (c) 2002-2020 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See * for project information https://simulation.tudelft.nl. The DSOL * project is distributed under a three-clause BSD-style license, which can be found at * * https://simulation.tudelft.nl/dsol/3.0/license.html. *

* @author Alexander Verbraeck */ public class MM1QueueSwingApplication extends DSOLApplication { /** * @param title String; the title * @param panel DSOLPanel<Double,Double,SimTimeDouble>; the panel */ public MM1QueueSwingApplication(final String title, final DSOLPanel panel) { super(title, panel); } /** */ private static final long serialVersionUID = 1L; /** * @param args String[]; arguments, expected to be empty * @throws SimRuntimeException on error * @throws RemoteException on error * @throws NamingException on error * @throws InterruptedException on error * @throws InputParameterException on parameter error */ public static void main(final String[] args) throws SimRuntimeException, RemoteException, NamingException, InterruptedException, InputParameterException { DEVSSimulator.TimeDouble simulator = new DEVSSimulator.TimeDouble("MM1QueueSwingApplication"); MM1QueueModel model = new MM1QueueModel(simulator); Replication.TimeDouble replication = Replication.TimeDouble.create("rep1", 0.0, 0.0, 100.0, model); simulator.initialize(replication, ReplicationMode.TERMINATING); new TabbedParameterDialog(model.getInputParameterMap()); new MM1QueueSwingApplication("MM1 Queue model", new MM1QueuePanel(model, simulator)); } /** *

* copyright (c) 2002-2019 Delft University of Technology.
* BSD-style license. See DSOL License. *
* @author Alexander Verbraeck */ protected static class MM1QueuePanel extends DSOLPanel { /** */ private static final long serialVersionUID = 1L; /** * @param model MM1QueueModel; the model * @param simulator DEVSSimulator.TimeDouble; the simulator */ MM1QueuePanel(final MM1QueueModel model, final DEVSSimulator.TimeDouble simulator) { super(model, simulator); addTabs(model); } /** * add a number of charts for the demo. * @param model MM1QueueModel; the model from which to take the statistics */ protected final void addTabs(final MM1QueueModel model) { TablePanel charts = new TablePanel(2, 1); super.tabbedPane.addTab("statistics", charts); super.tabbedPane.setSelectedIndex(1); charts.setCell(model.serviceTimeChart.getSwingPanel(), 0, 0); charts.setCell(model.serviceTimeBWChart.getSwingPanel(), 1, 0); } } }