Traffic / TrafficReader
Code File Location: VisualSim/actor/lib/io/Traffic_Reader
This block reads a file or URL, one line at a time, and outputs each line as a data structure. The file or URL name is specified in the file Parameter. When the last line of the file is read and produced on the output port, this block produces true on the endOfFile port. If the Repeat parameter is selected the sequence is repeated. This block requires a trigger to read the next line. The 6 Header fields will be added to the fields from the file.
This block accepts a file name as a parameter. There are a number of file path options available for this block. To see the list, view the section on File Paths in the Reference Guide document here. The file name is a concatenation of any number of individual strings and parameters, separated by "+". To view the file path in a demo model, click here.
The first row should contain the column names which will become the field names of the data structure. There must be one name for each column and no spaces in the name are allowed.
The second row must contain the type in each column. The following types are accepted: array, boolean, bin, double, hex, integer, long, octal, and string.
There can be as many lines in the file as required. Each column must contain the set type for each column and must contain a value in each column. The columns can be separated either by tabs or commas.
HEX, OCTAL and BINARY will be converted to integer. Hex value can start with '0x' or just contain the HEX value; OCTAL value can start with '0' or just contain the OCTAL value.
For string entries, the Traffic_Reader will add "" around the entry, even if it not included in the text file.
Listen to Block will list the line number to correspond with the list row number. This can be used to determine which row has a bad setup. It is a good practise to see if the file can be opened correctly using Excel or other spreadsheet editing tools before using the Traffic Reader block.
Refer TrafficReader Demo Model.
Parameter |
Explanation |
fileOrURL |
View the above section on formats. |
Repeat_File |
When this is selected, the file is repeated until the simulation is completed. |
Port |
Explanation |
Type |
endOfFile |
An output port that produces false until the end of file is reached, at which point it produces true. |
Boolean |
Created with the Personal Edition of HelpNDoc: Produce online help for Qt applications