02-11-2023 03:48 PM - edited 02-11-2023 03:49 PM
Hello all,
This is what my code is doing. I have data coming from a PSD that comes in every second. This is in the form of intensity that then is put through a lock-in amplifier to remove some of the noise. I set this loop to restart every 2 seconds because I only really care that my data is consistently taken every 1/2/3 etc seconds. I need to run a FFT later so I need consistent time differences.
The issue with my code. It runs perfectly for the first few hours but then begins to slow down. I am not sure why this happens if its a memory leak or something is being cached and not removed. Is there an option to reset the program or automatically close/ open the vi? I have looked into it, but haven't found a solution
Also, this wouldn't be that big of a deal because I could just end LabVIEW and setup am automation program to restart it. The issue with this, is when I stop the VI it freezes and I have to use taskkill to close LabVIEW . After that, if I try and launch labVIEW it will just hang and never launch. The only option is to restart the computer which would be difficult to automate.
Solved! Go to Solution.
02-11-2023 05:38 PM
You forgot to attach some subVIs so the problem could be e.g. inside "referencebuilder.vi". Sorry, I don't have drivers, so most subVIs are missing.
Do you really need to create a virtual channel and configure timing with every iteration, then never close it??? Maybe that belongs before the loop. If you continue to create new virtual channels and never close the old one, you run out of resources!!!! I am sure that's what happening!
One glaring issue is also the overuse of express VIs and dynamic data. Look at all these coercion dots! Execution order is fully determined by dataflow, there is absolutely no need for the sequence structure!
If you just want to append simple rows to a text file, it is more lightweight to open the file once, then append using simple primitives.
Here is a quick draft that might give you some ideas....
02-11-2023 11:49 PM
Thank you very much for this assistance. As you can see I am definitely a novice here.
I implemented the appending text save method you described and it seems like it works. I also moved the DAQmx Create Channel VI to outside of the loop as you can see. I am assuming that is the vi that you referred to as creating new virtual channels? (I am not absolutely sure that this is the correct vi you were referring to).
Also a few specific functions that I couldn't find:
- The function to the left of the "Array to spreadsheet" function. It looks like build array, but I couldn't find it.
- Also, I tried to implement the "In place Element Structure" within the for loop as you showed, but i couldn't fund that array function to the left of it. If I used the Index Array function that I currently have, it didn't work.
- Lastly, I could not find that orange function to the right of the relative seconds vi.
I am using labview 2018 SP1, so there is a possibility those vi's aren't a part of this version?
Also I replaced the referencebuilder.vi with its subvi's instead.
02-12-2023 10:11 AM
@kdolghier wrote:
Also a few specific functions that I couldn't find:
- The function to the left of the "Array to spreadsheet" function. It looks like build array, but I couldn't find it.
- Also, I tried to implement the "In place Element Structure" within the for loop as you showed, but i couldn't fund that array function to the left of it. If I used the Index Array function that I currently have, it didn't work.
- Lastly, I could not find that orange function to the right of the relative seconds vi.
(Sorry, I am on a different computer, so I don't have the code)
02-12-2023 10:33 AM
@kdolghier wrote:
Also I replaced the referencebuilder.vi with its subvi's instead.
A few more comments:
On a side note, please make the front panel a reasonable size and get rid of all that blanks space between the controls.