Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

desmoj
Class Experiment  view Experiment download Experiment.java

java.lang.Object
  extended bydesmoj.NamedObject
      extended bydesmoj.Experiment

public class Experiment
extends NamedObject

Experiment is the class that provides the infrastructure for running the simulation of a model. It contains all data structures necessary to simulate the model and takes care of all necessary output. To actually run an experiment, a new instance of the experiment class and a new instance of the desired model have to be created. To link both instances, call the connectToExperiment(Experiment e) method of the model instance and pass the new experiment as a parameter. Additional functionality by Ruth Meyer: Experiments may be "timed", i.e. the simulation time (represented as doubles) may be mapped to a true date and time. This requires the specification of a time unit, too. Example: Simulation starts at sim time 0.0 = true time 23.5.1999 10:00, time unit is minutes, so sim time 5.0 = true time 23.5.1999 10:05.

Version:
DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL

Field Summary
static int ABORTED
          Status of an Experiment finished and to be cleared.
private  boolean abortFlag
          Flag indicating if the simulation is supposed to stop after the current event is processed.
private  Model client
          The model to be run by this experiment.
private  Scheduler clientScheduler
          The scheduler used for this experiment.
static int CONNECTED
          Status of an Experiment connected to a Model and ready to be started.
(package private) static java.lang.Class debugnote
          The class reference to messages of type desmoj.report.DebugNote
private  DistributionManager distMan
          The distribution manager for the model's distributions.
(package private) static java.lang.Class errormessage
          The class reference to messages of type desmoj.report.ErrorMessage
private  java.lang.ThreadGroup expThreads
          The ThreadGroup for this Experiment.
private  java.util.Vector fileRegistry
          The Vector to register all FileOutput objects to close them after finishing the Experiment.
static int INITIALIZED
          Status of an Experiment instantiated with all needed accessories available.
private  boolean isTimed
          Flag to indicate if this experiment is "timed", i.e.
private static int lastSuffix
          The last suffix used with filenames when creating multiple batch runs of an experiment.
private  MessageDistributor messMan
          The message manager for the model's messages.
static int NOT_INITIALIZED
          Status of an Experiment just created without any accessories created yet.
private  java.lang.String pathname
          Specifies an output path for the report files (Modification by Nicolas Knaak, 02/2001)
private  java.lang.String pathName
          Specifies an output path for the report files (Modification by Nicolas Knaak, 02/2001)
private  ReportManager repMan
          The report manager for the model's reports.
(package private) static java.lang.Class reporter
          The class reference to messages of type desmoj.report.Reporter
private  ResourceDB resDB
          The resource database storing all resource allocations and requests.
static int RUNNING
          Status of an Experiment currently running the simulation.
private  long seedGeneratorSeed
          The seed used to start the SeedGenerator with.
private  boolean showProgressBar
          Flag indicating whether a progressbar for this experiment should be displayed or not.
static int STARTED
          Status of an Experiment being started.
private  int status
          Flag indicating if the simulation is running.
static int STOPPED
          Status of an Experiment stopped after having run.
private  Condition stopper
          The Condition which can cause an experiment to stop.
private  SimTime stopTime
          The SimTime when the experiment is supposed to stop.
private  int timeFloats
          The number of floating point digits of simulation time to be printed in Reports.
(package private) static java.lang.Class tracenote
          The class reference to messages of type desmoj.report.TraceNote
private  TimeConverter trueTimer
          The time converter used to convert sim time to true time and vice versa.
 
Fields inherited from class desmoj.NamedObject
 
Constructor Summary
Experiment(java.lang.String name)
          Constructs a new Experiment with the given name.
Experiment(java.lang.String name, java.lang.String pathName)
          Constructs a new Experiment with the given name.
Experiment(java.lang.String name, java.lang.String referenceTime, int referenceUnit)
          Constructs a new Experiment with the given name.
