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!
(PS I am not very computer or technical savvy, so when explaining please "dumb it down" as much as possible... I greatly appreciate it! 🙂 )
Welcome to the forums
To reword your question:
..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.
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?
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)?
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.
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?
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?
..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.
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?