ReportInterfaces

Top  Previous  Next

The ReportInterface object provides a mechanism to collect data and text to be written to an ASCII file.

 

A ReportInterface can be used to output data at various points within a Mission Plan to a single report, collecting all the data into a single repository for later output to a file.

oThis is useful if a complex Mission Sequence has multiple If, For, Target, and/or While loops, and data needs to be collected at different points in the sequence, but sent to a single file.

oIt is also useful to use a ReportInterface object to create custom headers and specific text messages that get produced in the output file.

The ReportInterface also provides an option to append new data to the end of an existing file.

For a complete list of available options, see ReportInterface properties and methods.

The Close command should be used to terminate the ReportInterface session.

oClosing a ReportInterface closes the file associated with the ReportInterface and sets the append mode to true.

oClosing the file allows other processes to access the newly generated or edited file while the Mission Plan is still running.

oBy default, FreeFlyer keeps all report files open during the execution of a Mission Plan.

oIf a file is not explicitly closed before being used by another program, then there is no guarantee that all data will be present in the file.

If a Mission Plan generates a report file, and at the end of the Mission Plan, the newly generated report file is processed by another application via the Run command, if you do not close the file before the Run command, you are not guaranteed to have all the data in the file when the Run command is executed.

 

The script example below shows how to create a ReportInterface via FreeFlyer script and append elevation and range information to the end of an existing file.

 

ReportInterface ReportInterface1("myReportFilename.txt");

 

// --or--

 

ReportInterface ReportInterface1("myReportFilename.txt",1); // The "1" indicates the append mode

 

ReportInterface1.Append = 1;

Report GroundStation1.Elevation(Spacecraft1), Spacecraft1.Range(GroundStation1) to ReportInterface1;

Close ReportInterface1;

 

The ReportInterface object offers many useful properties that can be changed to customize your output file such as the NumberFormat, HeaderType, ColumnDelimiter, AutoPadding, AutoLinefeed properties. The script example below shows how to create a ReportInterface via FreeFlyer script and report a variable, array, and matrix to a file using the ReportInterface.NumberFormat property:

 

ReportInterface ReportInterface1("myReportFilename.txt");

 

Array a = {123.123, 234.234, 345.345};

 

Matrix matrix1 = 

  [1.5004600, 0.5000000, 0.5001000;         

   0.5004600, 1.5000000, 0.5001000;         

   0.5004600, 0.5000000, 1.5001000];  

   

Variable v = 500.612;

 

ReportInterface1.AutoPadding  = 1;         // Automatically pads columns with spaces

ReportInterface1.HeaderType   = 2;         // Formats the headers to use labels

ReportInterface1.NumberFormat = "%1.3e";   // Formats the numeric values reported 

 

Report v            to ReportInterface1;

Report a            to ReportInterface1;

Report matrix1 to ReportInterface1;

 

 

Output Report:

 

     v

  5.006e+02

 

     a[0]           a[1]           a[2]

  1.231e+02       2.342e+02      3.453e+02

 

  matrix1[:,0]   matrix1[:,1]   matrix1[:,2]

   1.500e+00      5.000e-01      5.001e-01

   5.005e-01      1.500e+00      5.001e-01

   5.005e-01      5.000e-01      1.500e+00

 

 

The script example below shows how to create a ReportInterface with custom header labels using the ReportInterface.SetCustomHeaderLabels() method:

 

ReportInterface ReportInterface1("myReportFilename.txt");

ReportInterface1.AutoPadding = 1;           // Automatically pads columns with spaces

ReportInterface1.HeaderType = 2;            // Formats the headers to use labels

ReportInterface1.NumberFormat = "%1.3f";    // Formats the numeric values reported

ReportInterface1.SetCustomHeaderLabels({"Data Type","columnLabel1""columnLabel2""columnLabel3"}); // Customize header labels

 

Array a = {123.123, 234.234, 345.345};

 

Matrix matrix1 = 

  [1.5004600, 0.5000000, 0.5001000;         

   0.5004600, 1.5000000, 0.5001000;         

   0.5004600, 0.5000000, 1.5001000];  

   

Variable v1 = 500.612;

Variable v2 = 400;

Variable v3 = 21.85;

 

Report "Matrix: "   , matrix1   to ReportInterface1;

Report "Array: "    , a         to ReportInterface1;

Report "Variables: ",v1, v2, v3 to ReportInterface1;

 

 

Output Report:

 

  Data Type   columnLabel1   columnLabel2     columnLabel3

  Matrix:         1.500           0.500          0.500

                  0.500           1.500          0.500

                  0.500           0.500          1.500

 

  Data Type   columnLabel1   columnLabel2     columnLabel3

   Array:         123.123         234.234        345.345

 

  Data Type    columnLabel1   columnLabel2     columnLabel3

  Variables:      500.612          400.000       21.850

 

 

ReportInterface Object Editor


The Properties page allows users to define the path and filename of the output report file, and choose whether to append data to an existing file. This option prevents an existing file from being overwritten with each run - data from the current run is added to the end of the information already existing in the file.

 

 

 

See Also


Report Command

Close Command

ReportInterface Properties and Methods