com.xj.anylogic.engine
Class ExperimentSimulation<ROOT extends ActiveObject>

java.lang.Object
  extended by com.xj.anylogic.engine.Presentable
      extended by com.xj.anylogic.engine.Utilities
          extended by com.xj.anylogic.engine.Experiment<ROOT>
              extended by com.xj.anylogic.engine.ExperimentSimulation<ROOT>
Type Parameters:
ROOT - class of root object
All Implemented Interfaces:
java.io.Serializable

public abstract class ExperimentSimulation<ROOT extends ActiveObject>
extends Experiment<ROOT>

The simplest possible experiment consisting of a single simulation run. One should implement the createRoot() method in a subclass to set a particular model to this experiment.
A typical usage pattern is here:

public class MyExperiment extends ExperimentSimulation {

public ActiveObject createRoot( Engine engine ) {
MyMain root = new MyMain( engine, null, null );
//set parameters of root if needed
...
return root;
}

public void setup( JApplet applet ) {
Engine eng = getEngine();
//set engine stop time, time mode, etc.
...
Presentation p = new Presentation( ex, null );
p.start();
//set presentation size, configure toolbar, etc.
...
}

public static void main( String[] args ) {
MyExperiment ex = new MyExperiment();
ex.setName( "My Experiment" );
ex.setup( null );
}

}

Code for an applet that runs such experiment would look like this:

public class MyApplet extends JApplet {
MyExperiment ex;

public void init() {
ex = new MyExperiment();
ex.setName( "My Experiment" );
ex.setup( this );
}

public void destroy() {
ex.stop();
}

}

Author:
XJ Technologies Company Ltd. www.anylogic.com
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.xj.anylogic.engine.Experiment
ERROR, FINISHED, IDLE, modelExecutionCommandQueue, mutexModelActionQueue, OPEN_RESULTS, OPEN_SNAPSHOT, PAUSE, PAUSED, PLEASE_WAIT, RUN, RUNNING, SAVE_RESULTS, SAVE_SNAPSHOT, STEP, STOP
 
Fields inherited from class com.xj.anylogic.engine.Utilities
AM, APRIL, AUGUST, DAY, DECEMBER, FEBRUARY, FRIDAY, HOUR, infinity, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK, YEAR
 
Fields inherited from class com.xj.anylogic.engine.Presentable
ALIGNMENT_CENTER, ALIGNMENT_LEFT, ALIGNMENT_RIGHT, CAD_ANTIALIASING, CAD_INVERTED, LINE_STYLE_DASHED, LINE_STYLE_DOTTED, LINE_STYLE_SOLID, NAVIGATION_FULL, NAVIGATION_LIMITED_TO_Z_ABOVE_ZERO, NAVIGATION_NONE, NAVIGATION_ROTATION_ONLY, SHAPE_ARC, SHAPE_BUTTON, SHAPE_CAD, SHAPE_CHART_BAR, SHAPE_CHART_HISTOGRAM, SHAPE_CHART_HISTOGRAM2D, SHAPE_CHART_PIE, SHAPE_CHART_PLOT, SHAPE_CHART_STACK, SHAPE_CHART_TIME_COLOR, SHAPE_CHART_TIME_PLOT, SHAPE_CHART_TIME_STACK, SHAPE_CHECKBOX, SHAPE_COMBOBOX, SHAPE_CURVE, SHAPE_EMBEDDED_OBJECT, SHAPE_FILECHOOSER, SHAPE_GROUP, SHAPE_IMAGE, SHAPE_LINE, SHAPE_LISTBOX, SHAPE_OVAL, SHAPE_PIXEL, SHAPE_POLYLINE, SHAPE_PROGRESSBAR, SHAPE_RADIOBUTTONS, SHAPE_RECTANGLE, SHAPE_ROUNDED_RECTANGLE, SHAPE_SLIDER, SHAPE_TEXT, SHAPE_TEXTFIELD
 
Constructor Summary
ExperimentSimulation()
          Creates the experiment and a new simulation engine that will be used for all simulations.
 
Method Summary
 void customRunPause_xjal(boolean absoluteTime, double t)
          Deprecated. this method shouldn't be called by user and may be removed/renamed in the next release
 com.xj.anylogic.engine.internal.ActiveView ep_xjal()
          This method shouldn't be accessed by user
is public due to technical reasons
 void finish()
          Sets a flag that, when tested by the engine, causes it to finish after completing the current event execution.
 Engine getEngine()
          Returns the engine executing the model.
 double getProgress()
          Returns the progress of the experiment: in this case it is the same as the progress of the current simulation run.
 double getRunTimeSeconds()
          Returns the real duration of the experiment in seconds, excluding pause times, in this case it is same as duration of the simulation run.
 int getState()
          Returns the current state of the experiment.
 void pause()
          Pauses the model execution.
 void registerPresentation_xjal(Presentation presentation)
          This method isn't designed to be called by user.
 void run()
          Runs the model from the current state.
abstract  void setupRootParameters(ROOT root, boolean callOnChangeActions)
          Is called to setup parameters of root active object.
 void step()
          Performs one step of the model execution.
 void stop()
          Terminates the model execution, destroys and forgets the model and calls garbage collector, but keeps all experiment data.
 