Experiment(java.lang.String name, java.lang.String pathName, java.lang.String referenceTime, int referenceUnit)
          Constructs a new Experiment with the given name.
 
Method Summary
 void addDebugReceiver(MessageReceiver trcRec)
          Adds a messagereceiver for debugnotes to the experiment.
 void addErrorReceiver(MessageReceiver trcRec)
          Adds a messagereceiver for error messages to the experiment.
 void addReceiver(MessageReceiver trcRec, java.lang.Class messageType)
          Adds a messagereceiver for the given subtype of message to the experiment.
 void addTraceReceiver(MessageReceiver trcRec)
          Adds a messagereceiver for tracenotes to the experiment.
 boolean debugIsOn()
          Returns a boolean indicating whether debug notes are forwarded to the debug ouput or not.
 void debugOff(SimTime stopTime)
          Switches the debug output off at the given point of simulation time.
 void debugOn(SimTime startTime)
          Switches the debug output on at the given point of simulation time.
 void debugPeriod(SimTime startTime, SimTime stopTime)
          Switches the debug output on for the given period of simulation time.
 void deRegister(FileOutput file)
          De-registers a file at the experiment.
 void finish()
          Stopps all running simprocesses that might still be scheduled and closes the output files.
 DistributionManager getDistributionManager()
          Returns the distributionmanager for this experiment.
 SimTime getEpsilon()
          Returns the epsilon value representing the minimum distinguishable span of simulation time for this experiment.
 MessageDistributor getMessageManager()
          Returns the messagemanager for this experiment.
 Model getModel()
          Returns the model that is connected to this experiment or null if no model is connected so far.
 java.lang.String getOutputPath()
          Returns the name of the path the experiment's report-, trace-, debug- and error-files are written to.
 java.lang.String getReferenceTime()
          Returns the reference time for this experiment.
 int getReferenceUnit()
          Returns the reference unit for this experiment.
 ReportManager getReportManager()
          Returns the reportmanager for this experiment.
 ResourceDB getResourceDB()
          Returns the resource database for this experiment.
 Scheduler getScheduler()
          Returns the scheduler for this experiment.
 SimClock getSimClock()
          Returns the simclock for this experiment.
 SimTime getStopTime()
          Returns the SimTime when the experiment is expected to stop running.
(package private)  java.lang.ThreadGroup getThreadGroup()
          Returns the threadgroup associated to this experiment.
 int getTimeFloats()
          Returns the experiment's number of floating point digits of simulation time that are displayed in the various output files
 boolean isAborted()
          Displays the current state of the simulation run.
 boolean isConnected()
          Shows if this experiment has already been connected to a model.
 boolean isRunning()
          Displays the current state of the simulation run.
 boolean isShowProgressBar()
          Returns if a progress bar should be displayed for this experiment or not.
 void proceed()
          Proceeds with a stopped experiment.
 void register(FileOutput file)
          Registers a file output at the experiment.
(package private)  void registerModel(Model mainModel)
          Connects a model to this experiment.
 void removeDebugReceiver(MessageReceiver msgRec)
          Removes a messagereceiver for debugnotes from the experiment's messagedistributor.
 void removeErrorReceiver(MessageReceiver msgRec)
          Removes a messagereceiver for errormessages from the experiment's messagedistributor.
 void removeReceiver(MessageReceiver msgRec)
          Removes a messagereceiver from the experiment's messagedistributor.
 void removeReceiver(MessageReceiver msgRec, java.lang.Class messageType)
          Removes a messagereceiver for the given subtype of message from the Experiment's messagedistributor.
 void removeTraceReceiver(MessageReceiver msgRec)
          Removes a messagereceiver for tracenotes from the experiment's messagedistributor.
 void reName(java.lang.String newName)
          Overrides inherited NamedObjectImp.rename(String newName) method to prevent the user from changing the experiment's name during an experiment.
 void report()
          Writes a report about the model connected top this experiment, its reportable components and all related submodels into the report output.
 void report(Model m)
          Writes a report about the given model which has to be connected to this experiment as main model or as a submodel.
 void resetOutputTimeFormat()
          Resets the time format to be used for output of true time Strings to the default pattern: dd.MM.yyyy HH:mm:ss:SSS.
private  void scheduleTimedTraceEvent(SimTime simTime, java.lang.String whatTime, Event directSuccessor)
          Schedules an ExternalEventTimedTrace event to insert an entry in the trace file stating the true time (and time unit) of the given sim time.
(package private)  void sendDebugNote(java.lang.String component, java.lang.String description)
          Creates and sends a debugnote to the messagedistributor.
(package private)  void sendMessage(Message m)
          Sends a message to the messagedistributor.
(package private)  void sendWarning(java.lang.String description, java.lang.String location, java.lang.String reason, java.lang.String prevention)
          Creates and sends an error message to the messagedistributor to warn the modeller that some conditions required by the framework are not met.
(package private)  void setAbortFlag(boolean value)
          Sets the abort flag to the given value.
 void setEpsilon(SimTime eps)
          Sets the epsilon value for the smallest distinguishable timespan to the given SimTime parameter.
 void setOutputTimeFormat(java.lang.String pattern)
          Sets the time format to be used for output of true time Strings.
 void setSeedGenerator(long seed)
          Sets the seed of the SeedGenerator to the given value.
 void setShowProgressBar(boolean newShowProgressBar)
          Sets the new value for showing the progress bar for this experiment or not.
(package private)  void setStatus(int newStatus)
          Sets the experiment's status to the given integer value.
 void start()
          Starts the simulation with default start time 0.0.
 void start(SimTime initTime)
          Starts the experiment with the given simulation time as starting time.
 void stop(Condition stopCond)
          Stops the simulation when the given condition returns true.
 void stop(SimTime stopTime)
          Stops the simulation at the given point of simulation time.
 void stop(java.lang.String trueStopTime)
          Stops the simulation at the given point of true time.
 SimTime toSimTime(double duration, int unit)
          Converts the given duration to an corresponding sim time using the given time unit.
 SimTime toSimTime(java.lang.String trueTime)
          Converts the given true time to the corresponding sim time.
 java.lang.String toTrueTime(SimTime simTime)
          Converts the given sim time to the corresponding true time.
 java.lang.String toTrueTime(SimTime simTime, java.lang.String pattern)
          Converts the given sim time to the corresponding true time.
 boolean traceIsOn()
          Returns a boolean indicating whether trace notes are forwarded to the trace ouput or not.
 void traceOff(SimTime stopTime)
          Switches the trace output off at the given point of simulation time.
 void traceOn(SimTime startTime)
          Switches the trace output on at the given point of simulation time.
 void tracePeriod(SimTime startTime, SimTime stopTime)
          Switches the trace output on for the given period of simulation time.
 void writeReport(Model m, java.lang.String suffix)
          Triggers the reporters of the given model or submodel to write their report data into the report output registered at the experiment's messagemanager.
 void writeReport(java.lang.String suffix)
          Triggers the reporters to write their data into the report output registered at the experiment's messagemanager.
 
Methods inherited from class desmoj.NamedObject
getName, getQuotedName, rename, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOT_INITIALIZED

public static final int NOT_INITIALIZED
Status of an Experiment just created without any accessories created yet.

See Also:
Constant Field Values

INITIALIZED

public static final int INITIALIZED
Status of an Experiment instantiated with all needed accessories available.

See Also:
Constant Field Values

CONNECTED

public static final int CONNECTED
Status of an Experiment connected to a Model and ready to be started.

See Also:
Constant Field Values

STARTED

public static final int STARTED
Status of an Experiment being started. Only if an Experiment is

See Also:
Constant Field Values

STOPPED

public static final int STOPPED
Status of an Experiment stopped after having run.

See Also:
Constant Field Values

RUNNING

