Class FWSimulationSelector

java.lang.Object
net.simplace.sim.control.FWSimulationControlContainer
net.simplace.sim.control.FWSimulationSelector
All Implemented Interfaces:
FWSimFieldContainer
Direct Known Subclasses:
WeightedLeastDifferenceSelector

public abstract class FWSimulationSelector extends FWSimulationControlContainer
Base class of the selectors of a calibration: a selector selects the best simulations of an iteration by implementing select(ResultSet). During the simulations the selector's inputs (e.g. simulated and observed values, with an aggregation mode) are written by a FWSimCalibrationOutput (<id>DATA) to the database; after the iteration they are read with an SQL statement and passed to select(ResultSet). The selected simulations are written to the calibration outputs.
Author:
Andreas Enders
  • Field Details

    • iFrequence

      protected FWSimIOAdapter.FREQUENCE iFrequence
      frequency of the selector's data output (attribute frequence, default DAILY)
    • iSelectStatement

      protected String iSelectStatement
      SQL statement reading the data of the current iteration
    • iGlobalModeSimulationIDMap

      protected HashMap<String,String> iGlobalModeSimulationIDMap
      in GLOBAL mode: simulation ids by index
  • Constructor Details

    • FWSimulationSelector

      public FWSimulationSelector()
      Constructor for instantiation via reflection (documentation).
    • FWSimulationSelector

      public FWSimulationSelector(org.jdom2.Element aSimulationSelectorElement, FWSimSession aSession)
      Creates the selector: registers the system inputs (simulation id, iteration, project id, simulation number, current date), reads the input children (value, or source variable with mode) and creates the data output of the selector.

      Note: the element is read before its null check.

      Parameters:
      aSimulationSelectorElement - the selector element
      aSession - the session
  • Method Details

    • createSelectStatement

      protected void createSelectStatement()
      Creates the SQL statement reading the data of the current iteration: in INDIVIDUAL mode for the current project ordered by simulation id, in GLOBAL mode for all projects ordered by simulation number and project.
    • createSimulationSelector

      public static FWSimulationSelector createSimulationSelector(org.jdom2.Element aSimulationSelectorElement, FWSimSession aSession)
      Factory method: creates the selector of the class given in the attribute class via its constructor (Element, FWSimSession). Errors are logged.
      Parameters:
      aSimulationSelectorElement - the selector element
      aSession - the session
      Returns:
      the selector, or null if it cannot be created
    • createSimulationSelector

      public static FWSimulationSelector createSimulationSelector(String aSimulationSelectorClassName)
      Factory method for documentation purposes: creates a selector without element and session.

      Note: looks for a constructor (Element, FWSimSolution), which the selectors do not have, so this method returns null.

      Parameters:
      aSimulationSelectorClassName - full class name of the selector
      Returns:
      the selector, or null if it cannot be created
    • selectSimulations

      public void selectSimulations(FWSimProject aProject)
      Selects the best simulations of the current iteration: commits the database, reads the data of the iteration with the select statement and calls select(ResultSet) (skipped if the data cannot be read). Then the project data of the selected simulations is loaded and each selected simulation (of this project, unless in GLOBAL mode) is written to the calibration outputs. Errors are logged.
      Parameters:
      aProject - the project (not used)
    • select

      protected abstract void select(ResultSet aResultSet)
      Selects the best simulations from the data of the iteration and stores them in the selected simulations of the control cache; to be implemented by the subclasses.
      Parameters:
      aResultSet - the data of the iteration, or null if there is no select statement