![]() | Note |
---|---|
The ADInterfaceMCC (Analog/Digital Interface) is an interface between the BCVTB and USB-data acquisition devices. This interface has been tested for one device (USB-1208LS) of the Measurement Computing Corporation and is only supported on Windows. This interface will work properly only if the drivers of the Data Acquisition device have been installed correctly and the device has been configured. Read the user guide available at http://www.mccdaq.com/PDFmanuals/USB-1208LS.pdf and the Data Acquisition software manual http://www.mccdaq.com/PDFs/Manuals/DAQ-Software-Quick-Start.pdf to learn how to install and to configure the USB-1208LS. |
The BCVTB contains an actor, called
ADInterfaceMCCReader
, that can read from ADInterfaceMCC
devices and an actor, called ADInterfaceMCCWriter
,
that can write to ADInterfaceMCC devices. Both actors use a
configuration file that specifies the ADInterfaceMCC devices. The next sections describe how
to write these configuration files, and how to set
up a model that reads from and writes to ADInterfaceMCC devices.
The ADInterfaceMCCReader
actor reads an xml
configuration file to determine what data it needs to
read from ADInterfaceMCC devices. The xml configuration file has the following syntax:
It starts and ends with
<?xml version="1.0" encoding="utf-8"?> <ADInterfaceMCC> <!-- Child elements are not shown. --> </ADInterfaceMCC>
The above element ADInterfaceMCC
has at least one child element of the form
<Object BoardNumber = "0" ChannelNumber = "0" ChannelGain = "2" ChannelOptions = "0" ApplicationTag = "read"/>
The element name needs to be set to Object
.
The attribute BoardNumber
is the board number associated with the board used to collect the data when it was installed with InstalCal.
The attribute ChannelNumber
is the A/D (Analog/Digital) channel number.
The attribute ChannelGain
is the A/D range code. If the board has a programmable gain, it will be set according to this argument value.
The attribute ChannelOptions
is reserved for future use by the hardware manufacturer and should be set to zero.
The attribute ApplicationTag
is a value that can be set to read
or write
depending on whether the interface should be used in the READ
or WRITE
mode.
Table 5.9, “Attribute's values for the USB-1208LS Data Acquisition Device (READ
mode).” gives a short overview about the values that the attributes could have in the configuration file.
Table 5.9. Attribute's values for the USB-1208LS Data Acquisition Device (READ
mode).
Attribute | Value |
---|---|
BoardNumber | Integer from 0 to 99 |
ChannelNumber | Integer from 0 to 7 |
ChannelGain | 1: channel with 10 volts unipolar 2: channel with 10 volts bipolar 3: channel with 5 volts unipolar 4: channel with 5 volts bipolar |
ChannelOptions | 0 |
ApplicationTag | read |
To read data from ADInterfaceMCC devices, the
ADInterfaceMCCReader
actor calls an executable
program that is in the directory bcvtb/lib/adInterfaceMCC-stack
. This
section describes how the entries in the xml file
relate to this executable. The example shows the
low-level implementation.
To read from ADInterfaceMCC, the adInterfaceMCC-stack provides the following function:
java -jar adInterfaceReader.jar BoardNumber ChannelNumber ChannelGain ChannelOptions
The ADInterfaceMCCWriter
actor reads an xml
configuration file to determine what data it needs to
write to ADInterfaceMCC devices. The xml configuration file has the following syntax:
It starts and ends with
<?xml version="1.0" encoding="utf-8"?> <ADInterfaceMCC> <!-- Child elements are not shown. --> </ADInterfaceMCC>
The above element ADInterfaceMCC
has at least one child element of the form
<Object BoardNumber = "0" ChannelNumber = "0" ChannelGain = "3" ChannelOptions = "0" ApplicationTag = "write"/>
The element name needs to be set to Object
.
The attribute BoardNumber
is the board number associated with the board used to collect the data when it was installed with InstalCal.
The attribute ChannelNumber
is the D/A (Digital/Analog) channel number. The maximum allowable channel depends on which type of D/A board is being used.
The attribute ChannelGain
is the D/A range code. If the device has a programmable gain, it will be set according to this argument value. If the specified range is not supported,
the function will return a BADRANGE error. If the gain is fixed or manually selectable, you must make
sure this argument matches the gain configured for the device.
The attribute ChannelOptions
is reserved for future use by the hardware manufacturer and should be set to zero.
The attribute ApplicationTag
is a value that can be set to read
or write
depending on whether the interface should be used in the READ
or WRITE
mode.
Table 5.10, “Attribute's values for the USB-1208LS Data Acquisition Device (WRITE
mode).” gives a short overview about the values that the attributes could have in the configuration file.
Table 5.10. Attribute's values for the USB-1208LS Data Acquisition Device (WRITE
mode).
Attribute | Value |
---|---|
BoardNumber | Integer from 0 to 99 |
ChannelNumber | 0 or 1 |
ChannelGain | 1: channel with 10 volts unipolar 2: channel with 10 volts bipolar 3: channel with 5 volts unipolar 4: channel with 5 volts bipolar |
ChannelOptions | 0 |
ApplicationTag | write |
To write data to ADInterfaceMCC devices, the
ADInterfaceMCCWriter
actor calls an executable
program that is provided by the adInterfaceMCC-stack. This
section describes how the entries in the xml file
relate to this executable. The example shows the
low-level implementation.
To write to ADInterfaceMCC, the adInterfaceMCC-stack provides the following function:
java -jar adInterfaceWriter.jar BoardNumber ChannelNumber ChannelGain ValueToBeWritten ChannelOptions
The ADInterfaceMCCReader
and the
ADInterfaceMCCWriter
actor can be used in the same
Ptolemy II model. In this section, we will
explain how to configure a Ptolemy II model that
writes to and reads from ADInterfaceMCCdevices. This example can be found in the directory
bcvtb/examples/adInterfaceMCC-roomControl
. A similar example can also be found in the directory
bcvtb/examples/adInterfaceMCC-room
.
Figure 5.45.
Ptolemy II system model that uses the ADInterfaceMCCReader and the ADInterfaceMCCWriter
actors.
Figure 5.45
shows a Ptolemy II system model that uses the
ADInterfaceMCCReader
and the ADInterfaceMCCWriter
actors. To configure the
ADInterfaceMCCReader
, double-click on its icon and
add the name of its configuration file that has been
developed as described in
Section 5.13.2, “Reading from ADInterfaceMCC”
. There is also a check-box called
continueWhenError
. If activated and an
error occurs, then Ptolemy II will continue the
simulation and the actor will output at its ports the
last known value and the error message, unless the
error occurs in the first step, in which case the
simulation stops. If deactivated and an error occurs,
then the simulation will stop, the error message will
be displayed on the screen and the user is required to
confirm the error message by clicking on its
button.
Thus, select this box if the BCVTB should continue its operation when a run-time error occurs.
The ADInterfaceMCCReader
has the following ports:
There is one input port, which is a trigger port. If
the SDF Director is used in the Ptolemy II system
model, then this port need not be connected. The
ADInterfaceMCCReader
has the output ports shown
in Table 5.11, “Output ports of the ADInterfaceMCCReader
actor.”.
Table 5.11. Output ports of the ADInterfaceMCCReader
actor.
Port | Description |
---|---|
errorSignal | If there were no errors in the previous data exchange, then this port outputs zero. Otherwise, the output is a non-zero integer. |
errorMessage | If there was an error in the previous data exchange, then this port outputs the error message that was generated by the ADInterfaceMCCReader actor.
(The error messages that were generated by the binary of the ADInterfaceMCC are output of the consoleOutput port.) |
consoleOutput |
This port outputs the standard output stream and the standard error stream of the binary that communicates with ADInterfaceMCC. |
propertyValue |
This port outputs the values obtained at the last successful communication with the ADInterfaceMCC device.
The output data type is a vector whose elements
are string representations of the ADInterfaceMCC
properties that are read according to the
configuration file. Elements can be extracted
from this vector using actors from Ptolemy II's
|
The configuration of the ADInterfaceMCCWriter
actor is similar to the configuration of the
ADInterfaceMCCReader
.
To configure the
ADInterfaceMCCWriter
, double-click on its icon and
add the name of its configuration file that has been
developed as described in
Section 5.13.3, “Writing to ADInterfaceMCC”
. There is also a check-box called
continueWhenError
. If activated and an
error occurs, then Ptolemy II will continue the
simulation and the actor will output the error message
at its ports, unless the error occurs in the first
step, in which case the simulation stops. If
deactivated and an error occurs, then the simulation
will stop, the error message will be displayed on the
screen and the user is required to confirm the error
message by clicking on its button.
Thus, select this box if the BCVTB should continue its operation when a run-time error occurs.
Input into the actor are values that will be written to the ADInterfaceMCC device according to the order specified in the xml configuration file.
The ADInterfaceMCCWriter
has one multiport input. This
port is used to collect the data that need to be sent
to the ADInterfaceMCCdevices. The ADInterfaceMCCWriter
has the output ports shown
in Table 5.12, “Output ports of the ADInterfaceMCCWriter
actor.”.
Table 5.12. Output ports of the ADInterfaceMCCWriter
actor.
Port | Description |
---|---|
errorSignal | If there were no errors in the previous data exchange, then this port outputs zero. Otherwise, the output is a non-zero integer. |
errorMessage | If there was an error in the previous data exchange, then this port outputs the error message that was generated by the ADInterfaceMCCWriter actor.
(The error messages that were generated by the binary of the ADInterfaceMCC are output of the consoleOutput port.) |
consoleOutput |
This port outputs the standard output stream and the standard error stream of the binary that communicates with ADInterfaceMCC. |