cromax Posted November 12, 2010 Report Share Posted November 12, 2010 Good Evening All sorry if the question is basic but the project that I have written is very large and difficult to manage in g language. Let me explain better. It is a VI in which three different programs co-exist (3 vi with while loop which make them remain active). The three programs exchange data in real time and manage separate acquisition, data processing and control actuators. Now it becomes difficult to manage the navigation windows and pan, for scrolling and showing the code. I would therefore like to know how I can do. I thought of the creation of 3 subVI for the three programs so that they will be included in a so called main vi but in that way the 3 subVI do not exchange data with each other. In fact FIFO system allow the exchange of data only if the subvi exits from while loop but so the subvi is closed and the program do not work isThere no way to hide parts of code in order to better manage the project? or can I work with subroutine or with class in my code Thank you very much Cromax Quote Link to comment
crossrulz Posted November 12, 2010 Report Share Posted November 12, 2010 (edited) You might want to look into the Producer/Consumer design pattern and the use of Queues. There are certainly many ways to communicate between parallel VIs (global variables, Queues, Notifiers, Action Engines). Based on what little I understand about your situation, I would say the Queue if probably your best bet. As far as reducing block diagram size (for a main VI), subVIs are your friend, especially if you are performing the same action in different places. Edited November 12, 2010 by crossrulz Quote Link to comment
PaulG. Posted November 12, 2010 Report Share Posted November 12, 2010 You were on the right track with your first idea in making 3 seprate vi's. Queues can exchange information in between seperate vi's so if you use queues you will have a handy way of exchanging data in between the seperate vi's. Again, sub-vis are your friend. The world is simply a better place when your vi fits on one screen. Quote Link to comment
ShaunR Posted November 12, 2010 Report Share Posted November 12, 2010 The world is simply a better place when your vi fits on one screen. Amen ! There is no excuse for it not to. Quote Link to comment
jgcode Posted November 13, 2010 Report Share Posted November 13, 2010 Amen ! There is no excuse for it not to. One page is best, but an example of when this can be hard/impossible is with ActiveX/dotNET/Reference-y-type calls with wide nodes. In this case, as long as you only have to scroll in one direction, thats ok IMO. Quote Link to comment
ShaunR Posted November 13, 2010 Report Share Posted November 13, 2010 One page is best, but an example of when this can be hard/impossible is with ActiveX/dotNET/Reference-y-type calls with wide nodes. In this case, as long as you only have to scroll in one direction, thats ok IMO. well. ActiveX and dotNET are banned in my applications Quote Link to comment
cromax Posted November 15, 2010 Author Report Share Posted November 15, 2010 thank you very much but how can I do if i have many connectors for output?!icone is small Quote Link to comment
jgcode Posted November 15, 2010 Report Share Posted November 15, 2010 thank you very much but how can I do if i have many connectors for output?!icone is small Hi Cromax You could use a Cluster as an output if you wanted to maintain a standardised connector pane e.g. 4x2x2x4 You could also look at Classes. Quote Link to comment
cromax Posted November 15, 2010 Author Report Share Posted November 15, 2010 thanks a loto jgcode but I do not know the function that you tell me to use. I have also another problem. thanks again I use notifiers to communicate between subVIs loaded in the same main VI ,but if the graphics of a subvi had to be displayed in real-time control panel how can I do to see them again. If I load in the main vi a subVI with its graphics functio on control pannel the graphics windows of the subVI does not appear on the control panel of the main VI. How can I do? thanks Quote Link to comment
Dan DeFriese Posted November 16, 2010 Report Share Posted November 16, 2010 (edited) If I load in the main vi a subVI with its graphics functio on control pannel the graphics windows of the subVI does not appear on the control panel of the main VI. How can I do? thanks Sounds like you could use a subpanel control on your main VI (top-level front panel) to select between your 3 subVIs. Look at the "Subpanel Viewer.vi" in the Example Finder. (Help -> Find Examples...). ~Dan Edited November 16, 2010 by Dan DeFriese Quote Link to comment
cromax Posted November 16, 2010 Author Report Share Posted November 16, 2010 thanks I will try it Quote Link to comment
335_x Posted December 3, 2010 Report Share Posted December 3, 2010 Amen ! There is no excuse for it not to. sooo... it's kind of a sin to do this in an excercise as simple as this one... circuito prueba 1.vi Quote Link to comment
jgcode Posted December 3, 2010 Report Share Posted December 3, 2010 sooo... it's kind of a sin to do this in an excercise as simple as this one... Hey if it works it works? One issue with tying your logical code to your UI code is that you can't easily test your logic. I would say you definitely have scope to use subVIs. How far you what to go with it depends on e.g. What is the life-cycle of the code? Does some one else have to work on it? Will the project be expand to include more functionality? etc... Quote Link to comment
ShaunR Posted December 3, 2010 Report Share Posted December 3, 2010 sooo... it's kind of a sin to do this in an excercise as simple as this one... Sin? Noooo. But this is an interesting one. It will fit on 1 screen. Just do a "Clean Up Diagram" with shorter variable names and you're pretty much there. But that's not the interesting bit There is a large number of operations that are identical. Identical operations easily be encapsulated into sub-vis. This not only shrinks your diagram, but also segments it into easy to digest chunks of code. Consider this piece of code.... this is replicated no less that 6 times. I would be tempted to do something like this : It achieves several benedits. 1. it is more compact 2. It is easier to identify repeated functions.. 3. It reduces wiring errors 4. It gives more control (you can, for example make it a "Subroutine" for faster execution) 5. You can re-use it . There are many more places within this piece of code where it could benefit from sub-vis. The net result would be that it will probably fit on 1/4 of a screen and be a lot easier to read/maintain. There are also a few areas that would benefit from "For Loops" too. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.