Class TrackingSystem
- Namespace
- NominalSystems.Universe
- Assembly
- NominalSystems.Universe.dll
[Nominal] The tracking system is able to keep track of data and objects over the lifetime of the simulation and can store data into databases associated with this particular system.
public class TrackingSystem : UniverseSystem
- Inheritance
-
TrackingSystem
- Extension Methods
Constructors
TrackingSystem()
Default constructor
protected TrackingSystem()
Fields
AdvancedTracking
A list of flags that determine whether advanced tracking is enabled for the system.
[Hidden]
public Dictionary<Guid, bool> AdvancedTracking
Field Value
DatabasePath
The full path to the database that the tracking system will use to store data. This should be a SQLite database and be a new database.
public string DatabasePath
Field Value
Interval
[s] The interval at which the tracking system will update the data.
[Unit(UnitType.SECOND)]
public double Interval
Field Value
IsTicked
A flag that determines whether the system has done the first frame, as this will need to be skipped.
public bool IsTicked
Field Value
TrackedMessages
A list of messages that are being tracked by the system.
[Hidden]
public List<Message> TrackedMessages
Field Value
TrackedObjects
A list of universe event objects that are being tracked by the system.
[Hidden]
public List<UniverseEvent> TrackedObjects
Field Value
Methods
ExportToCSV(Object, string, bool, string)
Exports the tracking data to a CSV file. This will look at a particular object that may be stored in the database and attempt to export it to a CSV file. This will overwrite any existing file with the same name.
public bool ExportToCSV(Object obj, string path, bool includeUnits = false, string separator = "|")
Parameters
obj
ObjectThe object that was tracked
path
stringThe full file path to the CSV
includeUnits
boolA flag whether to include the units in the header
separator
stringThe separator for the CSV. Be careful with ',' as some values may include ','.
Returns
- bool
A successful write to the CSV file
ExportToFile(Object, string)
Exports the tracking data to a JSON file. This will look at a particular object that may be stored in the database and attempt to export it to a JSON file.
public bool ExportToFile(Object obj, string path)
Parameters
obj
ObjectThe object that was tracked
path
stringThe full path to the text file that will store the data
Returns
- bool
A successful write to the file
ExportToJSON(Object)
Exports the tracking data to a JSON object. This will look at a particular object that may be stored in the database and attempt to export it to a JSON object.
public JObject ExportToJSON(Object obj)
Parameters
obj
ObjectThe object that was tracked
Returns
- JObject
The JSON object from the object tracked
ExportToString(Object)
Exports the tracking data to a string. This will look at a particular object and attempt to export it to a JSON string.
public string ExportToString(Object obj)
Parameters
obj
ObjectThe object that was tracked
Returns
- string
The JSON string that was exported
OnFinish(double)
Called when the object is deleted from the simulation and can handle any cleanup of variables.
protected override void OnFinish(double time)
Parameters
time
double[s] The current clock time when deleted
OnLoad(double)
Called after all of the data has been loaded from a save state on this object. This enables any post-load operations to be performed and extra data to be loaded from the metadata.
protected override void OnLoad(double time)
Parameters
time
double[s] The current clock time of the simulation
OnUpdate(double, double)
Called when the object should update from the simulation tick. This will take in a time and a step, where the time is the time of the clock before updating the object.
protected override void OnUpdate(double time, double step)
Parameters
time
double[s] Current time of the simulation before the update
step
double[s] The time-step to update during this tick
Query(Object, double, double, params string[])
Queries the data of the object in the database. This will return all the data within a range of time values stored within the database and will be able to output the data, in a JSON format, for the parameters that are passed into the function.
public JObject Query(Object obj, double minTime = 0, double maxTime = 0, params string[] parameters)
Parameters
obj
ObjectThe object that was tracked
minTime
double[s] The minimum time to select from
maxTime
double[s] The maximum time to select from, 0 if all values
parameters
string[]An array of parameter strings to select, empty for all values
Returns
- JObject
A JSON object for the query
QueryTimes(Object)
Queries the times of the object in the database. This will be in simulation seconds and returns all times of the data that is stored associated with an object.
public double[] QueryTimes(Object obj)
Parameters
obj
ObjectThe object that was tracked
Returns
- double[]
An array of all simulation times (in seconds) from the object
QueryValues(Object, string)
Queries the data of the object in the database. This will return all the data for a particular object and a particular parameter.
public string[] QueryValues(Object obj, string parameter)
Parameters
Returns
- string[]
An array of all values of the parameter from the object
TrackObject(Object, bool)
Starts tracking an object in the system. This will be used to store the properties of the object in the database.
public void TrackObject(Object obj, bool includeAdvanced = false)
Parameters
obj
ObjectThe object to start tracking
includeAdvanced
boolA flag whether to include advanced variables too
UntrackObject(Object)
Stops tracking an object in the system. This will remove the object from the database and stop storing its properties.
public void UntrackObject(Object obj)
Parameters
obj
ObjectThe object to stop tracking