Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

MinIntoDay weirdness


ekahler Feb 8, 2016 06:55 PM

Does anyone know how MinIntoDay works? 

I'm having a hard time using MinIntoDay to control the switched voltage that turns on my modem. This is the command I have in the program for turning on the modem (written by shortcut, by the way).

'SW12 Timed Control
  'Get minutes into current day
  MinIntoDay=Public.TimeStamp(4,1)/60
  'Turn ON SW12 between 1200 hours and 1700 hours
  If (MinIntoDay>=700 AND MinIntoDay<900)
   SW12State=True
  Else
   SW12State=False
  EndIf
  'Always turn OFF SW12 if battery drops below 11.5 volts
  If BattV<11.5 Then SW12State=False
  'Set SW12 to the state of 'SW12State' variable
  SW12(SW12State)

In Shortcut, it seemed to very clearly indicate that it would mean "turn on switched voltage from 11:40am to 3:00pm", but it still isn't turning on when it should.  I just tried to connect at 11a.m. this morning and it did.  It seems to turn on correctly the first day then start to turn on and off randomly - or at least it seems random to me.  I also just resent the program at about noon today, and the modem didn't turn back until 1pm.  Why would it wait for the new hour to turn on rather than recognizing that it was between the time interval when it should be on?

I'm going to try using TimeIsBetween instead, but I'd like to know why MinIntoDay seems so random.  Shortcut used it for the SW12 by default.


smile Feb 9, 2016 04:13 PM

Dears

First of all, how the post it was written, it would seem that it is talking about of an instruction, really "minintoday" is just the name of a variable (that could be called in other ways as you like), and not is an instruction of the set of CRbasic, that work in a strange way.

In this variable, for this line of program

MinIntoDay=Public.TimeStamp(4,1)/60,

the logger write the minutes of the day (1..1440) synchronous with the logger clock.

I.E. 12:00 are 720 minutes and 23:59 are 1439 and 8:00 are 480 minutes of the day.

So.....
More precisely in the following program portion should be commented:

 'Turn ON SW12 between 11:40 hours and 15:00 hours
  If (MinIntoDay>=700 AND MinIntoDay<900)

so if the battery is charged (V> 11.5) and the modem is connected to SW12 without absorbing more than about 0,8..0,9 Amp (or you must use a fair relay) the modem will stay ON from 11:40 to 15 : 00 (clock of the logger!)

most likely, gets my shortcut, the "minintoday" variable, it has been declaredis not visible "DIM", so to make it visible and verify which are minute, in case of realtime display, you have to change the head of the program and become "PUBLIC", this program line:
DIM minintoday
must become
Public minintoday

Regards

Smile


ekahler Feb 9, 2016 06:21 PM

That's a good tip, thanks - my datalogger clock is synced with my laptop (real time) but maybe if I can see the MinIntoDay I can figure out why it's weird.

Thanks!

Log in or register to post/reply in the forum.