取消
顯示結果 
搜尋替代 
您的意思是: 

how do I make the VI as fast as the sub VI?

已解決!
前往解決方案

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

0 積分
1 條訊息(共 6 條)
3,116 檢視

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. 

0 積分
2 條訊息(共 6 條)
3,106 檢視

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

0 積分
3 條訊息(共 6 條)
3,064 檢視

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

0 積分
4 條訊息(共 6 條)
3,063 檢視
解決方案
由主題作者所接受 dav2010

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).



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
5 條訊息(共 6 條)
3,051 檢視

@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.

0 積分
6 條訊息(共 6 條)
3,042 檢視