Sign in to follow this  
Followers 0
jaccov

SunRise SunSet Calculate

23 posts in this topic

I try to find a way to calculate the SunRise and SunSet time in the PLC. Is this possible. Who can help me. I am using a Omron CJ1 plc with FB support Edited by jaccov

Share this post


Link to post
Share on other sites
Wow, now this ones got me curious. The only way I can think to do it is to have a table with the sunrise and sunset for everyday. But then again if you had the values for the longest and shortest days could you come up with a formula? I'm going to move this to the General Topics Section

Share this post


Link to post
Share on other sites
If you google sunrise formula you find that its actually a very complex formula that changes based on your location, and the path the sun takes. It also is not a linear curve, but parabolic. A good approximation would be shown as: Unfortunately you will have to calculate the actual values based on where you are ( lattitude/longitude) but NOAA is a good place to start.

Share this post


Link to post
Share on other sites
Try this site http://www.weatherimages.org/latlonsun.html if you email him he might also give you the equations

Share this post


Link to post
Share on other sites
Assuming that the CJ1 comes with SIN, COS, ARCCOS and PI Functions the NOAA Low Acccuracy Calculations should be useful. If not you'll need to try the NOAA Java Calculator Code and convert it to PLC.

Share this post


Link to post
Share on other sites
This VB Script Might ALso prove Useful

Share this post


Link to post
Share on other sites
Maybe there is a easier formula, I can except a difference for about 15 minutes.

Share this post


Link to post
Share on other sites
Is this required for some function that needs to turn off/on at sunset/sunrise? Could a photo sensor be used instead? Much less work.

Share this post


Link to post
Share on other sites
Historical data in a table?

Share this post


Link to post
Share on other sites
I was thinking the same thing. http://aa.usno.navy.mil/data/docs/RS_OneYear.html

Share this post


Link to post
Share on other sites
I would have to agree, if you dont want to use the formula then historical data or a light sensor would be best. THe reason the formula is so complex is because the path that the sun travels at noon is actually a figure 8, and the shape of that figure8 is dependant on how far from the equator you are. /shrug Lousy science always getting in the way

Share this post


Link to post
Share on other sites
Another thought. I was looking around on the net, and there are devices for home systems to turn lights on and off using sunrise and sunset calculations. perhaps you could get one of these and use it as PLC inputs for when its sunrise or sunset.

Share this post


Link to post
Share on other sites
I recommend using a look up table. You can probably get your needed accuracy with an entry for every other day. On a related note, the solar analemma (the path traced by the sun at a specific time of day over a year) makes for some very interesting photograpy. As you can see, describing the sun's path will require some very sophisticated mathematics. http://www.perseus.gr/Astro-Solar-Analemma.htm http://en.wikipedia.org/wiki/Analemma

Share this post


Link to post
Share on other sites
Wow and i just thought that the sun rises in the East and sets in the West... thats what it does in the sothern hemisphere anyways.. A look up table would the the easitest to achieve, you could even go down to the level of just adjusting 12 times a year depending on each month...

Share this post


Link to post
Share on other sites
I'm with Sleepy, I have never seen the sun do what Alaric's picture shows. It just rises in the east and sets in the west

Share this post


Link to post
Share on other sites
If you were to point a camera to exactly the same spot in the sky near the sun everyday and take a picture at exactly the same time, then put all the pictures together, that figure 8 is what you would get. Now if you look at the different points along the figure 8 and consider how far they are from the horizon (sun set) then you can get a feel for how the time of sunset changes changes. In the Northern hemisphere, the smaller and higher end of the figure 8 is Summer time, the lower fat part of the 8 is winter time. Solstices are at the highest top and lowest bottom points of the 8 and the equinoxes are right where the figure 8 crosses over. It should be obvious that the equation for this is going to be complex - thats the reason I recommend a look up table. Also a look up table can be adjusted manually for local horizon conditions such as mountains, etc. Edited by Alaric

Share this post


Link to post
Share on other sites
Yes I was being smart. But thanks for the explaination

Share this post


Link to post
Share on other sites
Well I'm lazy so I'd use something like this with a relay turning on a PLC bit. http://cgi.ebay.com/ws/eBayISAPI.dll?ViewI...item=4453906103 This one looks industrial: http://cpc.farnell.com/jsp/endecaSearch/pa...jsp?SKU=PL08703 One would have thought a few HVAC timer makers would do them? http://www.theben.de/zeitsteuerung0.html?L=1 a whole flock of them.....

Share this post


Link to post
Share on other sites
The first one looks like the ticket, here's a little more info on it: http://www.smarthome.com/4259W.html

Share this post


Link to post
Share on other sites
I don't know why I didn't ask about the application until I read a thread on solar tracking on another PLC forum. I just assumed it was for switching something on/off at sunset/sunrise. Jaccov, is this for a solar tracking application? If so then there may be a simpler approach. No matter where you are or what time of year it is the sun is at its zenith at local noon; that is it is directly overhead. Its azimuth at noon changes with the season and with your latitude, but it is still always at zenith, or overhead, at noon. Due to the way time zones are apportioned local noon is not at 12:00 except at specific longitudes. So unless you happen to be exactly on a whole numbered longitudinal coordinate then local noon occurs sometime before or after 12:00 noon. But once you know the time of local noon you can work backwards and forwards from there to determine the position of the sun in the sky. For a solar tracking application this may be much simpler than trying to use sunrise and sunset times. I've never actually done an application like this myself; I'm just an amateur astronomer hopefully applying my hobby. If it is for a sunrise/sunset switch on/off application, then disregard. Edited by Alaric

Share this post


Link to post
Share on other sites
If you are doing on/off control I would recommend this. I used them before for fish tank lighting at a biological station. Very easy to set up and quite reliable.

Share this post


Link to post
Share on other sites
One formula calculates the longitudinal angle between the observer and the Sun (subpoint); you would combine that with your longitude and look in an ephemeris or navigational almanac for the time when the Sun is predicted to have that GHA. The formula is an algebraic transformation of this equation: Sin height = (sin lat sin dec) + (cos lat cos dec cos LHA). height = angular height (from horizontal) lat = latitude dec = declination LHA = Local Hour Angle, the difference in the longitudinal coordinates of the observer and the celestial body, e.g. Sun. Cos LHA = [(sin height) - (sin lat sin dec)]/(cos lat cos dec). The height of the Sun at sunrise is estimated. It will be about the sum of its semidiameter (SD) correction (SD is within .3' of its -16' average), nominal astronomical refraction (about -34'), and the ardistance [-1.15'root(elevation of observer in feet)] between the horizon and the observer. {That arcdistance is the apparent dip [about -.97'root(elevation of observer in feet)] + the terrestrial refraction correction of (.97' - 1.15')root(elevation of observer)}. So the sine of the height is determined and can be entered as a constant in the formula. For 10,000 feet, the height would be about -(16' + 34' + 115') or -165' or -(2 deg 45 min). Its sine is about -.047978. For example: LHA = arccos [-.047978 - (sin lat sin dec)]/(cos lat cos dec). When evaluated it tells the difference in longitude between the observer and the Sun's subpoint on Earth. If, for example the difference is 95 deg 02 min, and the observer is at 120 deg 30 min West, then the Sun's Greenwich Hour Angle (GHA) is (120 deg 30 min) - (95 deg 02 min) = 025 deg 28 min. Since the GHA of the Sun is tabulated (in the Online Nautical Almanac, for instance), the (sunrise) moment can be found (by interpolating) when the Sun is predicted to have a GHA of 025 deg 28 min. Mark Prange Edited by bethpage89

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0