HIL Read HIL Read Analog Codes navigation bar

Table of Contents

HIL Read Analog

Reads the specified analog channels immediately.

Library

QUARC Targets/Data Acquisition/Generic/Immediate I/O MATLAB Command Line Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window: qc_open_library('quarc_library/Data Acquisition/Generic/Immediate I//O')

Description

HIL Read Analog

The HIL Read Analog block reads the specified analog channels every time the block is executed. The channels are read immediately.

Input Ports

This block has no input ports.

Output Ports

The number of output ports depends on the Vector output parameter. If this option is off then there is one output port for each channel and each port outputs the value read from the corresponding channel. If this option is on then the output is a vector containing the values read from the channels specified in the Channels parameter. If the option is grouped, then there will be an output port for each consecutive group of channels. Refer to the documentation on the Vector output parameter below for more details.

Data Type Support

The HIL Read Analog block outputs real signals of type double.

Parameters and Dialog Box

HIL Read Analog

Board Name

The name of the board whose analog channels will be read. Boards are configured using the HIL Initialize block. Place an HIL Initialize block in your diagram to add a board name to the list.

Channels

The analog channels to read. The number of channels available depends on the board selected. Refer to Channels for more information.

Select a board type from the list for board-specific details:

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time. Since this is a source block, only inherent the sample time when it is placed in a conditionally executed subsystem, like a Triggered or Enabled Subsystem, or in a referenced model.

The default sample time is set to qc_get_step_size, which is a QUARC function that returns the fundamental sampling time of the model. Hence, the default sample time is a discrete sample time with the same sampling time as the fixed step size of the model.

Vector output

If this option is set to off then the block will have one output for each channel. The output ports will appear in the same order as the channels in the Channels parameter. Each port will be labeled with the corresponding channel number.

If this option is set to on then the block will have a single vector output with one element in the vector for each channel. The values read from each channel will appear in the vector in the same order as the channels in the Channels parameter.

If this option is set to grouped then the block will have one output for each consecutive group of channels. The output ports will appear in the same order as the channels in the Channels parameter. Each port will be labeled with the first channel in the corresponding group. Note that the Channels parameter will not be tunable offline when the outputs are grouped because the channel numbers themselves determine the number of outputs.

To force grouped channels that are naturally consecutive to appear as separate outputs, simply change the order so that they are not consecutive. For example, a channel selection of [0, 1, 2] will appear as a single vector, but a channel selection of [2, 1, 0] will appear as three separate outputs, the first for channel 2, the next for channel 1 and the last for channel 0. Finally, a channel selection of [2, 0, 1] will appear as a scalar output for channel 2 and a 2-vector output for channels 0 and 1.

Port labels

This parameter allows the labels on the port to be changed to reflect the channel numbers or the signal names, when signal names are available. The table below enumerates the different display options. This parameter has no effect on generated code.

Option

Description

channel numbers

Displays the channel number.

signal names

Displays the full signal name for each port, if available. Otherwise the channel number is displayed.

short names

Displays a shortened version of the signal name for each port, if available. Otherwise the channel number is displayed. Each word in the signal name is typically shortened to no more than four characters.

abbreviated names

Displays an abbreviated version of the signal name for each port, if available. Otherwise the channel number is displayed. The abbreviated version is the first letter from each word in the signal name. Any parentheses or brackets are removed.

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

No

No

Not supported.

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

Due to safety and liability concerns, the hardware may not be accessed during normal simulation.

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar