Change Readme

master
Orion Stark 7 years ago
parent a7e10d6796
commit 2cc6afb762
  1. 15
      README.md
  2. 13
      dist/solar-calculation.js
  3. 13
      test.js

@ -1,2 +1,17 @@
# calculation-of-sun # calculation-of-sun
Sun calculation fully based on formula from http://aa.quae.nl/en/reken/zonpositie.html Sun calculation fully based on formula from http://aa.quae.nl/en/reken/zonpositie.html
## Warning
This program is not really accurate about the calculation. For the sunrise and sunset, the error value is about 2 minutes miss from the actual time. For the Altitude the error value is near 0.6 degrees and the azimuth as well.
# Install with npm
'npm install calculation-ofsun'
# Use
'''jvascript
// getSunInformation parameter: Date, Latitude, Longtitude
const cls = require('calculation-ofsun')
console.log(cls.getSunInformation(new Date(), 33, 3))
'''

@ -36,9 +36,9 @@ class Sunpositioning {
C6: 0, C6: 0,
EC: 0.0000 EC: 0.0000
}; };
this.earth_perihelion = 102.94719; this.earth_perihelion = 102.9373;
this.earth_obliquity = 23.44 * (Math.PI / 180); this.earth_obliquity = 23.4393 * (Math.PI / 180);
this.earth_obliquity_degrees = 23.44; this.earth_obliquity_degrees = 23.4393;
this.earth_sideral_time = { this.earth_sideral_time = {
at_zero_long: 280.1470, at_zero_long: 280.1470,
rate_of_change: 360.9856235 rate_of_change: 360.9856235
@ -46,6 +46,10 @@ class Sunpositioning {
} }
/*
@function
Get Information of sun by giving a date, latitude and longtitude
*/
getSunInformation(date, lat, long) { getSunInformation(date, lat, long) {
this.CLIENT_JD = this.dateToJD(date); this.CLIENT_JD = this.dateToJD(date);
this.CLIENT_LATITUDE = lat; this.CLIENT_LATITUDE = lat;
@ -184,5 +188,4 @@ class Sunpositioning {
} }
} }
} }
module.exports = new Sunpositioning();
module.exports = Sunpositioning;

@ -1,13 +1,2 @@
const a = require('./dist/solar-calculation'); const a = require('./dist/solar-calculation');
let b = new a(); console.log(a.getSunInformation(new Date(), 52, 5));
let lat = 3.597031;
let long = 98.678513;
function JDtoDate(jd) {
let d = new Date((jd + 0.5 - 2440588) * (1000 * 60 * 60 * 24))
console.log(d);
return d.toString();
}
let sff = b.getSunInformation(new Date(), 3.597031, 98.678513)
console.log(sff.clientJD)
console.log(JDtoDate(sff.sunset));
console.log(sff)

Loading…
Cancel
Save