public CdmBin(CdmConjunction conjunction) { Conjunctions = new List <CdmConjunction>(); Conjunctions.Add(conjunction); PrimarySSC = conjunction.Primary.SSC; SecondarySSC = conjunction.Secondary.SSC; }
public CdmConjunction(CdmConjunction rhs) { this.ReferenceFrame = rhs.ReferenceFrame; this.CreationDate = rhs.CreationDate; this.TCA = rhs.TCA; this.ID = rhs.ID; this.ProbabilityMethod = rhs.ProbabilityMethod; this.MissDistance = rhs.MissDistance; this.RelativeSpeed = rhs.RelativeSpeed; this.Probability = rhs.Probability; this.SigmaDilution = rhs.SigmaDilution; this.RelPosR = rhs.RelPosR; this.RelPosT = rhs.RelPosT; this.RelPosN = rhs.RelPosN; this.RelVelR = rhs.RelVelR; this.RelVelT = rhs.RelVelT; this.RelVelN = rhs.RelVelN; this.Primary = new CdmSatellite(rhs.Primary); this.Secondary = new CdmSatellite(rhs.Secondary); }
public static CdmConjunction ReadCdmXmlByTag(string xmlPath, out string error) { error = ""; try { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(xmlPath); CdmConjunction conjunction = new CdmConjunction(); CdmSatellite[] sats = new CdmSatellite[] { new CdmSatellite(), new CdmSatellite() }; conjunction.CdmFilePath = xmlPath; conjunction.RelPosR = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_POSITION_R"); conjunction.RelPosT = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_POSITION_T"); conjunction.RelPosN = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_POSITION_N"); conjunction.RelVelR = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_VELOCITY_R"); conjunction.RelVelT = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_VELOCITY_T"); conjunction.RelVelN = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_VELOCITY_N"); conjunction.RelativeSpeed = GetDoubleFromXmlTag(xmlDoc, "RELATIVE_SPEED"); conjunction.Probability = GetDoubleFromXmlTag(xmlDoc, "COLLISION_PROBABILITY"); conjunction.ProbabilityMethod = GetStringFromXmlTag(xmlDoc, "COLLISION_PROBABILITY_METHOD"); conjunction.ID = GetStringFromXmlTag(xmlDoc, "MESSAGE_ID"); conjunction.CreationDate = GetStringFromXmlTag(xmlDoc, "CREATION_DATE"); conjunction.MissDistance = GetDoubleFromXmlTag(xmlDoc, "MISS_DISTANCE"); conjunction.TCA = GetStringFromXmlTag(xmlDoc, "TCA"); conjunction.TCA = StkAssistant.ValidateDateFormat(conjunction.TCA); conjunction.CreationDate = StkAssistant.ValidateDateFormat(conjunction.CreationDate); if (xmlDoc.GetElementsByTagName("relativeMetadataData").Count > 0) { foreach (XmlNode node in xmlDoc.GetElementsByTagName("relativeMetadataData")[0].ChildNodes) { if (node.Name.ToUpper().Equals("COMMENT")) { string metadataComment = node.InnerText; string pattern = "SIGMA_DILUTION=(?<sigmaDilution>\\d+(.\\d+)?)"; Regex dateRegex = new Regex(pattern); Match match = dateRegex.Match(metadataComment); double sd; if (match.Groups["sigmaDilution"].Success && double.TryParse(match.Groups["sigmaDilution"].Value, out sd)) { conjunction.SigmaDilution = sd; } break; } } } for (int i = 0; i < 2; i++) { sats[i].isPrimary = i == 0; sats[i].EpochISOYMD = GetStringFromXmlTag(xmlDoc, "TCA"); sats[i].EpochISOYMD = StkAssistant.ValidateDateFormat(sats[i].EpochISOYMD); // Get satellite names sats[i].SatName = GetStringFromXmlTag(xmlDoc, "OBJECT_NAME", i); // Get International Designators sats[i].InternationalDesignator = GetStringFromXmlTag(xmlDoc, "INTERNATIONAL_DESIGNATOR", i); // Get Catalog Number sats[i].SSC = GetStringFromXmlTag(xmlDoc, "OBJECT_DESIGNATOR", i); if (sats[i].SSC == "KNOWN OBJECT") { sats[i].SatName = "KNOWN OBJECT"; sats[i].SSC = "99999"; } if (sats[i].SatName.Trim() == "") { sats[i].SatName = "UNIDENTIFIED OBJECT"; } // Get ephemeris check data string ephTemp = GetStringFromXmlTag(xmlDoc, "EPHEMERIS_NAME", i); sats[i].EphemerisFile = string.IsNullOrEmpty(ephTemp) || ephTemp.ToUpper().Equals("NONE") ? null : Path.Combine(Path.GetDirectoryName(xmlPath), ephTemp); // Get Orbital Data sats[i].ReferenceFrame = GetStringFromXmlTag(xmlDoc, "REF_FRAME", i); sats[i].XPos = GetDoubleFromXmlTag(xmlDoc, "X", i); sats[i].YPos = GetDoubleFromXmlTag(xmlDoc, "Y", i); sats[i].ZPos = GetDoubleFromXmlTag(xmlDoc, "Z", i); sats[i].XVel = GetDoubleFromXmlTag(xmlDoc, "X_DOT", i); sats[i].YVel = GetDoubleFromXmlTag(xmlDoc, "Y_DOT", i); sats[i].ZVel = GetDoubleFromXmlTag(xmlDoc, "Z_DOT", i); // Get Force Model Definition sats[i].GeopotentialModel = GetStringFromXmlTag(xmlDoc, "GRAVITY_MODEL", i); sats[i].LunarsolarPerturbations = GetStringFromXmlTag(xmlDoc, "N_BODY_PERTURBATIONS", i); sats[i].SolidEarthTidesPerturbation = GetStringFromXmlTag(xmlDoc, "EARTH_TIDES", i); sats[i].SolarRadiationPerturbation = GetStringFromXmlTag(xmlDoc, "SOLAR_RAD_PRESSURE", i); sats[i].SolarRadiationCoefficient = GetDoubleFromXmlTag(xmlDoc, "CR_AREA_OVER_MASS", i); sats[i].DragModel = GetStringFromXmlTag(xmlDoc, "ATMOSPHERIC_MODEL", i); sats[i].BallisticCoefficient = GetDoubleFromXmlTag(xmlDoc, "CD_AREA_OVER_MASS", i); sats[i].CovarianceMethod = GetStringFromXmlTag(xmlDoc, "COVARIANCE_METHOD", i); sats[i].xx = GetDoubleFromXmlTag(xmlDoc, "CR_R", i); sats[i].yx = GetDoubleFromXmlTag(xmlDoc, "CT_R", i); sats[i].yy = GetDoubleFromXmlTag(xmlDoc, "CT_T", i); sats[i].zx = GetDoubleFromXmlTag(xmlDoc, "CN_R", i); sats[i].zy = GetDoubleFromXmlTag(xmlDoc, "CN_T", i); sats[i].zz = GetDoubleFromXmlTag(xmlDoc, "CN_N", i); sats[i].Vxx = GetDoubleFromXmlTag(xmlDoc, "CRDOT_R", i); sats[i].Vxy = GetDoubleFromXmlTag(xmlDoc, "CRDOT_T", i); sats[i].Vxz = GetDoubleFromXmlTag(xmlDoc, "CRDOT_N", i); sats[i].VxVx = GetDoubleFromXmlTag(xmlDoc, "CRDOT_RDOT", i); sats[i].Vyx = GetDoubleFromXmlTag(xmlDoc, "CTDOT_R", i); sats[i].Vyy = GetDoubleFromXmlTag(xmlDoc, "CTDOT_T", i); sats[i].Vyz = GetDoubleFromXmlTag(xmlDoc, "CTDOT_N", i); sats[i].VyVx = GetDoubleFromXmlTag(xmlDoc, "CTDOT_RDOT", i); sats[i].VyVy = GetDoubleFromXmlTag(xmlDoc, "CTDOT_TDOT", i); sats[i].Vzx = GetDoubleFromXmlTag(xmlDoc, "CNDOT_R", i); sats[i].Vzy = GetDoubleFromXmlTag(xmlDoc, "CNDOT_T", i); sats[i].Vzz = GetDoubleFromXmlTag(xmlDoc, "CNDOT_N", i); sats[i].VzVx = GetDoubleFromXmlTag(xmlDoc, "CNDOT_RDOT", i); sats[i].VzVy = GetDoubleFromXmlTag(xmlDoc, "CNDOT_TDOT", i); sats[i].VzVz = GetDoubleFromXmlTag(xmlDoc, "CNDOT_NDOT", i); if (sats[i].VxVx == 0) { sats[i].VxVx = small; } if (sats[i].VyVy == 0) { sats[i].VyVy = small; } if (sats[i].VzVz == 0) { sats[i].VzVz = small; } } conjunction.Primary = sats[0]; conjunction.Secondary = sats[1]; return(conjunction); } catch (Exception e) { error += e.Message; return(null); } }