From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem about data in "real time"

I didn't see that the message 4, was yours answer too ^^ 

 

Well I'll draw your example (it will be long maybe cause I don't know every block so I will search a little 🙂

 

I'll coming just after some tests to tell you if it's ok or not 🙂 

 

Regards,

 

Maxime L

0 Kudos
Message 11 of 58
(1,303 Views)

It's me, again :'( 

 

Then Steve, I did your program. I never used waveform before, so I don't really understand how it works... But it's not the problem, i'll have enough time to understand after 🙂 

 

The problem actually is about excel, and about the block "write in a measure file". When I run my VI I got an error : In english it's probably just :

 

the error 5 was in :write in a measure's file3 -> Bilan Excel Final.vi  

Possible reasons : LabVIEW : the file is already open (and he is not, that's sure) 

=============================================

NI-488 : The command needs the controller GPIB as a controller system. 

 

 

So... The first reason is impossible. And the second... And don't even know what it mean -_- 

 

Finally, even if I had an error, the file is created, and when I try to open it, I got an error in Excel : Excel cannot open the file "test entrées.xls" because de file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches format of the file. 

 

 

So... I don't know what's happening. It's probably something basic. I join my VI to show you that I add your example at my VI. Maybe did I forgot something ? 

 

Thank you in advance... 

 

Regards,

 

Maxime L. 

0 Kudos
Message 12 of 58
(1,297 Views)

Maxime,

 

     Please forgive me for being a little bit "off topic" -- I intended to follow up on your most recent post about Excel, Write to Measurement File, and other issues, but I first took a brief look at your code, and decided I might do more "good" by giving you some ideas about LabVIEW Programming, in general.

 

     One of the first things I learned about LabVIEW is the importance of style.  Here are some "Style Rules" that you should almost always follow:

  • Use LabVIEW Project to organize any non-trivial Project.  [You do this -- good for you!!].
  • Always make an Icon for your sub-VIs.  [You often do this -- good for you!].
  • Always (!!!) use the left-side connectors for Inputs, the right-side connectors for Outputs.
  • (Almost) always use the 4-2-2-4 Connector Pattern, with Error In and Error Out on the lower corners.
  • (Almost) always use Error In and Error Out.
  • Always write brief documentation for your sub-VIs, at a minimum listing (briefly) what it does and the Input and Output terminals.
  • When VIs are supposed to happen in sequential order, use the Error Lines to show this (and to keep your Block Diagram neat).  Error Lines can be your friend (and cost very little to implement).

     Here's a hint about organizing your Project.  Most of the files mentioned in your Project lie inside your Project folder, but a few do not -- File Solution, Excel Demo, and Sans titre 1 are in your Downloads folder, hence show up as Errors in the Project File when we open the Zip folder you sent.  Either remove them from the Project or move them into, say, a sub-folder called Downloads, or Other Stuff, and add that sub-folder to your Project.

 

     I opened your Main, and saw you were doing things with sub-panels.  Here is a much simpler way to call them, one that is more-or-less self-documenting.  In order to make this work "with style", I needed to add Error Lines to your Sous_VI-Mesures_Accel routine, which led me to notice the "wrong" connectors, and the notes above.  In your Main, you obtain a VI Reference from the (movable) VI Path, use that to run the VI, and put it in the Front Panel.  Here is an easier, self-documenting (if you've made icons, which you have) way that does the same thing, but is rather more compact:

Sub-Panel Call.png

Oops -- I accidentally saved this in LabVIEW 2015, and I think you might be running LabVIEW 2014.  I apologize, but I think you can get the idea.  I modified your sub-VI by disconnecting all of the terminals, changing the Connector Pattern to 4-2-2-4, adding Error In and Error Out, and rewiring the Connectors (wiring Error In to Error Out in the Block Diagram, and putting the three outputs in the other three right-hand output terminals).  I'm not sure why it called your Sub-Panel FAsec, might be a "language" thing ...

 

Bob Schor

 

 

Message 13 of 58
(1,284 Views)

Hi Bob,

 

It's not a problem if you are a little bit "Off Topic" At least you payed attention to my topic, it's already a lot. 

 

I remember my last topic, I solved the problem, but like always, each time that I solve a problem, an other one is coming soon :'(. 

 

You are helping me a lot with this answer. Indeed, I don't think about all of this when I'm programming. And I have to let a project enough easy to understand when i'll leave the company in one month so obviously your advices are trully welcoming ! 

 

I understood some of them, but I don't understand what's the 4-2-2-4 connector patern :s I'm sorry.. 

About the documentation you are right, I will write some explanation of my Vis and Sub_VIs, I didn't think about this. 

 

Now about the last part of your message...When you said that you modified my Vis etc, was it in order to show me this work ? Cause you didn't join a file to your message 🙂

I don't know if you just forgot or if it was volontary ahah ^^

 

Thank you again,

 

Regads. 

 

Maxime 

0 Kudos
Message 14 of 58
(1,271 Views)

As far as I can tell, the reason you were getting "error 5" is that 1st there was a DAQmx error. The error input on the Write to Measurement File was not wired, so the file became corrupt. The DAQmx error was caused because the default timeout for a measurement is 10 seconds. You have a 10 second measurement. The timeout needs to be greater.

 

There was also an error made in copying the conversion routine I sent.

The "0" constant was wired to the Row input instead of the Column input.

 

Attached is a modified version of your file.

 

You must open all of the DAQ Assistants and change the timeouts - 11 seconds should work.

I could not change them because it complained that the HW was not present.

The setting is on the Advanced Timing tab - Additional Timing Settings.

 

I also moved the logging to a separate loop. This prevents the file saving operation from slowing down the data acquisition.

steve

 

 

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 15 of 58
(1,263 Views)

Hi Steve, 

 

I think it's close to the end ! 

 

The first time I ran the VI, it worked ! I had my Excel's file, he was very clear and with the good data in real time as I wish. 

 

But the problem is that it works only 2 or 3 times... when I tried 10 or 15 times. I still got the same error. About the timeout I don't know, the first time I ran the Vi without modification so with the timeout = 10. It worked, and then I would like to try with the real system so I ran a second time the VI and the error was displayed :s I don't understand why..

 

Then I tried with the timeout = 11, it was the same result. It's really strange. Why this VI works one time and then doesn't work for the 4 next test and finally the 7th works too ? 😮 

 

I'm sure that the solution is close... you made a really big job, I understand how does it works, and I thank you a lot again... but I need your help for this last problem. The last yes, I hope 🙂 

 

Regards,

 

Maxime L.

0 Kudos
Message 16 of 58
(1,256 Views)

As an experiment, try reducing the number of samples to 1k instead of 10k.

You may be hitting the limit of what the DAQ Assistant vis can provide.

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 17 of 58
(1,252 Views)

I don't know, it's not the solution too 😕 

 

Maybe it can help you... But it's always after the third iteration that the error is displayed. And when I click on "continue" on the error. Then the acquisition continue without problem and without interrupt. But I still can't open the Excel's file. 

 

I tried different samples/ Samples'frequency/Timeout. I tried to add some input in different DAQ assistant or delete some of them and it doesn't make a difference :s 

0 Kudos
Message 18 of 58
(1,243 Views)

This is very strange because if I take your example and open it like that it doesn't work too. But It doesn't explain why the first time it worked... I changed nothing ! It's really strange -_-

0 Kudos
Message 19 of 58
(1,242 Views)

Sorry, I've been busy.

 

When you make a VI, the Connector block shows in the upper-right corner of the Front Panel view, with little blocks where you can connect Controls and Constants.  If you look at how many blocks are in a column, you can describe this connector pattern as a series of numbers.

 

When you make a new VI, LabVIEW gives you the "default" connector pattern having 4 inputs on the left, four on the right, and two on top and bottom.  Counting the rows from left to right, there are 4-2-2-4 blocks, hence the 4-2-2-4 "pattern".  You'll find that many (most?) of NI's functions now use this Pattern, with Error In and Error Out on the lower left/right corner blocks.

 

I was illustrating how I work with sub-Panels, using Static VI References instead of Paths wired to Open VI Reference.  I also tend to directly call the sub-VI as a parallel sub-VI (meaning that it is not buried in another loop, so it runs "in parallel" with the rest of the code until it ends itself or is "ended" by other means).  My Snippet shows the Static VI Reference created from your sub-VI opening the sub-Panel, and then the sub-VI being called to run (inside the sub-Panel).  Very simple, very small.  As a bonus, if you ever need to create an Executable from this code, it just works (whereas getting the path to the sub-VI inside an EXE can be non-intuitive).

 

Bob Schor 

0 Kudos
Message 20 of 58
(1,225 Views)