Class FWSimulationControlContainer
java.lang.Object
net.simplace.sim.control.FWSimulationControlContainer
- All Implemented Interfaces:
FWSimFieldContainer
- Direct Known Subclasses:
FWSimulationGenerator, FWSimulationIterator, FWSimulationSelector
Base class of the components that control a project run: generators (
FWSimulationGenerator, create the
simulations of a project, e.g. SimpleSimulationGenerator for simulations from project data or
DefaultSimulationGenerator as base for own plug-ins), iterators (FWSimulationIterator, decide
whether another calibration iteration is run) and selectors (FWSimulationSelector, select the best
simulations). They are configured by an element of the project file with input, cal
(calibration variables), constraint and identifier children, and keep their variables in
the control variable map of the FWSimulationControlCache.- Author:
- Andreas Enders
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FWSimulationControlCachecontrol cache of the session (iterations, selected simulations, control variable map)protected HashMap<String, FWSimCalibrationVariable<?>> calibration variables that are varied between the generated simulations (childrencal)protected net.simplace.sim.control.FWSimulationControlContainer.Constraintconstraint filtering the generated parameter combinations (childconstraint), ornullprotected org.jdom2.ElementtheElementthe component is configured from, may benullprotected FWSimVarMapcontrol variable map of the project runprotected LinkedHashMap<String, FWSimVariable<?>> variables of the component (fromFWSimFieldContainer.createVariables()and the calibration variables)protected Stringrule for generating the simulation ids (childidentifier), ornullnot usedprotected LinkedHashMap<String, FWSimVariable<?>> input variables configuring the component (childreninput)protected StringName of the component (attributeid,Defaultwithout element)protected HashMap<String, FWSimVariable<?>> parameters of the calibration variablesprotected FWSimSessionthe current sessionprotected FWSimVarMapvariable map of the solution -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor for instantiation via reflection (documentation); the name is the simple class name.protectedFWSimulationControlContainer(org.jdom2.Element aContainerElement, FWSimSession aSession, HashMap<String, FWSimVariable<?>> aFieldMap) Creates the component; to be called by the subclasses. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProcessTime(long aProcessTime) Adds a measured processing time to the runtime statistics (not possible for instances created via reflection).voidaddVariable(FWSimVariable<?> aVariable) Adds a variable to the field map; to be called by the subclasses inFWSimFieldContainer.createVariables().voidcheckCondition(Boolean aCheckResult, String aMessage) Passes the check to the checker of the session.protected booleanevaluate(FWSimVarMap aVarMap, Boolean aDefault) Evaluates the constraint for the values of a variable map.Returnssys.org.jdom2.ElementNo form.org.jdom2.ElementgetEditFormXML(boolean aEnabled) No form.HashMap<String, FWSimVariable<?>> Returns the variables of the component (the live map).Returns the variables of the field map with input content.getName()Returns the name of the component.intReturns 0.Returns the variables of the field map with output content.getVariable(String aKey) Returns a variable of the control variable map: keys starting withCURRENT.and other keys with a dot as they are (the latter with a warning), others prefixed with the name of the component.Returns the variable map of the solution.protected abstract voidinit()Initializes the component after its configuration has been read; called once.booleanAsks the checker of the session.protected voidReads the configuration from the element:input: withsourcea variable of the solution; otherwise the value (text) of a registered variable of the component, or a new variable with the givendatatype(with a warning)cal: calibration variables; for generators only those with a rule are usedconstraint: rule filtering the parameter combinations (checked in GLOBAL calibration)identifier: rule for the simulation idsvoidremoveVariable(String aID) Removes a variable from the field map - use with care.voidsetPropertyValue(String aKey, Object aValue) Sets the value of a variable of the component (<name>.<key>) in the control variable map.org.jdom2.ElementtoXML()Not implemented.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface FWSimFieldContainer
createVariables
-
Field Details
-
iName
Name of the component (attributeid,Defaultwithout element) -
iCache
control cache of the session (iterations, selected simulations, control variable map) -
iControlMap
control variable map of the project run -
iSimulationMap
variable map of the solution -
iFieldMap
variables of the component (fromFWSimFieldContainer.createVariables()and the calibration variables) -
iInputMap
-
iContainerElement
protected org.jdom2.Element iContainerElementtheElementthe component is configured from, may benull -
iInputs
input variables configuring the component (childreninput) -
iCals
calibration variables that are varied between the generated simulations (childrencal) -
iParams
parameters of the calibration variables -
iSession
the current session -
iConstraint
protected net.simplace.sim.control.FWSimulationControlContainer.Constraint iConstraintconstraint filtering the generated parameter combinations (childconstraint), ornull -
iIdentifier
rule for generating the simulation ids (childidentifier), ornull
-
-
Constructor Details
-
FWSimulationControlContainer
public FWSimulationControlContainer()Constructor for instantiation via reflection (documentation); the name is the simple class name. No session and no runtime statistics are set. -
FWSimulationControlContainer
protected FWSimulationControlContainer(org.jdom2.Element aContainerElement, FWSimSession aSession, HashMap<String, FWSimVariable<?>> aFieldMap) Creates the component; to be called by the subclasses. Its variables (FWSimFieldContainer.createVariables()) are added to the control variable map.- Parameters:
aContainerElement- the configuring element, may benullaSession- the sessionaFieldMap- additional variables of the component, may benull
-
-
Method Details
-
readInputCalAndConstraint
protected void readInputCalAndConstraint()Reads the configuration from the element:input: withsourcea variable of the solution; otherwise the value (text) of a registered variable of the component, or a new variable with the givendatatype(with a warning)cal: calibration variables; for generators only those with a rule are usedconstraint: rule filtering the parameter combinations (checked in GLOBAL calibration)identifier: rule for the simulation ids
-
init
protected abstract void init()Initializes the component after its configuration has been read; called once. -
getOrderNumber
public int getOrderNumber()Returns 0.- Specified by:
getOrderNumberin interfaceFWSimFieldContainer- Returns:
- position of this container in the order of execution
- See Also:
-
getContentType
Returnssys.- Specified by:
getContentTypein interfaceFWSimFieldContainer- Returns:
- the content type of the variables of this container (e.g.
sys,mgm) - See Also:
-
addVariable
Adds a variable to the field map; to be called by the subclasses inFWSimFieldContainer.createVariables().- Specified by:
addVariablein interfaceFWSimFieldContainer- Parameters:
aVariable- the variable
-
evaluate
Evaluates the constraint for the values of a variable map.- Parameters:
aVarMap- variable map with the parameter combinationaDefault- result if the rule gives no boolean or fails- Returns:
- the result of the constraint,
truewithout constraint
-
getVariable
Returns a variable of the control variable map: keys starting withCURRENT.and other keys with a dot as they are (the latter with a warning), others prefixed with the name of the component.- Specified by:
getVariablein interfaceFWSimFieldContainer- Parameters:
aKey- the key- Returns:
- the variable
- Throws:
SimFieldMissingException- if the variable does not exist (thrown byFWSimVarMap.getSimVariable(String))
-
setPropertyValue
Sets the value of a variable of the component (<name>.<key>) in the control variable map.- Parameters:
aKey- key of the variable without the component nameaValue- the value- Throws:
SimFieldMissingException- if the variable does not exist
-
removeVariable
Removes a variable from the field map - use with care.- Specified by:
removeVariablein interfaceFWSimFieldContainer- Parameters:
aID- id of the variable- See Also:
-
getName
Returns the name of the component.- Specified by:
getNamein interfaceFWSimFieldContainer- Returns:
- the name of the container
- See Also:
-
getInputVariables
Returns the variables of the field map with input content.- Specified by:
getInputVariablesin interfaceFWSimFieldContainer- Returns:
- the input variables of the field map
- See Also:
-
getOutputVariables
Returns the variables of the field map with output content.- Specified by:
getOutputVariablesin interfaceFWSimFieldContainer- Returns:
- the output variables of the field map
- See Also:
-
addProcessTime
public void addProcessTime(long aProcessTime) Adds a measured processing time to the runtime statistics (not possible for instances created via reflection).- Parameters:
aProcessTime- processing time in milliseconds
-
getFieldMap
Returns the variables of the component (the live map).- Specified by:
getFieldMapin interfaceFWSimFieldContainer- Returns:
- the whole field map as created in
FWSimFieldContainer.createVariables() - See Also:
-
getVarMap
Returns the variable map of the solution.- Specified by:
getVarMapin interfaceFWSimFieldContainer- Returns:
- the var map this container belongs to
- See Also:
-
toXML
public org.jdom2.Element toXML()Not implemented.- Specified by:
toXMLin interfaceFWSimFieldContainer- Returns:
- always
null - See Also:
-
getCreateFormXML
public org.jdom2.Element getCreateFormXML()No form.- Specified by:
getCreateFormXMLin interfaceFWSimFieldContainer- Returns:
- always
null - See Also:
-
getEditFormXML
public org.jdom2.Element getEditFormXML(boolean aEnabled) No form.- Specified by:
getEditFormXMLin interfaceFWSimFieldContainer- Parameters:
aEnabled- iffalse, the form fields are read-only- Returns:
- always
null - See Also:
-
getFrequence
- Specified by:
getFrequencein interfaceFWSimFieldContainer- Returns:
- always
null; control components have no frequency
-
checkCondition
Passes the check to the checker of the session.- Specified by:
checkConditionin interfaceFWSimFieldContainer- Parameters:
aCheckResult- result of the check;falsemeans the condition is violatedaMessage- message describing the condition- See Also:
-
isConditionCheck
public boolean isConditionCheck()Asks the checker of the session.- Specified by:
isConditionCheckin interfaceFWSimFieldContainer- Returns:
trueif conditions are checked with the current check level of the session- See Also:
-