05-19-2020 03:18 PM
Hi,
I'm creating a small project, with a VI named "Mainpanel" and a subVI named "TankModel". There are 2 control: InletValve(boolean) and SimulateInlet(DBL). An indicator: Level(DBL).
What I want is: when I start the Mainpanel, Level is initialized at 4000. Then if InletVavle is TRUE, and SimulateInlet>0, then Level starts increasing from 4000.
The problem is, when I run the subVI itself, everything worked like what I said above.
However, if I run the VI Mainpanel, and change InletValve and SimulateInlet, the corresponding variable in TankModel changed as well, but indicator (Level) didn't changed, in both the VI and the subVI.
Can you give me some advice with my problem?
Thank you
Solved! Go to Solution.
05-19-2020 03:53 PM
Couple of things you have done wrong, all stemming from the fact that you have misunderstood the main LabVIEW principle of dataflow.
When your subVI (Tank model) loads, pretty much the first thing that probably happens is that the local variables are evaluated, and they won't be what they were set to the last time the VI ran, they will be the default values, 0 in your case. This means that the Flow and Level local variables both output 0.
You basically need to enforce the proper order of excecution by wiring your nodes in the right order.
To pass the current tank level to the next iteration of your loop you also need to use a shift register in your main VI.
I have attached some modified code. Look at the Diagram Disable Strucutres for the code that I changed.
Also, you have to put in a pretty large number into the ControlValve terminal to actual see any change in tank level...
05-19-2020 04:05 PM
Hi Niatross,
Thank you for replying to me.
I will take a look at your solution, and if there are some further questions, hope you can instruct me. About the large number have to set to ControlValve, I noticed that, but firstly I want to fix the problem above, so I haven't editted some constant yet.
Again, thank you for helping.