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.
11-25-2012 09:14 PM
I am trying/learning to build larger VIs from subVI's but, I noticed a tricky problem...I am losing all my speed!!! One VI "DC voltmeter..." measures voltage, and the other "voltage reader.." uses it as a subVI to measure voltage and then do a simple multiplication operation on the measured voltage. Why is the larger VI SO MUCH SLOWER?? It's a LOT slower than the simpler vi. Why is the "voltage reader" so much slower than the "DC voltmeter"? How can I structure it so I don't lose so much execution speed???
If I put the WHILE Loop on the DC voltmeter, as shown in the third listed VI, the data stream is very rapid. Where is the speed going when you convert it to a subVI? Am I wiring these things correctly?
Thanks,
Dave
Solved! Go to Solution.
11-25-2012 11:11 PM - edited 11-25-2012 11:12 PM
There is overhead when creating the task and setting the sampling rate. That's why your subVI is slower.You need to create your DAQ task and set the sampling rate in it's own SubVI outside your while loop, then enter your loop and do the DAQ read only. When the loop terminates, then call the DAQ Clear Task.
11-26-2012 04:49 PM
Hi Thanks, but, isn't what you are describing the original vi titled "DC voltmeter (DAQmx) FORUM_nov 25.vi" This vi goes superfast!
I thought that creating the component vi's and then connecting them together would make editing the overall vi easier than creating all the code as a single vi. I could easily configure the components as you suggest, but, then I wouldn't be using vi's. Or, are you suggesting to highlight the code outside the WHILE loop and making that the subVI, instead of importing an entire finished vi from the functions pallette, ..:Select VI'?
What is the correct way to implement small vi's to build big vi's?
Dave
11-26-2012 04:50 PM
Sorry about the weird yellow snarly face above...I don't know how it got there! HIt some magic key and didn't notice.
Dave
11-26-2012 06:51 PM
dav2010 wrote:What is the correct way to implement small vi's to build big vi's?
For DAQ tasks like this, I like to have a single VI that sets up the task (adds channels, setup timing, etc.). So you are correct in that everything before the while loop is a good canidate to be a subVI.
A more general answer, anything that is a simple, logical block of code should probably be a subVI. This is especially true if you find that you are duplicating code (turn it into a subVI instead of duplicating).
11-26-2012 07:43 PM - edited 11-26-2012 07:45 PM
@dav2010 wrote:
Sorry about the weird yellow snarly face above...I don't know how it got there! HIt some magic key and didn't notice.
Dave
Go to your Profile and My Settings. Go to the Preferences Tab then Display. For Emoticons, choose None rather than Use Default (Smiley) or any of the other ones.
That will prevent certain key combinations such as 😛 (colon P) or 😄 (colon D) from showing up as emoticons. You had typed colon-S, so that looks like the Smiley Frustrated icon for anyone who didn't fix that setting within their profile.