07-08-2021 08:26 AM
Hi all.
So I have now some data from a textfile, that I can parse over to some string indicators, like shown below:
The issue is that, the indicators, which is named "Channel 1 value 1, Channel 1 value 2.... Channel 4 value 2" is not possible to pass from this subvi to the main vi. Therefore I was thinking of using Notificer.
However I was only able to notify with a single float, not an array with floats. So basically, how do I make a notification when array with floats are updated?
Solved! Go to Solution.
07-08-2021 08:34 AM
We cannot debug pictures. Can you attach your VI instead?
Are you showing the main or the subVI in the picture?
Where do you read the file? (e.g. mainVI or subVI?)
How is the subVI called? Does it return quickly?
What does the program do with the data?
07-08-2021 08:54 AM
Ok, I will try to add my VI's here:
- CL1234dummy.log : Log file with 4 channels with 2 floats per line. (The format can not be changed, unfortunately)
- ReadingLastLineInDataFile.vi: Well, it reads the "last" line in datafile, i.e. the last line, that contain valid data. Not the real last line, because that is CR, and the 2nd last is just an empty line. So basically this vi reads the 3rd last dataline 😉
- ReadingDataFile Message Loop.vi: This is the "Main loop" for the ReadingDataFile. This has been implemented to support the design structure from the template of Queued Message Handler.
So basically I just need to understand the following:
1) Will I be able to use a notifier to, which refnum is an array of floats? I can only get it to work with a refnum of type float, but not a type array of floats.
The main VI is basically the main.vi from the template of the Queuede Message Handler project template.
07-08-2021 09:15 AM - edited 07-08-2021 09:20 AM
@ChristianLiinHansen wrote:
The issue is that, the indicators, which is named "Channel 1 value 1, Channel 1 value 2.... Channel 4 value 2" is not possible to pass from this subvi to the main vi.
Huh? That makes no sense. Looking at your PICTURE (BTW: actual code would be better so we can run it) all of your String indicators should update when your program exits that case.
But we can't see what the other cases in that case statement do so who knows?
Also I am not a big fan of Notifiers so I never use them, but I don't think l this sounds like a proper use case for them. As Notifiers are used to communicate between While Loops, not sub-vi to parent vi.
I will toss this out: When I need to update a front panel indicator from a sub-vi I usually use a Reference
07-08-2021 09:24 AM
Did you not get the VI's?
07-08-2021 10:27 AM - edited 07-08-2021 10:30 AM
Hi Christian,
@ChristianLiinHansen wrote:
1) Will I be able to use a notifier to, which refnum is an array of floats? I can only get it to work with a refnum of type float, but not a type array of floats.
Why do you want to use a notifier at all? You already use a QMH approach!? Can't you send a message on one of those queues?
On your ReadDataLine VI: it may also look like this:
IMHO it would make more sense to output all 8 values in an array instead of using 8 scalar indicators and 8 connectors on the connector pane! (You are building an array of those 8 values in your calling VI anyway!)
07-09-2021 07:53 AM
So thanks for the reply.
I completed the task by placing the array of float into the UI queue. I.e. I did not use the Notifier afterall, because the data was only required to be pulled every 60 seconds. So I do the following:
1) Reading the last datafile from the subvi, which I have attached as "ReadingLastLineInDataFile.vi"
2) From the attached file "ReadingDataFile Message Loop.vi" I place the array with floats on the UI Message Loop.
3) And from the UI message loop, in the case, where it was reading the "DataToShow", I then take out the string array and show in the main array of the HMI
07-09-2021 07:55 AM
@GerdW wrote:
Hi Christian,
@ChristianLiinHansen wrote:
1) Will I be able to use a notifier to, which refnum is an array of floats? I can only get it to work with a refnum of type float, but not a type array of floats.
- You have an array of notifier refnums: you cannot connect that array to a SendNotiifcation node…
- The elements of that refnum array are of type "float": that's why SendNotification expects a scalar float to be sent…
- When you want to notify with an array of floats then you need to define a notifier reference of that very datatype!
Why do you want to use a notifier at all? You already use a QMH approach!? Can't you send a message on one of those queues?
On your ReadDataLine VI: it may also look like this:
IMHO it would make more sense to output all 8 values in an array instead of using 8 scalar indicators and 8 connectors on the connector pane! (You are building an array of those 8 values in your calling VI anyway!)
So, Thanks GerdW for the solution regarding array and stick to the QMH approach 🙂