Notifications
Clear all

GPS Week

6 Posts
3 Users
0 Reactions
1 Views
(@cturlington)
Posts: 32
Trusted Member Registered
Topic starter
 

I developed an excel spreadsheet that calculates the GPS week and Epoch.?ÿ It appears to coincide with the NGS GPS week calendar, but does not use GPS time, just weeks from January 06, 1980 to any given date.?ÿ It is also not calculating seconds and not accounting for the leap second.?ÿ Though my GPS week calculation from excel appear correct, minus seconds not used for my purposes, should I be concerned about not using GPS time to calculate the GPS week from?

 
Posted : 10/05/2021 7:44 pm
(@geeoddmike)
Posts: 1556
Noble Member Registered
 

I believe the NGS GPS week calendar is based on code developed by Dr. Benjamin W. Remondi (in C) see: https://www.ngs.noaa.gov/gps-toolbox/bwr-c.txt ?ÿ?ÿ

You will notice it used Julian and modified Julian dates. I have clipped out the relevant portion of the code in the image below. (Taken from the above link).

FB8DD931 B833 4099 BFD5 2C96C5BE4509
 
Posted : 10/05/2021 8:16 pm
(@bill93)
Posts: 9834
 

If you use UTC instead of GPS time there is a window of several seconds (18?) around UTC midnight Saturday/Sunday (late afternoon or evening Saturday in the US) where you will get the wrong week. Otherwise it will be correct.

I'd worry more about checking leap year days are correct.

 
Posted : 11/05/2021 1:51 am
(@cturlington)
Posts: 32
Trusted Member Registered
Topic starter
 

@bill93,

Thanks for your thoughts on this subject.?ÿ My excel spreadsheet just subtracts the dates to determine total days, then divides by 7 to get total weeks.?ÿ I assume excel keeps track of the leap years/days within its time clock.?ÿ The Epoch calculation is using the excel Year function.?ÿ The seconds seem like an odd quantity, I believe it is the elapsed number of seconds in the week of the calculated week number.?ÿ I assume that starts on day 1 (Sunday) at midnight?

 
Posted : 11/05/2021 9:38 am
(@geeoddmike)
Posts: 1556
Noble Member Registered
 

Looking at your original post, you indicate that your spreadsheet determines the GPS Week and EPOCH. What do you mean by Epoch.?ÿ

GPS time is measured continuous and does not account for leap seconds.

As you have the NGS GPS Calendar you can check your spreadsheet results. You will likely find some discrepancies. I did using an approach similar to yours.Dr Remondiƒ??s code works.

 
Posted : 11/05/2021 9:16 pm
(@cturlington)
Posts: 32
Trusted Member Registered
Topic starter
 

@geeoddmike,

?ÿ

Thank you, I will look into Dr. Remondi's code a lot closer.?ÿ My spreadsheet calculates the GPS week, and a separate line calculation for the Epoch as year and fraction of year, which is the easiest part.?ÿ I was concerned with the GPS week, and if using excel would be good to calculate the week since I am not the calculating the seconds part of the GPS week, I assume excel tracks leap days.?ÿ But the correct approach may be to calculate the correct seconds and then week from that.?ÿ However, I will look into Dr. Remodi's code, that may reveal some of the confirmation I am looking for regarding approach.?ÿ But if I choose to calculate seconds as a learning exercise, it seems I should just have to calculate the elapsed number of seconds within the GPS week, which excel should be able to do easily...I may be over simplifying.

 
Posted : 12/05/2021 5:47 am
Share: