Arduino external mode USB - Virtual Desktops

1 view (last 30 days)
Hello,
we are trying to make simulink and arduinos work in external mode with our VDI infrastructure. We are using Horizon View and we are redirecting the client USB per IP to VMs in our datacenter. Compiling and deploying works, we have issues when we sample data over 200Hz, I presume the added latency is the culprit here. Is there a way to compensate for the higher latency caused by the USB redirection?
Cristiano

Answers (1)

Gillian Rosen
Gillian Rosen on 11 Apr 2017
Hi Cristiano, 
I understand that you are running a simulation in External mode on Arduino through a Virtual Desktop interface, but you are encountering issues when you try to sample at over 200 Hz. 
First, please note that MATLAB is not qualified against virtual desktops, and therefore, virtual desktop operations are not guaranteed to perform as expected. 
If you are experiencing lagging data or missing data points, you may be able to correct this by changing the Duration parameter in your model's External mode settings. 
The Duration value specifies the number of contiguous points of data to be collected in each buffer of data-  this value should be large enough that the time it takes to send the data is less than the times it takes to log the next packet of data. If you enter a value less than the number of available sample points since the previous sent packet, you may lose sample points during the time spent transferring values from the data buffer to the MATLAB workspace.
To set this value, please use the following steps:
1. Under the 'Code' tab in the Simulink window, select 'External Mode Control Panel'.
2. Open the 'Signal and Triggering...' window.
3. Set the Duration parameter.
4. Click 'OK' to apply your changes and close the window. 
By default, the Trigger duration for Arduino models is set to 2. To prevent loss of data, increase the duration to  a value greater than 2 (For instance, for a sample time of 1 ms, set the Duration to 10).
For more details, please see the following documentation link:

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!