public static final int RUNNING
Status of an Experiment currently running the simulation.

See Also:
Constant Field Values

ABORTED

public static final int ABORTED
Status of an Experiment finished and to be cleared.

See Also:
Constant Field Values

lastSuffix

private static int lastSuffix
The last suffix used with filenames when creating multiple batch runs of an experiment.


tracenote

static java.lang.Class tracenote
The class reference to messages of type desmoj.report.TraceNote


debugnote

static java.lang.Class debugnote
The class reference to messages of type desmoj.report.DebugNote


errormessage

static java.lang.Class errormessage
The class reference to messages of type desmoj.report.ErrorMessage


reporter

static java.lang.Class reporter
The class reference to messages of type desmoj.report.Reporter


stopper

private Condition stopper
The Condition which can cause an experiment to stop. The user has to implement the check() method of this Condition in order to effectively stop an experiment.


abortFlag

private boolean abortFlag
Flag indicating if the simulation is supposed to stop after the current event is processed.


status

private int status
Flag indicating if the simulation is running.


client

private Model client
The model to be run by this experiment.


clientScheduler

private Scheduler clientScheduler
The scheduler used for this experiment.


distMan

private DistributionManager distMan
The distribution manager for the model's distributions.


repMan

private ReportManager repMan
The report manager for the model's reports.


messMan

private MessageDistributor messMan
The message manager for the model's messages.


seedGeneratorSeed

private long seedGeneratorSeed
The seed used to start the SeedGenerator with. Default is zero, but can be set via the ExperimentOptions to individual values.


expThreads

private java.lang.ThreadGroup expThreads
The ThreadGroup for this Experiment.


timeFloats

private int timeFloats
The number of floating point digits of simulation time to be printed in Reports.


fileRegistry

private java.util.Vector fileRegistry
The Vector to register all FileOutput objects to close them after finishing the Experiment.


resDB

private ResourceDB resDB
The resource database storing all resource allocations and requests. Also needed to detect deadlocks.


stopTime

private SimTime stopTime
The SimTime when the experiment is supposed to stop. Is initially null and will be set only if the user provides a time limit as some kind of stop Condition.


showProgressBar

private boolean showProgressBar
Flag indicating whether a progressbar for this experiment should be displayed or not.


trueTimer

private TimeConverter trueTimer
The time converter used to convert sim time to true time and vice versa.


isTimed

private boolean isTimed
Flag to indicate if this experiment is "timed", i.e. if sim time is mapped to a true date and time. Default is false.


pathname

private java.lang.String pathname
Specifies an output path for the report files (Modification by Nicolas Knaak, 02/2001)


pathName

private java.lang.String pathName
Specifies an output path for the report files (Modification by Nicolas Knaak, 02/2001)

Constructor Detail

Experiment

public Experiment(java.lang.String name)
Constructs a new Experiment with the given name. This is the shortcut constructor with just the name needed as parameter to identify the outputfiles produced by this experiment. All other possible settings are set to default values. These settings for an experiment without special ExperimentOptions are:
  1. epsilon = 0.00001 : The minimum distinguishable timespan
  2. time floats = 4 : The number of floating point digits displayed for simulation time in reports
  3. seed = 979 : The initial seed setting for the seed-generator
The default stop condition for this experiment will never interfere, always returning false.


Experiment

public Experiment(java.lang.String name,
                  java.lang.String pathName)
Constructs a new Experiment with the given name. This is the shortcut constructor with just the name needed as parameter to identify the outputfiles produced by this experiment. All other possible settings are set to default values. These settings for an experiment without special ExperimentOptions are:
  1. epsilon = 0.00001 : The minimum distinguishable timespan
  2. time floats = 4 : The number of floating point digits displayed for simulation time in reports
  3. seed = 979 : The initial seed setting for the seed-generator
The default stop condition for this experiment will never interfere, always returning false.


Experiment

