‎07-09-2014 03:34 AM - edited ‎07-09-2014 03:34 AM
optimal structure.
I am structuring my project with the following loops and case structures. I am following a good method? are good practices?
‎07-09-2014 03:59 AM - edited ‎07-09-2014 04:00 AM
Hey,
try to avoid deep nested structures. Please avoid the usage of a While loop in a While loop in a while loops.....
If you open LabVIEW -> welcome window -> create Project
take a look at the state machine template or the other architectures already implemented. I guess this would be a good starting point for a good structure..
Regards,
CMW..
‎07-09-2014 04:08 AM
Not at all. Please go to the Project templates available in LabVIEW and also search for "Design Patterns" in LabVIEW, you will get some good designs to start with your project. You also have tutorials which will guide in using the design patterns according to your requirement.
‎07-09-2014 07:14 AM
I would also say you likely want to go with a State Machine.
You also might want to break up some of your code into modules. For instance, you could have a loop just for controlling your motor with another handling your state machine.
‎07-11-2014 02:50 AM
Thanks for resquest.
All that programming structure is because I'm setting the filling and draining three tanks of fuel controlled SCADA. To control this work the state machine would you use?
The programming is finished and the way I said above and it works fine. But this was only the first test and now I want to make it perfect so that no errors occur.
Regards
‎07-12-2014 08:24 AM
‎07-13-2014 02:18 PM
@mikeporter wrote:
Yes, this application would be well suited for a state machine. Given the added information you provided -- that there are 3 tanks -- I would start by developing a reentrant VI capable of controlling one tank, and at runtime launch a copy of it for each tank.
The problem with having everything in one big VI is that a problem with one tank could adversely effect all three.
Mike...
For instance, if one tank developed a problem where it got stuck, all the other tanks would never get serviced by the VI... and you can just imagine all sorts of bad things happening because of that...
‎07-14-2014 02:57 AM
Thank you. For the problem of the tanks. Two of the tanks discharge on another. Do not know if this affects. I do not think so. If I try to modify the code as soon as possible. But after all the work done do not know if I will have problems where none now.
A greeting.
‎07-14-2014 03:16 AM
Hey,
So you stick to your original architecture?
"But after all the work done...." -> think about the sunk-cost fallacy and modify your architecture 🙂
mikeporter's idea of making the VI reentrant sounds good and also the statemachine should fit your application.
Who knows which problems will arise; what happens when you need an additional tank; ...
Regards
CMW...
‎07-14-2014 03:52 AM
After thinking it over and discuss it with my partner if I will modify my structure as a state machine.
Thanks for all your advice.