LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to create files with write to measure.vi

Hi all,

 

I am new to Labview and I am working on a project where I need to develop a program to measure individual anode currents in an aluminium smelter. My supervisor has given me an old file to work on but it has a problem regarding the sampling frequency (apparently the sampling frequency is different to what we specifcy in the VI) and the write to measure.vi.

 

Before I can solve the sampling frequency issue I need to solve the issue with the write to measure.vi. I have read an old post of last year about solving a bug in the VI in LV2009. I tried the suggested method and it still fails to create the file in the specified file path. In fact it doesnt create any files at all. I linked an indicator to the saving data output and the light is on whenever i pressed the enable button to save the data.

 

I have connected my computer with the Real time target correctly and I doubt that the problem lies on connection problems. However the CompactRio I am using is currently not measuring anything, is this the reason why no data is produced?

 

I have attached the VI i m working on so it would be greatly appreciated if anyone can help look into my VI and see whether theres any major mistakes regarding the write to measure.vi settings. THANKS!!

0 Kudos
Message 1 of 77
(3,083 Views)

Hello,

 

Can you post also the whole Real-time project? From only VI is hard to troubleshoot in Real-Time. The information about CompactRIO and C-modules installed on it would be also needed.

 

Best Regards,

Gregor Černe

 

National Instruments

0 Kudos
Message 2 of 77
(3,066 Views)

Thanks for the reply!

 

I just figured out that the files are in fact written into the RIO itself rather than into my computer. So whenever I need to access the files I need to open my explorer and go into the ftp:ip address domain. That is fine for now as my priority is to sort out the sample frequency problem. However I am not quite sure how to specify the sampling frequency using the timed loop. Another problem I am having is regarding the write to measure.vi bug but I have searched on this forum and found some posts on similar issues so I will look into those before asking any Qs on that. 🙂

 

I have compressed the files into a rar file and it is attached below. Thanks!!!

 

0 Kudos
Message 3 of 77
(3,064 Views)

Hello,

 

I'm glad to hear that you solve one of your problems on your own.

 

Now let begin with your timed loop problem - with timed loop you are not defining the frequency, but the period of one execution - so if you want timed loop to be executing with 100Hz frequency, you need to set period to 10ms (period = 1/frequency). In your VI you are setting period for the timed loop with constanst, near which it is written "Scan Rate".

 

And when you will want to implement communication to computer (to write files on computer), I advise you to check the example in example finder called "RT Network Communication", where is decribed how can you transfer data from CompactRIO to computer.

 

If you will have more question regarding your problems feel free to ask.

 

Best Regards,

Gregor Černe

 

National Instruments 

0 Kudos
Message 4 of 77
(3,055 Views)

Thanks for the quick reply!! I changed the period to different values but the sampling rate has stayed at 5 to 6 sample/s. Could this be related to the module I am using?

 

The module I am using is NI 9205 and the controller is NI cRIO 9024. Hope this info helps. Thanks!

0 Kudos
Message 5 of 77
(3,049 Views)

Hello,

 

Probably main problem is that the code inside the timed loop execute longer that you set with timed loop period. I spotted few parts of a code that could be a source of a problem:

 

  •  first one is the Write to measurement file2 Express VI - this VI needs quite a long time to execute, that is why this Express VI need to execute in a VI that runs on the computer (writing to a file does not influence acquiring data)
  •  next source could be the Formula Express VI - as I saw the formula inside is: x0*(x1/x1), which is equal to just x0; that why I think all of those Formula Express VI are not necessary.
  •  too many front panel object in the cRIO VI - the problem appear because each of those terminals are shown on Computer and not on cRIO - meaning all those object need to establish a connection between a cRIO and a computer, result is having a lot of different connection that share the same line. In your program you can just send al the data to computer VI instead to Write to measurement file2 Express VI, and then display/write data on computer VI

If you want to examine which one take the most time you can try disabling parts of a code with Diagram Disable Structure and then run the VI and see if there is any changes.

 

As you see the communication to computer is quite necessary to really have desired response of Real-Time, so please check the "RT Network Communication" example and try to implement to your code - if you will have any problems with it just ask.

 

Best Regards,

Gregor Cerne

 

National Instruments

 

 

 

 

0 Kudos
Message 6 of 77
(3,046 Views)

Sorry, I was just informed by my supervisor that he does not want me to post the the original copy of the project online... is there a way to remove those attachments off my previous posts?

 

I have now moved my VIs (the main VI plus the wirte2measure vi) under my computer so it runs on the computer rather than the cRIO juz like in the RT example u suggested, and it is now able to write files into my computer at a higher sampling rate, however it seems to only reach about 37Hz maximum. I have removed most of the forumla express.vi within the program and unfortunately it doesnt seem to make any difference... 

 

in your previous reply u mentioned that "In your program you can just send al the data to computer VI instead to Write to measurement file2 Express VI, and then display/write data on computer VI" can u please clarify on this and explain how can i save the data by not using Write to measuremnt express VI?

 

I have also failed to understand the RT network communication example...can u please breifly explain whats going on in the RT.vi and the host.vi?

 

Thanks for your patience.

0 Kudos
Message 7 of 77
(3,018 Views)

Sorry for double posting, just want to clarify as well that currently i checked the sampling frequency by counting the number of rows of data are produced in those lvm files output (I open them in excel and juz calculate the difference in row numbers accordingly). Are there any quicker ways which I can tell straight away whether the samples are beign collected at the desired frequency?

 

Is it possible that the module is indeed taking the data at the correct (user specified) frequency but the write to measure. vi fails to catch up to the frequency and therefore porducing less data points than it should be?

0 Kudos
Message 8 of 77
(3,011 Views)

@Batistuta002 wrote:

Sorry, I was just informed by my supervisor that he does not want me to post the the original copy of the project online... is there a way to remove those attachments off my previous posts?

 


Contact the moderator to have them removed.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 9 of 77
(2,972 Views)

Thanks! One quick question, is it a good idea for me to learn about using DAQassistant.vi for my project? It seems like a popular program to use in taking data measurement especially at high sampling rate.

0 Kudos
Message 10 of 77
(2,952 Views)