public Experiment(java.lang.String name,
                  java.lang.String referenceTime,
                  int referenceUnit)
Constructs a new Experiment with the given name. This is the shortcut constructor with just the name needed as parameter to identify the outputfiles produced by this experiment. All other possible settings are set to default values. These settings for an experiment without special ExperimentOptions are:
  1. epsilon = 0.00001 : The minimum distinguishable timespan
  2. time floats = 4 : The number of floating point digits displayed for simulation time in reports
  3. seed = 979 : The initial seed setting for the seed-generator
The default stop condition for this experiment will never interfere, always returning false.


Experiment

public Experiment(java.lang.String name,
                  java.lang.String pathName,
                  java.lang.String referenceTime,
                  int referenceUnit)
Constructs a new Experiment with the given name. This is the shortcut constructor with just the name needed as parameter to identify the outputfiles produced by this experiment. All other possible settings are set to default values. These settings for an experiment without special ExperimentOptions are:
  1. epsilon = 0.00001 : The minimum distinguishable timespan
  2. time floats = 4 : The number of floating point digits displayed for simulation time in reports
  3. seed = 979 : The initial seed setting for the seed-generator
The default stop condition for this experiment will never interfere, always returning false.

Method Detail

addDebugReceiver

public void addDebugReceiver(MessageReceiver trcRec)
Adds a messagereceiver for debugnotes to the experiment. Whenever a model produces a message of that type, it will also be sent to the given messagereceiver for further processing. Note that the given receiver must be capable of handling debugnotes.


addErrorReceiver

public void addErrorReceiver(MessageReceiver trcRec)
Adds a messagereceiver for error messages to the experiment. Whenever a model produces a message of that type, it will also be sent to the given messagereceiver for further processing. Note that the given receiver must be capable of handling messagereceiver.


addReceiver

public void addReceiver(MessageReceiver trcRec,
                        java.lang.Class messageType)
Adds a messagereceiver for the given subtype of message to the experiment. Whenever a model produces a message of that type, it will also be sent to the given messagereceiver for further processing.


addTraceReceiver

public void addTraceReceiver(MessageReceiver trcRec)
Adds a messagereceiver for tracenotes to the experiment. Whenever a model produces a message of that type, it will also be sent to the given messagereceiver for further processing. Note that the given Receiver must be capable of handling tracenotes.


debugIsOn

public boolean debugIsOn()
Returns a boolean indicating whether debug notes are forwarded to the debug ouput or not. Debug ouput can be switched on and off using the methods debugOn(SimTime startTime) or debugOff(SimTime stopTime)


debugOff

public void debugOff(SimTime stopTime)
Switches the debug output off at the given point of simulation time.


debugOn

public void debugOn(SimTime startTime)
Switches the debug output on at the given point of simulation time.


debugPeriod

public void debugPeriod(SimTime startTime,
                        SimTime stopTime)
Switches the debug output on for the given period of simulation time. If the second parameter (off) is "sooner" then the first parameter (on), they will be swapped automatically. Same parameters will result in no debug output at all!


deRegister

public void deRegister(FileOutput file)
De-registers a file at the experiment. Registered files will be flushed and closed after the experiment has finished. If the file is manually closed by the user and has been registered at the Experiment, deRegister it


finish

public void finish()
Stopps all running simprocesses that might still be scheduled and closes the output files.


getDistributionManager

public DistributionManager getDistributionManager()
Returns the distributionmanager for this experiment. Distributions need access to the distributionmanager for handling antithetic modes, resetting and their initial seeds.


getEpsilon

public SimTime getEpsilon()
Returns the epsilon value representing the minimum distinguishable span of simulation time for this experiment. This has effect on the simulation clock, that won't advance if the new point of simulation time is smaller than epsilon. In this case two events are occurring at the same point of simulation time in the report.


getMessageManager

public MessageDistributor getMessageManager()
Returns the messagemanager for this experiment. Messages need access to the MessageManager for distributing the messages to one or more specified output streams.


