public class AutomaticSimulation extends VergilApplication implements ExecutionListener
ConfigurationApplication.IgnoreErrorHandler
_commandOptions
_basePath, _commandFlagsWithDescriptions, _commandTemplate, _configuration, _exit, _parser, _printPDF, _run, _run20x, _statistics, _test
Constructor and Description |
---|
AutomaticSimulation(java.lang.String[] args)
Parse the specified command-line arguments, creating models
and frames to interact with them.
|
Modifier and Type | Method and Description |
---|---|
static void |
changeParameter(int waitingTime,
AutomaticSimulation vergil,
java.lang.String[] modelPath,
java.lang.String propertyLine,
double[] values,
int solver)
Change a parameter in the .xml, making it assume previously
chosen values.
|
static void |
changeParameter(int waitingTime,
AutomaticSimulation vergil,
java.lang.String[] modelPath,
java.lang.String propertyLine,
float start,
float end,
float step,
int solver)
Change a parameter in the .xml, making it vary within an interval defined by the
parameters start and end.
|
static void |
changeParameters(int waitingTime,
AutomaticSimulation vergil,
java.lang.String[] modelPath,
java.lang.String[] propertyLines,
double[][] values,
int solver)
Change a parameter in the .xml, making it vary within an interval defined by the
parameters start and end.
|
static java.util.ArrayList<java.lang.String> |
convertFileToString(java.io.File file)
Read a file and return the contents as ano ArrayList of Strings.
|
static java.lang.String |
findParameterValue(java.io.File file,
java.lang.String propertyLine)
Find a parameter value from a file.
|
static void |
main(java.lang.String[] args)
The main method.
|
void |
managerStateChanged(Manager manager)
Verify if the model is initializing, changing the variable _wait to false if
this execution phase has been achieved.
|
static boolean |
runAllModels(AutomaticSimulation vergil)
Run all the models.
|
_createDefaultConfiguration, _createEmptyConfiguration, _parseArgs, _usage, errorAndExit, openLibrary
_initializeApplication
_configurationUsage, _configurationUsage, _openModel, _openModel, _parseArg, _printPDF, _readConfiguration, closeModelWithoutSavingOrExiting, configurationDirectories, configurationDirectoryFullOrFirst, executionError, executionFinished, getActiveCount, models, openModel, openModelOrEntity, readConfiguration, runModels, setActiveCount, specToURL, throwArgsException, waitForFinish
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
executionError, executionFinished
public AutomaticSimulation(java.lang.String[] args) throws java.lang.Exception
args
- The command-line arguments.java.lang.Exception
- If command line arguments have problems.public static java.util.ArrayList<java.lang.String> convertFileToString(java.io.File file) throws java.io.IOException
file
- The file whose content is going to be turned into String.java.io.IOException
- If there is a problem converting the file to an
ArrayList of strings.xpublic static java.lang.String findParameterValue(java.io.File file, java.lang.String propertyLine) throws IllegalActionException
file
- The file to be readpropertyLine
- The property line to be foundIllegalActionException
- If there is a problem
reading the property file.public static void changeParameter(int waitingTime, AutomaticSimulation vergil, java.lang.String[] modelPath, java.lang.String propertyLine, double[] values, int solver) throws IllegalActionException
waitingTime
- The time the system will wait to close all
the windows of a federation, after its execution has finished.
This parameter is intended to give the user the ability to
choose how long he will have to look at the simulation's
results. If the variable is given a negative value, the user
will be asked repetedly if he havalued time to look at the
models and they will only close when he answers "yes".vergil
- An instance of vergil.modelPath
- The path to the model you want to run.propertyLine
- The xml line of the parameter that we want to change.values
- The values the new property will assume.solver
- Which RKSolver to useIllegalActionException
- If there is a problem reading a file.public static void changeParameter(int waitingTime, AutomaticSimulation vergil, java.lang.String[] modelPath, java.lang.String propertyLine, float start, float end, float step, int solver) throws IllegalActionException
waitingTime
- The time the system will wait to close all the windows of a federation, after its execution has finished.
This parameter is intended to give the user the ability to choose how long he will have to look at the simulation's results.
If the variable is given a negative value, the user will be asked repetedly if he had time to look at the models and they will
only close when he answers "yes".vergil
- An instance of vergil.modelPath
- The path to the model you want to run.propertyLine
- The xml line of the parameter that we want to change.start
- The value of the parameter.end
- The end value of the parameter.step
- The increment of the parameter value.solver
- Which RKSolver to useIllegalActionException
- If there is a problem reading a file.public static void changeParameters(int waitingTime, AutomaticSimulation vergil, java.lang.String[] modelPath, java.lang.String[] propertyLines, double[][] values, int solver) throws IllegalActionException
waitingTime
- The time the system will wait to close all the windows of a federation, after its execution has finished.
This parameter is intended to give the user the ability to choose how long he will have to look at the simulation's results.
If the variable is given a negative value, the user will be asked repetedly if he had time to look at the models and they will
only close when he answers "yes".vergil
- An instance of vergil.modelPath
- The path to the model you want to run.propertyLines
- The xml line of the parameter that we want to change.values
- The values the new property will assume.solver
- The Runge-Kutta solver order number.IllegalActionException
- If there is a problem reading a file.public static void main(java.lang.String[] args)
args
- The command-line arguments.public void managerStateChanged(Manager manager)
managerStateChanged
in interface ExecutionListener
managerStateChanged
in class ConfigurationApplication
manager
- The manager.ExecutionListener
public static boolean runAllModels(AutomaticSimulation vergil)
vergil
- The script