public CdmSatellite(CdmSatellite rhs) { this.isPrimary = rhs.isPrimary; this.isEphemerisBased = rhs.isEphemerisBased; this.EpochISOYMD = rhs.EpochISOYMD; this.SatName = rhs.SatName; this.InternationalDesignator = rhs.InternationalDesignator; this.SSC = rhs.SSC; this.CovarianceMethod = rhs.CovarianceMethod; this.ReferenceFrame = rhs.ReferenceFrame; this.XPos = rhs.XPos; this.YPos = rhs.YPos; this.ZPos = rhs.ZPos; this.XVel = rhs.XVel; this.YVel = rhs.YVel; this.ZVel = rhs.ZVel; this.xx = rhs.xx; this.yx = rhs.yx; this.yy = rhs.yy; this.zx = rhs.zx; this.zy = rhs.zy; this.zz = rhs.zz; this.Vxx = rhs.Vxx; this.Vxy = rhs.Vxy; this.Vxz = rhs.Vxz; this.VxVx = rhs.VxVx; this.Vyx = rhs.Vyx; this.Vyy = rhs.Vyy; this.Vyz = rhs.Vyz; this.VyVx = rhs.VyVx; this.VyVy = rhs.VyVy; this.Vzx = rhs.Vzx; this.Vzy = rhs.Vzy; this.Vzz = rhs.Vzz; this.VzVx = rhs.VzVx; this.VzVy = rhs.VzVy; this.VzVz = rhs.VzVz; this.GeopotentialModel = rhs.GeopotentialModel; this.SolidEarthTidesPerturbation = rhs.SolidEarthTidesPerturbation; this.LunarsolarPerturbations = rhs.LunarsolarPerturbations; this.SolarRadiationPerturbation = rhs.SolarRadiationPerturbation; this.DragModel = rhs.DragModel; this.BallisticCoefficient = rhs.BallisticCoefficient; this.SolarRadiationCoefficient = rhs.SolarRadiationCoefficient; this.EphemerisFile = rhs.EphemerisFile; }
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); } }