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

Empty Brackets Behavior Confusing

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: R2014a, R2015a, R2016a, R2017a, R2018A
    • Fix Version/s: Someday
    • Component/s: Script Language
    • Labels:
      None

      Description

      GMAT's behavior parsing empty brackets is very confusing, and potentially object specific. I would expect the script below to result in no primary bodies and no Point mass bodies (which is not allowed, i am trying to write a validatin test). However, this script propagates because it apparently uses default of Earth for PrimaryBody.

      We need to document at minimum and make an attempt at consistency accross objects.

      Create Spacecraft aSat;

      Create ForceModel aForceModel;
      %aForceModel.CentralBody = Earth;
      aForceModel.PrimaryBodies = {}
      aForceModel.PointMasses = {};

      Create Propagator aProp;
      aProp.FM = aForceModel;

      BeginMissionSequence

      Propagate aProp(aSat,

      {aSat.ElapsedDays = .2}

      );

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              shughes Steven Hughes added a comment -

              CCB: We believe that brackets {} mean add the contents in the brackets to the list. So empty brackets essentially add nothing to the list. We need to decide on the behavior along with larger script behavior clarification and document.

              Show
              shughes Steven Hughes added a comment - CCB: We believe that brackets {} mean add the contents in the brackets to the list. So empty brackets essentially add nothing to the list. We need to decide on the behavior along with larger script behavior clarification and document.
              Hide
              gmatloj Linda Jun added a comment -

              I'm reassigning this to you for clarification and doccumentation.

              Show
              gmatloj Linda Jun added a comment - I'm reassigning this to you for clarification and doccumentation.
              Hide
              jjkparker Joel Parker added a comment -

              Description from duplicate issue GMT-3341:

              The syntax "field = {}" behaves differently for each resource:

              • Barycenter.BodyNames: resets to default
              • ForceModel.PointMasses: nothing
              • ForceModel.PrimaryBodies: resets to default
              • Formation.Add: not allowed
              • GroundTrackPlot.Add: empties list
              • ImpulsiveBurn.Tank: not allowed
              • ReportFile.Add: not allowed
              • Spacecraft.Tanks: not allowed
              • Spacecraft.Thrusters: not allowed
              • Thruster.Tank: not allowed
              • XYPlot.YVariables: not allowed
              Show
              jjkparker Joel Parker added a comment - Description from duplicate issue GMT-3341 : The syntax "field = {}" behaves differently for each resource: Barycenter .BodyNames : resets to default ForceModel .PointMasses : nothing ForceModel .PrimaryBodies : resets to default Formation .Add : not allowed GroundTrackPlot .Add : empties list ImpulsiveBurn .Tank : not allowed ReportFile .Add : not allowed Spacecraft .Tanks : not allowed Spacecraft .Thrusters : not allowed Thruster .Tank : not allowed XYPlot .YVariables : not allowed
              Hide
              jjkparker Joel Parker added a comment -

              See ScriptLanguage_ReferenceArrays_* tests.

              Show
              jjkparker Joel Parker added a comment - See ScriptLanguage_ReferenceArrays_* tests.
              Hide
              jjkparker Joel Parker added a comment -

              Proposal for R2013a:

              • Document in Script Language: "The behavior when specifying an empty list is resource-dependent."
              • Document on each resource.

              Proposal for Someday:

              • Empty list should mean "make the list contain nothing".
              • If the field cannot accept an empty list, throw an invalid input exception.

              This is consistent with other languages that accept object lists. We should see how close we can get to this behavior without causing huge backward-compatibility problems.

              Show
              jjkparker Joel Parker added a comment - Proposal for R2013a: Document in Script Language: "The behavior when specifying an empty list is resource-dependent." Document on each resource. Proposal for Someday: Empty list should mean "make the list contain nothing". If the field cannot accept an empty list, throw an invalid input exception. This is consistent with other languages that accept object lists. We should see how close we can get to this behavior without causing huge backward-compatibility problems.
              Hide
              jjkparker Joel Parker added a comment -

              I closed GMT-3341 as a duplicate of this issue. That issue was assigned to me with this comment:

              Once behavior is described, CCB will retriage.

              See proposal above.

              Show
              jjkparker Joel Parker added a comment - I closed GMT-3341 as a duplicate of this issue. That issue was assigned to me with this comment: Once behavior is described, CCB will retriage. See proposal above.
              Hide
              jjkparker Joel Parker added a comment -

              Committed GMT-3726 through GMT-3729 to update the documentation for each resource. Sending this to P3/Someday for the bigger issue.

              Show
              jjkparker Joel Parker added a comment - Committed GMT-3726 through GMT-3729 to update the documentation for each resource. Sending this to P3/Someday for the bigger issue.
              Hide
              rqureshi Rizwan Qureshi added a comment -
              • The syntax "field = {}" behaves as follows for OrbitView.Add field:

              For OrbitView.Add = {} a warning is thrown in Message Window that The OrbitView will be turned off since no SpacePoints were added to plot.

              Show
              rqureshi Rizwan Qureshi added a comment - The syntax "field = {}" behaves as follows for OrbitView.Add field: For OrbitView.Add = {} a warning is thrown in Message Window that The OrbitView will be turned off since no SpacePoints were added to plot.

                People

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

                  Dates

                  • Created:
                    Updated: