LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SMA Sunny WebBox UDP data parsing

Hello, I have managed to get data from SMA Sunny WebBox using RPC through UDP, but I can't seem to convert the data from UDP read VI from a string to number after obtaining the values using array. 

Any idea what type of string/data is coming out of UDP read VI?

I have also noticed the string for each letters have one spacing between each other.

 

I have attached some images below.

 

Thanks,

Jason

0 Kudos
Message 1 of 7
(1,204 Views)

After checking the code. I found out the output of the UDP read to be an ASCII code.

 

How do I convert ASCII code to back to normal strings?

 

Thanks,

Jason

0 Kudos
Message 2 of 7
(1,166 Views)

Seems I had fix the issue myself, thanks. Here the VI to log data every 15 seconds from SMA Sunny WebBox using UDP everyone 😃

 

The solution to the parsing was to simply strip '0' I have inserted.

Strip.png

0 Kudos
Message 3 of 7
(1,145 Views)

Hi Jason,

 

two comments:

  1. Those intermixed zero bytes seem to indicate UniCode is used instead of plain old ASCII for communication with your device. I guess the manual of your device should have explained that, but you forgot to attach the manual. (After reading the manual it is clear it uses UTF-8 encoding…)
  2. That subVI used to convert the UDP string into seperate items should use a cluster/array for all its output values to minimize the connector pane. And you should NOT use a local variable to send the string data into the VI: ever heard of RACE CONDITIONs before?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(1,141 Views)

UTF-8 does not use embedded 0 bytes. This is definitely UTF-16BE if it works like this. As long as you do not use extended ASCII characters, the LabVIEW strings would be directly compatible with UTF8, since the first 127 character codes in UTF8 are equivalent to the 7-bit ASCII codes that are also used in all normal Windows codepages for the first 127 characters.

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 7
(1,133 Views)

Hi GerdW,

 

I took a few days break in between when programming this and I seems to have forgotten about the removal of '0's when I am back to programming it. 😅

 

In order to prevent race condition, what would be the better way to send string data to the VI. Do I link it directly? I realise the data from UDP is slightly slower than the data at the indicators.

I need those indicators on the GUI, would using array for the output values achieve the same results?

 

Thanks, 

Jason

0 Kudos
Message 6 of 7
(1,115 Views)

Hi Jason,

 


@Jason_Y wrote:

In order to prevent race condition, what would be the better way to send string data to the VI. Do I link it directly?


Yes, usually you just use wires to transfer data! (Pretty basic LabVIEW stuff…)

 


@Jason_Y wrote:

I need those indicators on the GUI, would using array for the output values achieve the same results?


In the end: yes.

I prefer clusters as you can label each cluster element individually…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 7
(1,111 Views)