I'm having trouble with the call of a function inside a function. The GMAT script just freezes and I do not know what is causing this issue. Let me explain the problem in more detail.
I have a first function (Fun_BurnAngle) that computes the Burn Angle of a specific thrust direction, and another function (Fun_TargetLOI) that find the thrust direction using the V13ad Optimizer. The Fun_TargetLOI function calls the function Fun_BurnAngle to check if this angle is within certain bounds.
If I call Fun_BurnAngle at the beginning of Fun_TargetLOI there is no problem, but if this function is called inside the Optimize Loop used to find the Maneuver, the first time the function is called GMAT freezes and does not respond. If I comment the function and copy what is inside the function outside it, and then it all works fine.
So GMAT seems to struggle with calling a function inside the Optimize loop.
All this can be seen in function Target_LOI_DVconstraintFoR_dvminCB_Integrated.gmf lines 47 - 53 (calling function) and lines 56 - 76 where the inside of the function is implemented.