06-02-2009 03:27 AM
I would like to implement a Time Control System, which is used to control AC-single phase load (240V) based on different time schdule (For example: Monday 9-11am [ON], Tuesday 2-4pm [ON], etc.. The time of controlling load is repeated after 1 week)
Unfortunately, I don't have any idea to develop this project. Hope all the Professional Seniors, Teachers and Masters can help me solve this problem.
I will appreciate all of your guidances. Looks forward your reply eagerly.
Thank you very much.
Solved! Go to Solution.
06-02-2009 09:31 PM
Hi Kelvin,
If all you want to do is to check for the time and perform some action based on the day/time, you can easily do this using the time functions in LabVIEW. Here's a quick screenshot of how I'd imagine it would be done:
What I have there basically gets the date and time, extracts the day of the week and hour (you can also get down to fractions of a second) and then the case and in range function simply allows you to choose what to do for the particular day and hour. The Boolean indicator can be replaced with the output to your system.
In the screenshot above, I choose to turn ON the controller on Mondays from 9-11 am (like you mentioned in your post). You can easily change this behavior as you like. Put this logic inside a While Loop to continuously poll the time and you're done.
06-06-2009 08:40 AM
Thank you for advance me...
i have tried wat you told me but still cannot function....
it cannot function by following the day of week.... is it a.m. or p.m. will interupt the result?
beside that, how the system recognise the monday till sunday?
and how i put it in while loop to make it continuos?
06-07-2009 09:06 PM
Hi Kelvin,
What do you mean by "it cannot function by following the day of week" ? Do you mean that it does not recognize the correct day of the week? I realised that I was mistaken with my example, a day of the week of 1 means Sunday, 2 means Monday and so on till 7 (Saturday).
AM and PM is not directly given, the hour returns a value from 0-23 (0 being 12.00 AM and 23 being 11.00 PM) so the hour returned is equivalent to the 24-hour clock system.
All this info can be found in the Help file:
And to put it in a while loop, well, just create a while loop around all of that. If you don't know how to do this, then you should start off with some tutorials for LabVIEW beginners. A good place to start is here:
http://zone.ni.com/devzone/cda/tut/p/id/5247
06-10-2009 01:57 AM
YA! thank you, I have understood....but if I wan to set from (9:30 a.m. until 12:30 p.m.) how to develop it?
I have tried to use 2 In range & coef. (1 for hour & 1 for minute) then combined their output with And gate to the indicator, but it cant work by follow the time...why?
06-10-2009 03:53 AM
Hi Kelvin,
Could you post your VI here so that I can take a look at it? Its quite hard to know where you went wrong if I haven't seen the VI.
Generally though, what you would need is (following your example) to turn ON the output whenever the hour is 10 or 11. When the hour is 9, you will turn on if the minute is >30. When the hour is 12, you would turn on if the minute is <30. Therefore you would need different logic for hours 9 and 12.
A quick and dirty way would be to simply use a case structure to handle the hours of 9, 10, 11 and 12. For 10 and 11, just turn ON. For 9, check the minutes and if it is greater than 30, ON. Similarly, for 12, turn ON the output if the minute is less than 30. Finally, your default case would turn the output OFF.
Hope that helps.
06-11-2009 03:09 AM
this is wat i hav done, but cant function as wat i wan....
i wan to control the load no only following the hour of time but also minute of time....
(for example 2:15 till 3:20)
wat i told u bfore is only hour so sorry to make u confuse...
06-11-2009 04:21 AM
Hi Kelvin,
Ok, if you follow the logic of your VI step by step you'll see where you went wrong. First case structure determines if the hour is within the right range (again, following your example of the desired time being between 2:15 and 3:20 then the hours that give a TRUE output should be between 2 and 3).
Then, if the hour is TRUE, you check for the minutes. Now, lets say your lower limit minute is 0 and upper limit minute is 15, then the second case would return TRUE every time the hour is between 2 and 3 AND the minute is between 0 and 15. What that means is that you will get a TRUE output from your second case structure when the time is between 2:00 and 2:15 and 3:00 and 3:15.
What you should have is, if the hour is 2, then if the minute is between 15 and 59, it should be TRUE. If the hour is 3, then the minute should be between 0 and 20 in order to have a TRUE output. What I am trying to say is that the conditions for the minutes change for different hour values. So the easiest and most straight forward way of doing this is to use multiple case structures:
This way, you'd configure what the behavior should be for each day, hour, and minute.
06-12-2009 01:22 AM