When to create a subVI

Happy new year folks
My question is based on style.
Should a SubVI be created with the view of simplifying a main VI or with the view of a general purpose. To make my question more clear i'll state an example. 
I have a Cluster of 4 controls and based on the value of one control i must increment or decrement another control. Now, do i pass the complete cluster into a subVI and unbundle inside or Send in only the two controls involved in the process? because the other 2 control valuses would remain unchanged. Doing the former would make a simpler Main VI and the latter would permit me to use this same Sub VI somewhere else.Which is a better practice to use?
Thank you
Solved!
Go to Solution.

Personally, I think I may have had 2 subVIs in my CLD.  If you go for the subVI, make sure it is a concise function.  In the exam setup (because of time), go for the ease of reading (which will also be tidyness).  In your exact example, I wouldn't make the subVI unless it was something that I would need in multiple places.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • LV crashes when I Create a subVI

    I am a newbe with LabView, and I am working through some courses using the Student Edition.
    Every time I mark everything on this simple vi (written to try to isolate what conditions are causing this problem) LabView does a complete crash and burn. This only happens when I am using a local variable, although I am not sure I have implemented it correctly.
    Attached is the VI and the LabView error report.
    Regards,
    DerekS
    Attachments:
    Crasher.vi ‏19 KB
    lvlog07-26-04-21-36-17.txt ‏3 KB

    Hi,
    In your program there is no need of the sequence structure or even the local variable. I have attched a modified version of the vi that gives the same results as before but this one does not crash LabVIEW 7.0 when you try to create a subvi by highlighting. On another note, it is best if you create a subvi using the connector pane. Read on help for "creating Subvis from selection" on LabVIEW help to know what are the pitfalls when you create a subvi by highlighting.
    Attachments:
    Crasher_modified_lv_7.0.vi ‏14 KB

  • How can I create a subVI that has state?

    I'm trying to simplify a VI that I inherited and I noticed a recurring pattern that IMHO should be a subVI.  The pattern is that we have a digital output line that is controlled by a timer.  Each output has a start time for it to activate and a duration after which it is turned off.  When the state changes, a single line entry is added to a common log file and an indicator shared variable is set so that the remote host VI updates.  We have a big while loop that checks the current time against each of the activation conditions.  To detect when the state has changed, we're using a shift register (for each actuator).  It's one thing to see the same pattern 3 times, but it's worse -- we want to sometimes use a different number of actuators.  If I was writing this in C++ (with which I'm far more comfortable than LabView), I'd write a class for the actuator and instantiate it N times.  The class would have member data to keep track of its state.  I can create a subVI that does the meat of the design pattern, but I can't figure out how to store the previous state in the subVI without requiring it to be passed in.  How do I keep the state and behavior of a VI together?  Surely there's a way to do this because otherwise I can't see how you could implement state-ful algorithms like, say, a PID controller.  But I'm at a loss to figure it out ...
    Thanks.
    Keith.

    To save state in a subVI and not use that state in other subVI calls, make the subVI reentrant.  When a subVI that is reentrant is called it creates a unique memory space for that subVI.  This is called a clone.  That memory space is where state is held for that subVI.  Keep in mind that it also means that the memory footprint is going to be larger.
    To set a subVI to be reentrant, open it and go to File -> VI Properties and select execution.  It will be a choice on the bottom left.
    Hope that this helps,
    Bob Young
    Bob Young - Test Engineer - Lapsed Certified LabVIEW Developer
    DISTek Integration, Inc. - NI Alliance Member
    mailto:[email protected]

  • Problem when executing the same subVI in parallel.

    Hey!
    I have created a subVI that I am using in two applications that executes in parallel. For some reason the applications is using the same instance of the subVI, which creates conflicts when the applications are trying to use the same subVI at the same time. Is it possible to solve this problem?
    /Jakob

    Open the SubVI and go to File>>VI Properties. Select Execution and check "Make VI reentrant". This should solve your problem. You should read more about reentant VIs and how they work in the site. They have different kind of uses.
    Try to take over the world!

  • How To Create a SubVi and Limit Required Inputs

    Hello,
    Description:
    I have created a VI that reads in voltage values from the NI USB-6008 device. After putting that value into a formula, I compare the new value with an array of data and output a corresponding value (this is not too important for the problem).
    Problem:
    The VI currently works great. My goal is to make it into a SubVi that can read in various channels and output their values. However, when I attempt to make a subVi thourgh Edit>>Create SubVi, the subVi created requires many inputs because of the many controls I utilize in the VI.
    What I want to do:
    Is there any way to use the default values of the controls in the SubVi and not require the user to input each control's value into the SubVi? Or, do I have to change my controls to be constants?
    Any assitance would be greatly appreciated.
    Attachments:
    YSI_R_to_T.vi ‏379 KB

    You don't have to create a subvi by using the Edit - Create Subvi button. Any vi can be a subvi. Go to the front panel, right click on the icon in the top right corner, select show connector. Figure out how many inputs and outputs you want to connect to the main vi. Right click on the connector pane and select Patterns, then the pattern that fits your needs. If you want to have the main send a channel and have the subvi send an output, choose the 4 connector pane pattern. Put Error In and Error Out clusters on your front panel. Wire the channel input control to the top left terminal of the connector pane, the output indicator to the top right connector, the Error In to the bottom left, and Error Out to the bottom right. It is good to use the Error In and Out to indicate errors and to help control execution order through data flow. Save the vi. In your main block diagram, go to functions - Select a VI, and select the vi you just saved, which now becomes a subvi to the main. You can wire a control to the new subvi top left, and so on...
    - tbob
    Inventor of the WORM Global

  • Create a subvi

    hello,
    I would like to create a subvi in labview 7.(I have a vi that I would like to reproduce 2 times in another Vi)

    Hi Rémi,
    in the upper right corner of your front panel you can see an icon depicted. It represents the code of VI as a subVI in anothor VI when it is loaded via "select a VI". Click rigth with the mouse on this icon and you get an context menu. There should be a menu point named "Show connector". The icon should change in a pattern of white sqaures. If you have in- and output structures on your front panel, the white should represent them in numbers. The rectancles on the left represents the input structures and the ones on the right the output structures. Take the "connect wire" tool and click the rectangle which should represent the data structure on the front panel und then click on the mentioned front panel structure. The colour of the recta
    ngle changes from white to the colour of the used data type. E.g., if you have a simple Digital Indicator it should become orange for real values or blue for integer values.
    If you load this VI now as a subVI with "select a VI" you should be able to see this connection on the icon.
    Please keep telling me wheather my description has helped you.
    Stephan

  • When I create a New Folder (on the desktop or in Finder), the system uses the Generic Document Icon instead of the Generic Folder Icon. How can I change this back?

    When I create a New Folder (on the desktop or in Finder), the system uses the Generic Document Icon instead of the Generic Folder Icon. How can I change this back?
    All of a sudden I noticed that most of the folders on my computer were no longer using the folder icon, but the generic document icon. I had to manually change back the icon being used by opening Get Info for each folder and copying and pasting the generic folder icon from some folders that remained unchanged. Now whenever I create a New Folder (right click -> "New Folder"), the icon that shows up is the generic document icon (white page with top right corner turned down). And I have to manually change it so it shows up as a folder in Finder or on my desktop. I don't know why or how this switch happened. All of the folders now on my computer look ok, but I need to change the default so when I create a New Folder it uses the correct icon.
    I have also Forced Relaunch of my Finder and rebooted the system. I downloaded Candybar but am not sure what will fix anything, so I haven't proceeded.
    Anyone know how I can do this? Thanks.

    Anyone?

  • How do I get rid of the auto signature "sent from my iPhone" when I create a new message?

    how do I get rid of the auto signature "sent from my iPhone" when I create a new message?

    Settings -> Mail -> Signature and edit it to whatever you'd like.

  • When I create a playlist and sync it to my iPhone not all of the playlist transfers over.  All of the songs are there and are playable they just do not show up on the playlist.

    When I create a playlist and sync it to my iPhone not all of the songs on the playlist transfer over.  All of the songs are there and are playable they just do not show up on the playlist.  For example, in itunes on my computer a playlist has over 100 songs, but when I sync my phone, my iphone only shows 60 songs.  I can go into my phone and add the missing songs to the playlist, but the next time I sync my phone the songs are gone again.

    Wondering if you haven't been bitten by the new "feature" of iOS 5, as was my son. turingtest2 explained it very well in reply to my own query about "missing" songs in playlists.
    Here's that thread...
    https://discussions.apple.com/message/16903613#16903613

  • HT2534 when i create the apple ID with the above procedure, i dont see "none" options under credit card selection, please help.

    When i create the apple ID with the above procedure, i dont see "none" options under credit card selection, please help.

    Apple needs people like you.

  • I have set up a second iTunes user account on my PC, but when I create the new iTunes account it copies the music, videos etc from the original account and they seem to be linked.  What am I doing wrong?

    I have set up a second iTunes user account on my PC, but when I create the new iTunes account it copies the music, videos etc from the original account and they seem to be linked, so that when I delete a song from one library it deletes from the other one. 
    On the online tutorials I've seen it shows that when you create a new iTunes library it should open as a blank account, but that isn't happening.
    What am I doing wrong?

    If you  have iTunes 11 turn on the Sidebar. Go to iTunes>View and click on Show Sidebar. You can also do a Crtl+S to show the sidebar. The sidebar is where Devices appears. and Control+B to show the Menu bar
    If necessary:
    iOS: Device not recognized in iTunes for Windows
    or
    iOS: Device not recognized in iTunes for Mac OS X

  • Why Dynamic Parameter is not working, when i create report using stored procedure ?

    Post Author: Shashi Kant
    CA Forum: General
    Hi all
    Why Dynamic Parameter is not working, when i create report XI using stored procedure ?
    Only i shaw those parameters which i used in my stored procedure, the parameter which i create dynamic using stored procedure
    is not shown to me when i referesh the report for viewing the results.
    I have used the same procedure which i mention below but can not seen the last screen which is shown in this .
    ============================================================================================
    1. Select View > Field Explorer2. Right-click on Parameter Fields and select New from the right-click menu.3. Enter u201CCustomer Nameu201D as the name for your parameter4. Under u201CList of Valuesu201D select u201CDynamicu201D5. Under the Value column, click where is says u201Cclick here to add itemu201D and select Customer Name from the drop-down list. The dialog shown now look like the one shown below in Figure 1. Click OK to return to your report design.
    Dynamic Parameter Setup6. Next, select Report > Select Expert, select the Customer Name field and click OK.7. Using the drop-down list beside select u201CIs Equal Tou201D and using the drop-down list, select your parameter field (it should be the first field). 8. Click OK to return to your report design and see the parameter dialog.The parameter dialog will appear and show you a dynamic list of values that is updated each time your run your report. It couldnu2019t be easier! In our next tutorial, we will be looking at how to use this feature to create cascading parameter fields, where the values are filtered by the preceding selection.
    Dynamic Parameters in Action
    My question is that whether dynamic parameter is working with storedprocedure or not.
    When i added one table and try to fetch records using dyanmic prameters. after that i am not be able to find the dynamic parameter option when i referesh my report.
    One more thing when i try the static parameter for my report, the option i see when i referesh the screen.
    Please reply soon , it's urgent
    Regards
    shashi kant

    Hi Kishore,
    I have tested the issue step by step by following you description, while the first issue works well in my local environment. Based on my research, this can be caused by the lookup expression or it indeed return Male value based on the logic. If you use the
    expression below, it will indeed only return the Male record. So please try to double-check the record in the two datasets and the expression in your environment:
    =lookup(first(Fields!ProgramID.Value,"DataSet1"),Fields!ProgramID.Value,Fields!Gender.Value,"DataSet2")
    As to the second issue, please try to use the following expression:
    =Count(Lookup(fields!ProgramID.value,fields!ProgramID.value,fields!Gender.value,"DataSet2"))
    Besides, if this issue still exist, in order to trouble shoot this issue more efficiently, could you please post both the .rdl  file with all the size properties to us by the following E-mail address?  It is benefit for us to do further analysis.
    E-mail: [email protected]
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • When i create a new window, firefox Yanks me back to where i was and i dont want to be yanked back.

    i duplicate current pages by create new windows on a very frequent basis;
    to do this, i go to the top of the page that i want to duplicate and right-click and click on Open Link in New Window;
    I specifically want to duplicate the page i am on in another Window, not a new tab;
    Because
    Duplicating the current page to Open Link in New Tab, gives tabs on the top of my screen;
    Duplicating the current page to Open Link in New Window, gives 'tabs' on the bottom of my screen;
    I want 'tabs' to show on the bottom of my screen and to do that i have to Open Link in New Window;
    My question and What is happening, is that firefox is yanking me back to the page that i have just duplicated by right-clicking at the top of the page and clicking on Open Link in New Window;
    When i create the new Window, firefox yanks me back to the page that i just duplicated and i dont want to be yanked back to that page;
    I want to stay on the page that i just duplicated.
    I have tried changing the way tabs work in Options but nothing checked or unchecked results in the specific way i want to have new Windows open and STAY on that newly created Window and not be YANKED back to the window i duplicated.

    The original window did not have a Flash object, but does the window that hides itself contain a Flash object? That is the usual pattern for this bug in the plugin's protected mode feature.
    If you have not already tried disabling it, the following pages/posts provide different ways to do that:
    * Adobe support article under the heading "Last Resort": [http://forums.adobe.com/message/4468493#TemporaryWorkaround Adobe Forums: How do I troubleshoot Flash Player's protected mode for Firefox?]
    * Manual steps: https://support.mozilla.org/questions/968190?page=5#answer-509209
    * Batch file to automate the manual steps: https://support.mozilla.org/questions/982093#answer-518078
    Flash needs to completely unload from memory (restarting Firefox might help) before this would take effect.
    More history: [https://support.mozilla.org/questions/955659 Opening New Windows and Shockwave Flash]

  • Recently, when I create a new album (untitled), it immediately fills with picture either from the album above it or, if I have a Faces collection open, with the pictures from that collection. Why and how do I fix it?

    Recently, when I create a new album (untitled), it immediately fills it immediately fills with picture either from the album above it or, if I have a Faces collection open, with the pictures from that collection. Why and how do I fix it?

    When a new album is created it will fill with whatever is in the right hand window,  If you're in the Events or Photos mode it will contain all photos in the library.  Yes, strange behavior.
    OT

  • In pages, when a create a document, potions of it, say several pages will be clumped together and it effects me editing their order.  It is like they are forever joined- How do I edit my document and print just one page or move just one page?

    In pages, when a create a document, potions of it, say several pages will be clumped together and it effects me editing their order.  It is like they are forever joined- How do I edit my document and print just one page or move just one page?

    May you open your eyes before creating a new thread ?
    Your question was already asked and answered today.
    https://discussions.apple.com/thread/3177074?tstart=0
    Yvan KOENIG (VALLAURIS, France) jeudi 14 juillet 2011 14:40:40
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please :
    Search for questions similar to your own
    before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

Maybe you are looking for

  • Problem with PBEWithMD5AndDES on RedHat 9

    Hi, I'm trying to encrypt a string then save it in the database, then retrieve the string and decrypt it. I have tested this on JDK1.3 (Sun and IBM) yet it works on Windows XP Pro and Debian, but as soon as I try it on RedHat 9 it fails. Where it all

  • Hard drive running constantly despite no material programs running

    I have an iMac that has been a home computer for about two years now. The hard drive is 1TB, which has 111 GB free. It has 4GB in memory. Over the past few weeks it has begun to operate very sluggish and now requires a force shut down of programs reg

  • Push mail is not working for gmail and hotmail on ...

    i have been using my nokia e72 since february 2011. i had two mailbox configured, gmail and hotmail. Until last week, everything was fine. but suddenly my push mail stopped working for both gmail and hotmail. when i noticed this, i removed both of my

  • How to retain an object (lader) painted blue in a Green screen set....

    Hello there!      I would appreciate a piece of advise about a matter I am working on. I have attached two photos  and I will explain what I want to do. I would like to key out the green backdrop in order to keep just the actors but I also want to re

  • Query doesn't retrieve data after modify multiprovider

    Hi all, I created a backup cube and i put it under my MP, now my query doesn't retrieve the relative archived data. I don't have any customer exit, and i see the infoprovider in the query filter on infobject 0infoprovider. i see the data under transa