Home PageFacebookRSS News Feed
PocketGPS
Web
SatNav,GPS,Navigation
SurfShark VPN
Pocket GPS World - SatNavs | GPS | Speed Cameras: Forums

Pocket GPS World :: View topic - Auto Day night switch.
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log in for private messagesLog in for private messages   Log inLog in 

Auto Day night switch.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Pocket GPS World Forum Index -> Garmin Portable Navigation Devices
View previous topic :: View next topic  
Author Message
gcb
Regular Visitor


Joined: Oct 24, 2005
Posts: 151

PostPosted: Fri Nov 18, 2005 1:47 pm    Post subject: Auto Day night switch. Reply with quote

I am impressed by the way the I3 changes from Day to Night mode.

Dont think it uses a light sensor or it would switch when indoors surely.

It seems that as the I3 knows where it is exactly in the world that it also knows exactly what time is sundown on what day of the year.

As we aproach the winter months I3 seems to switch to night mode a couple of minutes earlier each day.

Maybe I am giving too much credit here and maybe the I3 uses a much simpler method to know if it day or night. Any ideas.

What ever it does, all I am saying is how ever much it has ballsed up routes, crashed whatever one thing it has always knew precisely when it was day or night.
Back to top
View user's profile Send private message
zogman
Frequent Visitor


Joined: Sep 05, 2005
Posts: 1417
Location: swindon uk

PostPosted: Fri Nov 18, 2005 2:03 pm    Post subject: Reply with quote

some calenders/diarys have sunset and sunrise info so its not a big deal for a gps to change its screen colours..
_________________
***************************
Back to top
View user's profile Send private message Visit poster's website
gcb
Regular Visitor


Joined: Oct 24, 2005
Posts: 151

PostPosted: Fri Nov 18, 2005 2:59 pm    Post subject: Reply with quote

So do you recon the I3 stores sunset/Sun rise times for 24 or 25 time zones, or do you think that Garmin used a nice little algorithm to calculate the exact sunrise/sunset for the exact place you are standing.

I think the latter, its a nice little touch. Shame you cant display sunset time as you seem to be able to do on other Garmin GPS.

http://www.nicholsonprints.com/Articles/sun.htm

For anyone really interested, Its hard work for us humans armed only with a pecil and a calculator but with a little mathematical understanding and a spreadsheet you can write your own sunset, sunrise calculator

Theory:

Sunrise/Sunset Algorithm Example

Source:
Almanac for Computers, 1990
published by Nautical Almanac Office
United States Naval Observatory
Washington, DC 20392

Inputs:
day, month, year: date of sunrise/sunset
latitude, longitude: location for sunrise/sunset
zenith: Sun's zenith for sunrise/sunset
offical = 90 degrees 50'
civil = 96 degrees
nautical = 102 degrees
astronomical = 108 degrees

NOTE: longitude is positive for East and negative for West

Worked example (from book):
June 25, 1990: 25, 6, 1990
Wayne, NJ: 40.9, -74.3
Office zenith: 90 50' cos(zenith) = -0.01454


1. first calculate the day of the year

N1 = floor(275 * month / 9)
N2 = floor((month + 9) / 12)
N3 = (1 + floor((year - 4 * floor(year / 4) + 2) / 3))
N = N1 - (N2 * N3) + day - 30

Example:
N1 = 183
N2 = 1
N3 = 1 + floor((1990 - 4 * 497 + 2) / 3)
= 1 + floor((1990 - 1988 + 2) / 3)
= 1 + floor((1990 - 1988 + 2) / 3)
= 1 + floor(4 / 3)
= 2
N = 183 - 2 + 25 - 30 = 176

2. convert the longitude to hour value and calculate an approximate time

lngHour = longitude / 15

if rising time is desired:
t = N + ((6 - lngHour) / 24)
if setting time is desired:
t = N + ((18 - lngHour) / 24)

Example:
lngHour = -74.3 / 15 = -4.953
t = 176 + ((6 - -4.953) / 24)
= 176.456

3. calculate the Sun's mean anomaly

M = (0.9856 * t) - 3.289

Example:
M = (0.9856 * 176.456) - 3.289
= 170.626

4. calculate the Sun's true longitude
[Note throughout the arguments of the trig functions
(sin, tan) are in degrees. It will likely be necessary to
convert to radians. eg sin(170.626 deg) =sin(170.626*pi/180
radians)=0.16287]

L = M + (1.916 * sin(M)) + (0.020 * sin(2 * M)) + 282.634
NOTE: L potentially needs to be adjusted into the range [0,360) by adding/subtracting 360

