//Constructor with MCS Segment argument: depth - segment depth in main nest
        public Astg_SegData(IAgVAMCSSegment thisSegment, int depth)
        {
            l_SegObj.Add(thisSegment);
            l_Names.Add((thisSegment as IAgComponentInfo).Name);
            l_Values.Add(double.PositiveInfinity);
            l_types.Add(thisSegment.Type.ToString());
            l_depth.Add(depth);
            l_unit.Add("");
            l_isQuantity.Add(false);
            l_implemClass.Add(implem_Classes.NULL);

            List <string> localParent = new List <string>()
            {
            };

            l_localParents.Add(localParent);
            localParent.Add((thisSegment as IAgComponentInfo).Name);

            if (thisSegment.Type == AgEVASegmentType.eVASegmentTypeInitialState)
            {
                get_InitialState(thisSegment as IAgVAMCSInitialState, depth, localParent);
                get_SpacecraftParams(thisSegment as IAgVAMCSInitialState, depth, localParent);
                get_FuelTankParams(thisSegment as IAgVAMCSInitialState, depth, localParent);
            }
            else if (thisSegment.Type == AgEVASegmentType.eVASegmentTypeManeuver)
            {
                get_ManeuverParams(thisSegment, depth, localParent);
            }
        }
        public void get_TargSeq_Segments(IAgVAMCSTargetSequence TargSeq, int local_depth)
        {
            IAgVAMCSSegmentCollection InnerSegments = TargSeq.Segments;

            local_depth++;
            for (int ii = 0; ii < InnerSegments.Count - 1; ii++)
            {
                IAgVAMCSSegment InnerSegmentObj = InnerSegments[ii] as IAgVAMCSSegment;
                l_depth.Add(local_depth);
                Astg_SegData thisSegment = new Astg_SegData(InnerSegmentObj, local_depth);
                SegmentDataList.Add(thisSegment);

                if (InnerSegmentObj.Type == AgEVASegmentType.eVASegmentTypeTargetSequence)
                {
                    get_TargSeq_Segments(InnerSegmentObj as IAgVAMCSTargetSequence, local_depth);
                }
            }
        }
        public MCS_Segments(IAgSatellite satellite)
        {
            IAgVAMCSSegmentCollection m_MainSequence = (satellite.Propagator as IAgVADriverMCS).MainSequence;
            var startTime = (m_MainSequence[0].InitialState as IAgVAState).Epoch;
            var stopTime  = (m_MainSequence[m_MainSequence.Count - 1].InitialState as IAgVAState).Epoch;

            objectTimes.Add(startTime); objectTimes.Add(stopTime);
            for (int i = 0; i < m_MainSequence.Count - 1; i++)
            {
                IAgVAMCSSegment SegmentObj = m_MainSequence[i] as IAgVAMCSSegment;
                l_depth.Add(0);
                int          local_depth = 0;
                Astg_SegData thisSegment = new Astg_SegData(SegmentObj, local_depth);
                SegmentDataList.Add(thisSegment);

                if (SegmentObj.Type == AgEVASegmentType.eVASegmentTypeTargetSequence)
                {
                    get_TargSeq_Segments(SegmentObj as IAgVAMCSTargetSequence, local_depth);
                }
            }
        }
        //Impulsive
        public void get_ManeuverParams(IAgVAMCSSegment MnvrSegment, int depth, List <string> localParent)
        {
            depth++;
            IAgVAMCSManeuver thisMnvr = MnvrSegment as IAgVAMCSManeuver;

            #region List Header
            l_SegObj.Add(null);
            l_unit.Add("");
            l_depth.Add(depth);
            l_isQuantity.Add(false);
            l_implemClass.Add(implem_Classes.NULL);
            #endregion
            if (thisMnvr.ManeuverType == AgEVAManeuverType.eVAManeuverTypeImpulsive)
            {
                IAgVAManeuverImpulsive ImpMnvr = thisMnvr.Maneuver as IAgVAManeuverImpulsive;

                #region Type: Thrust Vector
                if (ImpMnvr.AttitudeControlType == AgEVAAttitudeControl.eVAAttitudeControlThrustVector)
                {
                    IAgVAAttitudeControlImpulsiveThrustVector thisImpMnvr = ImpMnvr.AttitudeControl as IAgVAAttitudeControlImpulsiveThrustVector;
                    l_Names.Add("Impulsive: Thrust vector"); //Header name
                    l_Values.Add(double.PositiveInfinity);
                    l_types.Add(thisImpMnvr.ThrustAxesName);
                    l_localParents.Add(localParent);
                    IAgPosition DV_vectorObj = (thisImpMnvr.DeltaVVector as IAgPosition);

                    Cartesian_Object DV_Vector = new Cartesian_Object();
                    DV_vectorObj.QueryCartesian(out DV_Vector.X, out DV_Vector.Y, out DV_Vector.Z);

                    DeltaVParams.Add("Del-V (X: Velocity)", DV_Vector.X);       l_unit.Add(units.u_Velocity);
                    DeltaVParams.Add("Del-V (Y: Normal)", DV_Vector.Y);         l_unit.Add(units.u_Velocity);
                    DeltaVParams.Add("Del-V (Z: Co-Normal)", DV_Vector.Z);      l_unit.Add(units.u_Velocity);

                    update_Lists(DeltaVParams, depth, thisMnvr, implem_Classes.Astg_Mnvr_DV, localParent);
                }
                #endregion

                #region Type: Along Velocity Vector
                else if (ImpMnvr.AttitudeControlType == AgEVAAttitudeControl.eVAAttitudeControlVelocityVector)
                {
                    IAgVAAttitudeControlImpulsiveVelocityVector thisImpMnvr = ImpMnvr.AttitudeControl as IAgVAAttitudeControlImpulsiveVelocityVector;
                    l_Names.Add("Impulsive: Along Velocity Vector"); //Header name
                    l_Values.Add(double.PositiveInfinity);
                    l_types.Add(" ");
                    l_localParents.Add(localParent);
                    DeltaVParams.Add("Del-V Magnitude", thisImpMnvr.DeltaVMagnitude); l_unit.Add(units.u_Velocity);

                    update_Lists(DeltaVParams, depth, thisMnvr, implem_Classes.Astg_Mnvr_DV, localParent);
                }
                #endregion

                #region Type: Anti-Velocity Vector
                else if (ImpMnvr.AttitudeControlType == AgEVAAttitudeControl.eVAAttitudeControlAntiVelocityVector)
                {
                    IAgVAAttitudeControlImpulsiveVelocityVector thisImpMnvr = ImpMnvr.AttitudeControl as IAgVAAttitudeControlImpulsiveVelocityVector;
                    l_Names.Add("Impulsive: Anti-Velocity Vector"); //Header name
                    l_Values.Add(double.PositiveInfinity);
                    l_types.Add(" ");
                    l_localParents.Add(localParent);
                    DeltaVParams.Add("Del-V Magnitude", thisImpMnvr.DeltaVMagnitude); l_unit.Add(units.u_Velocity);

                    update_Lists(DeltaVParams, depth, thisMnvr, implem_Classes.Astg_Mnvr_DV, localParent);
                }
                #endregion

                #region Type: Attitude
                else if (ImpMnvr.AttitudeControlType == AgEVAAttitudeControl.eVAAttitudeControlAttitude)
                {
                    IAgVAAttitudeControlImpulsiveAttitude thisImpMnvr = ImpMnvr.AttitudeControl as IAgVAAttitudeControlImpulsiveAttitude;
                    l_Names.Add("Impulsive: Attitude"); //Header name
                    l_Values.Add(double.PositiveInfinity);
                    l_types.Add(thisImpMnvr.RefAxesName);
                    l_localParents.Add(localParent);
                    DeltaVParams.Add("Del-V Magnitude", thisImpMnvr.DeltaVMagnitude); l_unit.Add(units.u_Velocity);

                    EulerAng_Object           MnvrEulAngs = new EulerAng_Object();
                    IAgOrientationEulerAngles angles      = (IAgOrientationEulerAngles)thisImpMnvr.Orientation.ConvertTo(AgEOrientationType.eEulerAngles);
                    MnvrEulAngs.Sequence = angles.Sequence;
                    MnvrEulAngs.Phi_1    = double.Parse(angles.A.ToString(), System.Globalization.CultureInfo.InvariantCulture);
                    MnvrEulAngs.Theta_2  = double.Parse(angles.A.ToString(), System.Globalization.CultureInfo.InvariantCulture);
                    MnvrEulAngs.Psi_3    = double.Parse(angles.A.ToString(), System.Globalization.CultureInfo.InvariantCulture);

                    //DeltaVParams.Add("Euler Angle Sequence", double.Parse(MnvrEulAngs.Sequence.ToString(), System.Globalization.CultureInfo.InvariantCulture)); l_unit.Add(units.u_Null);
                    DeltaVParams.Add("Euler Angle 1 (Phi)", MnvrEulAngs.Phi_1); l_unit.Add(units.u_Angle);
                    DeltaVParams.Add("Euler Angle 2 (Theta)", MnvrEulAngs.Theta_2); l_unit.Add(units.u_Angle);
                    DeltaVParams.Add("Euler Angle 3 (Psi)", MnvrEulAngs.Psi_3); l_unit.Add(units.u_Angle);

                    update_Lists(DeltaVParams, depth, thisMnvr, implem_Classes.Astg_Mnvr_DV, localParent);
                }
                ;
                #endregion
            }
        }