LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dead zone form a tank

Hi all,

 

I am quite new in this forum. I am writing because I have a problem with a VI that should manage a tank.

 

Attached you can find my vi.

 

I read this discussion: https://forums.ni.com/t5/LabVIEW/refrigerator-temperature-control/m-p/1096003#M484777

 

What I am not able to do, it is to set an analog input. In fact, if I run it, it is frozen to a constant value.

 


Thanks for your help,
Samuele

0 Kudos
Message 1 of 7
(586 Views)

Hi Samuele,

 


@fgjdgf wrote:

What I am not able to do, it is to set an analog input. In fact, if I run it, it is frozen to a constant value.


THINK DATAFLOW!

When the control is read only once before the loop then its value will not change inside the loop…

 

Recommendation: typedefine your state enum!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(553 Views)

Great, Thank you.

 

I did something like the vi attached and it seems to work, now.

 

Just one thing: what do you mean with

 


 

Recommendation: typedefine your state enum!


Thanks

0 Kudos
Message 3 of 7
(537 Views)

Hi fg,

 


@fgjdgf wrote:

Just one thing: what do you mean with

 


 

Recommendation: typedefine your state enum!



Create a typedefinition from your enum and use instance of that typedefinition in all places. Now changes to the typedefinition will be applied automatically to all instances…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(526 Views)

@fgjdgf wrote:

I did something like the vi attached and it seems to work, now.


Attached where?

0 Kudos
Message 5 of 7
(478 Views)

@fgjdgf wrote:

What I am not able to do, it is to set an analog input. In fact, if I run it, it is frozen to a constant value.


Please don't attach a VI verbatim that you downloaded blindly from the forum. A link is sufficient. (obviously this 14 year old code  is completely dysfunctional with dataflow problems and a greedy loop. Controlling a tank or refrigerator is a slow process, so spinning the loop millions of times per second just wastes power).

 

Then you talk about "analog input", which typically has a very special meaning involving measurements, not controls on the front panel. You also don't define "frozen". The control is not frozen and you can set a new value at any time, it's just that the code does not care because it is read only once.

 

You talk about a tank, so it is probably the tank volume, not refrigeration control.

 

Maybe as a first step define the problem you are trying to solve. What are the inputs (max volume, min volume, etc.) What are the process variables  (pumps, valves, flow rate, etc.). What are the outputs (current tank volume, etc.)? Then define all possible states in an enum (filling, draining, idle, etc.).

 

Properly done, the code would probably fit on a postage stamp.

 

0 Kudos
Message 6 of 7
(470 Views)

Here's a very simple tank simulation with a deadband. Maybe it can give you some ideas....

 

altenbach_0-1705335066397.png

 

0 Kudos
Message 7 of 7
(462 Views)