LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

im doing my final year project here and i need help- karasi

Solved!
Go to solution

 


@karnan wrote:

I need an explanation on case structure dealing with graphs. I've been trying to bring out the graph using a case structure but when it runs, it changes the graphs on its own, not when the buttons are clicked. The values are not important now though. So please do not say that I did not include any values. Please do not shoot me with your comments because I am really trying my hardest to learn this software as fast as I can. And it's getting more difficult as I try. Thanks .  Smiley Happy


 

"And it's getting more difficult as I try." 

 

The reason that it's getting MORE difficult is because you lack understanding of the basic concepts in LabVIEW programming.  You must learn that stuff first, there is no shortcut.  The VI you just posted doesn't even contain a loop.  If you run it, it will load one random point into the graphs ( which you can't see because it take two points to make a line segment appear), and then just stop executing.  It never even has a chance to read the buttons you press so I don't know how you're clicking them.  (I hope you're not starting the VI with the continuous RUN button!)

 

Start with the tutorials I linked to above.  Learn about loops, case structures, shift registers, basic math functions, etc...  Then start writing some simple examples using graphs.  As you learn the basics better the job you're trying to do right now will seem quite easy.  Don't rush it.  Read the tutorials, look at the example, try to modify those example to make them do what you want them to do.  Stick with it and don't get frustrated.

 

And seriously, I can't accept that the "values are not important now".  The values are the ONLY thing that's important.  LabVIEW is designed for engineers, pretty GUI front panels are possible but require advanced techniques that you just haven't learned yet. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 31 of 48
(1,072 Views)

This is what I've updated so far. I want to understand the iteration connection here. Don't really understand it. And I want to check whether my true and false cases are correct here to bring out the graph.

0 Kudos
Message 32 of 48
(1,058 Views)

First, you need to change the condition on your while loop to be Stop if True rather than Continue if True.

 

Second, you don't have any kind of wait statement in the while loop, so it is trying to run as fast as possible eating up all the CPU resources.

 

Third, your 4 boolean buttons are all disabled, so they don't actually do anything.  Worse, you can't tell they are disabled because they are set for disabled rather than disabled and grayed.

 

Forth and the biggest problem, because you have 4 boolean buttons with the visible property nodes in both the true and false cases of all 4 case structures, you have a huge race condition going on where all 4 groups of property nodes are competing with each other as to whether a given graph is visible or not.

 

You need to define your archictecture.  What is supposed to happen when a given button is pressed?  Can more than one button be pressed at a time?  If so, what happens?  If not, why aren't you using something like radio buttons to determine what is open?

 

Rather than having 4 parallel case structures competing with each other over and over again, you should probably have an event structure that determines the visibility of a graph only when a button is pressed.

Message 33 of 48
(1,056 Views)

Second, you don't have any kind of wait statement in the while loop, so it is trying to run as fast as possible eating up all the CPU resources.

 

Forth and the biggest problem, because you have 4 boolean buttons with the visible property nodes in both the true and false cases of all 4 case structures, you have a huge race condition going on where all 4 groups of property nodes are competing with each other as to whether a given graph is visible or not.

 


How do I include a wait statement here. Could you please explain?

 

Should I disable the property nodes of the graph that I do not wish to display in that case?

Eg. In Case 1, I disable XY graph 2, 3 & 4, temp graph 2, 3 & 4 and XY graph 1 &

temp graph 1 will be visible.

Is it supposed to be like that?

0 Kudos
Message 34 of 48
(1,049 Views)

Timing palette has a Wait (msec) function.  Drop that in the loop and wire up some reasonable time to it.

 

You really need to look at an event structure.  You only want the code that shows the graphs for 2 and hides graphs 1, 3, and 4 to occur when button 2 is actually pressed.  Likewise for the other buttons.

 

Your logic is actually backwards right now on disabling buttons.  Right now you disable all of them when they are false which means right away you can never press them.  Even if any happen to be true before the VI starts, the others will be immediately disabled.  And the ones that are True to start with will disable themselves as soon as you press them to be false.

 

The Disabled option for controls should never be used.  It is really makes a poor user interface for a user.  I see a button to be pressed, it looks normal, I try to press it and nothing happens.  What the heck is going on?  Now if it is disabled and grayed, now I can visually see that the button does nothing for me right now.

 

But in your VI, I don't see why you'd ever want to disable any of the buttons, because you do want the option to be able to click on one of the others, don't you?

 

If you want it to act more like a radio button, then set your mechanical action to be switched when released rather than latch when released.  That way the button looks like it stays down indicating that it is pressed.  You can use that code in the event structure to write a false to all the other buttons which will make them look like they are popping back up.

 

Make sure you set all your graphs to the same size and location.  Right now they are slight differences which makes some annoying shifts in appearance as the different graphs become visible.

Message 35 of 48
(1,043 Views)

Because you don't have, or at least have not provided a specification for the user interface, your code is a mess. I would suggest tou try a tab control and get rid of all those propert nodes. Drop a tab control on the block diagram. Place a pair of graphs on tab 1, place another pair on tab 2, another on 3, another on 4. Now the visibility is controlled with just the tab value.

0 Kudos
Message 36 of 48
(1,039 Views)

@Dennis Knutson wrote:

Because you don't have, or at least have not provided a specification for the user interface, your code is a mess. I would suggest tou try a tab control and get rid of all those propert nodes. Drop a tab control on the block diagram. Place a pair of graphs on tab 1, place another pair on tab 2, another on 3, another on 4. Now the visibility is controlled with just the tab value.


I got so locked in on trying to figure out what the OP is doing and how to fix it with all those buttons and property nodes, I never thought of what the appropriate and easier alternative of  tab control.Smiley Surprised

0 Kudos
Message 37 of 48
(1,037 Views)

 


@Ravens Fan wrote:

@Dennis Knutson wrote:

Because you don't have, or at least have not provided a specification for the user interface, your code is a mess. I would suggest tou try a tab control and get rid of all those propert nodes. Drop a tab control on the block diagram. Place a pair of graphs on tab 1, place another pair on tab 2, another on 3, another on 4. Now the visibility is controlled with just the tab value.


I got so locked in on trying to figure out what the OP is doing and how to fix it with all those buttons and property nodes, I never thought of what the appropriate and easier alternative of  tab control.Smiley Surprised


Been there myself lately.Smiley Wink

 

Message 38 of 48
(1,031 Views)

I've got mine working without the XY graph, my supervisor wants a chart waveform instead. Here's what I've done to get it working.

0 Kudos
Message 39 of 48
(1,021 Views)

karnan wrote:

"How do I include a wait statement here. Could you please explain?"

 

I was going to mention using the tab control as well but statements like the one above make me think I'm wasting my time trying to help.  If he won't learn the basics then we all get stuck with an endless thread full of "OK, that worked...  But now how do I make it do this???" posts.

 

karnan: Please learn the fundamentals of LabVIEW so you don't have to ask so many basic questions.  It doesn't take long and many of the tutorials are fun.  You can use the link I gave above, search for LabVIEW tutorial videos on YouTube, check your schools library, etc. 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 40 of 48
(1,003 Views)