03-30-2015 12:42 PM
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.
03-30-2015 12:53 PM
Take the tutorials and learn about race conditions. After that you should be able to rewrite this with time to spare for Wednesday.
03-30-2015 12:55 PM - edited 03-30-2015 12:58 PM
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.
03-30-2015 12:57 PM
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.
03-30-2015 01:06 PM
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.
03-30-2015 01:54 PM - edited 03-30-2015 02:05 PM
@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.
03-30-2015 05:28 PM
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 ...
03-30-2015 08:33 PM
@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
03-31-2015 07:34 AM
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
03-31-2015 03:47 PM
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.