public static SimDateTimeRange BuildRange(SimDateTime dtStart, int rangeSize) { EarthModel earth = new EarthModel(dtStart, true, (int)AbsoluteConstants.HoursPerDay); if (SimulationData.AvailableSnapshots.Contains(dtStart)) { SimDateTime sdt = dtStart.AddHours((rangeSize - 1) * earth.SnapshotLength); SimDateTime dtEnd = SimulationData.SelectNearestSnapshot(sdt); if (dtEnd != null) { return(new SimDateTimeRange(earth, dtStart, dtEnd)); } } return(null); }
public SimDateTimeRange(EarthModel earth, SimDateTime dtStart, SimDateTime dtEnd) { this.Start = dtStart; this.End = dtEnd; this.Earth = earth; AtmList = new List <Atmosphere>(); SfcList = new List <SurfaceLevel>(); for (SimDateTime sdt = dtStart; sdt.CompareTo(dtEnd) <= 0; sdt = sdt.AddHours(earth.SnapshotLength)) { Atmosphere atm = null; SurfaceLevel sfc = null; try { earth.SetUTC(sdt); atm = new Atmosphere(earth, true); sfc = new SurfaceLevel(earth, true); } catch { atm = null; sfc = null; } if (atm != null) { AtmList.Add(atm); } if (sfc != null) { SfcList.Add(sfc); } } }