package org.opentrafficsim.swing.script; import java.awt.Dimension; import java.rmi.RemoteException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.djunits.value.vdouble.scalar.Duration; import org.djunits.value.vdouble.scalar.Time; import org.djutils.cli.Checkable; import org.djutils.cli.CliException; import org.djutils.cli.CliUtil; import org.djutils.event.EventInterface; import org.djutils.event.EventListenerInterface; import org.djutils.exceptions.Throw; import org.djutils.exceptions.Try; import org.djutils.reflection.ClassUtil; import org.opentrafficsim.core.animation.gtu.colorer.GTUColorer; import org.opentrafficsim.core.dsol.OTSAnimator; import org.opentrafficsim.core.dsol.OTSModelInterface; import org.opentrafficsim.core.dsol.OTSSimulator; import org.opentrafficsim.core.dsol.OTSSimulatorInterface; import org.opentrafficsim.core.network.OTSNetwork; import org.opentrafficsim.draw.core.OTSDrawingException; import org.opentrafficsim.draw.factory.DefaultAnimationFactory; import org.opentrafficsim.road.network.OTSRoadNetwork; import org.opentrafficsim.swing.gui.AnimationToggles; import org.opentrafficsim.swing.gui.OTSAnimationPanel; import org.opentrafficsim.swing.gui.OTSSimulationApplication; import org.opentrafficsim.swing.gui.OTSSwingApplication; import nl.tudelft.simulation.dsol.SimRuntimeException; import nl.tudelft.simulation.dsol.experiment.Replication; import nl.tudelft.simulation.dsol.model.inputparameters.InputParameterMap; import nl.tudelft.simulation.dsol.model.outputstatistics.OutputStatistic; import nl.tudelft.simulation.jstats.streams.MersenneTwister; import nl.tudelft.simulation.jstats.streams.StreamInterface; import picocli.CommandLine.Command; import picocli.CommandLine.Option; /** * Template for simulation script. This class allows the user to run a single visualized simulation, or to batch-run the same * model. Parameters can be given through the command-line using djutils-ext. Fields can be added to sub-classes using the * {@code @Options} and similar annotations. Default values of the properties in this abstract class can be overwritten by the * sub-class using {@code CliUtil.changeDefaultValue()}. *
* Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
*
* BSD-style license. See OpenTrafficSim License.
*
* @version $Revision$, $LastChangedDate$, by $Author$, initial version 9 apr. 2018
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
private class ScriptModel implements OTSModelInterface
{
/** */
private static final long serialVersionUID = 20180409L;
/**
* @param simulator OTSSimulatorInterface; the simulator
*/
@SuppressWarnings("synthetic-access")
ScriptModel(final OTSSimulatorInterface simulator)
{
AbstractSimulationScript.this.simulator = simulator;
}
/** {@inheritDoc} */
@SuppressWarnings("synthetic-access")
@Override
public void constructModel() throws SimRuntimeException
{
Map