Jump to content

Current Time


Recommended Posts

i'm having a hard time with the current time..i'm not visually seeing the tanks rise..what should I do? I'm pretty new to this so any help would be greatly appreciated!

PROBLEM STATEMENT: The system consists of an upper tank

full of water with two spigots that are initially closed. The spigots are mounted at the

same height on the large tank at opposite sides from one another. The spigot on the upper

tank which drains into the cylindrical tank (and appears on the left side of the upper tank

in Figure 1) has a diameter of 0.06 ft. The spigot on the upper tank which drains into the

rectangular prism tank (and appears on the right side of the upper tank in Figure 1) has a

diameter of 0.08 ft. At time t=0 s, both spigots are opened and water discharges from

each spigot at an average velocity of 4.1 ft/s. The water from the left spigot discharges

into a cylindrical tank. The water from the right spigot discharges into a rectangular

prism tank. The dimensions for each of these two tanks appear in Table A below.

Cylindrical Tank

Rectangular Prism Tank

Radius = 0.44 ft

Width(W) = 1.5 ft

Depth = 2.0 ft

Tank Height = 3.0 ft

Tank Height = 1.5 ft

this program should use a while loop to compute the water height in the cylindrical tank, rectangular prism tank, and the percent difference between the two every 10.0 s until the user-entered time is reached. Hint: use the "Current Time" wire, control(s) given to you in your skeleton VI and LabVIEW function(s) to build a stop condition for your while loop. In addition "Current Time" should be incremented by 10.0 s before being used by the next loop iteration.

Also, each time the output is displayed, the program should wait 4x102 milliseconds before displaying the output at the next time increment. This can be done by simply placing a Wait inside your while loop. The Wait can be found on the Functions Panel under Timing. Once the Wait has been placed in the loop, simply enter the time of 4x102 milliseconds, which can by done by creating a constant numeric input on the left side of the Wait. Thus, the three outputs will then appear for 4x102 milliseconds, and then the outputs at the next time increment will appear for 4x102 milliseconds, and so on, until the final time is reached. Additionally, you should be able to see the water height in both the cylindrical and rectangular prism tank graphical indicators rise accordingly at each time increment and hold for 4x102 milliseconds until the next time increment

Link to comment

QUOTE (Callista @ Dec 3 2008, 03:20 PM)

i'm having a hard time with the current time..i'm not visually seeing the tanks rise..what should I do? I'm pretty new to this so any help would be greatly appreciated!

It looks like you've made a good start on this assignment and you just need to spend more time learning how to debug LabVIEW code so that you can find your error(s). Try using execution highlighting (the light bulb icon in the toolbar) and probes (right-click on a wire and choose probe) to follow the values on your wires as the program runs. It will also help if you clean up your wires and make sure they don't overlap. Right-click on your tanks and set the digital display to visible so that you can see the actual numeric value that your code is computing.

There are a few style issues - there's no need for sequence structures nor property nodes and you could move some of your calculations outside the while loop to reduce redundant computation - but focus first on getting your existing program working.

Link to comment

QUOTE (Callista @ Dec 3 2008, 12:20 PM)

PROBLEM STATEMENT: The system consists of an upper tank

full of water with two spigots that are initially closed. The spigots are mounted at the

same height on the large tank at opposite sides from one another. The spigot on the upper

tank which drains into the cylindrical tank (and appears on the left side of the upper tank

in Figure 1) has a diameter of 0.06 ft. The spigot on the upper tank which drains into the

rectangular prism tank (and appears on the right side of the upper tank in Figure 1) has a

diameter of 0.08 ft. At time t=0 s, both spigots are opened and water discharges from

each spigot at an average velocity of 4.1 ft/s. The water from the left spigot discharges

into a cylindrical tank. The water from the right spigot discharges into a rectangular

prism tank.

This is probably the coolest LabVIEW homework problem I've seen! :thumbup:

Where are you taking this class? What is the class name/instructor?

Also, you might try using formula nodes instead of the math function nodes as it can become difficult to figure out what your formulas are doing when they are spread via the math primitives for complex operations. I usually avoid the primitives if I have to do more than 2 or 3 mathematical operations. You can consider using both too, formulas where appropriate and math primitives where it is easier -- the goal for yourself is readability -- can you look at the code and basically understand what is happening or do you have to sit and stare for a few minutes before everything becomes clear. Good luck with your project, you look like you are making great progress!

Link to comment

...but which implementation executes fastest?!?

I just had to try this. So I made a quick calculation VI with 3 different implementations, as show in the picture.

You would think that LabVIEW would optimize the code and execute in almost the same way, but there is a time difference in all three implementations.


post-941-1228348201.png?width=400

The answer was the Formula Node :-)

Cheers,

Mikael

Link to comment
  • 1 month later...

MikaelH,

I see that in the formula node that you used you didn't initialize the variables that you were outputting from the formula node. I thought I recall that you had to declare all variables (excluding the inputs to the node) so that labview would know what type of variable to create. Do you know if this lack of declaring the variable type is something that's new to LabVIEW? It's not really important I suppose, but curiosity got the better of me.

Thanks,

Dave

Link to comment

QUOTE (Dave Graybeal @ Jan 16 2009, 08:04 AM)

MikaelH,

I see that in the formula node that you used you didn't initialize the variables that you were outputting from the formula node. I thought I recall that you had to declare all variables (excluding the inputs to the node) so that labview would know what type of variable to create. Do you know if this lack of declaring the variable type is something that's new to LabVIEW? It's not really important I suppose, but curiosity got the better of me.

Thanks,

Dave

I believe the only time you have to initialize a variable is if it isn't defined by an input or output of the formula node.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.