Class FWSimProject
java.lang.Object
net.simplace.sim.FWSimProject
A project is an ensemble of simulation runs that share the solution and its resources (e.g. files, databases) but
differ in the values of their
FWSimVariables. The simulations are created in chunks by a plug-in
FWSimulationGenerator (see updateSimulations(FWSimulationControlCache)) and run in a thread pool
(see simulate(List)). A project is defined in a project file (.proj.xml); without project file
only the solution is simulated.
The FWSimProject.PROJECT_MODE describes how the simulations are created:
FWSimProject.PROJECT_MODE.SOLUTION_ONLY: a single simulation of the solution, no project fileFWSimProject.PROJECT_MODE.SIMULATION: simulations as given by the project configurationFWSimProject.PROJECT_MODE.SENSITIVITY: simulations created by the generator, e.g. for sensitivity analysesFWSimProject.PROJECT_MODE.CALIBRATION: like SENSITIVITY, with an additionalFWSimulationSelectorthat selects the simulations fitting best to its criterion
- Author:
- Andreas Enders
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumModes of a project, see the class description. -
Constructor Summary
ConstructorsConstructorDescriptionFWSimProject(String aProjectID, FWSimulationGenerator aGenerator, FWSimProject.PROJECT_MODE aProjectMode, FWSimulationControlCache aCache) Creates a project and resets the generator to its initial state. -
Method Summary
Modifier and TypeMethodDescriptionbooleanHashMap<String, FWSimVariable<?>> getID()intNot implemented.static List<FWSimSimulation> initProject(List<FWSimSimulation> aSimulationList) Initializes a project run with the first chunk of simulations: updates the resources and registers the simulations at the output manager.final voidvoidsetSimulations(List<FWSimSimulation> aSimulations) Sets the simulations of the project manually.toString()org.jdom2.ElementtoXML()Creates an XML representation of the project: aprojectelement with onesimulationelement per simulation, containing its variables of content typevaranddyn.updateSimulations(FWSimulationControlCache aControlCache) Lets the generator create the next chunk of simulations (at mostFWSimEngine.MAX_SIMULATION_COUNTper call).
-
Constructor Details
-
FWSimProject
public FWSimProject(String aProjectID, FWSimulationGenerator aGenerator, FWSimProject.PROJECT_MODE aProjectMode, FWSimulationControlCache aCache) Creates a project and resets the generator to its initial state.- Parameters:
aProjectID- id (name) of the projectaGenerator- generator creating the simulationsaProjectMode- mode of the projectaCache- control cache of the project run; its control map defines whether the run is synchronized
-
-
Method Details
-
initProject
public static List<FWSimSimulation> initProject(List<FWSimSimulation> aSimulationList) throws Exception Initializes a project run with the first chunk of simulations: updates the resources and registers the simulations at the output manager. The run is skipped if the output manager reports that the output already exists (skip-above-size check).- Parameters:
aSimulationList- first chunk of simulations; the variable map of the first one is used for the project settings- Returns:
- the given list, or
nullif the project run is skipped - Throws:
Exception- if the resources cannot be updated or the outputs cannot be registered
-
toXML
public org.jdom2.Element toXML()Creates an XML representation of the project: aprojectelement with onesimulationelement per simulation, containing its variables of content typevaranddyn.Note: calls
updateSimulations(FWSimulationControlCache)withnull, which fails; the method therefore currently ends with aNullPointerException.- Returns:
- the project element
-
updateSimulations
public List<FWSimSimulation> updateSimulations(FWSimulationControlCache aControlCache) throws Exception Lets the generator create the next chunk of simulations (at mostFWSimEngine.MAX_SIMULATION_COUNTper call). The first chunk also initializes the project run (seeinitProject(List)).- Parameters:
aControlCache- control cache of the project run; its update counter is increased- Returns:
- the next simulations to run, or
nullif the generator has no more simulations or the project run is skipped - Throws:
Exception- if the generator or the project initialization fails
-
setSimulations
Sets the simulations of the project manually. This list is not filled byupdateSimulations(FWSimulationControlCache).- Parameters:
aSimulations- the simulations (copied into a new list)
-
getSimulations
- Returns:
- the simulations set by
setSimulations(List), ornullif none were set
-
getID
- Returns:
- the id of the project
-
getProjectMode
- Returns:
- the project mode
-
setProjectMode
- Parameters:
mode- the new project mode
-
toString
-
getSimulationCount
public int getSimulationCount()- Returns:
- the current simulation count of the control cache
-
canUpdate
public boolean canUpdate()- Returns:
trueif the generator can create more simulations for this project
-
getFieldMap
- Returns:
- the field map of the generator (the project variables)
-
getSyncVarMap
-