Example:
L = 170.626 + (1.916 * sin(170.626)) + (0.020 * sin(2 * 170.626)) + 282.634
= 170.626 + (1.916 * 0.16287) + (0.020 * -0.32141) + 282.634
= 170.626 + 0.31206 + -0.0064282 + 282.634
= 453.566 - 360
= 93.566

5a. calculate the Sun's right ascension

RA = atan(0.91764 * tan(L))
NOTE: RA potentially needs to be adjusted into the range [0,360) by adding/subtracting 360

Example:
RA = atan(0.91764 * -16.046)
= atan(0.91764 * -16.046)
= atan(-14.722)
= -86.11412

5b. right ascension value needs to be in the same quadrant as L

Lquadrant = (floor( L/90)) * 90
RAquadrant = (floor(RA/90)) * 90
RA = RA + (Lquadrant - RAquadrant)

Example:
Lquadrant = (floor(93.566/90)) * 90
= 90
RAquadrant = (floor(-86.11412/90)) * 90
= -90
RA = -86.11412 + (90 - -90)
= -86.11412 + 180
= 93.886

5c. right ascension value needs to be converted into hours

RA = RA / 15

Example:
RA = 93.886 / 15
= 6.259

6. calculate the Sun's declination

sinDec = 0.39782 * sin(L)
cosDec = cos(asin(sinDec))

Example:
sinDec = 0.39782 * sin(93.566)
= 0.39782 * 0.99806
= 0.39705
cosDec = cos(asin(0.39705))
= cos(asin(0.39705))
= cos(23.394)
= 0.91780

7a. calculate the Sun's local hour angle

cosH = (cos(zenith) - (sinDec * sin(latitude))) / (cosDec * cos(latitude))

if (cosH > 1)
the sun never rises on this location (on the specified date)
if (cosH < -1)
the sun never sets on this location (on the specified date)

Example:
cosH = (-0.01454 - (0.39705 * sin(40.9))) / (0.91780 * cos(40.9))
= (-0.01454 - (0.39705 * 0.65474)) / (0.91780 * 0.75585)
= (-0.01454 - 0.25996) / 0.69372
= -0.2745 / 0.69372
= -0.39570

7b. finish calculating H and convert into hours

if if rising time is desired:
H = 360 - acos(cosH)
if setting time is desired:
H = acos(cosH)

H = H / 15

Example:
H = 360 - acos(-0.39570)
= 360 - 113.310 [ note result of acos converted to degrees]
= 246.690
H = 246.690 / 15
= 16.446

8. calculate local mean time of rising/setting

T = H + RA - (0.06571 * t) - 6.622

Example:
T = 16.446 + 6.259 - (0.06571 * 176.456) - 6.622
= 16.446 + 6.259 - 11.595 - 6.622
= 4.488

9. adjust back to UTC

UT = T - lngHour
NOTE: UT potentially needs to be adjusted into the range [0,24) by adding/subtracting 24

Example:
UT = 4.488 - -4.953
= 9.441
= 9h 26m

10. convert UT value to local time zone of latitude/longitude

localT = UT + localOffset

Example:
localT = 9h 26m + -4
= 5h 26m
= 5:26 am EDT
Back to top
View user's profile Send private message
ps73uk
Regular Visitor


Joined: Jun 15, 2005
Posts: 116

PostPosted: Fri Nov 18, 2005 3:09 pm    Post subject: Reply with quote

gcb wrote:

1. first calculate the day of the year

N1 = floor(275 * month / 9)
N2 = floor((month + 9) / 12)
N3 = (1 + floor((year - 4 * floor(year / 4) + 2) / 3))
N = N1 - (N2 * N3) + day - 30

Example:
N1 = 183
N2 = 1
N3 = 1 + floor((1990 - 4 * 497 + 2) / 3)
= 1 + floor((1990 - 1988 + 2) / 3)
= 1 + floor((1990 - 1988 + 2) / 3)
= 1 + floor(4 / 3)
= 2
N = 183 - 2 + 25 - 30 = 176

2. convert the longitude to hour value and calculate an approximate time

lngHour = longitude / 15

if rising time is desired:
t = N + ((6 - lngHour) / 24)
if setting time is desired:
t = N + ((18 - lngHour) / 24)

Example:
lngHour = -74.3 / 15 = -4.953
t = 176 + ((6 - -4.953) / 24)
= 176.456

3. calculate the Sun's mean anomaly

M = (0.9856 * t) - 3.289

Example:
M = (0.9856 * 176.456) - 3.289
= 170.626

4. calculate the Sun's true longitude
[Note throughout the arguments of the trig functions
(sin, tan) are in degrees. It will likely be necessary to
convert to radians. eg sin(170.626 deg) =sin(170.626*pi/180
radians)=0.16287]

L = M + (1.916 * sin(M)) + (0.020 * sin(2 * M)) + 282.634
NOTE: L potentially needs to be adjusted into the range [0,360) by adding/subtracting 360

Example:
L = 170.626 + (1.916 * sin(170.626)) + (0.020 * sin(2 * 170.626)) + 282.634
= 170.626 + (1.916 * 0.16287) + (0.020 * -0.32141) + 282.634
= 170.626 + 0.31206 + -0.0064282 + 282.634
= 453.566 - 360
= 93.566

5a. calculate the Sun's right ascension

RA = atan(0.91764 * tan(L))
NOTE: RA potentially needs to be adjusted into the range [0,360) by adding/subtracting 360

Example:
RA = atan(0.91764 * -16.046)
= atan(0.91764 * -16.046)
= atan(-14.722)
= -86.11412

5b. right ascension value needs to be in the same quadrant as L

Lquadrant = (floor( L/90)) * 90
RAquadrant = (floor(RA/90)) * 90
RA = RA + (Lquadrant - RAquadrant)

Example:
Lquadrant = (floor(93.566/90)) * 90
= 90
RAquadrant = (floor(-86.11412/90)) * 90
= -90
RA = -86.11412 + (90 - -90)
= -86.11412 + 180
= 93.886

5c. right ascension value needs to be converted into hours

RA = RA / 15

Example:
RA = 93.886 / 15
= 6.259

6. calculate the Sun's declination

sinDec = 0.39782 * sin(L)
cosDec = cos(asin(sinDec))

Example:
sinDec = 0.39782 * sin(93.566)
= 0.39782 * 0.99806
= 0.39705
cosDec = cos(asin(0.39705))
= cos(asin(0.39705))
= cos(23.394)
= 0.91780

7a. calculate the Sun's local hour angle

cosH = (cos(zenith) - (sinDec * sin(latitude))) / (cosDec * cos(latitude))

if (cosH > 1)
the sun never rises on this location (on the specified date)
if (cosH < -1)
the sun never sets on this location (on the specified date)

Example:
cosH = (-0.01454 - (0.39705 * sin(40.9))) / (0.91780 * cos(40.9))
= (-0.01454 - (0.39705 * 0.65474)) / (0.91780 * 0.75585)
= (-0.01454 - 0.25996) / 0.69372
= -0.2745 / 0.69372
= -0.39570

7b. finish calculating H and convert into hours

if if rising time is desired:
H = 360 - acos(cosH)
if setting time is desired:
H = acos(cosH)

H = H / 15

Example:
H = 360 - acos(-0.39570)
= 360 - 113.310 [ note result of acos converted to degrees]
= 246.690
H = 246.690 / 15
= 16.446

8. calculate local mean time of rising/setting

T = H + RA - (0.06571 * t) - 6.622

Example:
T = 16.446 + 6.259 - (0.06571 * 176.456) - 6.622
= 16.446 + 6.259 - 11.595 - 6.622
= 4.488

9. adjust back to UTC

UT = T - lngHour
NOTE: UT potentially needs to be adjusted into the range [0,24) by adding/subtracting 24

Example:
UT = 4.488 - -4.953
= 9.441
= 9h 26m

10. convert UT value to local time zone of latitude/longitude

localT = UT + localOffset

Example:
localT = 9h 26m + -4
= 5h 26m
= 5:26 am EDT


8O Run that one by me again! Question Laughing , on second thoughts i'll just take your word for it that it works! Laughing Embarassed
_________________
Garmin Streetpilot i3,
Tomtom One
_________________
Paul
Back to top
View user's profile Send private message
gcb
Regular Visitor


Joined: Oct 24, 2005
Posts: 151

PostPosted: Fri Nov 18, 2005 3:56 pm    Post subject: Reply with quote

When you use floor in XL you have to put ,1

eg

N3 = (1 + floor((year - 4 * floor(year / 4) + 2) / 3))

In XL

Where Year is in C1

=(1 + FLOOR(((C1 - 4 * FLOOR((C1 / 4),1) + 2) / 3),1))

But Im afraid that looks even worse.

Still if you were to just plod through in XL checking against the example using the same date and location it should work then you can change the date to anything you like.
Back to top
View user's profile Send private message
littlelostboy
Occasional Visitor