getModel

public Model getModel()
Returns the model that is connected to this experiment or null if no model is connected so far.


getOutputPath

public java.lang.String getOutputPath()
Returns the name of the path the experiment's report-, trace-, debug- and error-files are written to.


getReferenceTime

public java.lang.String getReferenceTime()
Returns the reference time for this experiment. This is the true date and time of the start of the simulation run. If no reference time was specified for this experiment, the default reference time is returned.


getReferenceUnit

public int getReferenceUnit()
Returns the reference unit for this experiment. This is the time unit mapped to a time step of 1.0 in simulation time. So far, Hour, Minute, Second and Millisecond are supported.


getReportManager

public ReportManager getReportManager()
Returns the reportmanager for this experiment. Reports need access to the reportmanager for handling output, report width parameters and proper sorting of individual reports.


getResourceDB

public ResourceDB getResourceDB()
Returns the resource database for this experiment. The Res objects need access to the resource database to note their resource allocations and requests and for deadlock detection.


getScheduler

public Scheduler getScheduler()
Returns the scheduler for this experiment. ModelComponents need access to the scheduler for identifying the current active entity or process and to schedule themselves or other schedulables to activate at a given time in the future.


getSimClock

public SimClock getSimClock()
Returns the simclock for this experiment. ModelComponents need access to the simclock for retrieveing the current simulation time.


getStopTime

public SimTime getStopTime()
Returns the SimTime when the experiment is expected to stop running.


getThreadGroup

java.lang.ThreadGroup getThreadGroup()
Returns the threadgroup associated to this experiment. All Threads are associated to this threadgroup to get control of their number and state and to have a means to differentiate them from possible other experiments' threads.


getTimeFloats

public int getTimeFloats()
Returns the experiment's number of floating point digits of simulation time that are displayed in the various output files


isAborted

public boolean isAborted()
Displays the current state of the simulation run. If an experient is aborted, it can not be proceeded. All SimThreads still active are stopped, the main routine can finish.


isConnected

public boolean isConnected()
Shows if this experiment has already been connected to a model.


isRunning

public boolean isRunning()
Displays the current state of the simulation run.


isShowProgressBar

public boolean isShowProgressBar()
Returns if a progress bar should be displayed for this experiment or not.


proceed

public void proceed()
Proceeds with a stopped experiment. An experiment can be stopped, if either its status is changed from RUNNING to some other state, the scheduler runs out of scheduled events or if the check() method of the given stop Condition returns true after an Event has been processed.


register

public void register(FileOutput file)
Registers a file output at the experiment. Registered files will be flushed and closed after the experiment has finished. This is handy for modellers producing their own output who want their files to be closed at the end of the experiment.


registerModel

void registerModel(Model mainModel)
Connects a model to this experiment. The given model must not be submodel of other models and not already be connected to some other experiment. Otherwise an errormessage will be given and the experiment will be stopped.


removeDebugReceiver

public void removeDebugReceiver(MessageReceiver msgRec)
Removes a messagereceiver for debugnotes from the experiment's messagedistributor. Whenever a model produces a message of that type, it will not be sent to the given messagereceiver anymore. Note that if the messagereceiver is also registered for other types of messages, these will not be affected. Use method removeReceiverAll(MessageReceiver msgRec) to remove a messagereceiver from all types of messages.


removeErrorReceiver

public void removeErrorReceiver(MessageReceiver msgRec)
Removes a messagereceiver for errormessages from the experiment's messagedistributor. Whenever a model produces a message of that type, it will not be sent to the given messagereceiver anymore. Note that if the messagereceiver is also registered for other types of messages, these will not be affected. Use method removeReceiverAll(MessageReceiver msgRec) to remove a messagereceiver from all types of messages.


removeReceiver

public void removeReceiver(MessageReceiver msgRec)
Removes a messagereceiver from the experiment's messagedistributor. The given messagereceiver will not receive messages of any type any more Use method removeReceiver(MessageReceiver msgRec, Class messageType) to remove the messagereceiver from one type of messages only.


