Reading data into SIMULINK/MATLAB over UDP
6 views (last 30 days)
Show older comments
I am trying to read data into my SIMULINK model using the UDP receive block in the Instrument Control Blockset (I have also tried the UDP block from the Signal Processing Blockset). Within my local network, I have a device that is broadcasting data over the network using UDP protocol. I believe that I have entered all the parameters in the UDP block correctly and yet MATLAB does not seem to be able to communicate with the device. I have also tried using the tmtool in Matlab with a similar result. I created an interface object for the device and tried receiving data while it was broadcasting but I still do not receive any data. I have performed the following checks: 1) I pinged the IP of the device from the computer where MATLAB and it responds fine 2) Using wireshark, I could see that the device was broadcasting the data.
If you go to the URL below, you can see a snapshot from Wireshark. It shows the destination IP (set up for broadcast), the source IP, and the port numbers.
Can someone help configure the SIMULINK blocks (or the tmtool in MATLAB) so that I can receive the data being broadcast?
Thank you very much for your help.
Juri
0 Comments
Accepted Answer
Andres
on 3 Aug 2011
If your network configuration works fine and you are sure of it you should check your data configuration
The data type that you had choose is really significat when getting a correct output. Make sure that both data types match and also check the endian type chose (better try Littel Endian frist)
0 Comments
More Answers (1)
Arnaud Miege
on 5 Apr 2011
If creating a UDP object in MATLAB does not work, then it's no surprise that the Simulink approach does not work either.
What are the settings of the UDP Receive block? Have you tried clicking on the button " Verify address and port connectivity "? Does it work?
HTH,
Arnaud
2 Comments
Arnaud Miege
on 18 Apr 2011
Yes, I saw the snapshot, but that doesn't tell me much. It would be much more useful to know how the blocks are configured and what you get when you try "verify address and port connectivity" in the UDP Receive block. You can probably leave the local port to -1 (automatic) and the port needs to match what's on the host you're connecting to. Is the data encoded in any way, does it need to be decoded? You can also look at what's coming out of the status output.
See Also
Categories
Find more on Instrument Connection and Communication in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!