|
|||||||||
| Home >> All >> [ desmoj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
desmoj
Class Model

java.lang.Objectdesmoj.NamedObject
desmoj.ModelComponent
desmoj.Reportable
desmoj.Model
- public abstract class Model
- extends Reportable
The model is supposed to carry references to all static modelcomponents associated to a model. These are modelcomponents like distributions and statistic counters. Note that placing all essential components inside the model class allows you to use object orientation to reuse this model to implement different versions of it using subclassing for changes necessary for using other modelling paradigms. This way models can be easily reimplemented following the process-, event-, transaction- or activity- oriented paradigm. Note that transaction- and activity-oriented modelling requires the higher process synchronization mechanisms (Res, Bin, WaitQueue, CondQueue) by Soenke Claassen.
The modelcomponents belonging to a model have to be instantiated in the
init() method. They must not be instantiated in the model's
constructor since most components need access to a valid experiment
object. This can only be accessed after a model has been connected to an
experiment using method connectToExperiment(Experiment exp)
which implicitly calls the init() method after receiving the
valid reference to an experiment.
- Version:
- DESMO-J, Ver. 1.5 copyright (c) 2001 licensed under GNU GPL
| Field Summary | |
private Experiment |
myExperiment
The experiment this model is connected to. |
private ModelOptions |
mySettings
Contains this model's parameter settings |
private java.util.Vector |
reportables
Dynamic List containing all reportable components of this model. |
private java.util.Vector |
subModels
Dynamic List containing all associated submodels. |
| Fields inherited from class desmoj.Reportable |
|
| Fields inherited from class desmoj.ModelComponent |
|
| Fields inherited from class desmoj.NamedObject |
|
| Constructor Summary | |
Model(Model owner,
java.lang.String name,
boolean showInReport,
boolean showIntrace)
Constructs a model, with the given name and parameters for report and trace files. |
|
| Method Summary | |
protected boolean |
checkCompatibility(ModelComponent other)
Checks the given modelcomponent for compatibility. |
void |
connectToExperiment(Experiment exp)
Connects this model to an experiment. |
Reporter |
createReporter()
Creates the default reporter associated with this model. |
abstract java.lang.String |
description()
Should return the description of the model. |
abstract void |
doInitialSchedules()
Implement this method to schedule the entities and/or events needed for your model to start in a defined setting. |
(package private) void |
doSubmodelSchedules()
Calls the doInitialSchedules() method of all registered
submodels of the current model. |
Experiment |
getExperiment()
Returns the experiment that is connected to this model or null if the model is not yet connected to an experiment. |
boolean |
hasSubModels()
Shows, if there are submodels registered with this model. |
abstract void |
init()
Implement this method to do initialization work for your model. |
void |
init(ModelOptions options)
Initializes the model by calling method init() to
set up all model related components as specified in that method. |
boolean |
isConnected()
Shows if this model has already been connected to an experiment. |
boolean |
isMainModel()
Shows if this model is a main model and thus is not submodel of other models. |
boolean |
isSubModel()
Shows if this model is submodel to another model and thus is not the main models. |
(package private) void |
register(Reportable r)
Registers a reportable at this model. |
(package private) void |
registerSubModel(Model subModel)
Registers another model as submodel of this model. |
(package private) java.util.Enumeration |
report()
Produces a report about the model and all its related modelcomponents and submodels. |
void |
reset()
Resets the statistic counters of this model and of all its registered reportables. |
(package private) void |
setConnectedExperiment(Experiment e)
Connects submodels to the experiment given. |
(package private) void |
setMain()
Sets the current model to be the main model by setting the owner reference to itself. |
| Methods inherited from class desmoj.Reportable |
getObservations, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt |
| Methods inherited from class desmoj.ModelComponent |
current, currentEntity, currentEvent, currentModel, currentSimProcess, currentTime, debugIsOn, debugOff, debugOn, epsilon, getModel, isExperimentCompatible, isModelCompatible, sendDebugNote, sendMessage, sendTraceNote, sendWarning, setOwner, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn |
| 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 |
mySettings
private ModelOptions mySettings
- Contains this model's parameter settings
myExperiment
private Experiment myExperiment
- The experiment this model is connected to.
subModels
private java.util.Vector subModels
- Dynamic List containing all associated submodels.
reportables
private java.util.Vector reportables
- Dynamic List containing all reportable components of this model.
| Constructor Detail |
Model
public Model(Model owner, java.lang.String name, boolean showInReport, boolean showIntrace)
- Constructs a model, with the given name and parameters for report and
trace files.
| Method Detail |
checkCompatibility
protected boolean checkCompatibility(ModelComponent other)
- Checks the given modelcomponent for compatibility.
Needed exclusively when submodels are present that want to share
modelcomponents between them. The standard implementation only checks
if the modelcomponent
otherbelongs tothismodel. For use with multiple models, the user has to specify which other models are compatible to this model by overloading this method.
connectToExperiment
public void connectToExperiment(Experiment exp)
- Connects this model to an experiment.
The given experiment must not already be connected to some other model.
Otherwise an errormessage will be given and the experiment will
be stopped.
Since a model that is not yet connected has no access to the experiment's
messaging subsystem,
createReporter
public Reporter createReporter()
- Creates the default reporter associated with this model.
The default reporter returned by this method just prints the
model's description as implemented in method
description()and appends the simulation time of the last reset. If the user's model offers more information, create a special class derived from classdesmoj.report.ModelReporterto extract and present that extra information.- Overrides:
createReporterin classReportable
description
public abstract java.lang.String description()
- Should return the description of the model.
Implement this method to document the model's intent, creator, date and
all other information that needs to be published about this model in a
report. Please use it generously, other people interested in your model
will thank you.
doInitialSchedules
public abstract void doInitialSchedules()
- Implement this method to schedule the entities and/or events needed for
your model to start in a defined setting.
If a model is connected to an experiment and started without any
initial schedules, it will not run since no events to process are
on the scheduler's event-list.
This method is called automatically by the framework when
the experiment's
start()method is called.
doSubmodelSchedules
void doSubmodelSchedules()
- Calls the
doInitialSchedules()method of all registered submodels of the current model. Subsequently calls thedoSubmodelSchedules()method of all registered submodels.
getExperiment
public Experiment getExperiment()
- Returns the experiment that is connected to this model or
nullif the model is not yet connected to an experiment.
hasSubModels
public boolean hasSubModels()
- Shows, if there are submodels registered with this model.
init
public abstract void init()
- Implement this method to do initialization work for your model.
All ModelComponents associated with this model are supposed to be
instantiated in this method.
Caution! Do not use the Model's constructor method to instantiate your modelcomponents!
This prevents the modelcomponents to get contact to the associated Experiment since a Model can only be connected to an Experiment after itself has been instantiated correctly. Thus it is necessary to put all initialization and instantiation work into this method. Do not use this method to do the initial schedules needed for the scheduler to start with. Use methoddoInitialSchedules()instead. If there are no events scheduled in the eventList, the scheduler will stop the simulation immediately because there is nothing for him to do. If you are using submodels, take care that each of the submodels has its owninitmethod properly set up.
init
public void init(ModelOptions options)
- Initializes the model by calling method
init()to set up all model related components as specified in that method. After initializing the model, the given ModelOption'ssetOption()method is called with this model as parameter. This enables the user to specify different model parameter settings for different experiments. It even allows automated parameter variation to give a small but handy aid for model optimization. Implement the ModelOptions to set the parameters for your model. Make sure to react properly on the ModelOptions given. Note that specifiying ModelOptions is up to the user.
isConnected
public boolean isConnected()
- Shows if this model has already been connected to an experiment.
isMainModel
public boolean isMainModel()
- Shows if this model is a main model and thus is not submodel of other
models.
isSubModel
public boolean isSubModel()
- Shows if this model is submodel to another model and thus is not
the main models.
register
void register(Reportable r)
- Registers a reportable at this model.
Reports can only be drawn, if the reportbale is registered at his model.
registerSubModel
void registerSubModel(Model subModel)
- Registers another model as submodel of this model.
report
java.util.Enumeration report()
- Produces a report about the model and all its related modelcomponents
and submodels.
It registers the model's reporter and all other reporters at the
experiment's reportmanager to produce the report output.
The reporters are ordered into the reportmanager returned with this model's
reporter first, followed by all reportable's reporters. After this section,
all submodel's reporters are inserted according to the order they
were attached to this model. Each submodel's section is sorted using the
criteria above. Thus all reporters a re separated by model to
prevent confusion.
reset
public void reset()
- Resets the statistic counters of this model and of all its registered
reportables.
Also calls all submodels's
reset()methods.- Overrides:
resetin classReportable
setConnectedExperiment
void setConnectedExperiment(Experiment e)
- Connects submodels to the experiment given.
This method is called by the main model, when submodels register themselves
at the main model.
setMain
void setMain()
- Sets the current model to be the main model by setting the
ownerreference to itself.
|
|||||||||
| Home >> All >> [ desmoj overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC