File Access Block Models
OpenFileAppend
File: general_blocks/File_Access/OpenFileAppend.sim
Description
The model opens the specified file for write access, appending to the existing data in the file. If the open fails, then an error message is generated, and the output is NOT enabled.
Ports
Input Ports
- trigger Data Type: TRIGGER
Output Ports
Parameters
WriteFile_String
File: general_blocks/File_Access/WriteFile_String.sim
Description
The model writes an arbitrary string, defined as parameter
String to a file, named in parameter File_Name.
It is triggered by a token arriving at it's in port.
It passes the token out it's out port. The named file
must be open for writing. The token is sent out if the
string is successfully written to the file. The file is
specified by the File_Name parameter.
You can automatically identify the module from which the
printing is coming, by the %Block_Label keyword as part
of your string to be printed. This model will replace the
keyword with the full path-name of the instance in the
graph hierarchy.
Ports
Input Ports
Output Ports
Parameters
- File_Name Data Type: ANY
- String Data
Type: ANY
WriteFile_Real
File: general_blocks/File_Access/WriteFile_Real.sim
Description
The model writes an real value to a specified file.
Ports
Input Ports
Output Ports
Parameters
WriteFile_Int
File: general_blocks/File_Access/WriteFile_Integer.sim
Description
The model writes an integer value to a specified file.
Ports
Input Ports
Output Ports
Parameters
WriteInfo_Numeric
File: general_blocks/File_Access/WriteInfo_Numeric.sim
Description
The model writes an value to a file, which is specified from the Parameter
File_Name.
This value consist of concatenating the Parameter Leading_string
, the numeric value from the in port, and the Parameter
Trailing_string .
After writing to the file, the done port will be enabled.
Ports
Input Ports
Output Ports
Parameters
- File_Name Data
Type: ANY
- Leading_string Data Type: STRING
- Trailing_string Data Type: STRING
ReadFile_Real
File: general_blocks/File_Access/ReadFile_Real.sim
Description
The model reads an real value from a specified file. The file
is specified by the parameter File_Name. When the model is
triggered, the next value is read from the file. When end-of-file
is encountered on a read, the eof output is enabled instead
of
the value output.
Ports
Input Ports
- trigger Data Type: TRIGGER
Output Ports
- eof Data Type:
TRIGGER
- value Data Type: REAL
Parameters
ReadFile_Int
File: general_blocks/File_Access/ReadFile_Integer.sim
Description
The model reads an integer value from a specified file. The file
is specified by the parameter File_Name. When the model is
triggered, the next value is read from the file. When end-of-file
is encountered on a read, the eof output is enabled instead
of
the value output.
Ports
Input Ports
- trigger Data Type: TRIGGER
Output Ports
- eof Data
Type: TRIGGER
- value Data Type: INTEGER
Parameters
OpenFileWrite
File: general_blocks/File_Access/OpenFileWrite.sim
Description
The model opens the specified file for write access. If the open
fails,
then an error message is generated, and the output is NOT enabled.
Ports
Input Ports
- trigger Data Type: TRIGGER
Output Ports
Parameters
OpenFileRead
File: general_blocks/File_Access/OpenFileRead.sim
Description
The model opens the specified file for read access. If the open fails,
then an error message is generated, and the output is NOT enabled.
Ports
Input Ports
- trigger Data Type: TRIGGER
Output Ports
Parameters
CloseFile
File: general_blocks/File_Access/CloseFile.sim
Description
The model closes the file that is pointed to by the contents of the
parameter File_Name.
If the file is not open an error message is reported.
Ports
Input Ports
- trigger Data Type:
TRIGGER
Output Ports
Parameters
ReadFile_Line
File: general_blocks/File_Access/ReadFile_Line.sim
Description
The model gets a line of text from the specified
file. The file is specified by the parameter File_Name.
When the model is triggered, it starts from the current
file pointer position and skips over n-1 lines of text,
until it gets to line n. n is specified by the
Line_Position parameter. After locating the line of text,
the line is then sent out the "value" port. When
end-of-file is encountered on a read, the eof output is
enabled instead.
Ports
Input Ports
- trigger Data Type:
TRIGGER
Output Ports
Parameters
- File_Name
Data Type: CHAR
- Number_of_Lines
Data Type: INTEGER
ReadFile_String
File: general_blocks/File_Access/ReadFile_String.sim
Description
The model reads "white space delimited" strings from the
specified file. The file is specified by the parameter
File_Name. When the model is triggered, n-1 strings are
skipped over as they are read from the file. The n-th
string is sent out the "value" port. When end-of-file is
encountered on a read, the eof output is enabled instead
of the value output.
Ports
Input Ports
- trigger Data Type:
TRIGGER
Output Ports
Parameters
- File_Name
Data Type: CHAR
- Number_of_Strings
Data Type: INTEGER
WriteFile_Field
File: general_blocks/File_Access/WriteFile_Field.sim
Description
The model locates the specified field of a Composite Data
specified file. The file is specified by the parameter
file. It then passes the in data structure unmodified to
out port.
Ports
Input Ports
Parameters
- File_Name
Data Type: CHAR
- Field_Name
Data Type: CHAR
- Delimiter
Data Type: CHAR
- Specify the character to follow the printed
data. Allowable values are CR, TAB, SPACE
and NONE.
WriteFile_AppendField
File: general_blocks/File_Access/WriteFile_AppendField.sim
Description
The model locates the specified field of a Composite Data
specified file. The file is specified by the parameter
file. It then passes the in data structure unmodified to
out port.
Ports
Input Ports
Parameters
- File_Name
Data Type: CHAR
- Field_Name
Data Type: CHAR
- Delimiter Data Type: CHAR