Using Simulink to Collect Data from a Network Analyzer

3 vues (au cours des 30 derniers jours)
Matthew
Matthew le 30 Mar 2015
Commenté : Vinod le 24 Juil 2017
I am currently trying to collect data from an Agilent (formerly HP) 8752C network analyzer. This device uses a GPIB connection. I have been able to connect to the device using the tmtool and have successfully queried the Network Analyzer for data. Using the tmtool connection, this data can be returned in the form of an ASCII string or as an array of a u8int. The returned array is multiple bytes long.
I need to collect data from the network analyzer for 10 seconds. I have tried to accomplish this using Simulink. I currently have the block "Query Instrument" set up to query the network analyzer using the same commands as the tmtool. The instrument response needs to be in the u8int binary data format because this type of network analyzer cannot use the fprintf commands as outlined here: https://www.mathworks.com/products/instrument/limitations.html#GPIB
I have connected the "Query Instrument" block to a "To Workspace" block to look at the data. However, when I run my simulation, each query to the Network Analyzer only returns one byte of data. This byte that is returned is the first byte from the returned query from the tmtool response.
What do I need to do to receive the other missing bytes of the response from the Network Analyzer in my Simulink program?

Réponses (1)

Vinod
Vinod le 1 Avr 2015
If you already have your MATLAB function that acquires the data from the instrument and formats it for use later, you could consider putting that code into a MATLAB function block. That should significantly simplify your task.
  2 commentaires
X W
X W le 24 Juil 2017
Hi Vinood, How is that done? I read the tutorials on MATLAB functions and combed the docs, https://www.mathworks.com/help/simulink/slref/matlabfunction.html
I see that the supported list for the block is: https://www.mathworks.com/help/simulink/ug/functions-supported-for-code-generation--alphabetical-list.html
I see neither gpib() nor visa() in that list, how do we go about using gpib or visa to stick into a MATLAB function block?
Vinod
Vinod le 24 Juil 2017
You are right that the MATLAB function block does not support C/C++ code generation for the GPIB or VISA functions. This is because these functions rely on external software to interface with hardware.
Does your application just involve a Simulink model that needs to pull in data from a Network Analyzer? Do you plan to deploy this Simulink model onto embedded firmware?
If your Simulink model only runs from within the MATLAB environment, you should be able to use the MATLAB function block.
If you are looking to create a standalone application, you may want to look at the MATLAB Compiler as a way to create a standalone executable.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Instrument Connection and Communication dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by