// create model and experiment
NewConnectionExample model = new NewConnectionExample(null, "VerkettungsExample", true, true);
// null as first parameter because it is the main model and has no
// mastermodel
Experiment exp = new Experiment("VerkettungsExampleExperiment", TimeUnit.SECONDS, TimeUnit.MINUTES, null);
// ATTENTION, since the name of the experiment is used in the names of
// the
// output files, you have to specify a string that's compatible with the
// filename constraints of your computer's operating system. The remaing
// three
// parameters specify the granularity of simulation time, default unit
// to
// display time and the time formatter to use (null yields a default
// formatter).
// connect both
model.connectToExperiment(exp);
// set experiment parameters
exp.setShowProgressBar(false); // display a progress bar (or not)
exp.stop(new TimeInstant(100, TimeUnit.MINUTES)); // set end of
// simulation at
// 1500 minutes
exp.tracePeriod(new TimeInstant(0), new TimeInstant(100, TimeUnit.MINUTES)); // set
// the
// period
// of
// the
// trace
exp.debugPeriod(new TimeInstant(0), new TimeInstant(50, TimeUnit.MINUTES)); // and
// debug
// output
// ATTENTION!
// Don't use too long periods. Otherwise a huge HTML page will
// be created which crashes Netscape :-)
// start the experiment at simulation time 0.0
exp.start();
// --> now the simulation is running until it reaches its end criterion
// ...
// ...
// <-- afterwards, the main thread returns here
// generate the report (and other output files)
exp.report();
// stop all threads still alive and close all output files
exp.finish();
}