public void RenderSeperationEvent(SeperationEvent seperationEvent) { string timeOfOccurence = seperationEvent._OccurrenceTime;// + seperationEvent.OccurrenceTime.ToLongTimeString(); string track1 = seperationEvent._InvolvedTracks[0]._Tag; string track2 = seperationEvent._InvolvedTracks[1]._Tag; Console.WriteLine("Warning: Seperation event occurred at " + timeOfOccurence + " - Involved tracks are " + track1 + " and " + track2 + "."); }
public void AddSeperationEventFor(TrackData td1, TrackData td2, IFileOutput logger) { List <TrackData> tracks = new List <TrackData>() { td1, td2 }; SeperationEvent se = new SeperationEvent(td1.TimeStamp, tracks, true, td1.ConsoleOutput, logger); events.Add(se); logger.Write(se.FormatData()); }
public void LogInactiveSeparationEvent(SeperationEvent seperationEvent) { string timeOfOccurence = seperationEvent._OccurrenceTime.ToString(); TrackData track1 = seperationEvent._InvolvedTracks[0]; TrackData track2 = seperationEvent._InvolvedTracks[1]; //Creating instance of StreamWriter System.IO.StreamWriter streamWriter = System.IO.File.AppendText(startupPath + fileName); string lineToLog = "Timestamp: " + timeOfOccurence + " " + "Flight 1: " + track1._Tag + " | " + "Flight 2: " + track2._Tag + " | " + "SeperationEvent status: " + seperationEventInactive; //Perhaps it should be WriteLineAsync in order to keep up with the system streamWriter.Write(lineToLog); //Closing streamWriter instance and file streamWriter.Close(); }
public bool CheckForSeperationEvent(TrackData trackData1, TrackData trackData2) { //Check if both tracks are the same if (trackData1._Tag == trackData2._Tag) { throw new Exception("Provided TrackDatas have the same Tag"); } else { //Check if conditions are met with the given TrackData-objects if (Math.Abs(trackData1._CurrentXcord - trackData2._CurrentXcord) < MIN_X_DISTANCE && Math.Abs(trackData1._CurrentYcord - trackData2._CurrentYcord) < MIN_Y_DISTANCE && Math.Abs(trackData1._CurrentZcord - trackData2._CurrentZcord) < MIN_Z_DISTANCE) { //If seperation event does not exist yet, create it and add it to currentSeperationEvents //Check if separation event already exists if (!CheckIfSeperationEventExistsFor(trackData1, trackData2)) { // Add new separation event //string time = DateTime.Now.ToString(); string time = trackData1._TimeStamp; List <TrackData> trackDataInSeperationEvent = new List <TrackData>(); trackDataInSeperationEvent.Add(trackData1); trackDataInSeperationEvent.Add(trackData2); SeperationEvent SeperationEvent = new SeperationEvent(time, trackDataInSeperationEvent, true); _currentSeperationEvents.Add(SeperationEvent); _logger.LogActiveSeparationEvent(SeperationEvent); } return(true); } else { return(false); } } }