Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1354
  • Last Modified:

Sun and Moon Position in Lat/Lon from Date/time VB6 - Continue

This is a continue from http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_24363977.html

Because of complex in question and length. I move it to new question so it can be readable and hopefully useful for others.
 
Question was:
"
I am looking for code in visual basic 6 to get sun and moon position in latitude and longitude.
I have converted the code from this link: http://www.experts-exchange.com/Programming/Languages/CPP/Q_23501542.html?sfQueryTermInfo=1+10+posit+sun 
but it is not very acurate.

Does any one have  source code for both sun and moon position in visual basic 6
"
0
iscode
Asked:
iscode
  • 8
  • 6
  • 2
  • +1
1 Solution
 
tbsgadiCommented:
Have a look here for VBA code (which is the same as VB6)

Good Luck,

Gary
0
 
tbsgadiCommented:
0
 
iscodeAuthor Commented:
Hi tbsgadi
I allready had those formulas as I had traced this link from bodas.org but thanks anyway
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
tbsgadiCommented:
Don't they give you what you want?
0
 
iscodeAuthor Commented:
They give me RA= Right ascension and DEC=Declination=Latitude and distance
I need the GHA to get the longitude as we discovered in my first question
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_24363977.html
We had solved that for the sun but not for the moon
0
 
tbsgadiCommented:
Does this get you any closer?
http://www.stargazing.net/kepler/sunrise.html
0
 
iscodeAuthor Commented:
I have all those too :-) and sunrise and set is not helping me with the moon location as I said sun was solved already in last question but I dont blame you for not reading all that its pretty long,
what I am after now is just moon location latitude and longitude above earth
0
 
iscodeAuthor Commented:
OK I think I found my answer
as I already have RA in moon position I should get gha from this link
http://www.jgiesen.de/elevazmoon/basics/index.htm
Just need to check it out
0
 
iscodeAuthor Commented:
Yes actully it works same for the moon as for the sun after I have RA
T = (JD - 2451545.0 ) / 36525;
theta0 = 280.46061837 + 360.98564736629*(JD-2451545.0) + 0.000387933*T*T - T*T*T/38710000.0; // degrees

Local sidereal time:

theta = theta0 + longitude (eastern longitudes positive, western negative)

Hour angle: tau = theta - RA

0
 
tbsgadiCommented:
Great!
0
 
iscodeAuthor Commented:
Now how do I close the question without delete it?
0
 
tbsgadiCommented:
Press the Request Attention
0
 
mdouganCommented:
That was fast!  Congratulations!
0
 
iscodeAuthor Commented:
Thank you mdougan

Well I would never have made it with out your help in first place,
so tell me have you thought about the shadow :-)
that will be next question, are you inn?
0
 
mdouganCommented:
Sure, I'm in!  ;-)

All I've thought about the shadow, so far, is that the shadow will fall exactly along a meridian (longitude line), when the earth is perpendicular to the sun (which happens on the equinoxes).  So, on the equinoxes, you would, perhaps, plot a point at every degree of latitude, along the same longitude line, and draw the line between them.

But, as the earth tilts during the course of the year, the line will be more oblique.  In the summer months, for example, the shadow won't extend all the way to the North Pole... they have several months of daylight 24 hours a day.  So, you will need to find some websites that detail the formulas for calculating this shadow, and I suppose that will be different for the different kinds of projections... so, if you are using a Mercator projection, then look specifically for formulas related to that.  If you find a good resource, then I can help you convert it to VB!
0
 
iscodeAuthor Commented:
Good
Sound interesting enough and great tips already!
I will see what I can find useful, it can take me few days to prepare this.
0
 
JohnnyCommented:
i dont know if you found the code for the shadows but heres the math for it on your same site

http://www.jgiesen.de/map/index.html

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 6
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now