|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuchicago.src.sim.engine.SimInit
public class SimInit
Creates and initializes a simulation. A RePast model (one that implements
the SimModel interface) can either use this class to load themselves, or
be loaded by this class and associated with the appropriate controller.
In the first case, a RePast model would create and instance of itself
and SimInit in a main method, and the load itself using SimInits.load
method. For example,
And the model name then passed as argument to "java" on the command line,
public static void main(String[] args) {
MyModel model = new MyModel();
SimInit init = new SimInit();
init.load(model, null, false);
}
Model's loaded this way can load parameter files and specify whether
they are batch models are not. For how to do this, see the load definition
below.
java -cp ... mymodels.MyModel
Using SimInit to load your model works as follows. SimInit is passed as an argument on the command line to "java" and your fully qualified model name should follow "uchicago.src.sim.engine.SimInit". Two option switch can be passed to SimInit that determine how SimInit will treat your model.
ParameterReader and
the Repast how to documentation.Some sample ways to start the model models.MyModel. The model loading itself:
java -cp ... models.MyModel
Loading a models.MyModel as a batch model via SimInit
java -cp ...uchicago.src.sim.engine.SimInit -b models.MyModel my_params
Controller,
BatchController,
BaseController| Field Summary | |
|---|---|
static java.lang.String |
VERSION
|
| Constructor Summary | |
|---|---|
SimInit()
|
|
| Method Summary | |
|---|---|
void |
loadModel(SimModel model,
java.lang.String fileName,
boolean isBatch)
Loads the specified model as if it was given on the command line. |
static void |
main(java.lang.String[] args)
|
void |
setExitOnExit(boolean val)
Sets whether the simulation application should exit with a System.exit(0) call on exit (pressing the exit button), or dispose of all windows, release the model without killing this instance of the virtual machine. |
void |
setNumRuns(int numRuns)
Sets the number of runs in a batch run. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String VERSION
| Constructor Detail |
|---|
public SimInit()
| Method Detail |
|---|
public void setNumRuns(int numRuns)
numRuns - the number of runs to perform
public void loadModel(SimModel model,
java.lang.String fileName,
boolean isBatch)
model - the model to loadfileName - the name of a parameter file. This can be null, or an
empty String if no parameter file is desired.isBatch - whether this is a batch simulation or not.public void setExitOnExit(boolean val)
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||