private void CreateSat1TwoBody() { try { try { root.ExecuteCommand("Unload / */Satellite/Sat1"); } catch { } IAgSatellite sat1 = root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "Sat1") as IAgSatellite; sat1.SetPropagatorType(AgEVePropagatorType.ePropagatorTwoBody); IAgVePropagatorTwoBody propSat1 = sat1.Propagator as IAgVePropagatorTwoBody; propSat1.Step = 60; IAgVeGfxAttributesOrbit sat1Graph = sat1.Graphics.Attributes as IAgVeGfxAttributesOrbit; sat1Graph.Color = Color.LimeGreen; sat1Graph.Line.Width = AgELineWidth.e2; //'Definisco i parametri Kepleriani classici del satellite IAgOrbitStateClassical classical2B = propSat1.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical; classical2B.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000; //'Uso il semiasse maggiore e l'eccentricità per definire la forma e la dimensione dell'orbita classical2B.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis; IAgClassicalSizeShapeSemimajorAxis semi2B = classical2B.SizeShape as IAgClassicalSizeShapeSemimajorAxis; semi2B.SemiMajorAxis = semimajorAxisSat1; semi2B.Eccentricity = eccentricitySat1; //'Per definire l'orientamento dell'orbita nello spazio uso l'inclinazione, l'argomento del perigeo e la RAAN classical2B.Orientation.Inclination = inclinationSat1; classical2B.Orientation.ArgOfPerigee = argOfPerigeeSat1; classical2B.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN; IAgOrientationAscNodeRAAN raan = classical2B.Orientation.AscNode as IAgOrientationAscNodeRAAN; raan.Value = raanSat1; //'uso l'anomalia vera per definire la posizione iniziale del satellite lungo la sua orbita classical2B.LocationType = AgEClassicalLocation.eLocationTrueAnomaly; IAgClassicalLocationTrueAnomaly trueAnomaly = classical2B.Location as IAgClassicalLocationTrueAnomaly; trueAnomaly.Value = trueAnomSat1; //'Infine assegno i parametri orbtali così definiti al satellite e lo propago propSat1.InitialState.Representation.Assign(classical2B); propSat1.Propagate(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void CreateSat2J2() { try { try { root.ExecuteCommand("Unload / */Satellite/Sat2"); } catch { } IAgSatellite sat2 = root.CurrentScenario.Children.New(AgESTKObjectType.eSatellite, "Sat2") as IAgSatellite; sat2.SetPropagatorType(AgEVePropagatorType.ePropagatorJ2Perturbation); IAgVePropagatorJ2Perturbation propSat2 = sat2.Propagator as IAgVePropagatorJ2Perturbation; propSat2.Step = 60; IAgVeGfxAttributesOrbit sat2Graph = sat2.Graphics.Attributes as IAgVeGfxAttributesOrbit; sat2Graph.Color = Color.Orange; sat2Graph.Line.Width = AgELineWidth.e2; IAgOrbitStateClassical classicalJ2 = propSat2.InitialState.Representation.ConvertTo(AgEOrbitStateType.eOrbitStateClassical) as IAgOrbitStateClassical; classicalJ2.CoordinateSystemType = AgECoordinateSystem.eCoordinateSystemJ2000; classicalJ2.SizeShapeType = AgEClassicalSizeShape.eSizeShapeSemimajorAxis; IAgClassicalSizeShapeSemimajorAxis semiJ2 = classicalJ2.SizeShape as IAgClassicalSizeShapeSemimajorAxis; semiJ2.SemiMajorAxis = semimajorAxisSat2; semiJ2.Eccentricity = eccentricitySat2; classicalJ2.Orientation.Inclination = inclinationSat2; classicalJ2.Orientation.ArgOfPerigee = argOfPerigeeSat2; classicalJ2.Orientation.AscNodeType = AgEOrientationAscNode.eAscNodeRAAN; IAgOrientationAscNodeRAAN raan = classicalJ2.Orientation.AscNode as IAgOrientationAscNodeRAAN; raan.Value = raanSat2; classicalJ2.LocationType = AgEClassicalLocation.eLocationTrueAnomaly; IAgClassicalLocationTrueAnomaly trueAnomaly = classicalJ2.Location as IAgClassicalLocationTrueAnomaly; trueAnomaly.Value = trueAnomSat2; propSat2.InitialState.Representation.Assign(classicalJ2); propSat2.Propagate(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }