Solved

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

Posted on 2009-05-06
17
1,292 Views
Last Modified: 2012-06-21
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
Comment
Question by:iscode
  • 8
  • 6
  • 2
  • +1
17 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24323107
Have a look here for VBA code (which is the same as VB6)

Good Luck,

Gary
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24323108
0
 
LVL 6

Author Comment

by:iscode
ID: 24323938
Hi tbsgadi
I allready had those formulas as I had traced this link from bodas.org but thanks anyway
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24323956
Don't they give you what you want?
0
 
LVL 6

Author Comment

by:iscode
ID: 24324219
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
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24324262
Does this get you any closer?
http://www.stargazing.net/kepler/sunrise.html
0
 
LVL 6

Author Comment

by:iscode
ID: 24324357
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
 
LVL 6

Accepted Solution

by:
iscode earned 0 total points
ID: 24325462
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Author Comment

by:iscode
ID: 24326484
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
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24326517
Great!
0
 
LVL 6

Author Comment

by:iscode
ID: 24327017
Now how do I close the question without delete it?
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 24327561
Press the Request Attention
0
 
LVL 18

Expert Comment

by:mdougan
ID: 24328240
That was fast!  Congratulations!
0
 
LVL 6

Author Comment

by:iscode
ID: 24328742
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
 
LVL 18

Expert Comment

by:mdougan
ID: 24328861
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
 
LVL 6

Author Comment

by:iscode
ID: 24329685
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
 

Expert Comment

by:Johnny
ID: 26181719
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now