Clocks End of trail navigation bar

Table of Contents

Channels

QUARC provides numerous HIL blocks and functions for accessing data acquistion hardware. These blocks and functions read from inputs, write to outputs, or both. QUARC's hardware-in-the-loop interface is designed to be as generic as possible, to avoid dependencies on a particular manufacturer. The general nature of QUARC's HIL interface makes it possible to switch between different data acquisition hardware, even from different manufacturer's, without having to change your diagram or code. Only the board type parameter of the HIL Initialize block or hil_open function needs to change.

The term "channel" in QUARC is used in a very broad sense and refers either to a particular input signal from a data acquisition card, such as an analog input, a specific output signal, such as an analog output, or an event detected by the card, such as an analog threshold being exceeded. Such events are referred to as "interrupts" because they are generally detected by a card through an actual hardware interrupt.

Inputs

The inputs available on any card are organized into four broad categories:

Analog inputs read analog signals such as sinusoidal waveforms in voltage or current. These signals are read by data acquisition hardware using an analog-to-digital converter. The output of the the HIL blocks that read an analog signal will be in SI units of Volts (V) or Amperes (A). The only exception is the HIL Read Analog Codes block, which outputs the raw analog-to-digital converter codes.

Encoder inputs read quadrature encoders or count and direction signals. The output of the HIL blocks that read encoder signals is simply counts. Since encoders may be linear or rotary there are no SI units naturally associated with encoders themselves. The units really depend on the specific application.

Digital inputs read digital signals such as switches, relays and on/off sensors. The HIL blocks that read digital signals output either zero or one depending on the value of the input at the time.

"Other" inputs read any signals that do not fit under the preceding categories, such as encoder velocity sensors that output counts per second. Certain analog signals may also be used as other channels in addition to analog channels. For example, a temperature sensor may output temperature in degrees Celcius as an "other" input and voltage as an analog input.

Outputs

The outputs available on any card are also organized into four broad categories:

Analog outputs write analog signals such as sinusoidal waveforms in voltage or current. These signals are written by data acquisition hardware using a digital-to-analog converter. The inputs to HIL blocks that write an analog signal must be in SI units of Volts (V) or Amperes (A). The only exception is the HIL Write Analog Codes block, which requires the raw digital-to-analog converter codes.

PWM outputs write pulse-width modulated signals. The input to the HIL blocks that write PWM signals is typically a fraction between 0.0 and 1.0 representing the duty cycle. However, the PWM frequency and period may also be supplied as inputs for some cards.

Digital outputs write digital signals, used for such things as turning an LED on or off, or enabling external power amplifiers. The HIL blocks that write digital signals take either zero or one as an input.

"Other" outputs write any signals that do not fit under the preceding categories.

Channels

Specific inputs and outputs are referred to as channels, with each channel having an associated channel number. Channel numbers are generally zero-based, so that channel 0 is the first channel, channel 1 the second, etc.

Almost all HIL blocks and functions have a Channels parameter, indicating which channels are being read or written. This parameter is a vector of channel numbers. Each element of the vector should be entered as an integer number between 0 and one less than the number of channels supported by the card. For example, the Q8 card supports 8 analog inputs, 8 analog outputs, 8 encoder inputs, and 32 bidirectional digital I/O channels. Hence, analog and encoder channel numbers range from 0 to 7 and digital channel numbers range from 0 to 31. For example,

[0 5 6]

denotes channels 0, 5 and 6. Channel numbers need not be consecutive. Nor do they need to be specified in ascending order. Data read from an HIL board will appear in the same order as the channels in the vector. Likewise, data written to an HIL board must appear in the same order as the channels in the vector.

Other Channels

Channels that don't fit in the standard analog, digital, encoder or PWM paradigm - the "other" channels - employ a different channel numbering scheme. One of the primary goals of the HIL API was to make I/O as independent as possible from the underlying data acquisition hardware, regardless of the manufacturer. The idea is to make it possible to switch the underlying hardware simply by selecting a different board in the HIL Initialize block while leaving the rest of the diagram or code unchanged.

