Class FWSimEngine

java.lang.Object
net.simplace.sim.FWSimEngine

public final class FWSimEngine extends Object
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 Details

    • MAX_SIMULATION_COUNT

      public static int MAX_SIMULATION_COUNT
      number of simulations that are queued at once
  • Method Details

    • getInstance

      public static FWSimEngine getInstance()
      Returns a Reference to the Identity instance (if there is no one yet it creates one)
      Returns:
      the singleton instance
    • call

      public void call(int aClickCount, String aActionCommand) throws Exception
      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 button
      aFunction - as action command etc.
      aParameterMap - to pass predefined parameters to the software
      aAppMode -
      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

      public 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.
      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

      public FWCheckHelper.CHECK_LEVEL getCheckLevel()
    • setCheckLevel

      public void setCheckLevel(FWCheckHelper.CHECK_LEVEL aCheckLevel)
    • setWorkDir

      public static void setWorkDir(String aPathString)
      Parameters:
      aPathString -
    • getWorkDir

      public static String getWorkDir()
      Returns:
      the work directory
    • setOutputDir

      public static void setOutputDir(String aPathString)
      Parameters:
      aPathString -
    • getOutputDir

      public static String getOutputDir()
      Returns:
      the output dir
    • setProjectsDir

      public static void setProjectsDir(String aPathString)
      Parameters:
      aPathString -
    • getProjectsDir

      public static String getProjectsDir()
      Returns:
      the Projects dir
    • setDataDir

      public static void setDataDir(String aPathString)
      Parameters:
      aPathString -
    • getDataDir

      public static String 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

      public static FWSimSession registerSession(FWSimSession aSessionO)
      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

      public static void setAppMode(FWSimSession.APPLICATION_MODE aAppMode)
      Parameters:
      aAppMode -
    • getSessions

      public List<FWSimSession> getSessions()
      Returns:
      the current session (if only one)
    • finalizeSession

      public void finalizeSession(FWSimSession aCurrentSession)
      finalizes one seesion
      Parameters:
      aCurrentSession -
    • getAppMode

      public FWSimSession.APPLICATION_MODE getAppMode()
      Returns:
      the Application Mode