Showing results for 
Search instead for 
Did you mean: 

time slot problem

Go to solution

Is this homework?

0 Kudos
Message 11 of 22

what do you mean by homework? I am stuck in b/ is yet not complete

0 Kudos
Message 12 of 22

what do you mean by homework? I am stuck in b/ is yet not complete.

0 Kudos
Message 13 of 22

Are you a student and this is an assignment you are trying to get help with?  Or are you working in the real world trying to solve a problem?


Often the the way the question is asked gives a clue that something is homework.  In which case people will help, but will not do your work for you.  I see you attached a VI, but I can't tell what you are doing because it is too new of a version.  LV 16 just came out a little over a month ago, and many people have not had a chance to install it yet.  You should use Save for Previous Version in the File menu to save it back to LV 2015 or older.


What does "I am stuck in b/w..."  mean? 





0 Kudos
Message 14 of 22

Thanks for viewing the VI. I am not asking my work to be done by some one else. someone asked me to forward code to review so i did that. My intial problem was without any code. 


I just want to know how would i run a loop for one period of time that is from 08:00 hour to 20:00 hour. that is the problem, do i need timed loop or sequence or something else. 


anyways thanks for your feedback.

0 Kudos
Message 15 of 22

You don't need any timed loop or sequence.


You just need a loop that checks the current time.  The code shown will check if the hour of hte day is between 8 and 20.  Note that In Range and Coerce is set to include 8 (so the entire 8am hour is in) but does not include 20.  So when the time goes from 7:59:59 pm to 8:00 pm, the In Range output will go false.


If this needs to be more complicated to include times in between hours, then it would get a bit more complicated, or a different method would be better.  But this should get you started.


0 Kudos
Message 16 of 22


yeah, that is what i am saying "period" in between time is required to be involved, each and every, minute and second. If grid supply between 8:00 hr to 20:00 Hr get OFF than my diesel generator should start. I am not able to get how current time will check the whole period. suppose grid supply get OFF at 13:26 hour, than automatically diesel generator should start and i have to include a delay of few minutes because suppose it was a trip for a minute than diesel generator must not start immediately. 


0 Kudos
Message 17 of 22

I feel that you are far enough away from understanding programming logic that you'd benefit from tutorials before proceeding further.


LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours


This code would run in a loop.  Not necessarily a timed loop.  This bit of code checks the current time, compares it to your time slot and tells you whether you are in that time slot or not.


Figure out how to make that part run first, then you can add the other features.  Like how to determine if power is off.  How to determine if it is off for more than 2 minutes.  You can then implement that logic into the same loop.

0 Kudos
Message 18 of 22

Thanks, But i understand loop is required, that is what i said before too.

0 Kudos
Message 19 of 22

@nehaom wrote:

Thanks, But i understand loop is required, that is what i said before too.

You need much more than a loop. Do all the lessons and tutorial already mentioned and you don't need to ask these questions.


Your problem contains two parts:

  1. A program that runs 24/7 monitoring the loads and time of day and switched between various states based on the readings.
  2. Hardware that interfaces your computer to your grid, loads, and generator. You have not explained what you have. If you don't have any hardware you could simulated it of course. How do you measure load? (Just on/off or variable). How do you control the generators? How do you switch between Load A and Load B? Is it possible that A and B are on concurrently? What causes the grid supply to go on or off?

It is not helpful to just drop random words (timed loop, sequence, etc.) because you need much more than that for a well rounded program. (It is like having to to build a car and saying "I think I need either an engine or a teddy bear". You make no sense!)


As a first step make a nice drawing containing the timelines for the various loads, grids, and generator. Make sure you can deal with all possible combinations of factors. What are inputs (grid, time, etc.)? What are outputs (generator on/off)? Make a list of all possible states (incl the 2 minute delay state) and decide if the generator should be on of off for each. Then create a state machine where you measure the grid states, loads, and day time at regular intervals (e.g. 1Hz) and output a generator signal accordingly. Don't forget to also monitor front panel controls, e.g. to shut down the program. It's not rocket science.


Message 20 of 22