LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Proper architecture for LabVIEW Project

I've started programming in LabVIEW about 3 months ago. I've been looking for ways to learn it better. A lot of suggestions on the forums are to give yourself a real problem to solve. I'm trying to make a blackjack game. I want to know a good approach to starting this project. Rather than to just start coding. What's the technique for laying out a good architecture for the project so that I don't end up with one massive VI?

0 Kudos
Message 1 of 9
(4,955 Views)

Have a really good idea of what you want to accomplish.  Break it down into steps.  Each step will be a subVI.  If you're really thorough, maybe you have subparagraphs for each step.  Those can be "sub-subVIs".  This make figuring out where you went wrong so much easier, as you know the function of each subVI and can zero in on the issue right away.  Especially since the error call chain will tell you exactly what subVI it occurred in.  (If you have one massive VI, the call chain is meaningless because it just names your superVI and the error could be anywhere inside of it.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 9
(4,913 Views)

Well, one good metric specific to LabVIEW is that if you create a VI which has a block diagram that doesn't fit on your screen, you need to add some subVIs (or in some other way reorganize it) to make it fit on your screen.

 

For programming in general, anytime you find yourself repeating code you should make it into a separate function (or in LabVIEW's case, a subVI) so look for that as well, of course.

0 Kudos
Message 3 of 9
(4,910 Views)

@Kyle97330 wrote:

Well, one good metric specific to LabVIEW is that if you create a VI which has a block diagram that doesn't fit on your screen, you need to add some subVIs (or in some other way reorganize it) to make it fit on your screen.

 

For programming in general, anytime you find yourself repeating code you should make it into a separate function (or in LabVIEW's case, a subVI) so look for that as well, of course.


I think that, between what you and I said, your first paragraph issue generally takes care of itself.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 9
(4,898 Views)

I'll add one more that I employ for all of my LabVIEW Projects.  I create a Folder "Tree" for the Project -- the Top Level Folder is named for the Project, and has sub-Folders for Sub-VIs, Types, Documentation, Resources (Icons), Tests (which might also have Sub-VI and Types sub-folders), and Obsolete (not necessary if you are using Version Control, which you should be using).  I then structure the Project so that its Virtual Folder structure mimics this physical folder Tree.

 

Bob Schor

0 Kudos
Message 5 of 9
(4,879 Views)

there is a whitepaper that collects various resources regarding software engineering in labview

http://www.ni.com/white-paper/7117/en/

this might be helpful as well

 

regards

 


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 6 of 9
(4,878 Views)

@Bob_Schor wrote:

...  I then structure the Project so that its Virtual Folder structure mimics this physical folder Tree.

 

 


I take a different approach where I use Libraries instead of virtual folders. The libraries are in their own folder under the folder for the project and top-level VI. So the files/folder structure is sorta flat while the libraries inside the project have structure that mimics that hierarchy of the project. I do use virtual folders inside of libraries to hold the API, Public, Private, and controls.

 

Keeping the files/and folders on disk rather flat was recommended by AQ some years ago to make it easier for LV to find LVOOP classes. It also avoids an issue with Windows not liking to have a path with more than 255 characters.

 

The structure inside the projects does not have that limitation so the structure is created there.

 

I will also use multiple projects for an application when I have Re-Use code. Those are treated just like VIs from VI.lib in that they appear only in the dependencies. If I find that I need to enhance something in the Re-Use collection, I open the project for that collection, make the changes, and then return to the top level project.

 

Using multiple projects keeps the top level project lean and clean and free of the clutter of the support functions.

 

But that is just my 2 cents...

 

Ben 

 

Edit:

Since I mentioned Libraries I should share this blog article I wrote about exploiting libraries in LabVIEW. After all I wrote it help people out and what help would it be if nobody ever learned about it?

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 9
(4,876 Views)

@Ben wrote:

@Bob_Schor wrote:

...  I then structure the Project so that its Virtual Folder structure mimics this physical folder Tree.

 

 


I take a different approach where I use Libraries instead of virtual folders. The libraries are in their own folder under the folder for the project and top-level VI. So the files/folder structure is sorta flat while the libraries inside the project have structure that mimics that hierarchy of the project. I do use virtual folders inside of libraries to hold the API, Public, Private, and controls.

 

Keeping the files/and folders on disk rather flat was recommended by AQ some years ago to make it easier for LV to find LVOOP classes. It also avoids an issue with Windows not liking to have a path with more than 255 characters.

 

The structure inside the projects does not have that limitation so the structure is created there.

 

I will also use multiple projects for an application when I have Re-Use code. Those are treated just like VIs from VI.lib in that they appear only in the dependencies. If I find that I need to enhance something in the Re-Use collection, I open the project for that collection, make the changes, and then return to the top level project.

 

Using multiple projects keeps the top level project lean and clean and free of the clutter of the support functions.

 

But that is just my 2 cents...

 

Ben 

 

Edit:

Since I mentioned Libraries I should share this blog article I wrote about exploiting libraries in LabVIEW. After all I wrote it help people out and what help would it be if nobody ever learned about it?


Convergent evolution led me to a solution very similar to Ben's solution.  I might add that when I name a VI, I'll have a common "surname" that kind of links it to other related files (usually associated by virtual folder).  This way, if you view it in Windows Explorer you have an idea about how they are grouped together - although IMHO, LabVIEW files should never be viewed outside of their respective projects unless no other choice is available.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 8 of 9
(4,863 Views)

Cool -- I learn new things every day!  I have dipped my toes into LabVIEW Libraries, but didn't really "get it" and had trouble finding out the Hows, Whys, and Wherefores.  But your Blog article is a wealth of information -- many thanks.

 

Bob Schor

Message 9 of 9
(4,851 Views)