AP - The Recognized Standard In Audio Test

Login / Register Contact

Home Solutions Products Downloads Service & Support Sales & Lease About News

Share with Friend
  • Service & Support
  • Overview
  • Knowledge Base
  • Training
  • Solutions Partners
  • Service Offerings
  • Schedule Service
  • Calibration
  • Shipping Instructions
  • Downloads
  • AP Warranty terms and conditions
  • AP Calibration Services Datasheet

Knowledge BaseHOME/SERVICE & SUPPORT/KNOWLEDGE BASE

Using APx with VEE and MATLAB (API Wrapper)

Created 23 Oct 2009

AP's API Wrapper resolves .NET limitations in VEE and MATLAB, allowing them to access the complete APx API for automation and systems integration.

The APx API (Application Programming Interface) supports the .NET framework, allowing extensive automation and data exchange using any .NET compatible programming language. Two of the popular languages that work with APx are VEE from Agilent, and MATLAB from The Mathworks. VEE is a graphical language designed to utilize interconnected hardware for measurement and analysis. MATLAB is optimized for computationally intensive tasks and has advanced graphing capabilities.

The APx API makes extensive use of .NET interfaces. In programming terms, an interface contains no functional code, but serves as a bridge between a program and the outside world. Although VEE and MATLAB can see these interfaces, their .NET implementation only enumerates a small subset of the properties and methods that are contained in them, leaving the others inaccessible.

To overcome this problem, AP software engineers have created a class wrapper—a dynamic link library (DLL) that wraps the APx API interfaces in classes, so that all the API objects become visible from within VEE and MATLAB. The wrapper is available as a separate download for APx 2.4, but starting with APx 2.5, it will be installed along with the APx application. We aren’t currently aware of any other programming languages that need the wrapper, but if any arise, the wrapper should accommodate them as well.

Block diagram.

Accessing the API directly vs. using the API wrapper.

Using the wrapper imparts no performance penalty, and it is essentially transparent—all you have to do is reference it at the beginning of your code. In a default installation, you would reference the API wrapper at:

 

C:\Program Files\Audio Precision\APx500 x.x\Api\AudioPrecision.API2.dll

where x.x is the version of APx500 you are running.

Using the APx API Wrapper with VEE

To use the wrapper in a VEE program, proceed as follows:

1) Open VEE and add references to both the standard and wrapper APx API .dll files.

.NET Assembly References dialog box.

Adding references to the APx500 API and API wrapper to the VEE program.

2) Create an instance of the "APx500_Application" object. This is the API object contained in the new DLL. To do so, select a Constructor for the APx500_Application object under AudioPrecision.API2 in the Function and Object Browser.

Function and Object Browser.

Creating an instance of the APx500_Application object.

3) Once the instance of the APx500_Application object has been added, you can build your APx500 program by adding a series of .NET operation builders.

Selecting Device>Operation Builder, then “Select a Type” in VEE Express.

Adding a .NET operation to the VEE program.

A simple sample program written in VEE is shown below. It does the following:

  • Opens APx500 with the application window visible.
  • Turns off the signal monitors.
  • Selects the measurement named Frequency Response in Signal Path1.
  • When the Start button is clicked, it sets the start frequency, stop frequency, and analog generator level, and then runs the Frequency Response measurement.

 

VEE program shown in graphical interface.

Completed VEE program  (see larger version)  (view VEE code text file).

Using the APx API Wrapper with MATLAB

Our MATLAB code accomplishes the same tasks as the VEE example above. The first three lines reference the API wrapper.

Matlab code in Matlab code editor.

MATLAB wrapper example  (see larger version)  (view MATLAB code text file).

Wrap Up

The API wrapper now gives VEE and MATLAB complete access to the APx API. That, along with our existing .NET connectivity and the APx LabView driver, makes it possible to integrate APx into virtually any test and measurement environment.

*****
jb


Related Downloads

APx API Wrapper (for VEE, MATLAB)

This APx API wrapper dll enables you to access the entire APx API when using Agilent VEE and The Mathworks MATLAB. A discussion and instructions are in the kb article "Using APx with VEE." This download is only necessary for APx 2.4. APx 2.5 and later already include it.

AudioPrecision.API2.dll (185 KB)

Return to Knowledge Base home

Comments

0 comments so far

Please log in to add a comment.

Back To Top

Accredited by A2LA

Browse Products View Solutions Schedule a Demo Get Service Register

Audio Precision

Copyright © 2009 Audio Precision Inc. All Rights Reserved.    |  Privacy Policy