Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
Project 3 Star Gazing
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Eric Walsh
Project 3 Star Gazing
Commits
ed3c6bde
Commit
ed3c6bde
authored
Mar 19, 2019
by
Eric Walsh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
autosave
parent
9bb3230f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
Algorithm/Algorithm.cpp
Algorithm/Algorithm.cpp
+9
-4
Algorithm/AlgorithmTester.cpp
Algorithm/AlgorithmTester.cpp
+2
-2
No files found.
Algorithm/Algorithm.cpp
View file @
ed3c6bde
...
...
@@ -123,16 +123,21 @@ double julian(double year, double hours){
double
GMST
(
int
year
,
double
hours
){
//JD is the julian date (days since jan 1st, 4713 BC) and D is days since Jan 1st 2000
double
D
,
GMST
,
temp
,
JD0
;
//
double hoursLeft = modf((hours/24), &temp) * 24; // hours since the previous midnight
//
hoursLeft = (hoursLeft + 12)
;
double
hoursLeft
=
modf
((
hours
/
24
),
&
temp
)
*
24
;
// hours since the previous midnight
//
double hoursLeft
;
double
JD
=
julian
(
year
,
hours
);
//double JDmin = floor(JD) - 0.5;
//double JDmax = floor(JD) + 0.5;
JD0
=
floor
(
JD
)
+
0.5
;
D
=
(
JD
-
2451545.0
);
D
=
(
JD
-
2451545.0
);
double
D0
=
JD0
-
2451545.0
;
double
T
=
D
/
36525
;
// centuries since Jan 1st 2000 AD
double
hoursLeft
=
(
JD
-
JD0
)
*
24
;
//hoursLeft = (JD - JD0) *24;
/*if(JD > JD0){
hoursLeft = (JD - JD0) *24;
} else {
hoursLeft = (JD0 - JD) *24;
}*/
if
(
DEBUG
){
clog
<<
fixed
<<
setprecision
(
10
)
<<
"DEBUG: The GMST in days is: "
<<
D
<<
endl
<<
"DEBUG: The value of JD is: "
<<
JD
<<
endl
...
...
Algorithm/AlgorithmTester.cpp
View file @
ed3c6bde
...
...
@@ -32,8 +32,8 @@ int main(){
<<
"It actually returns: "
<<
julian
(
2017
,
641.9
)
<<
endl
;
cout
<<
"if the date is January 1, 20
00 at 00
:00:00, the GMST date function should return: 6.79519916667."
<<
endl
<<
"It actually returns: "
<<
GMST
(
20
00
,
0
)
<<
endl
;
cout
<<
"if the date is January 1, 20
19 at 08
:00:00, the GMST date function should return: 6.79519916667."
<<
endl
<<
"It actually returns: "
<<
GMST
(
20
19
,
8
)
<<
endl
;
//converting time and longitude to phi
/*cout << "if its January 27, 2034, 5:45 pm at a longitude of 49 the, phi should equal 4.65147698949." << endl
<< "Phi actually equals: " << timeToPhi(2034, 641.765166667, 49) << endl;*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment