User Tools

Site Tools


i_o

IO Library

Overview

This LabVIEW library leverages easy use of National Instruments data acquisition / generation devices of the “DAQmx” series. The plethora of functionality the native NI-DAQmx driver offers is ditched in favor of a handy interface to the most common use cases of data acquisition and generation. DriveTest IO Library is ideal for use with National Instruments TestStand and supports running multiple instances simultaneously.

Use cases for IO Library are:

  • Input - Reading physical values
    • Single Value Input: reading a single value from an analog or digital input channel
    • Finite Acquisition: a predetermined number of analog or digital samples is acquired at a constant clock rate
    • Continuous Acquisition: analog and digital acquisition at a constant clock rate is started and kept running until it is stop. Samples can be read while the acquisition is running and when it is stopped.
  • Output - Wrinting physical values
    • Static Output: writing a single value to an analog or digital output channel. The value is held until a new value is written
    • Finite Generation: a number of digital or analog samples is written ONCE to the output channel at a constant clock rate
    • Continuous Generation: a number of digital or analog samples is written REPEATEDLY to the output channel at a constant clock rate unitl generation is stopped

License

A license is required to use this library. Please contact DriveTest GmbH for more information.

System Requirements

  • Windows PC. The Windows version required is determined by the availability of the required LabVIEW Run-Time Engine.
  • LabVIEW Run-Time Engine matching the target version of the DriveTest IO Library
  • National Instruments NI-DAQmx driver. The library has been tested with NI-DAQmx 14.2. Other versions are likely to work but this is not guaranteed.
  • National Instruments NI-DAQmx device

Theory of Operation

Channel Definitions

IO Library uses NI-DAQmx Global Virtual Channels as input and output channels. Global Virtual Channels are handled in National Instruments Measurment and Automation Explorer (NI MAX). This software comes free of charge with the NI-DAQmx driver. Global Virtual Channles define the physical channel and offer an optional scaling to a virtual value. Functionality for import and export is available in NI MAX.

DAQmx Tasks

In NI-DAQmx jargon a measurement process is called Task. There are several kinds of task: analog input task, analog output task, digital input task and so on. Most NI-DAQmx devices can run one of a kind task at a time. For example, it is not possible to run a finite and a continuous analog acquistion at the same time on the same piece of hardware. It is possible to run a finite analog acquisition and a continuous analog output at the same time.

In short: The driver does not allow simultaneous use of the same piece of hardware by different measurement processes.

Functionality

Overview Image to be added.

General Functions

initialize.vi

Initialize an IO Instance to perform input and output operations with NI-DAQmx devices. This is the first VI to call when working with this library. IO Instances should be closed after use with “shutdown.vi”.

It is possible to run several IO Instances simultaneously as long as there is no hardware access conflict. Hardware access conflicts create NI-DAQmx run-time errors. Instances and their channels can be distinguished with the inputs “Instance No.” and “instance No. suffix on channels”.

IO.lvlib_IO.lvclass_initialize.vi Connector Pane

Inputs

Instance No.

Data Type Image The data type of this connection is “U8”. Wiring this connection is recommended. This input is used to distinguish instances of IO Library by numbers starting with 0.

Instance No. suffix on channels

Data Type Image The data type of this connection is “Boolean”. Wiring this connection is recommended. If this input is TRUE, an underscorce and the instance number (e.g. “_0”) are appended automatically to all channel names. This is useful for running multiple instances of IO Library simultaneously. By default, this input is FALSE.

error in

Data Type Image The data type of this connection is “Cluster”. Wiring this connection is recommended. Use this input for data flow or to inhibit excecution in case of errors in previous VIs.

Logging Configuration

Data Type Image The data type of this connection is “Path”. Wiring this connection is optional. With this input a custom log4net logging configuration file can be applied.

Outputs

IORef

Data Type Image The data type of this connection is “Refnum”. Reference to the IO Instance. This reference has to be made available for all VIs of the IO Library.

error out

Data Type Image The data type of this connection is “Cluster”. Information about run-time errors in this VI. Incoming errors are looped through to this output.

shutdown.vi

Close IOref reference. The reference can not be used after calling this VI.

DriveTest GmbH, 14.1.2015 (TOP)

IO.lvlib_IO.lvclass_shutdown.vi Connector Pane

Inputs

IORef

Data Type Image The data type of this connection is “Refnum”. Wiring this connection is required. Reference to the IO Instance. This reference is created by “initalize.vi”.

error in

Data Type Image The data type of this connection is “Cluster”. Wiring this connection is recommended. Use this input for data flow or to inhibit excecution in case of errors in previous VIs.

Outputs

error out

Data Type Image The data type of this connection is “Cluster”. Information about run-time errors in this VI. Incoming errors are looped through to this output.

configure log file.vi

Configure measurement data log file.

DriveTest GmbH, 28.1.2015 (TOP)

IO.lvlib_IO.lvclass_configure log file.vi Connector Pane

Inputs

IO Ref

Data Type Image The data type of this connection is “Refnum”. Wiring this connection is required. Reference to the IO Instance. This reference is created by “initalize.vi”.

log file

Data Type Image The data type of this connection is “Path”. Wiring this connection is required. Measurement data log file including path and file name. If the path does not exist, it is created. File ending must be *.tdms.

error in

Data Type Image The data type of this connection is “Cluster”. Wiring this connection is recommended. Use this input for data flow or to inhibit excecution in case of errors in previous VIs.

operation

Data Type Image The data type of this connection is “Enum U16”. Wiring this connection is recommended. If the measurement data log file specified with input “log file” does not exist, it is created. This input defines what happens if the file already exists.

append (0): append measurement data to the existing file replace (1): delete the existing file and create a new file

Outputs

error out

Data Type Image The data type of this connection is “Cluster”. Information about run-time errors in this VI. Incoming errors are looped through to this output.

configure sample rate.vi

Sets the acquisition / generation sample rates for input and output operations. Sample rates for different IO types are store independently.

IO.lvlib_IO.lvclass_configure sample rate.vi Connector Pane

Inputs

IO Ref

Data Type Image The data type of this connection is “Refnum”. Wiring this connection is required. Reference to the IO Instance. This reference is created by “initalize.vi”.

io type

Data Type Image The data type of this connection is “Enum U16”. Wiring this connection is required. analog input (0): continuous and finite analog input sample rate is defined

analog output (1): continuous and finite analog output sample rate is defined

digital input (2): continuous and finite digital input sample rate is defined

digital output (3): continuous and finite digital output sample rate is defined

noise input (4): noise acquisition sample rate is defined

sample rate

Data Type Image The data type of this connection is “Double Float”. Wiring this connection is required. Sample rate in Hz. Must be greater than 0.

error in

Data Type Image The data type of this connection is “Cluster”. Wiring this connection is recommended. Use this input for data flow or to inhibit excecution in case of errors in previous VIs.

Outputs

error out

Data Type Image The data type of this connection is “Cluster”. Information about run-time errors in this VI. Incoming errors are looped through to this output.

log file set property.vi

Set a property in measurement data log TDMS file. The property is applied to file level or group level, if a group of channels is specified.

DriveTest GmbH, 29.1.2015 (TOP)

IO.lvlib_IO.lvclass_log file set property.vi Connector Pane

Inputs

IO Ref

Data Type Image The data type of this connection is “Refnum”. Wiring this connection is required. Reference to the IO Instance. This reference is created by “initalize.vi”.

property name

Data Type Image The data type of this connection is “String”. Wiring this connection is required. Name of the TDMS property to set.

property value

Data Type Image The data type of this connection is “String”. Wiring this connection is required. Value of the property to set.

error in

Data Type Image The data type of this connection is “Cluster”. Wiring this connection is recommended. Use this input for data flow or to inhibit excecution in case of errors in previous VIs.

group name

Data Type Image The data type of this connection is “String”. Wiring this connection is optional. Specifies a TDMS group (of channels) to apply the property to. If not set, the property is applied to file level.

Outputs

error out

Data Type Image The data type of this connection is “Cluster”. Information about run-time errors in this VI. Incoming errors are looped through to this output.

any finite check.vi

Checks if a previously started Finite Task has finished. This VI works with the task types Analog Input, Analog Output, Digital Input and Digital Output.

DriveTest GmbH, 13.2.2015 (TOP)

IO.lvlib_IO.lvclass_any finite check.vi Connector Pane

Inputs

IORef

Data Type Image The data type of this connection is “Refnum”. Wiring this connection is required. Reference to the IO Instance. This reference is created by “initalize.vi”.

io type

Data Type Image The data type of this connection is “Enum U16”. Wiring this connection is required.

error in

Data Type Image The data type of this connection is “Cluster”. Wiring this connection is recommended. Use this input for data flow or to inhibit excecution in case of errors in previous VIs.

Outputs

error out

Data Type Image The data type of this connection is “Cluster”. Information about run-time errors in this VI. Incoming errors are looped through to this output.

task done?

Data Type Image The data type of this connection is “Boolean”.

i_o.txt · Last modified: 2015/02/13 16:44 by fabian