removeReceiver

public void removeReceiver(MessageReceiver msgRec,
                           java.lang.Class messageType)
Removes a messagereceiver for the given subtype of message from the Experiment's messagedistributor. Whenever a model produces a message of that type, it will not be sent to the given messagereceiver anymore. Note that if the messagereceiver is also registered for other types of messages, these will not be affected. Use method removeReceiverAll(MessageReceiver msgRec) to remove a messagereceiver from all types of messages.


removeTraceReceiver

public void removeTraceReceiver(MessageReceiver msgRec)
Removes a messagereceiver for tracenotes from the experiment's messagedistributor. Whenever a model produces a message of that type, it will not be sent to the given messagereceiver anymore. Note that if the messagereceiver is also registered for other types of messages, these will not be affected. Use method removeReceiverAll(MessageReceiver msgRec) to remove a messagereceiver from all types of messages.


reName

public void reName(java.lang.String newName)
Overrides inherited NamedObjectImp.rename(String newName) method to prevent the user from changing the experiment's name during an experiment. Renaming is not allowed with experiments, since it would not allow the user to identify the reports produced by an experiment. The method simply returns without changing the experiment's name, ignoring the given parameter.


report

public void report()
Writes a report about the model connected top this experiment, its reportable components and all related submodels into the report output. Note that a report can only be produced, if a valid main model is already connected to the experiment.


report

public void report(Model m)
Writes a report about the given model which has to be connected to this experiment as main model or as a submodel. Note that this will report about a branch of the tree of submodels constructed. A report will only be produced, if the model given is connected to this experiment. All reportable components of this model and all related submodels will be sent to the report output configured at the experiment's messagedistributor. Note that a report can only be produced, if a valid main model is already connected to the experiment.


resetOutputTimeFormat

public void resetOutputTimeFormat()
Resets the time format to be used for output of true time Strings to the default pattern: dd.MM.yyyy HH:mm:ss:SSS.


scheduleTimedTraceEvent

private void scheduleTimedTraceEvent(SimTime simTime,
                                     java.lang.String whatTime,
                                     Event directSuccessor)
Schedules an ExternalEventTimedTrace event to insert an entry in the trace file stating the true time (and time unit) of the given sim time. This private helper method is called in the methods tracePeriod(SimTime, SimTime), traceOn(SimTime) and traceOff(SimTime).


sendDebugNote

void sendDebugNote(java.lang.String component,
                   java.lang.String description)
Creates and sends a debugnote to the messagedistributor. Be sure to have a correct location, since the object and method that the error becomes apparent is not necessary the location it was produced in. The information about the simulation time is extracted from the Experiment and must not be given as a parameter.


sendMessage

void sendMessage(Message m)
Sends a message to the messagedistributor. Note that there are other shorthands for sending the standard DESMO-J messages.


sendWarning

void sendWarning(java.lang.String description,
                 java.lang.String location,
                 java.lang.String reason,
                 java.lang.String prevention)
Creates and sends an error message to the messagedistributor to warn the modeller that some conditions required by the framework are not met. Be sure to have a correct location, since the object and method that the error becomes apparent is not necessary the location it was produced in. The information about the simulation time is extracted from the experiment and must not be given as a parameter.


setAbortFlag

void setAbortFlag(boolean value)
Sets the abort flag to the given value. The abortflag is tested after each event processed by the scheduler. If it is set to true, the experiment will be stopped after processing the current event to its end. Otherwise the experiment will carry on.


setEpsilon

public void setEpsilon(SimTime eps)
Sets the epsilon value for the smallest distinguishable timespan to the given SimTime parameter.


setOutputTimeFormat

public void setOutputTimeFormat(java.lang.String pattern)
Sets the time format to be used for output of true time Strings. This influences the result of the methods getReferenceTime() and toTrueTime(SimTime).The given pattern must follow the time format syntax specified in java.text.SimpleDateFormat.


