LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help figuring out mistake in true/false strings

Hello. 

I have a labview project i have spent quite a lot of time on. unfortunatly there are quite a few mistakes here and there.

Im wondering if anyone can review the project and send me some feedback on where i am going wrong.  I am really short on time as this needs to be presented on wednesday and i just dont have the time to check everything again.

 

Basically the poblem is the munbers are not being processed correctly if tank 3 in valve is switched off.

Thanks to any one who can help with this.

Download All
0 Kudos
Message 1 of 20
(3,155 Views)

Take the tutorials and learn about race conditions. After that you should be able to rewrite this with time to spare for Wednesday.

0 Kudos
Message 2 of 20
(3,145 Views)

Look like a nightmare. The front panel is full or race conditions due to overuse and unecessary use of local variables. You write to the same local variable in several locations and there is no defined order.

You also don't seem to understand local variables, else you would not read one and then write the value immediately back to the same local variable (see example in image below). That code would act exactly the same if you would delete the contents of the false cases.

 

 

 

There are many more construct that don't make much sense in a dataflow language.

 

 

You need to take the "front panel.vi" and eliminate most (or all) locals and define a clear execution order.

 

Message 3 of 20
(3,143 Views)

Your abuse of local variables is causing all kinds of race conditions.  Specifically, I see controls that are being written to in at least 2 places in a given loop iteration.

 

Try getting rid of the local variables and only use the indicator terminals.  You need some extra logic in there to decide exactly what the value should be.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 20
(3,137 Views)

I always though if you do not set a false statement then the true statement will not stop. but thats a minor correction,

 

The part i really want help with is the last 3 tanks are not getting the correct numbers. everytime i get one to display properly it creates a new bug.

 

 

0 Kudos
Message 5 of 20
(3,128 Views)

@AceScottie wrote:

I always though if you do not set a false statement then the true statement will not stop. but thats a minor correction,


 

I have no idea what you are trying to say here? What is "set"? What is a "true/false statement"? What is "stop"?

 


@AceScottie wrote:

The part i really want help with is the last 3 tanks are not getting the correct numbers. everytime i get one to display properly it creates a new bug.


As we said, eliminate the race conditions and things will automagically work. For example you write to global variables from within the "front panel", but also write to the same global variables from the control panel every 250ms. Two independent code parts fighting to control the same location. Whoever did the most recent write wins. Similar problems are with your local variables in the front panel.

0 Kudos
Message 6 of 20
(3,108 Views)

Ill try clear up some of the code a bit more.

 

But as for the global variables being written from both controls and from the front panels, unless there is a way to set it so the a button can read/wright at the same time wuth a priority then thats the only way i know it works. I have to set something as true or false from the control panel, but if a condition from the frontpanel is met then it must be set to false, if it tell the control button to read the false value then it will just loop forever. 

 

and please note i have only been using Labview for about 3 days ...

0 Kudos
Message 7 of 20
(3,081 Views)

@AceScottie wrote:

Ill try clear up some of the code a bit more.

 

But as for the global variables being written from both controls and from the front panels, unless there is a way to set it so the a button can read/wright at the same time wuth a priority then thats the only way i know it works. I have to set something as true or false from the control panel, but if a condition from the frontpanel is met then it must be set to false, if it tell the control button to read the false value then it will just loop forever. 

 

and please note i have only been using Labview for about 3 days ...



I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 8 of 20
(3,068 Views)

Hi AceScottie,

 

As you have been informed your applciation has lot of conflcts in writing and reading from your controls and inidcators due to the overuse and implementation of the local variables, as a result this create race conditions.

The following link' Tutorial: Local Variable, Global Variable and Race Conditions' explains what race condtion is.

 

If you could modify your code to wire the controls to indicators where possible will be a good start. Having multiple writers and one reader is a way to create the race conditions and one way of avoiding this would be to have one writer and multiple readers.

 

Kind regards,

GajanS

 

 

0 Kudos
Message 9 of 20
(3,043 Views)

Ok worked my butt off today redoing most of the code for this. Took what everyone was saying on bored as well as the answer to another question i posted.

Switched to from tue false strings to a case structure.

 

Just 2 questions. I manually programmed in all 25 possible case events (booleans), is there a faster way i can do it without having to make an answer for every possible scenario ?

 

Again Attaching my work so if anyone is willing to verify it id appreciate it. Most of it is incomplete and i am aweare tanks can currently have negative values.

Download All
0 Kudos
Message 10 of 20
(3,011 Views)