private void UpdateTitle(double simulationProgressSeconds) { int num = (from g in visibleSatellites select g.SatelliteCount).Sum(); GnssTime gnssTime = simulation.SimulationParameters.Interval.Start + GnssTimeSpan.FromSeconds(simulationProgressSeconds); string text = (Simulation.SimulationParameters.Output is ILiveOutput) ? "SatGen Real Time" : "SatGen"; TimeSpan timeSpan = TimeSpan.FromSeconds(simulationProgressSeconds); Title = $"{text} - {num} satellites - {gnssTime} UTC (+{timeSpan})"; }
private static Simulation GetSimulator(ConfigFile config, Output output, TrajectorySource trajectorySource) { if (!File.Exists(config.NmeaFile)) { throw new ArgumentException("NMEA file does not exist"); } GnssTime gnssTime = GnssTime.FromUtc(config.Date); ILiveOutput liveOutput = output as ILiveOutput; if (liveOutput != null && liveOutput.IsTrueTime) { gnssTime = liveOutput.StartTime - GnssTimeSpan.FromSeconds(1); GnssTime startTime = liveOutput.StartTime; } else { gnssTime = GnssTime.FromUtc(config.Date); } Trajectory trajectory = (trajectorySource != TrajectorySource.Joystick) ? new NmeaFileTrajectory(gnssTime, config.NmeaFile, config.GravitationalModel) : new JoystickTrajectory(throttleSlider: Key.Z.IsDownAsync() ? JoystickSlider.ZAxis : (Key.D2.IsDownAsync() ? JoystickSlider.Slider2 : JoystickSlider.Slider1), startTime: gnssTime, nmeaFileName: config.NmeaFile, gravitationalModel: config.GravitationalModel); Range <GnssTime, GnssTimeSpan> interval = trajectory.Interval; if (interval.Width.Seconds < 1.0) { string text = trajectory.ErrorMessage; if (string.IsNullOrWhiteSpace(text)) { text = "Trajectory is shorter than one second"; } RLLogger.GetLogger().LogMessage(text); MessageBox.Show(Application.Current.MainWindow, text, "SatGen error", MessageBoxButton.OK, MessageBoxImage.Hand); return(null); } IReadOnlyList <ConstellationBase> readOnlyList = ConstellationBase.Create(config.SignalTypes, output); foreach (ConstellationBase item in readOnlyList) { string almanacPath = GetAlmanacPath(item.ConstellationType, config); item.LoadAlmanac(almanacPath, gnssTime); AlmanacBase almanac = item.Almanac; if (almanac == null || !almanac.BaselineSatellites.Any()) { string text2 = "Invalid " + item.ConstellationType.ToLongName() + " almanac file \"" + Path.GetFileName(almanacPath) + "\""; RLLogger.GetLogger().LogMessage(text2); MessageBox.Show(Application.Current.MainWindow, text2, "SatGen error", MessageBoxButton.OK, MessageBoxImage.Hand); return(null); } AlmanacBase almanac2 = item.Almanac; GnssTime simulationTime = interval.Start; almanac2.UpdateAlmanacForTime(simulationTime); } return(new DoubleBufferSimulation(new SimulationParams((IReadOnlyList <SignalType>)config.SignalTypes, trajectory, interval, output, readOnlyList, config.Mask, (IDictionary <ConstellationType, double>)config.CN0s, SignalLevelMode.None))); }