Uploaded image for project: 'GMAT'
  1. GMAT
  2. GMT-4558

Numeric errors setting ModifiedEquinoctial with LHS dependency

    Details

      Description

      The attached script shows numeric errors when setting ModifiedEquinoctial state in the mission sequence with a LHS dependency.

      The report file should show two identical lines. Instead, it shows this:

      25312.69065100999         0.4806740944540046        0.09392325751783447       0.01637707342508372       -0.5559879579506738       266.427572342041          
      25311.84271255868         -8.333005278328283        0.04945114832573694       0.01637707342495703       -0.5559879579529288       86.42757234201181         
      

      The second line is set using LHS parameter dependencies.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            gmatloj Linda Jun added a comment -

            When I used MJ2000Eq Axes for MarsInertial CoordianteSystem:

            Create CoordinateSystem MarsInertial
            MarsInertial.Origin =  Mars
            %MarsInertial.Axes   =  BodyInertial
            MarsInertial.Axes   =  MJ2000Eq;
            

            I get different results:

            25312.69065100999         0.4806740944540046        0.09392325751783447       0.01637707342508372       -0.5559879579506738       266.427572342041          
            25310.95802009546         -0.1216115612175915       0.09392325751817252       0.01637707342535619       -0.5559879579506177       266.4275723420666         
            
            Show
            gmatloj Linda Jun added a comment - When I used MJ2000Eq Axes for MarsInertial CoordianteSystem: Create CoordinateSystem MarsInertial MarsInertial.Origin = Mars %MarsInertial.Axes = BodyInertial MarsInertial.Axes = MJ2000Eq; I get different results: 25312.69065100999 0.4806740944540046 0.09392325751783447 0.01637707342508372 -0.5559879579506738 266.427572342041 25310.95802009546 -0.1216115612175915 0.09392325751817252 0.01637707342535619 -0.5559879579506177 266.4275723420666
            Hide
            gmatloj Linda Jun added a comment -

            If I report ModEquinoctial elements Without setting elements I get:

            7568487357633371          5314086.743927017         20920803.04854497         -0.1747614030205232       -0.1738510432510849       77.37395154443672         
            

            When I set SemilatusRectum to 7568487357633371 and set the rest elements as in the script then I get expected results:

            7568487347285453          0.4806740965110902        0.09392325869832426       0.01637707342973033       -0.5559879575390119       266.4275723440367         
            

            So I think setting unreasonable SemilatusRectum value 25312.69065100999 generated different results.
            Should the conversion code check for valid value?

            Show
            gmatloj Linda Jun added a comment - If I report ModEquinoctial elements Without setting elements I get: 7568487357633371 5314086.743927017 20920803.04854497 -0.1747614030205232 -0.1738510432510849 77.37395154443672 When I set SemilatusRectum to 7568487357633371 and set the rest elements as in the script then I get expected results: 7568487347285453 0.4806740965110902 0.09392325869832426 0.01637707342973033 -0.5559879575390119 266.4275723440367 So I think setting unreasonable SemilatusRectum value 25312.69065100999 generated different results. Should the conversion code check for valid value?
            Hide
            shughes Steven Hughes added a comment -

            The issue here is that we are tranlating from Earth to Mars, and intermediate transformations are nearing a singularity. The test script starts out at Earth, and tries to set semi-latus rectum at mars to 25000. Since semilatus rectum = SMA*(1-ECC^2), and ECC must be held constants for F and G to be constant (in this representation), this is equivalent setting SMA, and the resulting SMA is -5.365733571535686e-11 and the resulting ECC is 21585217.38586582.

            The solution is to not make major translations using keplerian-like elements, or to set them all at once. We should add a warning to the docs for this, and in a future version implement setting state vectors all at once.

            Create Spacecraft mySat
            mySat.DateFormat = 'UTCGregorian'
            mySat.Epoch = '03 Feb 2009 12:34:56.123'
            mySat.CoordinateSystem = MarsInertial
            
            Create CoordinateSystem MarsInertial
            MarsInertial.Origin =  Mars
            MarsInertial.Axes   =  BodyInertial
            
            Create ReportFile rf
            rf.Filename = 'Params_LhsDeps_ModifiedEquinoctial.report'
            rf.WriteHeaders = false
            
            Create Variable E1 E2 E3 E4 E5 E6
            
            % mySat.SemilatusRectum = 20000
            % mySat.ModEquinoctialF = 0.1
            % mySat.ModEquinoctialG = 0.2
            % mySat.ModEquinoctialH = 0.3
            % mySat.ModEquinoctialK = 0.4
            % mySat.TLONG = 10
            % 
            BeginMissionSequence
            
            E1 = 25000
            E2 = 0.3
            E3 = 0.4
            E4 = 0.5
            E5 = 0.6
            E6 = 266
            
            %  Report lines should match
            %Report rf E1 E2 E3 E4 E5 E6
            
            Report rf mySat.MarsInertial.X mySat.MarsInertial.Y mySat.MarsInertial.Z mySat.MarsInertial.VX mySat.MarsInertial.VY mySat.MarsInertial.VZ
            Report rf mySat.Mars.SemilatusRectum mySat.Mars.SMA mySat.Mars.ECC
            
            mySat.Mars.SemilatusRectum = E1
            
            Report rf mySat.Mars.SemilatusRectum mySat.Mars.SMA mySat.Mars.ECC
            Report rf mySat.MarsInertial.X mySat.MarsInertial.Y mySat.MarsInertial.Z mySat.MarsInertial.VX mySat.MarsInertial.VY mySat.MarsInertial.VZ
            
            Show
            shughes Steven Hughes added a comment - The issue here is that we are tranlating from Earth to Mars, and intermediate transformations are nearing a singularity. The test script starts out at Earth, and tries to set semi-latus rectum at mars to 25000. Since semilatus rectum = SMA*(1-ECC^2), and ECC must be held constants for F and G to be constant (in this representation), this is equivalent setting SMA, and the resulting SMA is -5.365733571535686e-11 and the resulting ECC is 21585217.38586582. The solution is to not make major translations using keplerian-like elements, or to set them all at once. We should add a warning to the docs for this, and in a future version implement setting state vectors all at once. Create Spacecraft mySat mySat.DateFormat = 'UTCGregorian' mySat.Epoch = '03 Feb 2009 12:34:56.123' mySat.CoordinateSystem = MarsInertial Create CoordinateSystem MarsInertial MarsInertial.Origin = Mars MarsInertial.Axes = BodyInertial Create ReportFile rf rf.Filename = 'Params_LhsDeps_ModifiedEquinoctial.report' rf.WriteHeaders = false Create Variable E1 E2 E3 E4 E5 E6 % mySat.SemilatusRectum = 20000 % mySat.ModEquinoctialF = 0.1 % mySat.ModEquinoctialG = 0.2 % mySat.ModEquinoctialH = 0.3 % mySat.ModEquinoctialK = 0.4 % mySat.TLONG = 10 % BeginMissionSequence E1 = 25000 E2 = 0.3 E3 = 0.4 E4 = 0.5 E5 = 0.6 E6 = 266 % Report lines should match %Report rf E1 E2 E3 E4 E5 E6 Report rf mySat.MarsInertial.X mySat.MarsInertial.Y mySat.MarsInertial.Z mySat.MarsInertial.VX mySat.MarsInertial.VY mySat.MarsInertial.VZ Report rf mySat.Mars.SemilatusRectum mySat.Mars.SMA mySat.Mars.ECC mySat.Mars.SemilatusRectum = E1 Report rf mySat.Mars.SemilatusRectum mySat.Mars.SMA mySat.Mars.ECC Report rf mySat.MarsInertial.X mySat.MarsInertial.Y mySat.MarsInertial.Z mySat.MarsInertial.VX mySat.MarsInertial.VY mySat.MarsInertial.VZ
            Hide
            jjkparker Joel Parker added a comment -

            Warning is added to the docs. I've changed the test to avoid the problem translation.

            Show
            jjkparker Joel Parker added a comment - Warning is added to the docs. I've changed the test to avoid the problem translation.
            Hide
            shughes Steven Hughes added a comment -

            Update the script

            Show
            shughes Steven Hughes added a comment - Update the script
            Hide
            jjkparker Joel Parker added a comment -

            Script is updated and it now passing. Closing.

            Show
            jjkparker Joel Parker added a comment - Script is updated and it now passing. Closing.
            Hide
            jjkparker Joel Parker added a comment -

            Reopening to remove Affects: R2014a

            Show
            jjkparker Joel Parker added a comment - Reopening to remove Affects: R2014a
            Hide
            jjkparker Joel Parker added a comment -

            Closing again.

            Show
            jjkparker Joel Parker added a comment - Closing again.

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h