public StarScannedEvent(DateTime timestamp, string name, string stellarclass, decimal solarmass, decimal radius, decimal absolutemagnitude, long age, decimal temperature, decimal distancefromarrival, decimal?orbitalperiod, decimal rotationperiod, decimal?semimajoraxis, decimal?eccentricity, decimal?orbitalinclination, decimal?periapsis, List <Ring> rings) : base(timestamp, NAME) { this.name = name; this.stellarclass = stellarclass; this.solarmass = solarmass; this.radius = radius; this.absolutemagnitude = absolutemagnitude; this.age = age; this.temperature = temperature; this.distancefromarrival = distancefromarrival; this.orbitalperiod = orbitalperiod; this.rotationperiod = rotationperiod; this.semimajoraxis = semimajoraxis; this.eccentricity = eccentricity; this.orbitalinclination = orbitalinclination; this.periapsis = periapsis; this.rings = rings; StarClass starClass = StarClass.FromName(this.stellarclass); if (starClass != null) { this.massprobability = sanitiseCP(starClass.stellarMassCP(solarmass)); this.solarradius = StarClass.solarradius(radius); this.radiusprobability = sanitiseCP(starClass.stellarRadiusCP(this.solarradius)); this.luminosity = StarClass.luminosity(absolutemagnitude); this.luminosityprobability = sanitiseCP(starClass.luminosityCP(this.luminosity)); // TODO remove when temperature is in journal this.temperature = StarClass.temperature(luminosity, this.radius); this.chromaticity = starClass.chromaticity; } }
public void TestJournalStarScan2() { string line = @"{ ""timestamp"":""2016-10-28T12:07:09Z"", ""event"":""Scan"", ""BodyName"":""Col 285 Sector CG-X d1-44"", ""DistanceFromArrivalLS"":0.000000, ""StarType"":""TTS"", ""StellarMass"":0.808594, ""Radius"":659162816.000000, ""AbsoluteMagnitude"":6.411560, ""Age_MY"":154, ""SurfaceTemperature"":4124.000000, ""RotationPeriod"":341417.281250, ""Rings"":[ { ""Name"":""Col 285 Sector CG-X d1-44 A Belt"", ""RingClass"":""eRingClass_Rocky"", ""MassMT"":1.1625e+13, ""InnerRad"":1.0876e+09, ""OuterRad"":2.4192e+09 } ] }"; StarScannedEvent theEvent = (StarScannedEvent)JournalMonitor.ParseJournalEntry(line); Assert.IsNotNull(theEvent); Assert.AreEqual(theEvent.radius, (decimal)659162816.0); Assert.AreEqual(theEvent.solarradius, StarClass.solarradius((decimal)659162816.000000)); Assert.AreEqual(0.94775, (double)theEvent.solarradius, 0.01); }
} // One of Basic, Detailed, NavBeacon, NavBeaconDetail public StarScannedEvent(DateTime timestamp, string scantype, string name, string stellarclass, decimal solarmass, decimal radius, decimal absolutemagnitude, string luminosityclass, long age, decimal temperature, decimal distancefromarrival, decimal?orbitalperiod, decimal rotationperiod, decimal?semimajoraxis, decimal?eccentricity, decimal?orbitalinclination, decimal?periapsis, List <Ring> rings) : base(timestamp, NAME) { this.scantype = scantype; this.name = name; this.stellarclass = stellarclass; this.solarmass = solarmass; this.radius = radius; this.absolutemagnitude = absolutemagnitude; this.luminosityclass = luminosityclass; this.age = age; this.temperature = temperature; this.distancefromarrival = distancefromarrival; this.orbitalperiod = orbitalperiod; this.rotationperiod = rotationperiod; this.semimajoraxis = semimajoraxis; this.eccentricity = eccentricity; this.orbitalinclination = orbitalinclination; this.periapsis = periapsis; this.rings = rings; solarradius = StarClass.solarradius(radius); luminosity = StarClass.luminosity(absolutemagnitude); StarClass starClass = StarClass.FromName(this.stellarclass); if (starClass != null) { massprobability = StarClass.sanitiseCP(starClass.stellarMassCP(solarmass)); radiusprobability = StarClass.sanitiseCP(starClass.stellarRadiusCP(this.solarradius)); tempprobability = StarClass.sanitiseCP(starClass.tempCP(this.temperature)); ageprobability = StarClass.sanitiseCP(starClass.ageCP(this.age)); chromaticity = starClass.chromaticity.localizedName; if (radius != 0 && temperature != 0) { // Minimum estimated single-star habitable zone (target black body temperature of 315°K / 42°C / 107°F or less) estimatedhabzoneinner = StarClass.DistanceFromStarForTemperature(maxHabitableTempKelvin, Convert.ToDouble(radius), Convert.ToDouble(temperature)); this.estimatedhabzoneinner = estimatedhabzoneinner; // Maximum estimated single-star habitable zone (target black body temperature of 223.15°K / -50°C / -58°F or more) estimatedhabzoneouter = StarClass.DistanceFromStarForTemperature(minHabitableTempKelvin, Convert.ToDouble(radius), Convert.ToDouble(temperature)); this.estimatedhabzoneouter = estimatedhabzoneouter; } } this.estimatedvalue = estimateValue(scantype == "Detailed" || scantype == "NavBeaconDetail"); }