"Apply Corrections" to DC in script?

Control flow commands, Target, Vary, Minimize, NonlinearConstraint, etc.

"Apply Corrections" to DC in script?

Postby djdichmann » Fri Jun 15, 2012 8:25 pm

One of the options for a Differential Corrector is to "Apply Corrections" to the values in the Vary commands.
Is there a way to incorporate an "Apply Corrections" command into a script?
More generally, if I run a script using the GMAT console version, is there a way to save the targeter solution within the script?
Of course, one way to save the solution is through a report of the maneuver values.
Posts: 14
Joined: Thu Jul 09, 2009 2:37 pm

Re: "Apply Corrections" to DC in script?

Postby DJCinSB » Wed Jun 27, 2012 10:27 pm

Hi, Don.

The "Apply Corrections" option is an option that is available for use after a run has completed or has been stopped by the user once a solver has been run. Because of that, it cannot be scripted directly in the core GMAT system. The same functionality can be achieved though in the way you mentioned -- by saving the solver data to variables, and then using those variables later in the script.

If this is functionality that you'd really like to have, an alternative approach is to write a plug-in command that performs the same steps as the "Apply Corrections" button. The button is associated with the command at the top of the "solver control sequence," which consists of the commands executed when running the solver. These commands are all children of the "SolverBranchCommand" class. When the button is pressed, GMAT calls a method of the SolverBranchCommand named "TakeAction", which has this signature:
Code: Select all
bool SolverBranchCommand::TakeAction(const std::string &action,
      const std::string &actionData = "")

When the first argument is set to the string "ApplyCorrections" and the second to the default setting (""), the corrections calculated by the associated solver are applied to the Vary commands in the solver control sequence. You could write a command that performs this task in a GMAT plug-in library. You'd need to include code that locates the SolverBranchCommand, and then just call TakeAction("ApplyCorrections") on that command. I'm not sure it would be very useful in practice though -- it only applies the data to the Vary commands, and you can accomplish the same thing and more with scripted variables. But that is an option if you need it (or if you'd like to learn how GMAT plug-in coding works).

Hope that helps.

- Darrel
Posts: 274
Joined: Mon Jun 09, 2008 3:57 pm

Re: "Apply Corrections" to DC in script?

Postby djdichmann » Tue Jul 10, 2012 9:45 pm

Thanks Darrel. That was very enlightening. I especially liked seeing a plug-in application that I would not have considered.
Posts: 14
Joined: Thu Jul 09, 2009 2:37 pm

Return to GMAT Commands

Who is online

Users browsing this forum: No registered users and 1 guest