public static List <VERIN> readVerificationInputs() { List <VERIN> vers = new List <VERIN>(); String file = null; file = "../../data/SGP4-VER.TLE"; System.IO.StreamReader fr = null; try { fr = new System.IO.StreamReader(file); String line = null; String line1 = null; String line2 = null; VERIN v = null; line = fr.ReadLine(); while (line != null) { if (!line.StartsWith("#")) { if (line1 == null) { line1 = line; } else { line2 = line; v = new VERIN(line1, line2); vers.Add(v); line1 = null; line2 = null; } } line = fr.ReadLine(); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } finally { if (fr != null) { try{ fr.Close(); }catch (Exception ex) {} } } return(vers); }
public static List <VEROUT> generateVerificationOutputs(List <VERIN> verins) { List <VEROUT> outl = new List <VEROUT>(); int size = verins.Count; VERIN v = null; TLE tle = null; int id = 0; List <VEROUTEntry> entries = null; VEROUT vo = null; VEROUTEntry ve = null; double [][] rv = null; double mins = 0; double startmin = 0; double stopmin = 0; double minstep = 0; for (int i = 0; i < size; i++) { v = verins[i]; tle = new TLE(v.line1, v.line2); vo = new VEROUT(); id = tle.getObjectNum(); vo.id = id; entries = new List <VEROUTEntry>(); vo.entries = entries; outl.Add(vo); mins = 0; rv = tle.getRV(mins); startmin = v.startMin; stopmin = v.stopMin; minstep = v.stepMin; mins = startmin; // always do zero if (startmin != 0) { rv = tle.getRV(0); ve = new VEROUTEntry(); ve.r = rv[0]; ve.v = rv[1]; ve.minutesSinceEpoch = 0; ve.error = tle.getSgp4Error(); entries.Add(ve); } while (mins <= stopmin) { rv = tle.getRV(mins); ve = new VEROUTEntry(); ve.r = rv[0]; ve.v = rv[1]; ve.minutesSinceEpoch = mins; ve.error = tle.getSgp4Error(); entries.Add(ve); mins += minstep; } if ((mins - minstep) != stopmin) { mins = stopmin; rv = tle.getRV(mins); ve = new VEROUTEntry(); ve.r = rv[0]; ve.v = rv[1]; ve.minutesSinceEpoch = mins; ve.error = tle.getSgp4Error(); entries.Add(ve); } } return(outl); }