Class FWSimCalibrationVariable<T>

java.lang.Object
net.simplace.sim.util.FWSimVariable<T>
net.simplace.sim.util.FWSimCalibrationVariable<T>
Type Parameters:
T - data type of the variable value

public class FWSimCalibrationVariable<T> extends FWSimVariable<T>
A variable that is varied by a generator, e.g. for calibration or sensitivity analysis. It is defined by a <cal> element whose <input> children (e.g. min, max, count, values) are stored as additional variables named <variable name>.<input id>. An input either has a constant value or references another variable of the var map via its source attribute.
Author:
Andreas Enders
  • Constructor Details

    • FWSimCalibrationVariable

      public FWSimCalibrationVariable(FWSimVariable<T> aCreateSimVariable, org.jdom2.Element aVarElement, FWSimVarMap aVarMap)
      Creates a calibration variable from a plain variable and reads its inputs. The inputs count and values also set the count of aCreateSimVariable.
      Parameters:
      aCreateSimVariable - variable created from the <cal> element; provides meta data and value
      aVarElement - the <cal> element with its <input> children
      aVarMap - var map used to resolve inputs with a source attribute
  • Method Details

    • createSimVariable

      public static FWSimCalibrationVariable<?> createSimVariable(org.jdom2.Element aVarElement, FWSimFieldContainer aFWSimFieldContainer, FWSimVarMap aVarMap)
      Creates a calibration variable of the data type given in the XML element.
      Parameters:
      aVarElement - the <cal> element with its <input> children
      aFWSimFieldContainer - the component (e.g. the generator) the variable belongs to
      aVarMap - var map used to resolve inputs with a source attribute
      Returns:
      the new calibration variable
      Throws:
      RuntimeException - if the value does not match the data type
    • createVariables

      public HashMap<String, FWSimVariable<?>> createVariables()
      Returns:
      a new map with all input variables and this variable, keyed by name
    • reset

      public void reset()
      Clears the values of all inputs that are calculated by a rule, so that they are re-evaluated on the next access.
      Overrides:
      reset in class FWSimVariable<T>
    • containsProperty

      public boolean containsProperty(String aPropertyName)
      Parameters:
      aPropertyName - input id, e.g. min
      Returns:
      true if the calibration has an input with this id
    • getProperty

      public FWSimVariable<?> getProperty(String aPropertyName, FWSimVarMap aCurrentMap)
      Returns an input variable. If the input is calculated by a rule and has no value yet, the rule is evaluated against the given var map first.
      Parameters:
      aPropertyName - input id, e.g. min
      aCurrentMap - var map used to evaluate rules
      Returns:
      the input variable
    • getPropertyValue

      public Object getPropertyValue(String aPropertyName, FWSimVarMap aCurrentMap)
      Parameters:
      aPropertyName - input id
      aCurrentMap - var map used to evaluate rules
      Returns:
      the value of the input
      See Also:
    • getDoublePropertyValue

      public Double getDoublePropertyValue(String aPropertyName, FWSimVarMap aCurrentMap)
      Parameters:
      aPropertyName - input id
      aCurrentMap - var map used to evaluate rules
      Returns:
      the value of the input converted to Double
      See Also:
    • getIntegerPropertyValue

      public Integer getIntegerPropertyValue(String aPropertyName, FWSimVarMap aCurrentMap)
      Parameters:
      aPropertyName - input id
      aCurrentMap - var map used to evaluate rules
      Returns:
      the value of the input converted to Integer
      See Also:
    • getBooleanPropertyValue

      public Boolean getBooleanPropertyValue(String aPropertyName, FWSimVarMap aCurrentMap)
      Parameters:
      aPropertyName - input id
      aCurrentMap - var map used to evaluate rules
      Returns:
      the value of the input converted to Boolean (false if it cannot be converted)
      See Also:
    • getStringPropertyValue

      public String getStringPropertyValue(String aPropertyName, FWSimVarMap aCurrentMap)
      Parameters:
      aPropertyName - input id
      aCurrentMap - var map used to evaluate rules
      Returns:
      the value of the input converted to String
      See Also: