Class CacheOutputAdapter
java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.output.FWSimOutputAdapter
net.simplace.sim.io.output.adapter.CacheOutputAdapter
- All Implemented Interfaces:
FWSimFieldContainer
Output adapter for the memory interface: stores the output lines of each simulation in a
FWSimResultCache
for later use in the application (charts, calibration, wrapper). The caches are created when the simulations are
registered (registerSimulation(FWSimSimulation)).- Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class FWSimIOAdapter
FWSimIOAdapter.FREQUENCE -
Field Summary
Fields inherited from class FWSimOutputAdapter
iCacheSize, iQueueFields inherited from class FWSimIOAdapter
iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey -
Constructor Summary
ConstructorsConstructorDescriptionCacheOutputAdapter(String aName, int aOrderNumber, FWSimIOAdapter.FREQUENCE aFrequence, String aCacheSize, ProcessTime aProcessTime, FWSimSession aSession) Creates the adapter from the graph panel with its own memory interface.CacheOutputAdapter(String aName, FWSimIOAdapter.FREQUENCE aFrequence, LinkedHashMap<String, FWSimVariable<?>> aVarList, FWSimVarMap aVarMap) Constructor for calibration outputs: creates a result cacheCALIBRATIONfor the given variables.CacheOutputAdapter(FWSimOutputAdapter aOldAdapter, MEMORYInterface aInterface) Copy constructor used when the interface is replaced.CacheOutputAdapter(org.jdom2.Element aResourceElement, int aOrderNumber, FWSimVarMap aVarMap) Creates the adapter from anoutputelement. -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves all result caches.voidfinalize()Nothing to finalize; the caches stay available.getDataContainer(String aSimulationID) getResultCache(String aID) protected voidinit(FWSimVarMap aVarMap) Nothing to initialize; the caches are created per simulation.booleanReturnsfalse; arrays are stored as a whole.voidregisterSimulation(FWSimSimulation aFwSimSimulation) Creates the result cache of a simulation and registers it at the simulation.protected voidwriteData(FWSimQueueObjectMap aObjectToWrite) Stores an output line in the result cache of its simulation (in the writer thread).Methods inherited from class FWSimOutputAdapter
createAdapter, createOutputFromObservable, getContentType, getInputVariables, getInterface, getOutputVariables, getQueueLenth, getResetScript, getStatistics, getStatisticsAdapter, getStatisticsHeaderVariables, getStatisticsResultCache, getVarMap, hasStatistics, initialize, isActive, isWriting, receiveData, toHTMLTablestring, toXML, updateAdapter, writeDataMethods inherited from class FWSimIOAdapter
addProcessTime, addVariable, checkCondition, createFormFields, createVariables, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getJexlRule, getKeyMap, getName, getOrderNumber, getVariable, isConditionCheck, removeVariable, setFrequenceAndRule, setInterface, setOrderNumber, toString, writeHeaderList
-
Constructor Details
-
CacheOutputAdapter
public CacheOutputAdapter(org.jdom2.Element aResourceElement, int aOrderNumber, FWSimVarMap aVarMap) Creates the adapter from anoutputelement.- Parameters:
aResourceElement- theoutputelementaOrderNumber- order number of the adapteraVarMap- template variable map of the solution
-
CacheOutputAdapter
public CacheOutputAdapter(String aName, int aOrderNumber, FWSimIOAdapter.FREQUENCE aFrequence, String aCacheSize, ProcessTime aProcessTime, FWSimSession aSession) Creates the adapter from the graph panel with its own memory interface.- Parameters:
aName- name of the adapter and the interfaceaOrderNumber- order number of the adapteraFrequence- frequency of the outputaCacheSize- capacity of the queue and the interface (must be a number)aProcessTime- runtime statistics of the adapteraSession- the session
-
CacheOutputAdapter
public CacheOutputAdapter(String aName, FWSimIOAdapter.FREQUENCE aFrequence, LinkedHashMap<String, FWSimVariable<?>> aVarList, FWSimVarMap aVarMap) Constructor for calibration outputs: creates a result cacheCALIBRATIONfor the given variables. Note: the header variables are still empty when their rules are set, andwriteData(FWSimQueueObjectMap)looks up caches by simulation id, so this cache is not filled.- Parameters:
aName- name of the adapteraFrequence- frequency of the outputaVarList- variables of the result cacheaVarMap- variable map (session and simulation id)
-
CacheOutputAdapter
Copy constructor used when the interface is replaced.- Parameters:
aOldAdapter- the adapter to copyaInterface- the new interface
-
-
Method Details
-
init
Nothing to initialize; the caches are created per simulation.- Specified by:
initin classFWSimOutputAdapter- Parameters:
aVarMap- variable map used for replacing tokens
-
isArrayMode
public boolean isArrayMode()Returnsfalse; arrays are stored as a whole.- Overrides:
isArrayModein classFWSimIOAdapter- Returns:
trueif the adapter has array variables (array elements are handled as separate values)- See Also:
-
writeData
Stores an output line in the result cache of its simulation (in the writer thread). A missing cache is logged.- Specified by:
writeDatain classFWSimOutputAdapter- Parameters:
aObjectToWrite- the output line- See Also:
-
registerSimulation
Creates the result cache of a simulation and registers it at the simulation.- Parameters:
aFwSimSimulation- the simulation
-
getResultCache
- Parameters:
aID- id of the simulation- Returns:
- the result cache of the simulation, or
nullif not registered
-
getDataContainer
- Parameters:
aSimulationID- id of a simulation, ornullfor all simulations- Returns:
- the data of one or all result caches as
DataContainer(e.g. for the wrapper), ornullif there is no result cache for the simulation id or no result cache at all (logged as warning)
-
finalize
Nothing to finalize; the caches stay available.- Overrides:
finalizein classFWSimIOAdapter- Throws:
Exception- if finalizing the interface fails- See Also:
-
clearSimulation
public void clearSimulation()Removes all result caches.
-