Klasse FWSimComponent

java.lang.Object
net.simplace.sim.model.FWSimComponent
Alle implementierten Schnittstellen:
FWSimFieldContainer
Bekannte direkte Unterklassen:
DefaultManagement, FWAnalyticsSimComponent, FWSimComponentGroup, FWSimpleSimComponent

public abstract class FWSimComponent extends Object implements FWSimFieldContainer
Autor:
Andreas Enders FWSimComponent is the smallest definable unit of a model It overrides the abstract FWSimFieldContainer with methods init, clone (with reset) and process It contains the algorithms of the scientific model Has to be documented in detail Simulation Modules are similar to the so called ?strategies? in ACE. They can be encapsulated with SimObjects and used in ACE as in SMILE Model Engine. Each FWSimComponent should have its own Unit Test, Input Forms and Result Forms
  • Felddetails

    • iName

      protected String iName
      Name of component
    • iVarMap

      protected FWSimVarMap iVarMap
      Centrally used VarMap reference
    • iFieldMap

      protected HashMap<String,FWSimVariable<?>> iFieldMap
      initial field map as given by the createVariables()-Method in the SimComponent implementation
    • iInputMap

      protected HashMap<String,String> iInputMap
      registered links of the SimComponent implementation
    • iSimModel

      protected FWSimModel iSimModel
      SimModel reference - can be seen as the thread the component is accessed in
    • iSimComponentElement

      protected org.jdom2.Element iSimComponentElement
      original SimComponent configuration element (jdom)
    • iOrderNumber

      protected int iOrderNumber
      order number for the serial order of the components
    • iFrequence

      protected FWSimIOAdapter.FREQUENCE iFrequence
      frequence to check if component is executed or not
    • iJexlRule

      protected JexlRuleScript iJexlRule
      rule to check if component is executed or not
    • isComponentGroup

      protected final boolean isComponentGroup
      Info about ComponentGroup
    • iMasterComponentGroup

      protected FWSimComponentGroup iMasterComponentGroup
      If component is part of a SimComponent Group Main Component mentioned here
  • Konstruktordetails

    • FWSimComponent

      protected FWSimComponent()
      Main constructor for use with Class.forName()
      Löst aus:
      RuntimeException
    • FWSimComponent

      protected FWSimComponent(String aName, HashMap<String,FWSimVariable<?>> aFieldMap, HashMap<String,String> aInputMap, org.jdom2.Element aSimComponentElement, FWSimVarMap aVarMap, int aOrderNumber)
      called via clone
      Parameter:
      aName -
      aFieldMap -
      aInputMap -
      aSimComponentElement -
      aVarMap -
      aOrderNumber -
  • Methodendetails

    • createSimComponent

      public static FWSimComponent createSimComponent(org.jdom2.Element aSimComponentElement, FWSimVarMap aVarMap, FWSimModel aSimModel, int aOrderNumber) throws SimLinkInvalidException
      factory method creating a SimComponent
      Parameter:
      aSimComponentElement -
      aVarMap -
      aSimModel -
      aOrderNumber -
      Gibt zurück:
      newly created FWSimComponent
      Löst aus:
      SimLinkInvalidException
    • createSimComponent

      public static FWSimComponent createSimComponent(org.jdom2.Element aSimComponentElement, FWSimComponentGroup aComponentGroup, FWSimVarMap aVarMap, FWSimModel aSimModel, int aOrderNumber) throws SimLinkInvalidException
      factory method creating a SimComponent
      Parameter:
      aSimComponentElement -
      aComponentGroup -
      aVarMap -
      aSimModel -
      aOrderNumber -
      Gibt zurück:
      newly created FWSimComponent
      Löst aus:
      SimLinkInvalidException
    • createSimComponent

      public static FWSimComponent createSimComponent(String tName, FWSimVarMap aVarMap, FWSimModel aSimModel, int aOrderNumber) throws SimLinkInvalidException
      Parameter:
      tName -
      aVarMap -
      aSimModel -
      aOrderNumber -
      Gibt zurück:
      the created FWSimComponent
      Löst aus:
      SimLinkInvalidException
    • createSimComponent

      public static FWSimComponent createSimComponent(String aClassname)
      Parameter:
      aClassname -
      Gibt zurück:
      the newly created sim component
    • getVariableField

      protected FWSimVariable<?> getVariableField(String aKey)
      Parameter:
      aKey -
      Gibt zurück:
      the FWSimVariable from FieldMap (not from the VarMap!)
    • isVariableAvailable

      protected boolean isVariableAvailable(String aString)
      Parameter:
      aString -
      Gibt zurück:
      if Variable is available in VarMap
    • addVariable

      public void addVariable(FWSimVariable<?> aVariable)
      Add Variable to the Filed map. This should be called in implementing classes within the method "createVariables".
      Angegeben von:
      addVariable in Schnittstelle FWSimFieldContainer
      Parameter:
      aVariable -
    • getVariable

      public FWSimVariable<?> getVariable(String aKey) throws SimFieldMissingException
      Angegeben von:
      getVariable in Schnittstelle FWSimFieldContainer
      Parameter:
      aKey -
      Gibt zurück:
      one SimVariable registered for given key
      Löst aus:
      SimFieldMissingException - if Variable is Null
    • removeVariable

      public void removeVariable(String aID)
      Remove variable from FieldMap - handle with care!
      Angegeben von:
      removeVariable in Schnittstelle FWSimFieldContainer
      Parameter:
      aID -
      Siehe auch:
    • getName

      public String getName()
      Angegeben von:
      getName in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      the name
    • getFieldMap

      public HashMap<String,FWSimVariable<?>> getFieldMap()
      Angegeben von:
      getFieldMap in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      the name
    • getVarMap

      public FWSimVarMap getVarMap()
      Angegeben von:
      getVarMap in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      number in the order of Components
    • getFrequenceRuleScript

      public JexlRuleScript getFrequenceRuleScript()
      Gibt zurück:
    • readInputs

      protected HashMap<String,String> readInputs(org.jdom2.Element aSimComponentElement)
      Parameter:
      aSimComponentElement -
      Gibt zurück:
      HashMap of inputs
    • writeVarInfos

      public String writeVarInfos(String aFilePath)
      Writes the varInfos to a given FilePath.
      Parameter:
      aFilePath -
      Gibt zurück:
      the string result
    • bind

      protected void bind()
      The model initialization function. Will be called only once, before running the model using process().
    • initialize

      public void initialize()
      The model initialization function. Will be called only once, before running the model using process().
    • init

      protected abstract void init()
      The model initialization function. Will be called only once, before running the model using process().
    • setVariablesDefault

      protected void setVariablesDefault()
      The models writable variables like outputs, states and rates are set to default .
    • createVariables

      public abstract HashMap<String,FWSimVariable<?>> createVariables()
      called only once when the SimComponent is created. Hereby the FieldMap is filled with the interfacing fields.
      Angegeben von:
      createVariables in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      variables from the field map
      Siehe auch:
    • performLinks

      public void performLinks() throws SimLinkInvalidException
      links like given in the input part of the SimComponent configuration are performed. This is done only while model creation.
      Löst aus:
      SimLinkInvalidException
    • performLinks

      protected void performLinks(HashMap<String,String> aLinkMap) throws SimLinkInvalidException
      Parameter:
      aLinkMap - with key = destination and value = source!
      Löst aus:
      SimLinkInvalidException
    • getInputs

      public Map<String,String> getInputs()
      Gibt zurück:
      the map of the input relations. key is given without the name of the component.
    • reset

      protected void reset(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
    • doProcess

      protected void doProcess()
      The main model calculation function. Is guaranteed to be called once per module-specific time step.
    • process

      protected abstract void process()
      The main model calculation function. Is guaranteed to be called once per module-specific time step.
    • clone

      protected abstract FWSimComponent clone(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
      Gibt zurück:
      the deep clone of the SimComponent
    • getInputVariables

      public ArrayList<FWSimVariable<?>> getInputVariables()
      returns the input variables from FieldMap
      Angegeben von:
      getInputVariables in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      FWSimVarables filtered - only input Variables
      Siehe auch:
    • getConstantVariables

      public ArrayList<FWSimVariable<?>> getConstantVariables()
      Gibt zurück:
      constant variables from the FieldMAp
    • getOutputVariables

      public ArrayList<FWSimVariable<?>> getOutputVariables()
      Angegeben von:
      getOutputVariables in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      the OutputVariables from the FieldMap
      Siehe auch:
    • toString

      public String toString()
      Name of the Component
      Setzt außer Kraft:
      toString in Klasse Object
      Siehe auch:
    • toDocXML

      public org.jdom2.Element toDocXML()
      Gibt zurück:
      Element of this document
      Siehe auch:
    • toXML

      public org.jdom2.Element toXML()
      Angegeben von:
      toXML in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      a xml element with all the settings of this component()
      Siehe auch:
    • toGroupXML

      public org.jdom2.Element toGroupXML(HashSet<String> aComponentsInGroup, String aGroupName)
      Parameter:
      aComponentsInGroup -
      aGroupName -
      Gibt zurück:
      xml element which contains group of SimComponents
    • toResourcesDataXML

      public org.jdom2.Element toResourcesDataXML()
      Gibt zurück:
      xml element with all the info about constants of this component
    • toResourcesDefinitionXML

      public org.jdom2.Element toResourcesDefinitionXML()
      Gibt zurück:
      xml element which contains section for this component for inclusion into solutions
    • toOutputDefinitionXML

      public org.jdom2.Element toOutputDefinitionXML()
      Gibt zurück:
      xml element which contains section for this component for inclusion into solutions
    • toComponentLinkingXML

      public org.jdom2.Element toComponentLinkingXML()
      Gibt zurück:
      xml element which contains section for this component for inclusion into solutions
    • getCreateFormXML

      public final org.jdom2.Element getCreateFormXML()
      Angegeben von:
      getCreateFormXML in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      a xml element with all the settings of this component()
      Siehe auch:
    • getEditFormXML

      public org.jdom2.Element getEditFormXML(boolean aEnabled)
      Angegeben von:
      getEditFormXML in Schnittstelle FWSimFieldContainer
      Parameter:
      aEnabled -
      Gibt zurück:
      a xml element with all the settings of this component()
      Siehe auch:
    • getOrderNumber

      public int getOrderNumber()
      Angegeben von:
      getOrderNumber in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      number in the order of Components
      Siehe auch:
    • getContentType

      public FWSimVariable.CONTENT_TYPE getContentType()
      Angegeben von:
      getContentType in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      number in the order of Components
      Siehe auch:
    • getFrequence

      public FWSimIOAdapter.FREQUENCE getFrequence()
      Angegeben von:
      getFrequence in Schnittstelle FWSimFieldContainer
      Gibt zurück:
      the Frequence of the Container calling
      Siehe auch:
    • getMasterComponentGroup

      public FWSimComponentGroup getMasterComponentGroup()
      Gibt zurück:
      the master component if this is part of FWSimComponentGroup
    • getDescription

      public String getDescription()
      Gibt zurück:
      the description including title
    • runComponentTest

      public static Boolean runComponentTest(String aComponentClassName, int aTestIndex)
      called for single component test to check the components algorithm.
      Parameter:
      aParamIndex - : Used to set up different test cases. Start with 0 - 1 aso
      Siehe auch:
      • Ungültige Referenz
        net.simplace.sim.util.FWSimFieldContainer#fillTestVariables(int aParamIndex, TEST_STATE aDefineOrCheck)
    • fillTestVariables

      public abstract HashMap<String,FWSimVariable<?>> fillTestVariables(int aTestIndex, FWSimComponent.TEST_STATE aDefineOrCheck)
      called for single component test to check the components algorithm.
      Parameter:
      aDefineOrCheck - : Use TEST_STATE.DEFINE for defining the test default values and TEST_STATE.CHECK for the accepted results
      aParamIndex - : Used to set up different test cases. Start with 0 - 1 aso
      Siehe auch:
      • Ungültige Referenz
        net.simplace.sim.util.FWSimFieldContainer#fillTestVariables(int aParamIndex, TEST_STATE aDefineOrCheck)
    • checkCondition

      public void checkCondition(Boolean aCheckResult, String aMessage)
      Beschreibung aus Schnittstelle kopiert: FWSimFieldContainer
      Called from inside the FWSimFieldContainer to log the initialization Errors.
      Angegeben von:
      checkCondition in Schnittstelle FWSimFieldContainer
      Parameter:
      aCheckResult -
      aMessage -
    • isConditionCheck

      public boolean isConditionCheck()
      Angegeben von:
      isConditionCheck in Schnittstelle FWSimFieldContainer