Package net.simplace.sim.io.output
Class FWSimOutputAdapter
java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.output.FWSimOutputAdapter
- All Implemented Interfaces:
FWSimFieldContainer
- Direct Known Subclasses:
CacheOutputAdapter
,CSVOutputAdapter
,DatabaseOutputAdapter
,NetCDFOutputAdapter
Abstract implementation for the IO-Adapter for only writing output data This
abstract implementation is
FWSimIOAdapter
. It additionally implements
a blocking queue ArrayBlockingQueue
that makes it possible to divide
the model output from writing the output to the different interfaces.
Cache size is the number of elements that can be cached in the queue before
the queue will also stop to take elements from the model output.
!!IMPORTANT!! Before finalizing the application it has to be checked, if all
output is written to the FWSimInterface
s resp. the blocking queue is
empty.
reads general information from the xml-structure given as - Author:
- Andreas Enders
-
Nested Class Summary
Nested classes/interfaces inherited from class net.simplace.sim.io.FWSimIOAdapter
FWSimIOAdapter.FREQUENCE
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
size of the temporary output cacheprotected ArrayBlockingQueue<FWSimQueueObjectMap>
Queue that temporarily stores output data until the writer is accessibleFields inherited from class net.simplace.sim.io.FWSimIOAdapter
iArrayMode, iFieldcount, iFrequence, iHeaderVariables, iInterface, iJexlRule, iKeyMap, iName, iOrderNumber, iProcessTime, iResourceElement, iSession, iSourceKey
-
Constructor Summary
ModifierConstructorDescriptionFWSimOutputAdapter
(String aName, org.jdom2.Element aOutputElement, FWSimInterface<?> aInterface, FWSimIOAdapter.FREQUENCE aFrequence, int aOrderNumber, String aCacheSize, ProcessTime aProcessTime, FWSimSession aSession) called from the graph panel while creating output adaptor.protected
FWSimOutputAdapter
(FWSimOutputAdapter aOutputAdapter, FWSimInterface<?> aInterface) should be called from implementations while constructing an updated adapter.protected
FWSimOutputAdapter
(org.jdom2.Element aOutputElement, int aOrderNumber, FWSimVarMap aVarMap) should be called from implementations while constructing. -
Method Summary
Modifier and TypeMethodDescriptionstatic FWSimOutputAdapter
createAdapter
(org.jdom2.Element aOutputElement, int aOrderNumber, FWSimVarMap aVarMap) static FWSimOutputAdapter
createOutputFromObservable
(FWObservable aObservable, int aOrderNumber) returns list of the input variables given as header informationalways returns empty list.int
getStatisticsResultCache
(String aSimulationID) boolean
protected abstract void
init
(FWSimVarMap aVarMap) void
initialize
(FWSimVarMap aVarMap) boolean
isActive()
boolean
for synchronization purposes checks, if the writing method is still active, even if the queue is emptyvoid
receiveData
(FWSimQueueObjectMap aQueueObjectMap) Outputter should write the data to this method - writing is done automatically in another thread.creates HTML Documentation form of the Output Adaptororg.jdom2.Element
toXML()
static FWSimOutputAdapter
updateAdapter
(FWSimOutputAdapter aAdapter, FWSimInterface<?> aInterface) void
method called by different thread actually writing the data to the given media in SimInterfaceprotected abstract void
writeData
(FWSimQueueObjectMap aObjectToWrite) writes data to the interface - has to be implemented for each adapter individuallyMethods inherited from class net.simplace.sim.io.FWSimIOAdapter
addProcessTime, addVariable, checkCondition, createFormFields, createVariables, finalize, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getHeaderVariables, getHeaderXML, getJexlRule, getKeyMap, getName, getOrderNumber, getVariable, isArrayMode, isConditionCheck, removeVariable, setInterface, setOrderNumber, toString, writeHeaderList
-
Field Details
-
iQueue
Queue that temporarily stores output data until the writer is accessible -
iCacheSize
protected int iCacheSizesize of the temporary output cache
-
-
Constructor Details
-
FWSimOutputAdapter
protected FWSimOutputAdapter(org.jdom2.Element aOutputElement, int aOrderNumber, FWSimVarMap aVarMap) should be called from implementations while constructing.- Parameters:
aOutputElement
-aOrderNumber
-aVarMap
-
-
FWSimOutputAdapter
should be called from implementations while constructing an updated adapter.- Parameters:
aOutputAdapter
-aInterface
-
-
FWSimOutputAdapter
public FWSimOutputAdapter(String aName, org.jdom2.Element aOutputElement, FWSimInterface<?> aInterface, FWSimIOAdapter.FREQUENCE aFrequence, int aOrderNumber, String aCacheSize, ProcessTime aProcessTime, FWSimSession aSession) called from the graph panel while creating output adaptor.- Parameters:
aName
-aOutputElement
-aInterface
-aFrequence
-aOrderNumber
-aCacheSize
-aProcessTime
-aSession
-aVarMap
-
-
-
Method Details
-
initialize
- Parameters:
aVarMap
-
-
init
- Parameters:
aVarMap
-
-
receiveData
Outputter should write the data to this method - writing is done automatically in another thread.- Parameters:
aQueueObjectMap
-
-
writeData
public void writeData()method called by different thread actually writing the data to the given media in SimInterface -
writeData
writes data to the interface - has to be implemented for each adapter individually- Parameters:
aSimulationID
-aObjectToWrite
-
-
createAdapter
public static FWSimOutputAdapter createAdapter(org.jdom2.Element aOutputElement, int aOrderNumber, FWSimVarMap aVarMap) throws MissingSimResourceException - Parameters:
aOutputElement
-aOrderNumber
-aVarMap
-- Returns:
- the output Adapter to be created
- Throws:
MissingSimResourceException
-
updateAdapter
public static FWSimOutputAdapter updateAdapter(FWSimOutputAdapter aAdapter, FWSimInterface<?> aInterface) throws MissingSimResourceException - Parameters:
aAdapter
-aInterface
-- Returns:
- updated FWSimOutputAdapter
- Throws:
MissingSimResourceException
-
createOutputFromObservable
public static FWSimOutputAdapter createOutputFromObservable(FWObservable aObservable, int aOrderNumber) throws MissingSimResourceException - Parameters:
aObservable
-aOrderNumber
-- Returns:
- the output Adapter to be created
- Throws:
MissingSimResourceException
-
getOutputVariables
always returns empty list. No Output expected from this adapter- Returns:
- FWSimVarables filtered - only output Variables
- See Also:
-
getInputVariables
returns list of the input variables given as header information- Returns:
- FWSimVarables filtered - only input Variables
- See Also:
-
getResetScript
- Returns:
- the rule
-
getContentType
- Returns:
- number in the order of Components
- See Also:
-
getQueueLenth
public int getQueueLenth()- Returns:
- length of the current queue
-
isActive
public boolean isActive()- Returns:
- if the Queue is actively running
-
getInterface
- Overrides:
getInterface
in classFWSimIOAdapter
- Returns:
- the connected interface
-
getVarMap
- Returns:
- number in the order of Components
-
hasStatistics
public boolean hasStatistics()- Returns:
- if the adapter has statistics
-
getStatisticsHeaderVariables
- Returns:
- the statistics header variable
-
getStatistics
- Returns:
- the statistics
-
getStatisticsResultCache
- Parameters:
aSimulationID
-- Returns:
- the statisticsResultCache
-
getStatisticsAdapter
- Returns:
- the statisticsAdapter
-
toXML
public org.jdom2.Element toXML()- Returns:
- a xml element with all the settings of this component()
- See Also:
-
toHTMLTablestring
creates HTML Documentation form of the Output Adaptor- Returns:
- the generated HTMLString
-
isWriting
public boolean isWriting()for synchronization purposes checks, if the writing method is still active, even if the queue is empty- Returns:
- true if the writing process is still active
-