FRC-17 MATLAB Function Call Feature Spec and Test Procedures Lead: Joel Developer: Linda Tester: Shawn Explore Known Bugs Failing Tests Other Findings Requirements Interface/Functional Spec Overview Syntax Description GUI Remarks Data Types Examples Test Procedures Assumptions Existing Tests Recommended Additional Tests Nominal Tests Edge/Corner/Stress Unique Validation Unique Mode Tests Unique GUI Tests Explore Known Bugs JIRA ID Summary Rec. GMT-924 Matlab no numbers in function call Improvement GMT-1012 Obtaining single element burn data from Matlab bug Verify GMT-1013 Entire Burn Structure not Showing up in MATLAB Verify GMT-1547 Incorrect Epoch value when passing SC to Matlab P1 GMT-2921 Arrays are corrupted when passed to MATLAB function Verify GMT-3073 Allow use of MatlabFunctions in math statements Improvement Failing Tests JIRA ID Test Math_Math_MatlabFunction Matlab_IN_Literal Matlab_IN_Spacecraft_Equinoctial_SpiceAtt_Quate rnion_AV Matlab_IN_String Matlab_IO_Array_Vector Matlab_IO_ImpulsiveBurn_Default Matlab_IO_Spacecraft_Equinoctial_SpiceAtt_Quate rnion_AV Matlab_IO_String Matlab_IN_Array_SingleElement Matlab_IN_Spacecraft_SphAZFPA_Spinner_MRPs_AV Matlab_IN_Spacecraft_SphRADEC_Spinner_Quaternio n_EulerAR Matlab_IN_Spacecraft_Cartesian_Coord_Euler_AV Matlab_IN_Spacecraft_Keplerian_Coord_Quaternion _AV Matlab_IN_Spacecraft_ModKeplerian_Coord_CosMatr ix_AV Matlab_Validation_NonExistArrayElement_GMAT Cause Other Findings JIRA ID Summary Rec. GMT-3323, GMT-3324 Issues with CallMatlabFunction panel P1 GMT-3325 Function call syntax is inconsistent and confusing P2 GMT-3326 Allow more types as input (literals, non-real parameters) Improvement Requirements ID Requirement FRC-17.1 The system shall allow the user to call a MATLAB function with optional input and output arguments. FRC-17.2.0 The system shall support the following data types as function inputs: FRC-17.2.1 FRC-17.3.0 1. Parameters of real number type The system shall support the following as function outputs: FRC-17.3.1 1. User-defined variables FRC-17.3.2 2. User-defined arrays FRC-17.3.3 3. User-defined array elements FRC-17.3.4 4. User-defined strings FRC-17.3.5 5. Parameters FRC-17.4 The system shall support calling a function with no inputs. FRC-17.5 The system shall support calling a function with no outputs. FRC-17.6 The system shall initiate communication with MATLAB the first time a MATLAB function is called. FRC-17.7 The system shall initiate communication with MATLAB only once per run. Interface/Functional Spec Overview Call a MATLAB function. Syntax MatlabFunction() MatlabFunction(input_argument[, input_argument]...) [output_argument[, output_argument]...] = MatlabFunction [output_argument[, output_argument]...] = MatlabFunction(input_argument[, input_argument]...) Description GMAT provides a special command that allows you to call a function written in the MATLAB language or provided with the MATLAB software. In the GUI, this is the CallMatlabFunction command. In the syntax description, MatlabFunction is a MatlabFunction resource that must be declared during initialization. Arguments can be passed into and returned from the function, though some data-type limitations apply. See Remarks for details. When a MATLAB function is called, GMAT opens a MATLAB command-line window in the background. This functionality requires that MATLAB be properly installed and configured on your system. See Also: MatlabFunction, MATLAB Interface GUI Figure 1: The CallMatlab Function GUI The CallMatlabFunction GUI provides two input boxes for input and output arguments and a list to select a function to call. The Output box lists all configured output argument parameters. These must be selected by clicking Edit, which displays a parameter selection window. See the Parameters reference for details on how to select a parameter. The Input box is identical in behavior to Output, but lists all configured input arguments to the function. Arguments must be selected by clicking Edit. The Function list displays all functions that have been declared as MatlabFunction resources in the Resources tree. Select a function from the list to call it. When the changes are accepted, GMAT does not perform any validation of input or output arguments. This validation is performed when the mission is run, when MATLAB has been started. Remarks Data Types The input arguments (input_argument values in the syntax description) can be any of the following types: ● resource parameter of real number type (e.g. Spacecraft.X) ● Array, String, or Variable resource ● Array resource element The output arguments (output_argument values in the syntax description) can be any of the following types: ● Array, String, or Variable resource ● Array resource element Data type conversion is performed for the following data types when values are passed between MATLAB and GMAT. When data is passed from GMAT to MATLAB as input arguments, the following conversions occur. GMAT MATLAB real number (e.g. Spacecraft.X, Variable, Array element) double String resource char array Array resource double array When data is passed from MATLAB to GMAT as output arguments, the following conversions occur. MATLAB GMAT char array string double real number double array Array resource Examples (Same examples as MatlabFunction) Test Procedures Assumptions (None) Existing Tests Status Name Summary partial, removed Matlab_IN_*, Matlab_OUT_*, Matlab_IO_* All data types as input, output, and passthrough partial, removed Matlab_IN_* All unique configurations of all resources as input replaced Matlab_Validation_ CallArgs Too many input arguments replaced Matlab_Validation_ NonExistFunc Nonexistent function replaced Matlab_Validation_ ReturnArgs Too many output arguments Recommended Additional Tests Nominal Tests All test names begin with the prefix “Matlab_”. Status Name Summary ✓ IO_* All data types as input, output, or passthrough ✓ IO_* All valid data types as output ✓ NoInputs Call function with no inputs ✓ NoOutputs Call function with no outputs ✓ NoInputsOutpu ts Call function with no inputs or outputs ✓ VariableInput s Call function with variable inputs ✓ VariableInput s Call function without capturing outputs Edge/Corner/Stress Status Name Summary Unique Validation All test names begin with the prefix “CallMatlabFunction_”. Status Name Summary ✓ TooFewInputs _* Too few input arguments ✓ InvalidInput s_* Input arguments of wrong type or dimension ✓ InvalidOutpu ts_* Output arguments of wrong type or dimension ✓ FunctionErro r Error in function ✓ InvalidInput s_* Disallowed input types ✓ InvalidOutpu ts_* Disallowed output types Unique Mode Tests Status Name Summary Unique GUI Tests These are tests that are unique to the GUI interface for this feature that are not covered by the standard GUI test template and procedures. Status Name Summary