04-20-2021 03:16 PM
Good evening,
I was able to successfully create a vi that does what I need, after some long hours messing with labview and modifying my needs.
Right now, my issue is syncing the rate of read.
Basically, I have one arduino which outputs a serial write of both rpm and torque.
I wanted to now add a second arduino which outputs information such as temperatures, fuel flow and air-fuel ratio. However, both arduinos have different output speeds. As such, when I run the vi, it seems that labview doesn't skip any read but refreshes all the information as quickly as the slowest arduino outputs. (For example, if one arduino outputs 4 times per second and the other one only 2 times per second, then labview will refresh only 2 times per second and quickly the quickest one will be presented later and later).
Could someone help me displaying everything as soon as it is read and, when saving to the file, make sure that each save iteration will save the latest values read?
PS: I was able to do that, apart from saving, if I create two while loops separately and without any flat sequence, however, I can't then find a way of saving the information.
The V1 vi, I can display the values as they are read but I can't find a way fo saving the values.
The V2 vi, I can save the values but the slower read stalls the faster one.
My alternative is trying to using only one arduino. However, this is last resort.
Could someone please help me?
Best regards,
Alexandre
04-21-2021 12:29 PM
I finally found out the issue. I didn't know about the channel write and read. Using those tools and configuring as tags, I was able to do what I needed.
Now, the only thing I would like to do is select the range of the charts, but other than that, it's working as I wanted. I leave my vi if someone needs it.
Cheers
04-21-2021 01:27 PM
Instead of using four separate channels per loop, build an array of the four measurements in each loop and send the array in one channel wire.
Also you can remove the Flat Sequence structure as it is superfluous... (Think Data Flow)
04-21-2021 02:23 PM - edited 04-21-2021 02:34 PM
Thank you for the advice. I tried building the array inside each loop and sending it to the save loop. However, what channel write/read should I use? I thought I should use the accumulator tag since the tag only can't send arrays, only single values. Stream doesn't seem like the correct channel to use since it doesn't replace the latest array. Can you please give me some advice?
EDIT: Nevermind. Somehow, in the beggining it was giving me an error when I tried keeping the tag as before. I tried using lossy stream but the save loop was as slow as the slowest while loop (in my case, the second/bottom while loop). I reverted to tag and it is still working without any issue, apparently.
I'm uploading the vi with the changes you suggested. I think now it's fine but if you see any strange thing, please let me know.
Also, do you, by any chance, know a way of changing the range of the charts, ie, changing the x-axis to display the latest 10 values, for example?
Thanks
04-21-2021 03:17 PM - edited 04-21-2021 03:18 PM
@alexbigmac wrote:
Thank you for the advice. I tried building the array inside each loop and sending it to the save loop. However, what channel write/read should I use? I thought I should use the accumulator tag since the tag only can't send arrays, only single values. Stream doesn't seem like the correct channel to use since it doesn't replace the latest array. Can you please give me some advice?
EDIT: Nevermind. Somehow, in the beggining it was giving me an error when I tried keeping the tag as before. I tried using lossy stream but the save loop was as slow as the slowest while loop (in my case, the second/bottom while loop). I reverted to tag and it is still working without any issue, apparently.
I'm uploading the vi with the changes you suggested. I think now it's fine but if you see any strange thing, please let me know.
Also, do you, by any chance, know a way of changing the range of the charts, ie, changing the x-axis to display the latest 10 values, for example?
Thanks
As for your X-Axis you can set the "Chart History Length", caveat being you can't change the history length during runtime.
04-21-2021 03:22 PM - edited 04-21-2021 03:35 PM
What I mean is, as you can see from the pictures, I can't change the x-axis range. In this case, it always displays the last 105 values or so. Can't I change it so that it displays the last 10 or something like that?
Cheers
EDIT: I found out. All I have to do is change the minimum and maximum scale to, say, 0 and 10 respectively and it will display the last 10 values!
Thanks for all the advice.
04-22-2021 12:49 AM - edited 04-22-2021 12:51 AM
Hi Alex,
another suggestion for code improvement:
To create additional indicators to show the current value of each chart is also considered Rube-Goldberg!
All you need to do is to enable the "Digital display" of each chart in its context menu (aka right-click menu)!
@alexbigmac wrote:
However, what channel write/read should I use? I thought I should use the accumulator tag since the tag only can't send arrays, only single values.
Why do you think the tag channel wire can't handle arrays? You just need to create a tag channel from the BuildArray output…
04-22-2021 05:43 AM
@GerdW escreveu:
Hi Alex,
another suggestion for code improvement:
To create additional indicators to show the current value of each chart is also considered Rube-Goldberg!
All you need to do is to enable the "Digital display" of each chart in its context menu (aka right-click menu)!
@alexbigmac wrote:
However, what channel write/read should I use? I thought I should use the accumulator tag since the tag only can't send arrays, only single values.
Why do you think the tag channel wire can't handle arrays? You just need to create a tag channel from the BuildArray output…
I was only testing the vi to make sure that it worked the way I wanted/needed. Now I'm optimizing the dials and charts and all that to make sure that I keep it simple. But thanks for the advice! That reference was great ahah
I thought it could. But when I made the changes, it gave me an error. But then I deleted and created the tag channel again from the build array and it worked fine. Now I only need to make the vi look pretty!