12-03-2025 10:31 AM - edited 12-03-2025 10:31 AM
Hi,
I have to implement an exe that reads UDP packets and check if a bit of the payload is 1. The exe have also to print a record of the packet on a file.
I have developed that exe in the file here uploaded but on windows each loop take around 250ms, while the packets sent to me are in the order every 10ms at maximum (it can be less).
How can I improve my exe? A buffer in reading messages and a buffer for printing records can be helpful?
Thank you for the help.
Best Regards,
Zuc
Labview 2019
12-03-2025 11:28 AM - edited 12-03-2025 11:55 AM
Can you isolate the inner code into a simulation ( no UDP, just generating typical strings for the inner code) so we can test it. Do you have documentation on the string structure?
12-03-2025 11:39 AM - edited 12-03-2025 11:45 AM
Also, "array to spreadsheet string" adds a linefeed, so using that subVI (which does the same but removes the trailing linefeed) and then adding a linefeed afterwards is just more complicated.
You can just clear error 56, replacing that case structure in the error case.
12-04-2025 03:13 AM
Hi,
I try to answer point by point:
1. I have removed the Text.text property since it was slowing down the loop (here after the updated version of the VI)
2. The subvi only check in the UDP payload if a bit is 1 or 0, but I link that too.
3. I need that time format that is not the default in case I directly connect the get date time as it is, if there is a smarter way open to improve but I need a timestamp like: 2025/12/04 09:44:50,785
4. The EOL is need since I am printing the txt log file row by row I need to pass to the next line at the next loop.
5. Why a chart? I don’t need to print anything.
6. Why the spreadsheet vi? I need to pass from an array to a comma string to print in txt. Maybe I am missing the point but with your suggest you are doing the exact opposite of what I need. From spreadsheet vi I obtain an array as output.
My point is: given my Vi SimpleUDPReceiver.vi is it possible to reduce the loop rate under 10ms? Doing everything is doing?
Thank you for the help and the advices.
Best regards,
Zuc
12-04-2025 06:58 AM
How fast do the packets arrive and how irregular is the time interval? If the loop code is slowing you down, put the UDP receive in a separate loop and push the raw data into a queue, to be read a leaisure in a parallel process.
12-04-2025 07:40 AM
@altenbach wrote:
I'll have a look at the subVIHow fast do the packets arrive and how irregular is the time interval? If the loop code is slowing you down, put the UDP receive in a separate loop and push the raw data into a queue, to be read a leaisure in a parallel process.
OK, your subVi is pure madness. I have no idea what an "Octec" is, but in your world it seems to be 16 bits.
All you need is take the raw string, cast it as U16 array and check the desired bit. Compare:
12-04-2025 08:13 AM
Hi Altenbach,
1. with the text.text, you mean this part? In that case it was my only way to get a string expressed as "45AD FF24 49D2" where i have the Octets divided by spaces.
2. Thank you
3. Done thank you
4-6. Done thank you for the advice and sorry for the misunderstanding
5. No problem it was and old case struct, a copy and past error
Tha packets have to arrive every 1ms and I have seen that the while loop follow messages every 4ms. It is also true that the sender run in windows so the delays can be also addressed to that. That's way i'm removing every possibility of delay on my side.
Thank you for the help!
Best Regards,
Zuc
12-04-2025 08:58 AM
Sorry for the mess I have learned Labview by myself without courses
What is this function?
Thank you for the help!
12-04-2025 09:56 AM
@Zuc_lab2 wrote:
Sorry for the mess I have learned Labview by myself without courses
What is this function?
Thank you for the help!
Logical Shift Function
See: https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/logical-shift.html
12-04-2025 10:07 AM
Not that my code currently only works correctly if the string length is even. Personally, I would convert the string to byte array.
Can you give your definition of "Octec"? Typically one would talk about octets.