LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to use VSA .NET API and having trouble with Class Structure

I am currently using the .NET API for an Agilent VSA application.  I am able to initiate a reference to locally setup an Agilent VSA application reference.  This allows me to use the various class properties within LabVIEW in the .NET API to manipulate main device settings (Frequency, bandwidth, etc...)

 

The most desireable class for me is the "Agilent.Sa.Vsa.Lte.MeasurementExtension" class within the LTE .dll (attached).  Without a proper reference to this class though, I can not obtain the properties from this class that are important to me.

Apparantly I need to use "type casting" to properly execute this class.

 

Please see the Agilent engineer's explanation:

 

There are three ways we provide access to the measurement extensions. I will try to describe them here and hopefully one of these can be used within Labview.

Meas.GetMeasurementExtension method performs the required typecasting and returns the measurement extension type. You must pass the type of the measurement extension into this method. In C# it would look like this:

lteMeas = app.Measurements.SelectedItem.GetMeasurementExtension(typeof(Agilent.Sa.Vsa.Lte.MeasurementExtension));


If a TypeOf function is not available you can perform your own typecasting using the Meas.MeasurementExtension property. In C# it would look like this:

lteMeas = (Agilent.Sa.Vsa.Lte.MeasurementExtension) app.Measurements.SelectedItem.MeasurementExtension


If typecasting is not available at all, like in Matlab, we provide a method that will perform this within the Measurement Extension object. In Matlab it would look like this:

LteType = Agilent.SA.Vsa.Lte.MeasurementExtension.ExtensionType;
LteMeasExt=vsaMeas.SetMeasurementExtension(LteType);
LteMeasHandle = Agilent.SA.Vsa.Lte.MeasurementExtension.CastToExtensionType(LteMeasExt);

 

 

I am attaching a sample VI where I attempt to reach the end results from the example from the Agilent engineer as well as the .dll files that are needed for the classes.  I am taking a guess that I can use "to more specific class" here to relate the reference created by VSA init and the class important to me.  However it errors when trying to relay the reference.  

 

Any suggestions as to how to apply what the person from Agilent has described?  I am new to using .NET with LabVIEW so I am not too familiar.

 

Thank you!

 

0 Kudos
Message 1 of 6
(3,713 Views)

Alex,

 

I can't test it but here's my translation of the C#/m code you were given:

 

asdf.png

 

I think the key thing you were missing was the .NET constant reference.

 

Good luck with the rest of your application.

 

~Simon

0 Kudos
Message 2 of 6
(3,702 Views)

Simon that did the trick!  You rule... the constant was the problem.  As you could see I was trying to pull the reference off of the property node for the class rather than using a reference constant.  

 

Thank you a ton!

 

-Alex

0 Kudos
Message 3 of 6
(3,683 Views)

Simon/All,

I have been using this method you helped me implement for a few months now without issue.  I now have a new PC for development and I have run into a very difficult issue where I am seeing type mismatching with the same .NET classes that have been used all along.  I have attached an example of code for one of the drivers I am using that is giving me this problem.  I run this same code on another Windows 7 PC and I do not see this same issue.  

 

I have tried many things to resolve this:

Installing many combinations of the .NET framework from MS.  

Matching the same version of LabVIEW and all NI related items (VISA, etc.) from the working PC

Exact versions of the .DLL files for the .NET classes from Agilent.

Same version of Agilent SW that the .NET API is built to control.

 

I don't believe the issue stems from Windows specifically and .NET because the failure behaves the same way even if I completely remove the .NET framework from the PC.

 

Do you have any other suggestions for possible solutions or causes of this mismatch?

 

Thank you again!

-Alex

0 Kudos
Message 4 of 6
(3,640 Views)

Hi SimonH and Alex,

 

I'm having a similar problem:

 

From 89600B VSA Software------>MeasSetup---->Measurement Type------->General Purpose------->Digital Demod.

 

I can do this manually from the VSA Software Application to configure Digital Demodulation. However, using .NET API in LabView to configure the VSA software to use Digital Demodulation is tricky. I created the VI similar like SimonH's attached file, but I couldn't find the way to tell me that I'm configuring the VSA to use Digital Demod.

 

For 89601A VSA Software, I used ActiveX controls to configure the 89601A VSA to use Digital Demodulation. ActiveX just tells you clearly where to get to DigDemod based on: AgtVsaVector._Application----->Automation Open---->App.Measurement-------------------->Measurement.DemodConfig------->vsaMeasDemodCnfDigital.

 

 

In .NET API LabView, I cannot find these similar way as in ActiveX.

 

All help are really appreciated.

 

Phong

 

Phong
0 Kudos
Message 5 of 6
(3,442 Views)

Phogn,

 

Since this is a fairly old thread, could you go ahead and make a new thread for your issue? This will give it higher visibility and help NI better sort out what kinds of issues our customers are having.

Kirk L. | Applications Engineer | National Instruments
0 Kudos
Message 6 of 6
(3,420 Views)