Methods inherited from class com.xj.anylogic.engine.Experiment
close, createRoot, error, getCommandLineArguments, getMutexRead_xjal, getMutexWrite_xjal, getName, getPresentation, getRunCount, getSnapshotFileName, getStep, getWindowHeight, getWindowWidth, initDefaultRandomNumberGenerator, isCommandEnabled, isLoadRootFromSnapshot, onBeforeSimulationRun, onDestroy_xjal, onDestroy, onEngineFinished, onError, reset, setCommandLineArguments_xjal, setLoadRootFromSnapshot, setName, setup, setupEngine
 
Methods inherited from class com.xj.anylogic.engine.Utilities
bernoulli, bernoulli, beta, beta, beta, beta, beta, binomial, binomial, binomial, binomial, binomial, briefInfoOn, cauchy, cauchy, cauchy, chi2, chi2, chi2, copyToClipboard, createURL_xjal, date, dateToTime, day, difference, difference, differenceInDateUnits, differenceInDateUnits, dropTime, erlang, erlang, erlang, error, exponential, exponential, exponential, exponential, exponential, exponential, format, format, format, format, format, format, formatDayOfWeek, formatGeoHeading, formatLatitude, formatLongitude, formatMonth, formatTimeInterval, gamma_frac, gamma, gamma, gamma, gamma, gamma, gammaLog, geometric, geometric, getAmPm, getAmPm, getDayOfMonth, getDayOfMonth, getDayOfWeek, getDayOfWeek, getDayOfYear, getDefaultRandomGenerator, getDistance, getDistance, getDistanceFromPointToLine, getDistanceFromPointToLineSq, getDistanceFromPointToSegment, getDistanceFromPointToSegmentSq, getDistanceSq, getDistanceSq, getHour, getHour, getHourOfDay, getHourOfDay, getLength, getLength, getMillisecond, getMillisecond, getMinute, getMinute, getMonth, getMonth, getRandom, getRandom, getSecond, getSecond, getTime, getYear, getYear, gumbel1, gumbel1, gumbel2, gumbel2, hour, hypergeometric, hypergeometric, inspectOf, isLineIntersectingLine, isLineIntersectingRectangle, isPointInsideRectangle, isPointOnTheSameLine, laplace, laplace, limit, limitMax, limitMin, logarithmic, logarithmic, logistic, logistic, lognormal, lognormal, millisecond, minute, negativeBinomial, negativeBinomial, negativeBinomial, negativeBinomial, normal, normal, normal, normal, normal, normal, pareto, pareto, pareto, pert, pert, poisson, poisson, poisson, poisson, prepareBeforeExperimentStart_xjal, pulse, pulseTrain, quantum, ramp, randomFalse, randomFalse, randomTrue, randomTrue, rayleigh, rayleigh, rayleigh, second, setDefaultRandomGenerator, sqr, step, time, timeToDate, toDate, toDateInMillis, toLatitude, toLongitude, toTimeout, trace, traceln, traceln, traceln, triangular, triangular, triangular, triangular, triangular, uniform_discr, uniform_discr, uniform_discr, uniform_pos, uniform_pos, uniform, uniform, uniform, uniform, uniform, week, weibull, weibull, weibull, weibull, weibull, xidz, zidz
 
