HIL Façade

class quanser.hardware.hil.HIL(card_type=None, card_identifier='0')

A Python wrapper for the Quanser HIL API.

Parameters
  • card_type (string) – A string indicating the type of HIL board being configured. For example, for the Q8 board the board type is “q8”. Some other valid board types are “q4” and “qpid_e”.

  • card_identifier (string) – A string identifying the particular board among all the boards of the same type. This parameter is only used when there is more than one board of the given type in the computer. Typically, this parameter is “0”, indicating the first board of the given type. Subsequent boards are typically numbered sequentially. Hence, the second board in the system is board “1”.

Raises

HILError – On non-zero return code. A suitable error message may be retrieved using get_error_message.

Examples

Constructs a new HIL object without opening a connection to a board.

>>> from quanser.hardware import HIL
>>> card = HIL()

Constructs a new HIL object and immediately connects to the specified board.

>>> from quanser.hardware import HIL
>>> card = HIL("q8_usb", "0")
>>> try:
>>>   # ...
...
>>> finally:
>>>   card.close()