Class FWSimulationController

java.lang.Object
net.simplace.sim.control.FWSimulationController

public class FWSimulationController extends Object
Reads the project file (.proj.xml) and controls the project run of a session. It creates the iterator, generator and selector from the projects element and determines the FWSimProject.PROJECT_MODE:
  • selector (with or without generator): CALIBRATION
  • generator only: SENSITIVITY
  • otherwise: SIMULATION (project data from XML or from a resource); without project file SOLUTION_ONLY
The project data is read either from project/simulation elements in the XML or from a resource (CSV, database, ...) named PROJECT_DATA. The project file may also override interfaces and define outputs and post-processing. During the run, iterate(String), generate(String) and select(FWSimProject) are called by the session.
Author:
Andreas Enders
  • Field Details

  • Constructor Details

  • Method Details

    • initProjectData

      public void initProjectData(FileData aProjectXMLFile) throws SimProjectException
      Reads the project file: interfaces, projects (control components and project data), outputs and post-processing. Without project file nothing is done (SOLUTION_ONLY).
      Parameters:
      aProjectXMLFile - the project file, or null
      Throws:
      SimProjectException - if the project file cannot be read or is invalid
    • iterate

      public boolean iterate(String aProjectID)
      Decides whether another iteration is run and, if so, generates its simulations (see the calibration modes in FWSimulationControlCache).
      Parameters:
      aProjectID - id of the project, or null in GLOBAL mode
      Returns:
      true if another iteration is run
    • generate

      public void generate(String aProjectID)
      Generates the simulations: without projects a default generator for the solution only (project DefaultProject); in GLOBAL mode for all projects; otherwise for the given project. Errors are logged.
      Parameters:
      aProjectID - id of the project, or null
    • select

      public void select(FWSimProject aProject)
      Selects the best simulations of the iteration (calibration only).
      Parameters:
      aProject - the project
    • finalize

      public void finalize()
      Finalizes the generator (returns its database connections).
      Overrides:
      finalize in class Object
    • getProjectIDs

      public Set<String> getProjectIDs()
      Returns:
      the project ids in order (the live set of the control cache)
    • getProject

      public FWSimProject getProject(String aProject)
      Creates a new project object for an id. Note: every call creates a new object and resets the generator to its initial state.
      Parameters:
      aProject - id of the project
      Returns:
      the new project
    • getFieldMap

      public HashMap<String, FWSimVariable<?>> getFieldMap()
      Returns:
      the variables of the project run (the live map)
    • getProjectMode

      public FWSimProject.PROJECT_MODE getProjectMode()
      Returns:
      the project mode
    • setProjectMode

      public void setProjectMode(FWSimProject.PROJECT_MODE aProjectMode)
      Parameters:
      aProjectMode - the project mode
    • getCurrentProjectID

      public String getCurrentProjectID()
      Returns:
      the id of the current project
    • getMaxIterationCount

      public int getMaxIterationCount()
      Returns:
      the maximum number of iterations of the iterator, at least 1