LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using my Notifier to update an array

Solved!
Go to solution

Hi all. 

So I have now some data from a textfile, that I can parse over to some string indicators, like shown below:

ChristianLiinHansen_0-1625750603903.png

ChristianLiinHansen_1-1625750634480.png

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?  

0 Kudos
Message 1 of 8
(1,428 Views)

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?

0 Kudos
Message 2 of 8
(1,424 Views)

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. 

0 Kudos
Message 3 of 8
(1,367 Views)

@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

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 8
(1,393 Views)

Did you not get the VI's? 


0 Kudos
Message 5 of 8
(1,375 Views)
Solution
Accepted by topic author ChristianLiinHansen

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!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 8
(1,352 Views)

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"

ChristianLiinHansen_1-1625834960412.png

 

2) From the attached file "ReadingDataFile Message Loop.vi" I place the array with floats on the UI Message Loop. 

ChristianLiinHansen_0-1625834832976.png

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

ChristianLiinHansen_2-1625835170732.png

 

 

Download All
0 Kudos
Message 7 of 8
(1,307 Views)

@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 🙂 

0 Kudos
Message 8 of 8
(1,305 Views)