08-16-2012 11:06 AM
Hello
I started to build a program that control on pump and valve
I don't know what is the effective way to work with out that have a conditions
1. Build a SubVI for every output?
2. Make a cluster with all the output
3. To make variable for every output
in my program I can control on the pump and valve manual or automatic
I don't know if to separate the manual from the automatic or to make it on the same VI or loop.
my last question.
I work with labview for 2 years and I learn it from the web, and every time I want to build something I search what I when to build and learn that. But I fill that this is not the correct way to learn. Maybe u have a site/videos that teach labview
thanks for your halp
08-16-2012 01:54 PM
Hi,
Of course, please post your VI's. In regards to "the right way", lets make it work first, then improve. If time is of no consequence, plan it out 🙂
Are you saying you want to evaluate the outputs using conditions against their values. If you are just pushing data out a subVI, I would suggest using a cluster to hold all you output types. I am assuming they are all coming out of one VI, yes?
You can improve this using a type deff to replace the cluster, then you can use the "type def cluster" more efficiently and scalable.
It's not clear how the gathering or processing of outputs that have conditions fits into the bigger picture.
***
You can put manual and automatic together in one VI , but that might be bulky. You can have a main VI that has several subs, manage them through a project. One sub for manual, one for automatic, etc...
Your question is a lot of questions at once, it seems. Can you be more specific, or are you looking for architecture recommendations?
08-17-2012 07:17 AM
thanks for your replay
I just started to build the front panel and not the block panel.
i build a sketch i wold like if you say what you think
there is two way
The Main Program
The First way
Output01
Output02
The Second way
What is the Best Way The first or the second?
thanks
08-17-2012 07:33 AM - edited 08-17-2012 07:35 AM
@Johnny1986 wrote:
thanks for your replay
I just started to build the front panel and not the block panel.
i build a sketch i wold like if you say what you think
there is two way
The Main Program
The First way
Output01
Output02
The Second way
What is the Best Way The first or the second?
thanks
How about a third way?
Use a common sub-VI for the sensor status and use that sub-VI in a sub-VI for each output.
Stepping back...
This is a question of design and in LV our designs are "data driven" in that we look for the data sets to give us direction on how to structure the code. From the little you have shown the two outputs are independent so they can be handled sepeartely (if it is time to change out #1 you do not have to think about out #2). But both outputs are dependent on sensors so therefore I suggested the three sub-VI approach.
When developing applications in LV it is the data that determines the code structure.
BTW:
All of your select nodes can be replaced with And gates to clean up your diagram.
Ben
08-17-2012 08:49 AM
How about a third way?
Use a common sub-VI for the sensor status and use that sub-VI in a sub-VI for each output.
Stepping back...
This is a question of design and in LV our designs are "data driven" in that we look for the data sets to give us direction on how to structure the code. From the little you have shown the two outputs are independent so they can be handled sepeartely (if it is time to change out #1 you do not have to think about out #2). But both outputs are dependent on sensors so therefore I suggested the three sub-VI approach.
When developing applications in LV it is the data that determines the code structure.
BTW:
All of your select nodes can be replaced with And gates to clean up your diagram.
Ben
if you can explain more about the third way you said "Use a common sub-VI for the sensor status and use that sub-VI in a sub-VI for each output.".
my english is not so good then if u can do a diagram in LV i will be good
Thanks
Johnny
08-17-2012 08:52 AM
First way, One way, ver 2: Build an array of the inputs and perform it in a loop. 🙂
/Y
08-17-2012 02:59 PM
Hi,
You are passing clusters to SubVI's. This seems to work fine either way.
Consider changing the clusters to 'type def', so you can update them ( add or remove elements) and all subVI's will update also.
It's hard to tell if either is better, all we are doing is passing clusters to subVI's.
Some questions to consider: Where did the clusters on the main VI come from, when are they used, do the outputs always get set together, or do you sometime only set some of the outputs. Is what you have shown the total of all channels (4 sensors, 2 pumps, one valve and two or three outputs )?
***
If you are constantly producing new values for the clusters and then passing the clusters to SubVI's, you could consider using a producer consumer. Maybe each output could be it's own SubVI, or maybe you want to process more than one output at a time, either way producer consumer will work.
If your process is well defined you could use a simple state machine, if it is somewhat dynamic you might consider producer consumer.
08-17-2012 04:17 PM
A fourth way which I suspect may be a bit too advanced at this type would be a LVOOP (LabVIEW Object Oriented) solution. If you are using LV 2012 you could look at the actor framework as a possible way to get started with LVOOP.