Unfortunately, the VISA libraries have limited portability. This means they work primarily on Windows desktop computers but cannot be compiled for other operating systems, such as the QNX RTOS used by Simulink Real-Time. Therefore, it is not possible to communicate with test and measurement (T&M) devices via VISA from a Speedgoat.
Consider one of the following workarounds:
1) SCPI via Common Communication Protocol:
Check if your T&M device supports SCPI via a common communication protocol supported by Simulink Real-Time (TCP, UDP, serial).
If you are unfamiliar with SCPI commands, and have a license for Instrument Control Toolbox, you can first connect your T&M device to MATLAB to exchange SCPI commands:
Then, implement the commands in your Simulink Real-Time model. You can use a Stateflow chart to implement the scheduler, especially for two-way communication between the Speedgoat and the T&M device.
2) Using VISA with a Windows PC:
If VISA is the only option, you could consider routing the Speedgoat - T&M device communication through a Windows PC (it can be your host PC with MATLAB/Simulink, or any PC). The Speedgoat would send the data to the PC via a protocol like TCP, and the PC relays the data to the T&M device. However, note that a Windows PC is not real-time capable.
To implement this on the PC, if you have access to Instrument Control Toolbox, you could either:
- Run a MATLAB script with "tcpclient" and "visadev" in a loop, or
- Run a Simulink model with "TCP/IP Receive" and "Instrument" or "VISA" (23b+) blocks
This example is a starting point for exchanging TCP packets between the Speedgoat computer and the Windows host PC:
You would then need to integrate "visadev" into the MATLAB script:
One way to do this is to use callbacks with "tcpclient" that fire when a terminator (end of command character) is received. In the callback, you can use "visadev" to send SCPI commands to the T&M device. This could be done in a few lines of code in MATLAB. Or, adapted to a MATLAB Function block in Simulink.
Alternatively, use any programming language of your choice that can handle TCP and VISA communication.