LabVIEW

cancel
Showing results for
Did you mean:

real time

Hello! I am very VERY new to LabView and am having an issue with figuring out how to turn a "flood gate" off during the REAL TIME of 10:00pm to 7:00AM. The other factor is to keep the floodgate open until it hits 250" or higher. My professor is not very great at teaching us how to use this program, so I am hoping someone out there can help! Attached is the copy of my VI that I have at the moment. Thanks!

Sincerely-

Mandy

(PS I am not very computer or technical savvy, so when explaining please "dumb it down" as much as possible... I greatly appreciate it! 🙂 )

Message 1 of 28
(1,479 Views)

Re: real time

Hi Mandy,

Welcome to the forums

..turn a "flood gate" off while the time is between 10:00pm to 7:00AM. (AND) The other factor is to keep the floodgate open until the depth is greater than or equal to 250".

So there are some clues in there as to the tools you will need to do the job.  It will be of most benefit to your development to have another go using those and post back the results.

Have fun!

Regards,

Peter D

Message 2 of 28
(1,459 Views)

Re: real time

Also, you'll have to think how to turn the date and time string into a number.

- Do you need to know minutes if it is between 20:00 and 07:00?

Regards,

Peter D

Message 3 of 28
(1,451 Views)

Re: real time

I honestly am not sure. My professor never really went into detail. Would it be easier to calculate the amount of minutes in between those hours to form the loop?

Message 4 of 28
(1,438 Views)

Re: real time

I don't think you need to know the minutes.

You wrote it yourself, "10:00pm to 7:00AM" the floodgate is 'off'.  That is the same as saying, between 07:00 and 20:00 - the floodgate is 'on' - currently ignoring what happens at exactly 07:00 or 22:00.

You know how to get the hours and minutes in the VI you posted - can you work out how to get only the hour, and turn it in to a number (rather than a string)?

Regards,

Peter D

Message 5 of 28
(1,427 Views)

Re: real time

Are you supposed to be getting an input for the time (from a control)?

Assuming no input, I would handle the time like this.  I used the Seconds to Date/Time function (in the Timing palette) to get the current time.  If you leave the input unwired, it gets the current time.  This function returns a cluster with all kinds of time parameters.  You need to use the Unbundle By Name to extract the Hours.  I then used the In Range and Coerce function to see of the hours were between 7AM and 10PM.  It doesn't matter what the minutes are.

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 6 of 28
(1,420 Views)

Re: real time

So essentially, you are saying that the Format Date/Time string isn't necessary at all? Or that it needs to be converted to a numerical form that displays on the Front Panel? And just so we are going in the right direction, between 10PM and 7AM (Which on the 24 hour clock is 22:00 - 07:00), the Floodgate will automatically close. We are using a simple Boolean to depict whether or not the floodgate is closed. We have managed to work out the greater than or equal to 250", which is seen within the case structure, linking to a boolean. Whenever a number is put into the input (numerical), it is tested against the numerical constant of '250', thus if it is that number or above the boolean is activated. What I am getting from what you are saying, and this is from a very inexperienced student, we need to implement a 'While Loop' within our case structure, that utilizes the In Range (which I don't completely understand) to test the result displayed from our 24 hour clock? And if this is the case, how do we make this While Loop transfer the results into the same Boolean?

Message 7 of 28
(1,419 Views)

Re: real time

Crossrulz method will tell you whether or not your are within the right time frame.

As you mention, you understand how to test whether the water level is greater than or equal to 250".  Now you need to combine the two, so the logic is:

If the time is within the limits AND the water level is NOT greater than or equal to 250" » The gate is open

Not greater than or equal to is equivalent to less than, right?

Regards,

Peter D

Message 8 of 28
(1,401 Views)

Re: real time

@JonCurry wrote:

..you are saying that the Format Date/Time string isn't necessary at all? Or that it needs to be converted to a numerical form that displays on the Front Panel?

You can display strings or numbers (or any data) on the front panel.  The reason to have it as a number is that we can process it more easily (i.e. compare it to other numbers.

we need to implement a 'While Loop' within our case structure

The While Loop will help you out if you want to test more than once (for instance, you could have a control on the front panel which is your simulated water level - and test the logic by changing the value).  In any case, the loop would most likely be outside the case structure (for this problem you probably don't need a case structure at all).

Try to get the logic working for single shot.  You should be able to input the water level (and time, unless you want to test between 22:00 and 07:00) - and see the boolean result.

Once you get there we can think about how to run the code continuously.

Regards,

Peter D

Message 9 of 28
(1,393 Views)

Re: real time

Crossrulz, I really appreciate the help thus far. Does this Seconds to Date/Time function determine the time by itself? Also, I connected the Range to another Boolean that will turn on if the time is in between 22:00 and 07:00, will this suffice?

Message 10 of 28
(1,390 Views)