LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

starting and stopping Elapsed Time


@LuisAE wrote:

Hello Chadius, 

 

Thanks for posting,

I took a look at your code this morning. We at NI recommend using varibales as one of the last resources when trying to pass data out in cases where this is rseally necesary, when looking at your code I realized that the variables to pass data are not needed and that actually there are some misconceptions about the functionality of the vi funtions, do not be ashamed that is totally understandable when you are new to a concept and more understandable if you are new to labVIEW.

 

Before proceeding with the code I would like to encourage you to check the Getting started with LV It gives you the basis to start programming in labVIEW and helps us understand better how LV executes.
There is also a lot of good help loaded in Labview that can help us determine what to use and what is expected of each function, you can access this by pressing ""CTRL+H" and accesing the detailed help when hovering over a specific VI and clicking detailed help.

 

Then if you are a new user to labview and would likely use labview for long term development I will suggest the training.

 

Now, getting to your code I can see that you are doing a bit more code than what you actually need, so for instance:

 

-we can eliminate the constants and the selector and just pass the boolean.

-we can also use less while loops so the part where you write to the variables can be done in the same while loop on the right.

-Instead writing to the variable and reading from that same variable you can just wire a cable so you have the same data

-You can use the error wire out/in of the functions to control code execution.

 

Last but not least, I am asumming here that this application you are coding is most likely to be a state machine where you are making a choice depending of the inputs you have, If "A" then "B"

 

This is an example of a simple state machine based on user input, you can change that input to be an event, a trigger etc.

 

 

Hope this helps, 

 

Luis

Application Engineer
National Instruments. 

 

 

 

 


Here is what I have done so far. I actually did part of that before you posted it. Hopefully that means I am kind of getting it. I'm still having the problem with elapsed time. But I realize that you guys are making code not crappy first. 🙂

0 Kudos
Message 11 of 16
(1,732 Views)


I think it is great that you are actually getting the way it works, 

 

Just to clarify can you please tell me where exactly is the part you are getting stucked and what exactly is that you want to do, I read through the posts but it is not clear to me.

regrads,

 

Luis A

Application Engineer.

National Instruments. 

0 Kudos
Message 12 of 16
(1,730 Views)

In the FOR loop, next to the C2R boolean, that is where the problem lies. I need the Elapsed Time to only start running when the OPEN global goes to 

zero voltage. The way the electrical circuit, and the vi is made to work, is that it stay on full open for one second and power shuts off to the valve. While power is shut off and it is closing, my timer needs to be running. If the timer hits 240 seconds, then my software will trigger power back on to the valve.

The catch is that the timer will only run while the valve is in the full open position. Once it leaves the full open switch, and power comes back to the switch, the timer stops.

 

By the way, I am using a 6215, 6009, and a 9211/9162 for my measuring equipment. The 6009 is wired for the digital side, to trigger an electrical circuit needed for the valve.

0 Kudos
Message 13 of 16
(1,728 Views)

@Chadius wrote:

In the FOR loop, next to the C2R boolean, that is where the problem lies. I need the Elapsed Time to only start running when the OPEN global goes to 

zero voltage. The way the electrical circuit, and the vi is made to work, is that it stay on full open for one second and power shuts off to the valve. While power is shut off and it is closing, my timer needs to be running. If the timer hits 240 seconds, then my software will trigger power back on to the valve.

The catch is that the timer will only run while the valve is in the full open position. Once it leaves the full open switch, and power comes back to the switch, the timer stops.

 

By the way, I am using a 6215, 6009, and a 9211/9162 for my measuring equipment. The 6009 is wired for the digital side, to trigger an electrical circuit needed for the valve.



You have no C2R boolean. You have a C2R Double that you compare to get a boolean result. You dont need the sequence in that loop since the latter case cant execute without the answer through the thread anyway. As i understand from a quick look you'll only need to connect 240 to Time Target and Reset connected to Open=0.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 14 of 16
(1,713 Views)

@Yamaeda wrote:

@Chadius wrote:

In the FOR loop, next to the C2R boolean, that is where the problem lies. I need the Elapsed Time to only start running when the OPEN global goes to 

zero voltage. The way the electrical circuit, and the vi is made to work, is that it stay on full open for one second and power shuts off to the valve. While power is shut off and it is closing, my timer needs to be running. If the timer hits 240 seconds, then my software will trigger power back on to the valve.

The catch is that the timer will only run while the valve is in the full open position. Once it leaves the full open switch, and power comes back to the switch, the timer stops.

 

By the way, I am using a 6215, 6009, and a 9211/9162 for my measuring equipment. The 6009 is wired for the digital side, to trigger an electrical circuit needed for the valve.



You have no C2R boolean. You have a C2R Double that you compare to get a boolean result. You dont need the sequence in that loop since the latter case cant execute without the answer through the thread anyway. As i understand from a quick look you'll only need to connect 240 to Time Target and Reset connected to Open=0.

 

/Y


I guess I am not understanding the first thing you said. I have no C2R boolean? Let me see if I am understanding the last thing your saying. Open global equal to zero, then wired to reset? I opened the elapsed time and put 240 inside. Will that do the same thing? The timer seems to run only when the valve is going full open and not when it is going closed. I need it to be the latter.

0 Kudos
Message 15 of 16
(1,704 Views)

So I finally got the vi to do what I am asking. Instead of the Elapsed Time feature, I am using Time Delay. It basically does what I need. The problem I have been seeing, is my 6009 module needs to be reset every time the vi is off for any length of time. I've tried 8 different modules, with same effect. This module is what the on and off bits are based off of. The other modules don't have any issues like this one does.

0 Kudos
Message 16 of 16
(1,692 Views)