LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FGV multiple read write reliability

Hi All

Wonder if I could have some help please!.  I am working on a large application and I want to seek some advice on this please where I am using FGV to share large amount of data between various Timed and while loops. Interestingly, whole application is working, but it does not seem to follow ‘science’ by which I mean when I am reading FGV, I do not expect to be writing FGV as FGVs are non-reentrant. However, application is working and I want to be sure that it is a reliable application and would not generate run-time errors in future due to FGV not being written when it is supposed to do!

 

Your comments would be truly appreciated. Please advise:

 

  1. Within Timed loop using ‘Create 1kHZ.vi’, I am reading using FGV at 1tick. However, in various other timed and while loops, I am writing into these FGVs. The data I am writing is not time critical, so I don’t mind if it is read in Timed Loop non-deterministically as long as it is eventually read, it would be fine. I understand that FGV architecture is non-reentrant and ‘Write’Instance’ may not execute while ‘Read Instance’ is executing. Does that mean that execution in the write loop stops and wait to push value in between short time window of 1ms which is the time period of timed loop?
  2. Any advice on to improve this data communication. It is only application setting data such as buttons on/off statuses, references, scaling factors etc. It does not contain any IO data.
  3. Is it possible to run Timed Loop or any loop in windows environment faster that 1ms. The option to set Timed Loop at 1us is not selectable.

 

Many Thanks in advance

Best regards

KWaris

 cld.jpg

ATE and Labview Consultant
https://www.easybodge.com
0 Kudos
Message 1 of 5
(4,306 Views)

@k-waris wrote:

Hi All

Wonder if I could have some help please!.  I am working on a large application and I want to seek some advice on this please where I am using FGV to share large amount of data between various Timed and while loops. Interestingly, whole application is working, but it does not seem to follow ‘science’ by which I mean when I am reading FGV, I do not expect to be writing FGV as FGVs are non-reentrant. However, application is working and I want to be sure that it is a reliable application and would not generate run-time errors in future due to FGV not being written when it is supposed to do!

 

Your comments would be truly appreciated. Please advise:

 

  1. Within Timed loop using ‘Create 1kHZ.vi’, I am reading using FGV at 1tick. However, in various other timed and while loops, I am writing into these FGVs. The data I am writing is not time critical, so I don’t mind if it is read in Timed Loop non-deterministically as long as it is eventually read, it would be fine. I understand that FGV architecture is non-reentrant and ‘Write’Instance’ may not execute while ‘Read Instance’ is executing. Does that mean that execution in the write loop stops and wait to push value in between short time window of 1ms which is the time period of timed loop?
  2. Any advice on to improve this data communication. It is only application setting data such as buttons on/off statuses, references, scaling factors etc. It does not contain any IO data.
  3. Is it possible to run Timed Loop or any loop in windows environment faster that 1ms. The option to set Timed Loop at 1us is not selectable.

 

Many Thanks in advance

Best regards

KWaris

 cld.jpg


You have basically the right idea of the FGV - one one caller will execute the FGV VI at any one time and any others will block. However I suggest that the data "traffic" be one way - one writer and muiltiple readers; otherwise there are better and less fragile options available.

 

Windows can't do any better than 1ms; in fact I would be suprised if you got this level of precision consistently at all. It's not a real-time OS so it can't be asked by LabVIEW to perform as one. If you really need a guarantee of faster precision then you need to move to real-time - that's why the 1us option isn't available.

 

However it seems like you are only doing UI operations - I'm suprised that you need faster response than around 10-20ms or so for UI responsiveness.

0 Kudos
Message 2 of 5
(4,295 Views)

Many thanks for your reply. It would really help if you could please advise

'one one caller will execute the FGV VI at any one time and any others will block'

so what happens to that particular 'Write Instance' which is blocked because 'Read instance' is being performed thousand times faster. Does it wait? Get Queued and is executed upon its turn?.

It is certainly not spoiled as my application seems to be working well.

Regarding OS, I am developing a reliable application using Daq PCIe card to be eventually execute on Linux. I might get close to couple of millisecond deterministic acquisition!!

Many Thanks in advance

Best regards

KWaris

 cld.jpg

 

ATE and Labview Consultant
https://www.easybodge.com
0 Kudos
Message 3 of 5
(4,271 Views)

Do they not cover FGV in the CLD anymore?  a FGV can be reentrant, it just very often is a bad idea, and usually better alternatives exist.

 

A FGV is usually like a lossy queue, that only ever contains one element, and whose last write is unknown.  This statement can be made false with extra work, but generally this is the case.  A FGV does not sound like the right tool for this situation and a lossless queue, or user event, sounds better.  This will ensure when new data comes in you do something.  And if 10 new pieces of data came in, you do that thing 10 times.  You can also add a timestamp to the queue data and know when that data was put on the queue to be processed.  Of course it sounds like you are asking multiple questions and they might not be related, which is why my suggestion might not be right.

 

As for your microsecond timing question.  Have you ever had Windows stop responding for multiple seconds, or minutes?  Where your mouse and keyboard just don't do anything?  What will your program do doing this?  Good luck getting microsecond timing, if you can't get millisecond timing.  What about when anti-virus programs spin up and take over?  My point is Windows is an operating system that will give you the time of day, but it might be a while until it answers.  You cannot rely on Windows to behave in a time critical manor.  All the more reason to use queues, and buffers to hold onto the data until you can get around to it.  That is if you can process the data faster than it is coming in.  If you need a real time system, then you need a real-time system.

 

 

0 Kudos
Message 4 of 5
(4,255 Views)

I get scared when people say "I am using a FGV to share data between loops."  If all you are doing is a Get/Set (meaning you just write a value to the Unitialized Shift Register in the Set case and just read from it in the Get case), then the point of the FGV is nullified.  You are not protecting against race conditions.  You have a lossy communications.  And you are much slower than just using global variables.  See this article I put to gether a few months ago.

 

So if you actually do care about every data point, then you need to use a lossless communication scheme: ie Queues and/or User Events.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(4,194 Views)