To support custom I/O while still preserving this manufacturer independence, QUARC defines a standard set of channel numbers for "other" channels. These channel numbers categorize the I/O in such a way that it should be possible for cards from different manufacturers to be used interchangeably, just by changing the selected card in the HIL Initialize block (or hil_open call). The channel numbers remain the same, so the rest of the diagram need not be changed!

The standard channel numbers for "other" channels in the HIL API are enumerated below. Note that the channels are divided into ranges. The first value in the range is used for the first "other" channel of that type, and subsequent channels are numbered sequentially thereafter.

Range

Description

0-999

X, Y, Z linear position in metres (i.e. 0=X1, 1=Y1, 2=Z1, 3=X2, 4=Y2, etc.) [altitude]

1000-1999

Rx, Ry, Rz angular position in radians

2000-2999

X, Y, Z linear velocity in m/s

3000-3999

Rx, Ry, Rz angular velocity in rad/s [gyros]

4000-4999

X, Y, Z linear acceleration in m/s2 [accelerometers]

5000-5999

Rx, Ry, Rz angular acceleration in rad/s2

6000-6999

X, Y, Z force in N

7000-7999

Rx, Ry, Rz torque in N-m

8000-8999

X, Y, Z magnetic field in Teslas [magnetometer]

9000-9999

Pressure in Pascals [airspeed and altimeter]

10000-10999

Temperature in Celsius [temperature sensors]

11000-11999

Operating capacity as a percentage (0.0 to 1.0 representing 0% to 100%)

12000-12999

Time in seconds (e.g., time since bootup, time since last read, etc)

13000-13999

Counts (e.g. Geiger counter)

14000-14999

Counts/s (e.g. encoder velocities)

15000-15999

Counts/s2 (e.g. encoder accelerations)

16000-16999

Enumeration for non-boolean states (e.g. move forward, left, right, or backwards)

17000-17999

Raw data (e.g. integer data from sensors prior to unit scaling)

18000-18999

Calibration data

Interrupt Channels

Interrupt sources of a data acquisition card are also referenced using channel numbers. Like "other" channels, interrupt sources do not employ a contiguous numbering scheme. One of the primary goals of the HIL API was to make I/O as independent as possible from the underlying data acquisition hardware, regardless of the manufacturer. The idea is to make it possible to switch the underlying hardware simply by selecting a different board in the HIL Initialize block while leaving the rest of the diagram or code unchanged.

To support custom interrupt sources while still preserving this manufacturer independence, QUARC defines a standard set of channel numbers for "interrupt" channels. These channel numbers categorize the interrupt sources in such a way that it should be possible for cards from different manufacturers to be used interchangeably, just by changing the selected card in the HIL Initialize block (or hil_open call). The channel numbers remain the same, so the rest of the diagram need not be changed!

The standard channel numbers for "interrupt" channels in the HIL API are enumerated below. Note that the channels are divided into ranges. The first value in the range is used for the first interrupt source of that type, and subsequent channels are numbered sequentially thereafter.

Range

Description of Interrupt Source

0-999

Edge or level on digital input occurred (may be specialized inputs that are not used as normal digital inputs, but interrupts from normal digital inputs should appear first in the ordering)

1000-1999

Encoder index pulse occurred

2000-2999

Analog threshold exceeded

3000-3999

Timer expired

4000-4999

Error occurred. Error interrupts are very specific so certain error interrupts have been predefined below to ensure consistency between cards.

4000-4099

Emergency stop pressed

4100

Memory failure detected

4101

Oscillator failure detected

4102

Stack overflow ocurred

4103

Page fault occurred

4104

Divide by zero detected

4105

Numeric overflow occurred

4200-4299

Low voltage condition detected

4300-4399

Over-voltage condition detected

 

navigation bar