Adding a Read Data Source

You use the Data Exchanger Component Editor to create a Read data source with a General Text, Name/Value, Table, or Vector format. The data are read from a file output by an external program. This is sometimes called an output parse because an output file is being read.

  1. Double-click the Data Exchanger component icon .

    The Data Exchanger Component Editor appears.

  2. From the Data Exchanger Component Editor, click the large button in the center of the editor to begin defining a data source.

    Tip: You can also click the <New> tab or click the New Data Source button.

    The Exchanger Wizard appears with the Select File screen displayed.

  3. Click Read a File.

    1. In the Sample file to use when designing Data Exchange text box, enter the name of the file that has a sample of the type of data to read when the model runs. You can also click Browse to locate the file.
    2. In the File to Read at Runtime list, enter the name of the file to read at run time. This is the name the file will have in the run-time working directory. If you enter a new file name, the Data Exchanger component creates a parameter with the file name and converts any periods to underscores. If you browsed to the file, this box is automatically filled with the name of the specified file. Instead of entering a file name, you can select an existing file parameter. The file specified by the file parameter is used.

      Note: If you entered the name of a file, an input file parameter is created that references the named file. This file parameter can be mapped from an earlier component in the simulation process flow that produced the file.

  4. In the Encoding list, select the type of encoding that you want to use.

    You can use this option to explicitly specify the encoding the file parameter is to use when converting between bytes and characters. In a Locale (a system setting that includes the language, number formats, and character set in use) that uses multibyte characters (Japanese, Chinese, Korean), there is a default encoding used to convert bytes into characters. Most text files are written using this encoding, but sometimes it is necessary to specify this encoding. For additional information on encoding, see File Type and Encoding in the Isight Development Guide.

    Note: This setting is visible only if the Show File Type Encoding option on the Files tab is selected on the Preferences dialog box. For more information about Preferences, see Setting Files and Directories Preferences in the Isight User’s Guide.

  5. Click Next.

    The File Format screen appears.

  6. Select one of the following:

    Option Description
    General Text Text with no particular structure. Fields are located by searching for words or phrases.
    Name/Value Data organized as a list of name/value pairs, where the name is the first word on the line and there is a delimiter (space or some punctuation) between the name and the value. Fields are located by matching names. This format is used only with specially formatted data; however, it does allow the variable names to be automatically selected based on the field names.
    Table Tables and lists of numbers. Fields are identified by row number (line) and column number. This format can be used with files in any format as long as the line numbers never change; the number of entries on each line do not have to be the same. The cells in the table can be separated by delimiters (e.g., space, comma, etc.), or the table columns can be defined by absolute character position (sometimes useful for reading packed Fortran formatted data). The Table format allows whole columns, rows, and arrays to be read into array parameters in one action.
    Vector Data organized as a list of values separated by spaces or punctuation. Fields are numbered sequentially through the whole section. The Vector format allows one-dimensional arrays to be read in one operation. The values can span multiple lines. This option is often used for Fortran list-directed input.

  7. If you selected the Name/Value format, do the following:

    1. Click Next, and select the delimiter that you want to use.

      Delimiters are characters that delimit multiple name/value pairs on a line; if Allow comments after Value is selected, delimiters indicate the start of a comment. For more information, see About Delimiters.

      Once you make a selection, the highlighted information in the Sample Text area is updated: the name fields are highlighted in orange, and the value fields are highlighted in green.

    2. Click More to set additional formatting options, as desired.

      • Name prefix. Enter an optional string that you want removed from the beginning of the name field. This can be useful for a file similar to the following:

        set a = 5

        set b = 10

        to remove the string set leaving just the names a and b.

      • Name suffix. Enter an optional string that you want removed from the end of each name.
      • Separator. Select a separator. You can use a space as a separator:

        a = b c = d

      • Click Allow comments after Value if you want to exclude everything after the first delimiter character. Because sections of text that do not contain the separator string are already ignored, this option is needed only if the separator could occur in a comment.

    3. Click Next, and determine how you want entries to be read from parameters.
    • Click Read All if you want all the entries in the Name/Value file to be read automatically from parameters with the same name as the Name field of the item.

      Click Clear All to remove your selections.

    1. Edit the parameter information, as desired.

      For more information, see About Editing Parameters.

  8. Click Finish.

    The file appears in the Data Source area as a new tab.

  9. Click OK to save your changes and to close the Data Exchanger Component Editor.