Package net.simplace.sim
Class FWSimEngine
java.lang.Object
net.simplace.sim.FWSimEngine
Engine is started with the main configuration xml file having no need of GUI-configuration or classes
Singleton implementation
Needs Solution.sol.xml-File. Structure is defined by the SimSolution.dtd.
For Project-Simulation a Project.proj.xml-File is needed defined by the SimProject.dtd.
First the
FWSimSolution
is created with a call with the actionCommand "createSolution".
Within the provided FWSimVarMap
the parameter "solution" points to the solution.sol.xml-File
Then the provided FWSimVarMap
could point to the project.proj.xml-File within parameter
"project". For Test mode no project file is provided. But "createProject" call is needed in all cases.
Three types of simulations are supported:
FWSimProject.PROJECT_MODE
.SIMULATION: Test simulations without project or simple project runs for given project
configuration
FWSimProject.PROJECT_MODE
.SENSITIVITY: Project creates List
of FWSimSimulation
via plug-in FWSimulationGenerator
and runs them accordingly
FWSimProject.PROJECT_MODE
.CALIBRATION: Like SENSITIVITY but additional FWSimulationSelector
selecting
one simulation that fits most to the plug-in selector.
simulations for each given
A call of "run" command starts the process.
FWSimEngine can be used to register Listeners to it: FWSimOutputListener
and FWSimulationListener
.- Author:
- Andreas Enders
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
number of simulations that are queued at once -
Method Summary
Modifier and TypeMethodDescriptionvoid
ModelViewControler architecture -FWSimEngine
signifies the controller to be calledvoid
call
(int aClickCount, String aFunction, HashMap<String, FWSimVariable<?>> aParameterMap, FWSimSession.APPLICATION_MODE aAppMode) void
finalizeSession
(FWSimSession aCurrentSession) finalizes one seesionstatic String
static FWSimEngine
Returns a Reference to the Identity instance (if there is no one yet it creates one)static String
static String
static int
static String
static FWSimSession
prepareSession
(String aProjectFileName, String aSolutionFileName) Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.static FWSimSession
prepareSession
(String aProjectFileName, String aSolutionFileName, Object[][] aParameters) Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.static FWSimSession
prepareSession
(String aProject, String aSolution, Object[][] aParameters, Integer[] aLinesToBeRead, FWSimSession.APPLICATION_MODE aApplicationMode) Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.static FWSimSession
prepareSession
(String aProjectFileName, String aSolutionFileName, FWSimSession.APPLICATION_MODE aApplicationMode) Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.prepareSession
(HashMap<String, FWSimVariable<?>> aParameterMap, Object[][] aParameters, FWSimSession.APPLICATION_MODE aApplicationMode) prepareSession
(org.jdom2.Element aSolutionElement, FWSimVarMap aVarMap, Object[][] aParameters, String aSessionName, FWSimSession.APPLICATION_MODE aApplicationMode, FileData aSolutionFile) static FWSimSession
registerSession
(FWSimSession aSessionO) static FWSimSession
registerSolution
(FWSimSolution aSolutionO, FWSimSession.APPLICATION_MODE aApplicationMode) static void
reset()
resets the whole engine to be able to reinitialize it.static FWSimSession
runProjects
(String aProject, String aSolution) Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.static FWSimSession
Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.static void
setAppMode
(FWSimSession.APPLICATION_MODE aAppMode) void
setCheckLevel
(FWCheckHelper.CHECK_LEVEL aCheckLevel) static void
setDataDir
(String aPathString) static void
setOutputDir
(String aPathString) static void
setProjectsDir
(String aPathString) static void
setSlotCount
(int aSlotCount) static void
setWorkDir
(String aPathString) void
shutDown()
Shutdown the Thread pool if it's finished
-
Field Details
-
MAX_SIMULATION_COUNT
public static int MAX_SIMULATION_COUNTnumber of simulations that are queued at once
-
-
Method Details
-
getInstance
Returns a Reference to the Identity instance (if there is no one yet it creates one)- Returns:
- the singleton instance
-
call
ModelViewControler architecture -FWSimEngine
signifies the controller to be called- Parameters:
aClickCount
-aActionCommand
-- Throws:
Exception
-
call
public void call(int aClickCount, String aFunction, HashMap<String, FWSimVariable<?>> aParameterMap, FWSimSession.APPLICATION_MODE aAppMode) throws Exception- Parameters:
aClickCount
- of mouse buttonaFunction
- as action command etc.aParameterMap
- to pass predefined parameters to the softwareaAppMode
-- Throws:
Exception
-
prepareSession
public static FWSimSession prepareSession(String aProjectFileName, String aSolutionFileName) throws IOException Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.- Parameters:
aProjectFileName
-aSolutionFileName
-- Returns:
- the prepared Session
- Throws:
IOException
- when a file could not be found.
-
prepareSession
public static FWSimSession prepareSession(String aProjectFileName, String aSolutionFileName, Object[][] aParameters) throws IOException Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.- Parameters:
aProjectFileName
-aSolutionFileName
-- Returns:
- the prepared Session
- Throws:
IOException
- when a file could not be found.
-
prepareSession
public static FWSimSession prepareSession(String aProjectFileName, String aSolutionFileName, FWSimSession.APPLICATION_MODE aApplicationMode) throws IOException Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.- Parameters:
aProjectFileName
-aSolutionFileName
-aApplicationMode
-- Returns:
- the prepared Session
- Throws:
IOException
- when a file could not be found.
-
prepareSession
public static FWSimSession prepareSession(String aProject, String aSolution, Object[][] aParameters, Integer[] aLinesToBeRead, FWSimSession.APPLICATION_MODE aApplicationMode) throws IOException Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.- Parameters:
aProject
-aSolutionFileName
-aLinesToBeRead
-aApplicationMode
-- Returns:
- the prepared Session
- Throws:
IOException
- when a file could not be found.
-
runProjects
public static FWSimSession runProjects(String aProject, String aSolution, HashMap<String, String> aSplitMap) Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode. Please make sure if you want to use the SplitList to add ${sessionid} or ${projectid} to your output files to prevent them from being overwritten!- Parameters:
aProjectFileName
-aSolutionFileName
-aSplitMap
- (500000)- Returns:
- runs all projects of the session and returns it.
-
runProjects
Ensemble of all needed calls to run a whole model specified in the solution-file and project-file if no project file name is given, the solution will be taken as default project and simulation will be run once in test mode.- Parameters:
aProject
-aSolution
-- Returns:
- runs all projects of the session and returns it.
-
prepareSession
public FWSimSession prepareSession(HashMap<String, FWSimVariable<?>> aParameterMap, Object[][] aParameters, FWSimSession.APPLICATION_MODE aApplicationMode) throws IOException- Parameters:
aParameterMap
-aApplicationMode
-- Returns:
- the FWSimSolution object filled with the parameters from XML in file
- Throws:
IOException
-
prepareSession
public FWSimSession prepareSession(org.jdom2.Element aSolutionElement, FWSimVarMap aVarMap, Object[][] aParameters, String aSessionName, FWSimSession.APPLICATION_MODE aApplicationMode, FileData aSolutionFile) - Parameters:
aSolutionElement
-aVarMap
-aSessionName
-aApplicationMode
-aSolutionFile
-- Returns:
- the FWSimSolution object filled with the parameters from XML in file
-
getCheckLevel
-
setCheckLevel
-
setWorkDir
- Parameters:
aPathString
-
-
getWorkDir
- Returns:
- the work directory
-
setOutputDir
- Parameters:
aPathString
-
-
getOutputDir
- Returns:
- the output dir
-
setProjectsDir
- Parameters:
aPathString
-
-
getProjectsDir
- Returns:
- the Projects dir
-
setDataDir
- Parameters:
aPathString
-
-
getDataDir
- Returns:
- the Data dir
-
registerSolution
public static FWSimSession registerSolution(FWSimSolution aSolutionO, FWSimSession.APPLICATION_MODE aApplicationMode) - Parameters:
aSolutionO
-aSolutionFile
-aApplicationMode
-- Returns:
- the created session
-
registerSession
- Parameters:
aSessionO
-- Returns:
- the created session
-
shutDown
public void shutDown()Shutdown the Thread pool if it's finished -
reset
public static void reset()resets the whole engine to be able to reinitialize it. -
getSlotCount
public static int getSlotCount()- Returns:
- number of free slots on this computer (processes)
-
setSlotCount
public static void setSlotCount(int aSlotCount) - Parameters:
aSlotCount
- number of free slots on this computer (parallel processes)
-
setAppMode
- Parameters:
aAppMode
-
-
getSessions
- Returns:
- the current session (if only one)
-
finalizeSession
finalizes one seesion- Parameters:
aCurrentSession
-
-
getAppMode
- Returns:
- the Application Mode
-