quanser.hardware.hil.get_version quanser.hardware.hil.close_all navigation bar

Table of Contents

quanser.hardware.hil.open

Opens a HIL board.

Syntax

[board, err] = quanser.hardware.hil.open(board_type, board_identifier)
[board, err] = quanser.hardware.hil.open(board_type)                   % opens board '0'
    

Description

Opens a HIL device. Note that this is a static method of the quanser.hardware.hil class so the full name must be specified. Since the board returned is an instance of the hil class, subsequent operations on the board use the board object returned. When finished with the device, the board must be closed. The board is typically closed using the method call:

board.close;

where board is the object returned from quanser.hardware.hil.open.

To close all open boards, use the static method quanser.hardware.hil.close_all as follows:

quanser.hardware.hil.close_all;

If no err output is provided then it throws an exception if an error occurs. In generated code it prints the error message. Use hil_get_error_message to get the message associated with an error code.

Parameters

board_type

The type of HIL board being configured. Select a board type from the list for board-specific details: .

For example, for the Q8 board the board type is q8.

board_identifier

The number of the board. This optional parameter is only used when there is more than one board of the given type in the computer. The default value for this parameter is "0", indicating the first board of the given type. Subsequent boards are numbered sequentially. Hence, the second board in the system is board "1".

Outputs

board

An instance of the hil class representing the open board.

err

A negative error code or zero on success.

Examples

board = quanser.hardware.hil.open('q8', '0');  % Opens the first Q8 board in the system (Q8 board #0).
...
board.close;  % Close the board to release resources
    

See Also

 

navigation bar