Current Position:Home > Basic application to record data

Basic application to record data

Update:11-30Source: network consolidation
Advertisement
I've built this application to acquire data from a couple DAQmx tasks. I want to record the temperature, pressure and liquid levels into a file. I also want to be able to turn a set of thermocouples on/off at the user's preference. I've successfully been able to record the data from the task that I want to, but that's about it. I know my code is janky, and I'm probably doing everything wrong. This is my first attempt at LabVIEW, and I'm trying to learn. Please take a look at my .vi and help me make it better.
Help I'm looking for:
I know the crazy while loop structure I have now is not the preferable way to do things. How can I clean this up?
How can I make a better timestamp for the spreadsheet file I'm writing to (I just want it to count elapsed seconds from the start, which it currently does, but maybe write the current date and time as a header)?
How can I activate/deactivate the thermocouples at the flip of a switch and possibly write that information to the same file as the other spreadsheet?
Why do the inner while loops continue to execute when I stop the outermost while loop?
Note: The function box for that converts a voltage to temperature, pressure and liquid level does not contain the actual functions I will use, those are just standins until I can actually test the program witht the real hardware.
Attachments:
SemiCont.vi ‏25 KB

The Best Answer

Advertisement
The while loops themselves are not so crazy.  Parallel loops are often used to run several tasks simultaneously and at different rates.  The outer loop is not necessary.  There are better ways to set the overal timing.
Two of your loops are infinite loops.  The only way to stop them is with the Abort button on the toolbar.  This is a bad way to stop a program. Someone on the Fourm suggested that using the Abort button to stop a VI is like using a tree to stop a car: It works but there are often undesirable consequences.  A notifier is a good way to use one button to stop multiple loops.
Use of local variables to move data around in a program is poor practice.  It can lead to race conditions and slower performance.  It is also more difficult to maintain.  The best way is always a wire.  However, you cannot wire data from one loop to another which runs in parallel.  You can use queues, Action Engines, and LV classes (LVOOP).  Search the help or the Forums for lots of information about these topics.
The formula nodes can be replaced by simple LV primitives (subtract, multiply, and divide).  All of those can be used directly on arrays.  No need to convert to clusters and unbundle.  To break out the data for display, either use an array indicator or Index Array.
Write to Spreadsheet File.vi opens, writes, and closes the file every time it is called. Doing this once a second for 8 data points seems excessive.  Accumulate data perhaps for a minute and then write?
Look at the Producer/Consumer design pattern and examples.
Documentation about what each loop does and why is a good idea.
Lynn
  • Basic application to record data Update:11-30

    I've built this application to acquire data from a couple DAQmx tasks. I want to record the temperature, pressure and liquid levels into a file. I also want to be able to turn a set of thermocouples on/off at the user's preference. I've successfully

  • How can I save captured clips to hard disk using the actual video recorded date, not the date I transferred it? Update:11-30

    When using Batch capture in AP5.5, the clips are saved to hard disk using the capture date as the Created Date and Modified Date.  How do I configure Premier to use the actual clips recorded date (Meta Data Basic/Date Created) so that I can view them

  • Recording data at particular iterations and writing to text file Update:10-11

    Hi all, this is my first time posting on the NI boards. I'm running into a couple problems I can't seem to figure out how to fix. I'm collecting data using a LabJack U3-HV daq. I've taken one of the out-of-the-box streaming functions that comes with

  • Control Record - Data fetch in IDOC Update:10-11

    Hi Folks, Can you please tell me from where the Control Record data for ORDERS and ORDCHG gets populated. ? I have checked the FM - IDOC_OUTPUT_ORDERS which has one of the import parameters as control_record_in which is already populated when it reac

  • Some question on IDOC (Control Record/Data Record/Status Record) Update:10-11

    Dear all, I am new in this area, and would like to enquire some question on this topic. When I view a IDOC via WE02, each of the IDOC record will consist of Control Record/Data Record/Status Record). Questions: I notice that the data records consists

  • Query WHERE statement to compare db record date Update:11-30

    Hello I can't get this where statement to work. I have it now so it is not throwing any errors, but it also isn't doing what it is supposed to. I am trying to match records date in my table with the actual calendar date, if there is a match, my cfif

  • Can anyone please tell me some basic infomation about Master data? Update:11-30

    Can anyone please tell me some basic infomation about Master data like 1)The history of master data 2) Why it is so critical 3) What the advantages of it 4) What is the future of master data Any inputs in this regard will be very helpful Thanks in ad

  • Remove application without losing data. Update:11-30

    I have an application which contains data I want to keep, but it is taking up all the space on my iPhone. So, I want to remove it temporarily until the update is released that will allow me to take this data directly off the application. Basically, i

  • Is it possible to record data directly from PXI-5112 scope card through PXI bus to SCSI RAID array (connected to PXI-8210)? Update:11-30

    Colleagues, Is it possible to record data directly from PXI-5112 scope card through PXI bus to SCSI RAID array (connected to PXI-8210)? Which will be the maximum transfer rate for continuous data recording? Thank you, Sergey SergeySergey, The PXI-821

  • PROBLEM Creating a Sample Application from Uploaded Data - ENDECA 3.1 Update:10-11

    Good morning. I'm installing OEID 3.1 and y have many problems. One is when i want to créate a Sample Application from Uploaded Data following "InfoDiscGettingStarted.pdf" I have the next error message: "Task execution failed for workflow I