Klasse FWSimOutputAdapter

java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.output.FWSimOutputAdapter
Alle implementierten Schnittstellen:
FWSimFieldContainer
Bekannte direkte Unterklassen:
CacheOutputAdapter, CSVOutputAdapter, DatabaseOutputAdapter, NetCDFOutputAdapter

public abstract class FWSimOutputAdapter extends FWSimIOAdapter
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 FWSimInterfaces resp. the blocking queue is empty. reads general information from the xml-structure given as
Autor:
Andreas Enders
  • Felddetails

    • iQueue

      Queue that temporarily stores output data until the writer is accessible
    • iCacheSize

      protected int iCacheSize
      size of the temporary output cache
  • Konstruktordetails

    • FWSimOutputAdapter

      protected FWSimOutputAdapter(org.jdom2.Element aOutputElement, int aOrderNumber, FWSimVarMap aVarMap)
      should be called from implementations while constructing.
      Parameter:
      aOutputElement -
      aOrderNumber -
      aVarMap -
    • FWSimOutputAdapter

      protected FWSimOutputAdapter(FWSimOutputAdapter aOutputAdapter, FWSimInterface<?> aInterface)
      should be called from implementations while constructing an updated adapter.
      Parameter:
      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.
      Parameter:
      aName -
      aOutputElement -
      aInterface -
      aFrequence -
      aOrderNumber -
      aCacheSize -
      aProcessTime -
      aSession -
      aVarMap -
  • Methodendetails

    • initialize

      public void initialize(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
    • init

      protected abstract void init(FWSimVarMap aVarMap)
      Parameter:
      aVarMap -
    • receiveData

      public void receiveData(FWSimQueueObjectMap aQueueObjectMap)
      Outputter should write the data to this method - writing is done automatically in another thread.
      Parameter:
      aQueueObjectMap -
    • writeData

      public void writeData()
      method called by different thread actually writing the data to the given media in SimInterface
    • writeData

      protected abstract void writeData(FWSimQueueObjectMap aObjectToWrite)
      writes data to the interface - has to be implemented for each adapter individually
      Parameter:
      aObjectToWrite -
      aSimulationID -
    • createAdapter

      public static FWSimOutputAdapter createAdapter(org.jdom2.Element aOutputElement, int aOrderNumber, FWSimVarMap aVarMap) throws MissingSimResourceException
      Parameter:
      aOutputElement -
      aOrderNumber -
      aVarMap -
      Gibt zurück:
      the output Adapter to be created
      Löst aus:
      MissingSimResourceException
    • updateAdapter

      public static FWSimOutputAdapter updateAdapter(FWSimOutputAdapter aAdapter, FWSimInterface<?> aInterface) throws MissingSimResourceException
      Parameter:
      aAdapter -
      aInterface -
      Gibt zurück:
      updated FWSimOutputAdapter
      Löst aus:
      MissingSimResourceException
    • createOutputFromObservable

      public static FWSimOutputAdapter createOutputFromObservable(FWObservable aObservable, int aOrderNumber) throws MissingSimResourceException
      Parameter:
      aObservable -
      aOrderNumber -
      Gibt zurück:
      the output Adapter to be created
      Löst aus:
      MissingSimResourceException
    • getOutputVariables

      public Collection<FWSimVariable<?>> getOutputVariables()
      always returns empty list. No Output expected from this adapter
      Gibt zurück:
      FWSimVarables filtered - only output Variables
      Siehe auch:
    • getInputVariables

      public Collection<FWSimVariable<?>> getInputVariables()
      returns list of the input variables given as header information
      Gibt zurück:
      FWSimVarables filtered - only input Variables
      Siehe auch:
    • getResetScript

      public String getResetScript()
      Gibt zurück:
      the rule
    • getContentType

      public FWSimVariable.CONTENT_TYPE getContentType()
      Gibt zurück:
      number in the order of Components
      Siehe auch:
    • getQueueLenth

      public int getQueueLenth()
      Gibt zurück:
      length of the current queue
    • isActive

      public boolean isActive()
      Gibt zurück:
      if the Queue is actively running
    • getInterface

      public FWSimInterface<?> getInterface()
      Setzt außer Kraft:
      getInterface in Klasse FWSimIOAdapter
      Gibt zurück:
      the connected interface
    • getVarMap

      public FWSimVarMap getVarMap()
      Gibt zurück:
      number in the order of Components
    • hasStatistics

      public boolean hasStatistics()
      Gibt zurück:
      if the adapter has statistics
    • getStatisticsHeaderVariables

      public LinkedHashMap<String,FWSimVariable<?>> getStatisticsHeaderVariables()
      Gibt zurück:
      the statistics header variable
    • getStatistics

      public LinkedList<FWSimStatisticVariable> getStatistics()
      Gibt zurück:
      the statistics
    • getStatisticsResultCache

      public FWSimResultCache getStatisticsResultCache(String aSimulationID)
      Parameter:
      aSimulationID -
      Gibt zurück:
      the statisticsResultCache
    • getStatisticsAdapter

      public FWSimOutputAdapter getStatisticsAdapter()
      Gibt zurück:
      the statisticsAdapter
    • toXML

      public org.jdom2.Element toXML()
      Gibt zurück:
      a xml element with all the settings of this component()
      Siehe auch:
    • toHTMLTablestring

      public String toHTMLTablestring()
      creates HTML Documentation form of the Output Adaptor
      Gibt zurück:
      the generated HTMLString
    • isWriting

      public boolean isWriting()
      for synchronization purposes checks, if the writing method is still active, even if the queue is empty
      Gibt zurück:
      true if the writing process is still active