UDP Communications between Target and Host PC

From Mech
Jump to navigationJump to search

Mathworks UDP Documentation

Click here to read Mathworks's documentation on UDP communications in XPC Target:UDP Documentation.

Sample UDP Models

Sample Mathworks Models:Mathworks UDP sample models.

Quick and Dirty Data Logging Model

Here is a crude and simple system that will use the Host PC to log data sent from the Target PC. Load udpsend.mdl onto the Target PC, and run udprec.mdl in Simulink on the Host PC. The target PC will send a timestamp and a 3-by-3 matrix of data; the host PC will receive this data, record the data into the workspace, and print it out in the MATLAB command prompt in real time.

Because you cannot make Simulink's time steps run in real time (it runs as fast as it can, which is usually much faster than the time step you specified in the model), you can't synchronize the target and host PCs. If you have your target PC send data slow enough, you should be able to get most of the data. This provided sample (tested on a 1.5GHz laptop computer) is reliable only if your target PC sends data every 0.5 seconds or slower.

Download the files here: UDP model.