05-18-2016 02:41 PM
Hello,
I am new to LabVIEW. I am communicating with LV via a robot. The robot is constantly sending updates of its position to LV via TCP/IP. The robot sends LV these positions as seperate messages as strings. In LV, I want to count how many messages (strings) it receives in 1 second. Anyone have any ideas on how to do that?
Thanks in advance for any help!
SM
05-18-2016 02:47 PM
Use the Search Replace string function, telling it to replace all found instances, and the returned function will tell you how many it replaced. You don't need to actually used the replaced string.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-18-2016 02:51 PM
I guess I also failed to mention I need to display the resulting number of strings per second as a DBL. How would I do that?
Thanks,
SM
05-18-2016 03:02 PM
With either a feedback node, to track how much time has gone by over a period of time. Or you use something like the Elapsed Timer VI, which will only trigger once every set amount of time. So either calculate how much time has gone by, or set a known about of time to go by and use that in your calculation.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-18-2016 03:07 PM
Could you show me an example, I think I'm confused on what you are trying to say Hoovah.
Thanks,
SM
05-18-2016 03:11 PM - edited 05-18-2016 03:12 PM
No problem. By the way this picture is executable code, no need trying to recreate it.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-18-2016 03:55 PM
I tried doing that with my incoming string as the input and it didn't really work. Any other suggestions?
Thanks,
SM
05-18-2016 04:00 PM
What does "it didn't work" actually mean? If you want suggestions, please post your latest VI so we can see what you've tried. Post it with the incoming data saved as a constant or as default data in a control so we can see what the data looks like.
05-18-2016 04:05 PM
Well I mean it doesn't count how many strings are received per second. I can't post it because it has too many things in it. The data is just an incoming string that starts with "10....", so I tried what Hoovah suggested, and searched "10" but all it is doing is saying "0.0001" and stays that way. Attached is a screenshot of my code.
Thanks,
SM
05-18-2016 04:08 PM
How fast is your loop running? If it is running once a millisecond, and you get 10 strings, then your calculations are going to be .0001. (And don't you want to take the number of string and DIVIDE BY the time to get strings / second? Right now you are seconds per string.)