package nl.tudelft.simulation.dsol.jetty.test41; 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.logger.SimLogger; import nl.tudelft.simulation.dsol.simtime.SimTimeDouble; import nl.tudelft.simulation.dsol.simulators.DEVSSimulator; /** *

* Copyright (c) 2002-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights * reserved. *

* See for project information www.simulation.tudelft.nl. *

* The DSOL project is distributed under the following BSD-style license:
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the * following conditions are met: *

* This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, * including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are * disclaimed. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, * special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or * services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, * whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use * of this software, even if advised of the possibility of such damage. * @author Alexander Verbraeck */ public class WebMM1Queue41Application { /** */ private DEVSSimulator.TimeDouble simulator; /** */ private WebMM1Queue41Model model; /** * Construct a console application. * @throws SimRuntimeException on error * @throws RemoteException on error * @throws NamingException on error */ protected WebMM1Queue41Application() throws SimRuntimeException, RemoteException, NamingException { this.model = new WebMM1Queue41Model(); this.simulator = new DEVSSimulator.TimeDouble(); Replication replication = new Replication<>("rep1", new SimTimeDouble(0.0), 0.0, 1000.0, this.model); this.simulator.initialize(replication, ReplicationMode.TERMINATING); this.simulator.scheduleEventAbs(1000.0, this, this, "terminate", null); this.simulator.start(); } /** stop the simulation. */ protected final void terminate() { SimLogger.always().info("average queue length = " + this.model.qN.getSampleMean()); SimLogger.always().info("average queue wait = " + this.model.dN.getSampleMean()); SimLogger.always().info("average utilization = " + this.model.uN.getSampleMean()); System.exit(0); } /** * @param args can be left empty * @throws SimRuntimeException on error * @throws RemoteException on error * @throws NamingException on error */ public static void main(final String[] args) throws SimRuntimeException, RemoteException, NamingException { new WebMM1Queue41Application(); } }