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.
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.
12-06-2021 11:23 AM
Context,
I have a labview program which runs great if I am running it out of the labview programming software. I have a loop timer as part of my program to keep an eye on the loop rate. If I create an executable and run the program on the same pc the loop rate is reduced to approximately 25% compared to when it runs from the programming environment.
Question,
What would the possible reasons be for the discrepancy? Am I doing something wrong when creating the executable?
12-06-2021 12:08 PM - edited 12-06-2021 12:10 PM
12-06-2021 01:07 PM
I have attached the project. Keep in mind I am learning and have not been doing this long. I am sure there are some fundamental problems, for instance I am not using the producer consumer format. If you would like to simulate the hardware it is as follows.
9174 CDaq with 4 cards
9375, 9215, 9215 and 9211.
We are trying to collect the analog voltage at 1K Hz (we know the 9211 will not meet that).
I am happy I made it this far, but could use advise.
12-06-2021 01:35 PM - edited 12-06-2021 01:46 PM
Hi Jim,
@JimFischer wrote:
We are trying to collect the analog voltage at 1K Hz (we know the 9211 will not meet that).
Why do you use the DAQmxRead with "1 Sample" mode when you want to reach a samplerate >100Hz?
Simple solution: use DAQmxRead in "n channel n samples" mode!
Btw. why do you set the buffer size at DAQmxTiming? Did you read the LabVIEW help for that function carefully? (In "continuous sample" mode that input is not needed…)
Other items with you rproject:
12-06-2021 01:45 PM
12-06-2021 01:57 PM
Thanks,
All of the feedback is good. I can look into the suggestions and hopefully move forward.
So, do you think that most of my problem with inconsistency regarding the executable on different PC's stems from my programming lack of knowledge or something else? Should the executable run as well as the program does directly from the labview software?
12-06-2021 02:08 PM
@JimFischer wrote:
Should the executable run as well as the program does directly from the labview software?
Everything else being equal, an executable is typically more efficient (removal of debug code and other ballast, etc.).
12-06-2021 02:11 PM
Hi Jim,
@JimFischer wrote:
So, do you think that most of my problem with inconsistency regarding the executable on different PC's stems from my programming lack of knowledge…?
I think so… 😄
@JimFischer wrote:
Should the executable run as well as the program does directly from the labview software?
The main difference between running the VI in the IDE and in the EXE is the presence of debugging options in the IDE (by default). Apart from that the EXE should behave the same as the VI in the IDE (theoretically)!
In your case some of the items in my previous post are just "bad", like overuse of local variables and banging the DAQmx device with "1 sample" requests: this may produce different behaviour in the EXE…
12-06-2021 02:43 PM
I appreciate the help.
I will change the read suggestion first and start looking at some of the other improvements. I may have more questions in a bit. I don't mind making mistakes as long as I can learn and move forward. I was starting to get lost in the problem. Having a direction helps.
12-06-2021 02:49 PM - edited 12-06-2021 02:53 PM
As has been said, your VIs need some extensive review, because many things are just plain silly.
Many things have already been mentioned, here are a few more:
This is just the tip of the iceberg! (since the first reading will be zero, you might want to reset the ptbypt VI if i=1, for example. Check the help)