Using Write measurement to file There is a huge lag

I have written a code where it simulates faults i.e the primary i/p the square wave would have a high duty cycle <thats not the problem>
The problem is i have to store all the data and i'm using Write measurement to file .... but after some time there is a lag between real time and the time it has processed
require urgent help
Attachments:
Air_dryer_read_8.vi ‏659 KB

Such Kind of TimeOut to editing the first post but...
"real time and the time it has processed"  
That's correct.  
The main reason of that is the Lack of Architecture in our code and overusing of Variables/Inner Loops/Bunch of Writing Files/Express VIs and one Fantastic DLL call... Everything in same Loop.
Its an heavy computional intensive to process everything without correct using of dataflow concept (Especially in ur Case). I'm still frightened...  Anyway.
Here some tips:
Avoid Variables: They can lead Race Conditions in our code and made some copies of data in memory. 
Avoid Stack Sequence Structures: Use DataFlow Concept to put everything in sequence
Decouple Processes: Create one Loop to UI actions, one to Data Acquisition/Generation, one to Log Raw Data, one to Create Report and Perform some analysis.Create some mechanism with Queues/Notifier to inter process communication (See Queue Message Handler Architecture).
Avoid Express VI: They are Inneficient,bad codded (Except File Dialog when there's one VI...) and put bunch of dependencies in your project. 
Create SubVIs: Provide Modularity and code reuse.
Stop Button needs to STOP:  Self Explanatory
Here some links about good pratices:
http://www.ni.com/white-paper/7117/en
http://www.ni.com/white-paper/5560/en/
https://decibel.ni.com/content/docs/DOC-22047
http://lavag.org/old_files/post-705-1100237457.pdf  <--- (That's good one)
"In theory, theory and practice are the same. In practice, they’re not."

Similar Messages

  • Write measurement to file slows data presentation

    I am sampling a light sensor at 1000Hz, and displaying the value using a waveform chart, and outputing to a file (using Write measurement to file), using a boolean.  Whenever i activate the write to file module, the acquistion rate slows down (i.e. I see the waveform propogate much slower). Has anyone else had this problem? Any solutions?

    Hi:
         Yes. We refer to low level vis as in programming languages. As higher the level, more "luxury" we give to the user, everything is done in a few steps, in a single step if possible. Low level ones do single tasks at a time: Open file, read file size, read some bytes of data (not the entire file), close the file, etc. etc. These instructions, even more troublesome for many people, gives you more control over the process. I'm attaching 2 files, one is a vi with some of LV menu vis which perform these smaller tasks (sorry it's in LV5, but any later version of LV you have, you would be able to open them), the other file is just a picture of the screen with the menus where those vis are (sorry again it's LV5, but you must be able to locate the corresponding menus in your version of LV).
         Good Luck.
    Attachments:
    Saving.vi ‏30 KB
    Saving.jpg ‏167 KB

  • How to view waveforms in DIAdem that were saved in Labview using "write waveforms to file" VI

    I'm new to DIAdem but would appreciate any help to my question.
    I seem to be having a little trouble but how do I view waveforms
    in DIAdem that were saved in Labview using "write waveforms to file" VI??
    tks, Terry

    Hello,
    There are several ways to write waveform data from LabVIEW so it can be accessed from DIAdem. Two of the easiest ways are to use either .lvm files or .tdm files. You can write .lvm files using the Write LabVIEW Measurement File.vi which is located in the File I/O palette. You can write .tdm files by using the storage VIs which are located in the File I/O >> Storage palette. So, I would recommend using either of these file formats if you are developing a new application since these can be loaded into DIAdem directly.
    If you are interested in loading files that where already created from the Write Waveforms to File.vi, I am wondering what file type you are using. For example are you saving your files as .dat or .txt with your Write Waveforms to File.vi? Feel free to reply to this thread with this information and I would be glad to help you out.
    Regards,
    Kevin L.
    Applications Engineer
    National Instruments

  • File not found when using write characters to file

    OK, I am missing something really basic here.  Whenever I try to use the Write Characters to File function, if I try to give it a path beyond the C:\filename directory, it returns an error.  In other words, C:\Dan works, but C:\Dan\Test reurns an error. WHAT am I missing?

    Bingo! That is the problem. You have to make sure the directory exists before you attempt to write files to it.
         BTW: In LV there is a function for creating folders programatically. A good way to see if a directory exists is to attempt to list its
                   contents. If the list function returns an error, the directory doesn't exist and you have to create it.
    So make use of the error that the file write returns. If you get an error, start at the root of your path and test to see if each level exists, and if not create it. When you have all the folders in place repeat the file save.
    Mike...
    Message Edited by mikeporter on 05-24-2007 12:55 AM
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Writing the file using Write to SGL and reading the data using Read from SGL

    Hello Sir, I have a problem using the Write to SGL VI. When I am trying to write the captured data using DAQ board to a SGL file, I am unable to store the data as desired. There might be some problem with the VI which I am using to write the data to SGL file. I am not able to figure out the minor problem I am facing.  I am attaching a zip file which contains five files.
    1)      Acquire_Current_Binary_Exp.vi -> This is the VI which I used to store my data using Write to SGL file.
    2)      Retrive_BINARY_Data.vi -> This is the VI which I used to Read from SGL file and plot it
    3)      Binary_Capture -> This is the captured data using (1) which can be plotted using (2) and what I observed is the plot is different and also the time scare is not as expected.
    4)      Unexpected_Graph.png is the unexpected graph when I am using Write to SGL and Read from SGL to store and retrieve the data.
    5)      Expected_Graph.png -> This is the expected data format I supposed to get. I have obtained this plot when I have used write to LVM and read from LVM file to store and retrieve the data.
    I tried a lot modifying the sub VI’s but it doesn’t work for me. What I think is I am doing some mistake while I am writing the data to SGL and Reading the data from SGL. Also, I don’t know the reason why my graph is not like (5) rather I am getting something like its in (4). Its totally different. You can also observe the difference between the time scale of (4) and (5).
    Attachments:
    Krishna_Files.zip ‏552 KB

    The binary data file has no time axis information, it is pure y data. Only the LVM file contains information about t(0) and dt. Since you throw away this information before saving to the binary file, it cannot be retrieved.
    Did you try wiring a 2 as suggested?
    (see also http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=925 )
    Message Edited by altenbach on 07-29-2005 11:35 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Retrive_BINARY_DataMOD2.vi ‏1982 KB

  • Write to Binary File strips carriage returns (LV 8.2.1)

       I was using Write to Binary File to write a combination of strings, numbers, and time stamps.  When I later went to read the filel, it didn't quite make sense.  Although I had written strings that had lines ending in <CR><LF>, when I read them back in, they only had <LF>.  I checked this using other programs to read the file.  The <CR>'s have been stripped out!  Why would a "binary" file VI kindly edit your strings for you?  I needed the strings to be written exactly as they were.  The VI corrupted my data.
       I couldn't find any explanation for this in the help, nor any way to turn this behavior off.  Is this a known issue, a bug, or a feature?
    Regards,
       Dave T.
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

       Thanks, Altenbach and Jarrod, for your help.
       Time to eat crow.  At Altenbach's prompting, I created a sample program that would demonstrate the problem.  It didn't.  Turns out the files were fine.  I was reading them with the "Read from Text File" vi, with the EOL option enabled!  I had used another program to check the data in the file, and was basing my conclusion on that.  Unfortunately, I didn't use a good hex editor, and it turns out the program I used was also stripping the <CR> off.  So the data in the file was good, I was reading it wrong, and my double-check was reading it wrong.
    Cheers,
        Dave
    David Thomson Original Code Consulting
    www.originalcode.com
    National Instruments Alliance Program Member
    Certified LabVIEW Architect
    There are 10 kinds of people: those who understand binary, and those who don't.

  • Write to text file while scrolling table issue

    Hi all,
    I have a LabVIEW application that logs data using 'write to text file' every second. This is a bckground task in a sub-VI. On the main screen I have several tables that have scrollbars. Every time the file is written the scrolling of a table is effectivley canceled. It is then necessary to click on the scrollbar again to re-start scrolling the table. I guess this is an issue with the OS but not sure yet. I have not tested other operating systems yet. I thought I would try the forum first. Has anyone else experienced this issue? Any ideas on how to fix this?
    I have tried using list boxes instead of tables but the same issue exists.
    I'm using windows 7 and LabVIEW 2011.
    Thank you.
    Certified LabVIEW Architect

    Hi Steve, thanks for offering to help. Right now I'm on a machine with LabVIEW 2010 and XP and the issue does not exist. But I have created a little test VI that should demonstrate the issue once running on LabVIEW 2011 SP1 and Windows 7. I can't confirm this VI will demonstrate the issue until later today when I can test it on the problem system myself. Feel free to give it a go and let us know what you find, or wait until I confirm the attached VI will demonsrate the issue (10 to 12 hrs time).
    Thank again.
    Certified LabVIEW Architect
    Attachments:
    Table scroll test_1.vi ‏13 KB

  • Problem using read from spreadsheet file and polar plotting

    Hi to all labview users,
    i am a beginner in labview and i am trying to do a polar plot.
    i read the polar plotting example in labview and it was straightforward.
    I used "write to spreadsheet file" to gather data.
    and they are in the following format
    13  10
    4  20
    8 30
    ....etc
    now. i tried using "read from spreadfile" to get the data into a array, then using "array to cluster" to convert the array into cluster, so i could connect it to the polar plot block
    however, it kept saying i couldnt connect that way, because polar plot uses 1-d array with cluster of 2 element and my source is a cluster of 9 elements....
    but doesnt the "read from spreadfile" block give me a 1-d array? and where does that 9 come from? i only have 3 rows and 2 columns in my data file....
    any guidance would be greatly appreciated.
    thx alot
    Happy guy
    ~ currently final year undergraduate in Electrical Engr. Graduating soon! Yes!
    ~ currently looking for jobs : any position related to engineering, labview, programming, tech support would be great.
    ~ humber learner of LabVIEW lvl: beginner-intermediate

    Helllo,
    I've made an example to try to help you  with that question.
    Notes:
     - the file must have values separeted by tab
     - reading the values from file as you mentioned using "read from spreadfile" you'll get a 2D array and not 1D;
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    Read Table and plot polar graph.vi ‏26 KB
    teste.txt ‏1 KB

  • Write Spreadsheet To File even if path doesn't exist (yet)

    I am interested in using Write Spreadsheet To File to log some data to my disk.  What is the easiest way to include this VI and tell it to create the folders if they don't already exist.
    For example:
    Using that example, if no "Data" folder can be found on my Desktop, how can I have LabVIEW create the "Data" and "Test1" folders necessary to create Test1.csv in the specified location?
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!
    Solved!
    Go to Solution.

    I ended up making a VI out of this community example https://decibel.ni.com/content/docs/DOC-23385
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

  • Data format problem with Write to Spreedsheet File

    I have a problem with the data format with Write to spredsheet file.
    I have an N*3 array, where the 3 elements in each row should has different length. When I used Write to spreedsheet file,
    it can only save the three data in one format. How can I save them in the format of "%0.8f %0.3f %0.2f"?
    Thanks for your help.

    Hi powerplay,
    another solution may be to convert column-wise using "number to fractional string", then interleaving resulting arrays and again using "array to spreadsheet string" (with "space" as separator).
    Many ways lead to Rome
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to populate column titles for y values when using Write to Measurement File Express VI with a tab delimited text-based .lvm file?

    The .lvm file generated by the Write to Measurement File Express VI includes column heading titles for the y values, but they are a default value of "untitled".  See attached example of a sample file when opened in Excel, the values in question are highlighted.  Is there a way to specify the column titles when the file is written?
    This is a similar question to this posting, which received a work around response to use the Write to Spreadsheet File.vi, rather than a solution when using this VI.
    Message Edited by Hightop Raven on 05-02-2007 03:37 PM
    Attachments:
    column_titles.gif ‏13 KB

    Sorry for the late reply.  I was out of the office Friday.
    You can do it, but the code can get rather ugly.  Under the hood, the dynamic data type (the dark blue wire) is an array of waveforms.  In your case, the scalar values you convert to a dynamic data type are being converted to an array of waveforms, each waveform having one element.  You have two options.
    Explicitly convert your scalars to one-element waveforms (t0=0, dt=1) and add the title before conversion to a dynamic data type.
    Convert your dynamic data type to an array of waveforms and loop through them to add the column labels.  The conversion blocks are in the Signal Manipulation Express palette.
    I would recommend 2, since it is the easiest to add.  It is also the easiest to run only on the first iteration.  Just put a case selector around the loop, wire the selection to the While loop iterator, and set the case containing the label code to 0.  The default case simply passes through the dynamic data.
    My apologies for not including a screen shot.  I am in the process of upgrading my machine and can't run LabVIEW.  If you need one, let me know and I can post one tomorrow.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Configuration "use next available filename" in "write measurement file" function

    My project recording signal and saving using "Write to Measurement File" function. I want to perform record multiple segments signals should have configured option "use next available filename". For example, if the original file is data.tdms then it will save the file into: data_1.tdms, data_2.tdms, data_3.tdms, ...
    To do that I use a button control enable and disable write functionality.
    In the past I have done normally. Now, I can not make it anymore, now every write new data were add into one file created without the next new file as desired, it has almost become a option "Append to file".
    I use LabVIEW 2013
    Solved!
    Go to Solution.
    Attachments:
    write measurement file.vi ‏54 KB

    Hello ducta9,
    It looks like you currently have the Write to Measurement File Express VI configured to "save to one file" - this means that all data from a given session will be saved to the same file.  The file number will only be incremented once the application is restarted or the Reset Boolean input is set to True.  If you want to save to a series of files, select the "save to a series of files" option and configure the Express VI as needed to generate new files at intervals. 
    If you want to write variable-size chunks of data to a new file every time the user clicks the Enable button, you might be able to get away with just wiring a True constant to the Reset.  I would still recommend taking a look at the options available in the save to a series of files settings.
    Best Regards,
    Tom L.

  • Writing several / multiple columns in a *.lvm file using write file option

    Hello All,
    I am doing several measurements and till now writing all the measurement in individual files thereby I am forced to use an external program to merge the files into one file of several columns.
    Is there a possibility to write a *.lvm file (or some other possibility say a *.txt file but no excel) with multiple columns where each column stands for a particular data?
    I am attaching a simple example where I have 4 different measurements (simulated using a regulator(I dont know how I can say this vi in english)??) which I am converting into array and trying to write them in a file of *.lvm extension. But the output is still a single column where every measurement is taking a different row which I dont want.
    Thanks in advance.
    Jan
    Attachments:
    Unbenannt 1.vi ‏97 KB

    Instead of using the Build Array, just wire your scalars to the Merge Signals function. This will create 4 separate signals that will be written in 4 separate columns. With the existing 1D array, you could also use the Write to Spreadsheet File instead of Write to Measurement File.

  • Using Swing applet to write data to file on SERVER

    Hello,
    I'm in the process of writing an applet using Swing (SDK v1.4.2). Here's the deal. The JApplet calls a JPanel, which will be used by customers on my site to enter data. I'm adding a <Save> button to the "form" which is supposed to write data to a file on the server (in order to preserve the customer's preferences).
    Please note that I am NOT attempting to write data to the customer's hard disk. That requires digital certificates, etc. which I am trying to avoid for now.
    Instead, I am using the URL class to access the file:
    URL page = new URL("http://www.whatever.com/mycustomers/preferences.txt")
    I then use the URLConnection class to establish the connection:
    URLConnection conn = this.page.openConnection();
    conn.setDoInput(true);
    conn.setDoOutput(true);
    conn.connect();
    etc...
    I've created a text file (preferences.txt) on my web site. Using the classes InputStreamReader, BufferedStreamReader, and StringBuffer, I can successfully read the file into a JOptionPane in my applet.
    The problem comes when I try to write data TO this file. I know the file exists because the applet can read it. I've set the permissions on the file to 666. I've got all of the appropriate syntax within a try statment that catches an IOException. I also have JOptionPanes all over the place to let me know where the program is. I've tried different combinations of output streams like BufferedWriter, BufferedOutputStream, StringWriter, but the file does not get updated. When the applet runs, it does not throw any exceptions, not even when I change the URL from "HTTP://www.whatever.com/prefs.txt" to "HTTP:/www.whatever.com/prefs.txt" (only one slash on HTTP, shouldn't I get a MalformedURLException?)
    I apologize for all the background, but I thought you might need it. The bottom line is:
    1) Can an applet write to a file on a remote server (not local hard disk)?
    2) If so, what (if any) caveats are there?
    3) Is there a way to check for file existence or be able to create a new file?
    4) I'm using the HTTP protocol - is there some restriction that prevents an applet from writing to a file using that protocol? If so, is there a workaround?
    5) Assuming that creating/writing a file using the method I've described is possible, what would be the appropriate output streams to use? (Currently, I'm using OutputStreamWriter with BufferedWriter).
    I've been struggling with this for a while. Any help/suggestions would be appreciated.
    Thanks
    P.S. I also posted this message on the Applet development forum, but I've received no response as of yet.

    Http servers support PUT as a mechanism to upload data to a specified URL. Get on the other hand which is what most people are familiar with is how you retrieve that data. The basic URLConnection is an abstraction of the Http connection which can be used for GET and POST operations by default based on doInput(true|false).. If you which to use any of the http methods other than GET|POST you will have to cast the URLConnection to HttpURLConnection so you can gain access to the specific Http functionaility that could not be abstracted.
    Since you are using a hosting service the chances are that you won't be able to use HTTP PUT on their server. Most servers do not support HTTP PUT without configuring them todo so. Now Apache allows localized config through the .htacess file. It might be possible (keep in mind I am not an apache expert) to configure a particular directory to allow HTTP PUT using this .htacess file it may not be possible. You will have to consult the Apache web server documentation for that answer.
    But regardless you can use the HttpURLConnection and the PUT method to send data from your applet to the server. In fact that is the preferred way to do this. If you can not configure your web server to support that method then you will have to develop a Servlet to do it. A servlet has several methods such as doGet(), doPost(), and doPut(). You would override the doPut() method get the URI path create a file and a FileOutputStream to that file, get from the request the inputstream, possibly skip the http headers, and then write byte for byte the incoming data to your OutputStream until you reach the end at which point you would close the OutputStream and send an Http Response of some sort. Typically in HTTP it would be 200 OK plus some web content. You content can be empty so long as your applet recognizes that is what it should expect...
    And away you go...

  • [svn] 3519: Fix typo in error string for situations where there are advanced messaging configuration settings from LCDS used in the configuration files but no AdvancedMessagingSupport service .

    Revision: 3519
    Author: [email protected]
    Date: 2008-10-08 04:17:40 -0700 (Wed, 08 Oct 2008)
    Log Message:
    Fix typo in error string for situations where there are advanced messaging configuration settings from LCDS used in the configuration files but no AdvancedMessagingSupport service. The error string said that there was no flex.messaging.services.AdvancedMessagingService registered but it is the flex.messaging.services.AdvancedMessagingSupport service that needs to be registered.
    Add configuration test that starts the server with a destination that has the reliable property set which is an advanced messaging feature but there is no AdvancedMessagingSupport service registered.
    Modified Paths:
    blazeds/trunk/modules/common/src/flex/messaging/errors.properties
    Added Paths:
    blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/messagingService/ReliableDestina tionWithNoAdvancedMessagingSupport/
    blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/messagingService/ReliableDestina tionWithNoAdvancedMessagingSupport/error.txt
    blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/messagingService/ReliableDestina tionWithNoAdvancedMessagingSupport/services-config.xml

    Hi,
    Unfortunately I already tried all kinds of re-installs (the full list is in my original message). The only one remaining is the reinstall of Windows 8 itself, which I would really like to avoid.
    What I find really strange is the time it takes for the above error message to appear. It's like one hour or even more (never measured exactly, I left the computer running).
    What kind of a timeout is that? I would expect that, if ports are really used by some other application, I get the message in less than a minute (seconds, actually). To me this looks like the emulator itself for some reason believes there's a problem with
    some port while in reality there isn't.
    I'll eventually contact Microsoft Support, thanks for the suggestion.

Maybe you are looking for

  • Java with mysql

    if two tables r given, i want a code which should tell tat ,in which table foreign key is available. so please kindly help out in this problem. is there is any query or code avalible to find out which table as foreign key.

  • How can you set a ringtone for unknown numbers

    How can you set a ringtone for unknown numbers?

  • When I'm editing a video on imovie, it opens with some black parts which are waging. How do I stop it?

    My imovie is with problem. When I'm editing a video, it opens with some black parts which are waging, then the macbook gets slow. The original clip of the event gets all in blue and when I close imovie, it remains loading and lock completely.

  • Edit operations

    In Jdeveloper 3.2.3, I can still use Ctrl+KB, Ctrl+KC, Ctrl+KI, Ctrl+KU, or Ctrl+Y,.. to define a block of text, indent a block, or erase a line. These functions seems gone in JDeveloper 9i. I understand these functions are coming from Borland. Is JD

  • ORACLE RMS transfers

    I am looking for some help with the concept of 'fill and kill' as it relates to transfers in RMS. Does RMS have a function where unfilled transfers can be auto-closed with out having to change the qty transfered manually. ex: a transfer is created fo