Overview: Ideas and collection for refactoring the DataProcessors for online setting
#236 @hm-schuhba1
This issue only organises the current thought process.
Requirements
Note: this is only a collection, not everything has to be implemented
-
What to do with data (from OutputFile / Socket view):
- send current collected data to File / Socket
- only for Files: preprocess data and transform accordingly (e.g. carry out PCA on data) -- potentially this data can also be send over socket, after the simulation is finished.
-
Some processors keep the values in RAM (and do not write the data), online processors only keep the current values in RAM to be accessed by other processors, OfflineProcessors should never provide data to other data (TODO: check this, if this is true currently!)
-
Online writing should be async, to not slow down too much the simulation
-
For performance data could/should be buffered when writing out (e.g. https://docs.oracle.com/javase/7/docs/api/java/io/BufferedWriter.html)
-
For sockets there have to be new user settings that need to be integrated somewhere in the GUI (like the file)
Interface / ABC for all "DataProcessors"
- init()
Interface / ABC for all "OnlineDataProcessors"
+ close()
+ asyncWrite()
# Only callable when wirting out to files, not to socket, but needs to be implemented by all OnlineDataProcessors
+ readData(OnlineProcessorList) -> Reads the files that were written out during simulation and transforms it accordingly
Interface / ABC for all "OfflineDataProcessors"
attr1: List of required OnlineProcessors
+ postprocessWriteData() -> calls "readData" and then transforms the data accordingly
Files to look at in Vadere:
-
"OutputFile" --> currently writes data to the file after simulation, the OutputFile would basically be either "Online" or "Offline", depending on the DataProcessor
- An "OutputFile" has either only online processors or only offline processors (check this, and set an attribute)
- The "OutputFile" should implement a function "asyncWriteFile" that writes the current content of processors during simulation, (only if "OutputFile" contains processors with online ability and therefore themself implement "asyncWrite")
- The "OutputFile" should "readData" and cast it to the values required (this will be a bit tricky...?)
- The "OutputFile" should implement a function "postprocessWriteFile" that handles the computation to the processors "postprocessWriteData()"
-
"ProcessorManager" --> via method "writeOutput" each OutputFile is triggered to write output.
-
"Simulation" --> in the
finally
block the output is written after the simulation, for the online property it should be somewhere in the loop, for offline property it should be called at the same position.
New classes / User interface
For Sockets a new class "OutputSocket" could be implemented which only allows "OnlineDataProcessors"