2
$\begingroup$

I have made various scripts that work with GMAT, but once in a while I get an "ArrayTemplate error : dimension error" error. I do not know what causes it, as in this case my script appears to be correct (it is a multiple-shooting/patch point script, and all the trajectories appear correct and meet at the patch points). There is zero information about it online, so in the context of GMAT's code/functionality, what causes it throw that error?

The only way I've been able to replicate it/force GMAT to throw it in other, working scripts is by using a very high perturbation value in the vary command, which isn't the case here. The only references to it online are in this source code file from GMAT's Sourceforge page, and this page from the same place, both of which I cannot interpret.

My theory: I assume that "array" in this case refers to the state vector of the spacecraft, so maybe this is an error relating to the spacecraft being in some kind of non-physical/mathematically undefinable trajectory (like asking GMAT to propagate the spacecraft to periapsis, but constraining the true anomaly to 350 degrees)? But this doesn't change the fact that this doesn't seem to be the case here.

$\endgroup$

1 Answer 1

2
$\begingroup$

The GMAT source code is written in C++. Those are C++ exceptions. They are invoked by a throw ArrayTemplateExceptions::DimensionError(); statement in the C++ source.

There are only a few places in the GMAT source code where this exception is thrown. Trying to assign a 3 vector to a 6 vector (or vice versa) would do it. So would adding a 3 vector to a 6 vector (or vice versa). So would multiplying a 3 vector by a 6x6 matrix. (Multiplying a 6x6 matrix by a 3 vector results in a TableTemplateExceptions::DimensionError exception.) In general, the ArrayTemplateExceptions::DimensionError exception is thrown where an operation is attempted to be performed on a pair of objects, the first of which is a one dimensional array, and the second object is dimensionally inconsistent with the first object and the operation at hand.

You can also create arrays in a GMAT script. The script uses the GMAT C++ code to implement those arrays and to perform the operations on them. Somewhere in your script you are making arrays and using them in a dimensionally inconsistent manner.

$\endgroup$
6
  • $\begingroup$ Thanks for the answer, this helps. If possible, can you give an example of "making arrays and using them in a dimensionally inconsistent manner"? $\endgroup$
    – kardalos
    Commented Jun 4, 2022 at 21:11
  • 1
    $\begingroup$ @kardalos I don't use GMAT. I do know the concept, but I use other tools. I looked at copies of GMAT imported to GitHub for where ArrayTemplateExceptions::DimensionError was thrown. GitHub has much better search tools than does SourceForge. GitHub does not have ads. Editorial: I don't know why anyone uses SourceForge anymore. (continued) $\endgroup$ Commented Jun 4, 2022 at 23:51
  • 1
    $\begingroup$ I've worked with people who do use GMAT, and I know GMAT uses a home-brewed scripting language. So I then looked at the GMAT user guides. I quickly saw that one can create arrays (vectors) and tables (matrices) in the GMAT scripting language. Using those user-created vectors and matrices in a dimensionally inconsistent management will result in throw in the C++ code. That such errors are caught in the C++ code that underlies the GMAT scripting language interpreter is far and away how GMAT handles user errors. $\endgroup$ Commented Jun 4, 2022 at 23:54
  • $\begingroup$ Got it, since your replies I have managed to recreate the error by using combinations of propagate and constraint commands that force GMAT to consider non-physical/mathematically undefinable trajectories, so with that and your answers it makes sense now. Thank you. $\endgroup$
    – kardalos
    Commented Jun 5, 2022 at 13:47
  • 1
    $\begingroup$ @kardalos You're welcome. I'm glad to be of assistance. $\endgroup$ Commented Jun 5, 2022 at 14:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.