11-03-2017 01:45 PM
Hello all,
I am trying to read values from a spreadsheet and feed those values to my controllers. I have attached the VI where every task is being carried out. Each VI has specific function written in it like reading data, writing data and evaluating/manipulating data. All these are timed loop. Inside the EVAL VI I am trying to read data from spreadsheet after each second and feed that data to my controllers. I have attached the block diagram of how it is being done.
The problem is when I run the EVAL VI block diagram it doesn't read the data after first row from spreadsheet, also it seems like my other data also get static as in they do not change frequently as they should. I am new to LabVIEW, so i do not understand what i should do?
I tried putting a while loop inside timed loop with wait function at 1 second but that didn't work and I also think while loop is wrong as i am already using a timed loop.
Is there some synchronisation issue between different timed loop VIs? Please suggest what to do
11-03-2017 02:22 PM
Attach VIs, not pictures of VIs! Grrr. I see you are a brand new member, so you haven't heard me yell about how difficult and frustrating it is for those of us who would like to help you and to have to contend with incomplete and hard-to-read images that we can't examine closely, can't edit, and can't execute. Oh, well.
I assume you are not running on a specialized LabVIEW Real-Time Platform (such as a PXI or a RIO). If this is the case, don't use the Timed Loop! It is (probably) inappropriate and will (probably) steer you down the wrong path. Learn to use LabVIEW's parallelism (think Data Flow) and think, for yourself, what tasks need to be timed, and how they need to be sequenced and prioritized. For Timing of those tasks that need timing, use Hardware Timers (I see you are doing Reads and Writes of some, possibly DAQ, equipment, so take advantage of their hardware timing capabilities, which usually are far superior to Windows) or use LabVIEW's Wait functions (to slow down loops). For sequencing, the Error Line Is Your Friend. For synchronizing, learn about the Producer/Consumer Design Pattern (briefly, the Producer loop acquires data and hands the data off to a parallel Consumer loop that processes it -- in your case, you get data from the DAQ device and "export" it, often via a Queue, to another loop that processes and saves it "on the fly").
Oops -- I just re-read your original post, and have my Producers and Consumers mixed up. In fact, you might not need such a complex system, as your data rates are so slow you can do it all sequentially. Here's the plan (and how you should learn to think "outside the box" about problems like this):
Bob Schor
11-03-2017 02:30 PM
Sorry for not attaching the VI. Please find it, the code was written by someone else and I am trying to add some functions to it.
11-03-2017 09:47 PM - edited 11-03-2017 09:47 PM
Thanks. The code is pretty clear. I also understand that the code was "someone else's". What is not at all clear is what is intended by this code. What is clear is that the design is largely "wrong".
This is a classic example of focussing on "How to do so-and-so" (in your case, emphasizing multiple Timed Loops and some code to manage a DAQ resource) instead of concentrating on "What do I want to do" (which can often be best conveyed by a simple paragraph or two of narrative, with absolutely no care/thought to the process or code you need to do it.
Here are some of the things this narrative should include:
Once you know what you want to do, it is much easier to describe LabVIEW "conventions" that will facilitate it. If it does not include LabVIEW RealTime, then I would strongly suggest that you should not be using Timed Loops. The Descriptive Narrative described in the previous paragraph should make clear what parts are sequential, which parts are parallel, what the timing needs to be, what processing needs to take place.
Bob Schor
11-03-2017 11:27 PM - edited 11-03-2017 11:29 PM
So, the code is intended to do following:
So i don't know why turning on the transient button doesn't take readings and slows down the measurements being read from my daq.
Sorry, for bothering you. It's just i have to do the experiments and deadline is in 3 days and i have been at it for so many days.