Joined: Oct 30, 2005
Posts: 23

PostPosted: Fri Nov 18, 2005 6:05 pm    Post subject: Reply with quote

Any maths professors out there like to add ther bit Surprised
Back to top
View user's profile Send private message
zogman
Frequent Visitor


Joined: Sep 05, 2005
Posts: 1417
Location: swindon uk

PostPosted: Fri Nov 18, 2005 6:08 pm    Post subject: Reply with quote

following gcb's formulea ,i've just built a nuclear reactor...
_________________
***************************
Back to top
View user's profile Send private message Visit poster's website
gcb
Regular Visitor


Joined: Oct 24, 2005
Posts: 151

PostPosted: Fri Nov 18, 2005 6:38 pm    Post subject: Reply with quote

Look :

If I put this in a spread sheet where you just enter the date and the longitude,latitude. It should tell you the sun down sunrise times for that place. You dont have to understand the reasoning behind it all.

Anyone find this at all interesting? All this clever stuff is in any Garmin GPS, its just your I3 doesnt tell you it.
Back to top
View user's profile Send private message
portman
Frequent Visitor


Joined: Nov 10, 2005
Posts: 435
Location: Dorset

PostPosted: Sat Nov 19, 2005 1:48 pm    Post subject: Reply with quote

Another little program to download

http://www.sunrisesunset.com/sun.html
Back to top
View user's profile Send private message
tomthompson
Frequent Visitor


Joined: 26/08/2003 15:43:37
Posts: 386
Location: Southampton, UK

PostPosted: Sat Nov 19, 2005 4:13 pm    Post subject: Reply with quote

gcb I am dumbstruck by the complicated calculations and applaud your knowledge.
Me I look out the window and think Ah daylight and then later think Oh its dark

CoPilot
_________________
Asus Zenfone 2 twin sim, Garmin Zumo 550, 660 and pocketgps speed camera database

I keep on learning but they invent new things faster ,How do I keep up ?
Back to top
View user's profile Send private message
RODTROTTER
Regular Visitor


Joined: Oct 30, 2005
Posts: 175

PostPosted: Sat Nov 19, 2005 7:32 pm    Post subject: Reply with quote

thats the way i understand it too pmsl :D
Back to top
View user's profile Send private message
MaFt
Pocket GPS Staff
Pocket GPS Staff


Joined: Aug 31, 2005
Posts: 15140
Location: Bradford, West Yorkshire

PostPosted: Mon Nov 21, 2005 2:02 pm    Post subject: Reply with quote

crazylegs wrote:
on a friday evening when all i want to do is chill and have a Guinness


eugh! bovril??!!! :P

MaFt Me Me Me
Back to top
View user's profile Send private message Visit poster's website
gcb
Regular Visitor


Joined: Oct 24, 2005
Posts: 151

PostPosted: Mon Nov 21, 2005 2:52 pm    Post subject: Reply with quote

Yes your all right , its complicated and theres no point in understanding all that really , but point I was making is your Garmin I3 , does all this and all it uses it for is to know when to switch between day and night settings for the display.

Thing is theres so much these GPS units do even the cheap ones like the I3. The main diference between diferent GPS through out the price ranges seem to be just down to restrictions in the software, whats enabled, accessible and what isn't.
Back to top
View user's profile Send private message
timkemp
Occasional Visitor


Joined: Oct 22, 2005
Posts: 10

PostPosted: Tue Nov 22, 2005 11:49 pm    Post subject: impressive though Reply with quote

impressive though how as the sun sets in your mirror, and the glare finally disappears, the unit changes at exactly the same moment.
Back to top
View user's profile Send private message
mcintyre
Occasional Visitor


Joined: Oct 30, 2005
Posts: 49
Location: Mirfield

PostPosted: Fri Nov 25, 2005 10:59 pm    Post subject: Reply with quote

I've been impressed with that too.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger







Posted: Today    Post subject: Pocket GPS Advertising

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pocket GPS World Forum Index -> Garmin Portable Navigation Devices All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Make a Donation



CamerAlert Database

Click here for the PocketGPSWorld.com Speed Camera Database

Download Speed Camera Database
22.051 (01 May 24)



WORLDWIDE SPEED CAMERA SPOTTERS WANTED!

Click here to submit camera positions to the PocketGPSWorld.com Speed Camera Database


12mth Subscriber memberships awarded every week for verified new camera reports!

Submit Speed Camera Locations Now


CamerAlert Apps



iOS QR Code






Android QR Code







© Terms & Privacy


GPS Shopping