setSeedGenerator

public void setSeedGenerator(long seed)
Sets the seed of the SeedGenerator to the given value. If the seed is not set here, its default is 979, unless specified different in the ExperimentOptions.


setShowProgressBar

public void setShowProgressBar(boolean newShowProgressBar)
Sets the new value for showing the progress bar for this experiment or not.


setStatus

void setStatus(int newStatus)
Sets the experiment's status to the given integer value. The value must be in the legal range of [-1,5], otherwise a warning is issued.


start

public void start()
Starts the simulation with default start time 0.0. This method can only be used once on an experiment. it initializes the connected model and starts the simulation. Note that in order to stop the simulation, the stop(SimTime stopTime) method has to be called first!


start

public void start(SimTime initTime)
Starts the experiment with the given simulation time as starting time. The experiment will not start unless a valid model has been connected to it before. Note that in order to stop the simulation at some point of time, the stop method has to be called first. StopConditions can be given alternatively.


stop

public void stop(Condition stopCond)
Stops the simulation when the given condition returns true. Beware that the simulation will run endless if the condition can not be met so always use a time limit if the condition in question can not be proven to be met in the run of a simulation! Also keep in mind that in order to determine if the condition was met, this class needs access to all data needed to do so.


stop

public void stop(SimTime stopTime)
Stops the simulation at the given point of simulation time. If no valid simulation time is given, the default is 0.0 which would not let the simulation run past that time.


stop

public void stop(java.lang.String trueStopTime)
Stops the simulation at the given point of true time. If no valid time format is given or the experiment's reference time is not set, the default is SimTime(0.0) which would not let the simulation run past that time.


toSimTime

public SimTime toSimTime(double duration,
                         int unit)
Converts the given duration to an corresponding sim time using the given time unit. The duration is thus interpreted as the interval of (simulation) time between sim time 0.0 and the converted sim time value.


toSimTime

public SimTime toSimTime(java.lang.String trueTime)
                  throws java.text.ParseException
Converts the given true time to the corresponding sim time. The true time value must be specified as a String following the time format syntax used in java.text.SimpleDateFormat.


toTrueTime

public java.lang.String toTrueTime(SimTime simTime)
Converts the given sim time to the corresponding true time.


toTrueTime

public java.lang.String toTrueTime(SimTime simTime,
                                   java.lang.String pattern)
                            throws java.text.ParseException
Converts the given sim time to the corresponding true time. The given pattern is used for output formatting of the true time String. The pattern has to follow the time format syntax specified in java.text.SimpleDateFormat.


traceIsOn

public boolean traceIsOn()
Returns a boolean indicating whether trace notes are forwarded to the trace ouput or not. Trace ouput can be switched on and off using the methods traceOn(SimTime startTime) and traceOff(SimTime stopTime)


traceOff

public void traceOff(SimTime stopTime)
Switches the trace output off at the given point of simulation time.


traceOn

public void traceOn(SimTime startTime)
Switches the trace output on at the given point of simulation time.


tracePeriod

public void tracePeriod(SimTime startTime,
                        SimTime stopTime)
Switches the trace output on for the given period of simulation time. If the second parameter (off) is "sooner" then the first parameter (on), they will be swapped automatically. Same parameters will result in no trace output at all.


writeReport

public void writeReport(Model m,
                        java.lang.String suffix)
Triggers the reporters of the given model or submodel to write their report data into the report output registered at the experiment's messagemanager. The string given will be added as a suffix to the report filename to help identify teh report when more than one report is produced by one Experiment at differnet points of simulation time.


writeReport

public void writeReport(java.lang.String suffix)
Triggers the reporters to write their data into the report output registered at the experiment's messagemanager. The string given will be added as a suffix to the report filename to help identification when more than one report is produced by one Experiment at differnet points of simulation time.