Methods inherited from class com.xj.anylogic.engine.Presentable
contains, drawCollection, drawDatabase, drawDataset, drawExcelFile, drawFunction, drawHistogram2DData, drawHistogramData, drawInsert, drawKeyValueTable, drawModel, drawModelElements, drawPlainVariable, drawPresentation, drawQuery, drawSchedule, drawShape, drawStatistics, drawTableFunction, drawTextFile, drawUpdate, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, executeShapeControlAction, finishReadObject_xjal, getExperiment, getNameOfShape, getPersistentShape, getShapeArcAngle, getShapeArcAngle, getShapeArcStartAngle, getShapeArcStartAngle, getShapeCADCustomLayerColors, getShapeCADDrawingAttributes, getShapeCADDrawingAttributes, getShapeCADFileName, getShapeCADFileName, getShapeCADVisibleLayerNames, getShapeChartColorFromDouble, getShapeChartDataColors, getShapeChartDataItems, getShapeChartDataPlotOptions, getShapeChartDataSets, getShapeChartDataTitles, getShapeChartHistogram2DOptions, getShapeChartHistogramOptions, getShapeChartHistograms, getShapeChartHistograms2D, getShapeChartProperties, getShapeControl, getShapeControl, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueBoolean, getShapeControlDefaultValueDouble, getShapeControlDefaultValueDouble, getShapeControlDefaultValueInt, getShapeControlDefaultValueInt, getShapeControlDefaultValueString, getShapeControlDefaultValueString, getShapeControlManager, getShapeControlMaximum, getShapeControlMaximum, getShapeControlMinimum, getShapeControlMinimum, getShapeControlMultipleSelectionMode, getShapeControlMultipleSelectionMode, getShapeControlProgressString, getShapeControlProgressString, getShapeControlTexts, getShapeControlTexts, getShapeControlTexts2D, getShapeControlTexts2D, getShapeControlType, getShapeControlType, getShapeControlValueType, getShapeControlValueType, getShapeEmbeddedObject, getShapeEmbeddedObject, getShapeFillColor, getShapeFillColor, getShapeFont, getShapeFont, getShapeGroupContent, getShapeHeight, getShapeHeight, getShapeImageFileNames, getShapeImageFileNames, getShapeImageNumber, getShapeImageNumber, getShapeLineColor, getShapeLineColor, getShapeLineDx, getShapeLineDx, getShapeLineDy, getShapeLineDy, getShapeLineStyle, getShapeLineStyle, getShapeLineWidth, getShapeLineWidth, getShapeNPoints, getShapeNPoints, getShapePackagePrefix, getShapePointsDx, getShapePointsDx, getShapePointsDy, getShapePointsDy, getShapeRadiusX, getShapeRadiusX, getShapeRadiusY, getShapeRadiusY, getShapeReplication, getShapeRotation, getShapeRotation, getShapeScaleX, getShapeScaleX, getShapeScaleY, getShapeScaleY, getShapeText, getShapeText, getShapeTextAlignment, getShapeTextAlignment, getShapeType, getShapeWidth, getShapeWidth, getShapeX, getShapeX, getShapeY, getShapeY, getViewAreas, iconContains, isShapeCADNegative, isShapeCADNegative, isShapeClosed, isShapeClosed, isShapeControlEnabled, isShapeControlEnabled, isShapeControlVertical, isShapeControlVertical, isShapePublic, isShapeVisible, isShapeWithManualControlPoints, isShapeWithManualControlPoints, modelElementContains, modelElementContains, onClickIconAt, onClickModelAt, onClickPresentationAt, onItemRemoved, onSelectionChanged, onShapeClick, onShapeClickAt, onShapeGroupDraw, presentationContains, readCustomData, setControlValueToDefault, setControlValueToDefault, writeCustomData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExperimentSimulation

public ExperimentSimulation()
Creates the experiment and a new simulation engine that will be used for all simulations.

Method Detail

getEngine

public Engine getEngine()
Returns the engine executing the model.

Specified by:
getEngine in class Presentable
Returns:
the engine executing the model

getState

public int getState()
Returns the current state of the experiment. In case of ExperimentSimulation it is the same as the state of the engine and can be IDLE, PAUSED, RUNNING, STEP, FINISHED, ERROR.

Specified by:
getState in class Experiment<ROOT extends ActiveObject>
Returns:
the current state of the experiment

getProgress

public double getProgress()
Returns the progress of the experiment: in this case it is the same as the progress of the current simulation run.

Specified by:
getProgress in class Experiment<ROOT extends ActiveObject>
Returns:
the progress of the experiment

getRunTimeSeconds

public double getRunTimeSeconds()
Returns the real duration of the experiment in seconds, excluding pause times, in this case it is same as duration of the simulation run.

Specified by:
getRunTimeSeconds in class Experiment<ROOT extends ActiveObject>
Returns:
the real duration of the experiment in seconds

run

public void run()
Runs the model from the current state. If model is not yet existing, resets the experiment, creates and starts the model.

Specified by:
run in class Experiment<ROOT extends ActiveObject>

customRunPause_xjal

@Deprecated
public void customRunPause_xjal(boolean absoluteTime,
                                           double t)
Deprecated. this method shouldn't be called by user and may be removed/renamed in the next release


step

public void step()
Performs one step of the model execution. If model is not yet existing, resets the experiment, creates and starts the model (not making a step).

Specified by:
step in class Experiment<ROOT extends ActiveObject>

pause

public void pause()
Pauses the model execution.

Specified by:
pause in class Experiment<ROOT extends ActiveObject>
See Also:
Engine.pause()

finish

public void finish()
Sets a flag that, when tested by the engine, causes it to finish after completing the current event execution.

See Also:
Engine.finish()

stop

public void stop()
Terminates the model execution, destroys and forgets the model and calls garbage collector, but keeps all experiment data.

Specified by:
stop in class Experiment<ROOT extends ActiveObject>
See Also:
Engine.stop()

setupRootParameters

public abstract void setupRootParameters(ROOT root,
                                         boolean callOnChangeActions)
Is called to setup parameters of root active object. This method must be defined in a subclass.

Parameters:
root - the root active object instance
callOnChangeActions - if true this method should use set_* methods of root to setup parameters, otherwise parameter values should be simply assigned to the fields of root

ep_xjal

public final com.xj.anylogic.engine.internal.ActiveView ep_xjal()
This method shouldn't be accessed by user
is public due to technical reasons


registerPresentation_xjal

public void registerPresentation_xjal(Presentation presentation)
Description copied from class: Experiment
This method isn't designed to be called by user.
Public due to technical reasons
May be removed in future releases

Overrides:
registerPresentation_xjal in class Experiment<ROOT extends ActiveObject>


Copyright © 1991-2008 XJ Technlogies. All Rights Reserved.