|
|
@ -1179,28 +1179,29 @@ func GetBanTime(JD, Lon, Lat, TZ, An float64) float64 {
|
|
|
|
JD = math.Floor(JD) + 1.5
|
|
|
|
JD = math.Floor(JD) + 1.5
|
|
|
|
ntz := math.Round(Lon / 15)
|
|
|
|
ntz := math.Round(Lon / 15)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
dec := HSunSeeDec(tztime)
|
|
|
|
|
|
|
|
tmp := -Tan((math.Abs(Lat)+An)*(Lat/math.Abs(Lat))) * Tan(dec)
|
|
|
|
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
return -2 //极夜
|
|
|
|
return -2 //极夜
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > An {
|
|
|
|
return -1 //极昼
|
|
|
|
return -1 //极昼
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
tmp = -Tan(Lat) * Tan(dec)
|
|
|
|
var sundown float64
|
|
|
|
|
|
|
|
if math.Abs(tmp) <= 1 && Lat < 85 {
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
sunrise := tztime + rzsc/24.0 + 35.0/24.0/60.0
|
|
|
|
sundown = tztime + rzsc/24.0 + 35.0/24.0/60.0
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sundown = tztime
|
|
|
|
i := 0
|
|
|
|
i := 0
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) < An {
|
|
|
|
for LowSunHeight(sundown, Lon, Lat, ntz) > An {
|
|
|
|
i++
|
|
|
|
i++
|
|
|
|
sunrise -= 15 / 60 / 24
|
|
|
|
sundown += 15.0 / 60.0 / 24.0
|
|
|
|
if i > 12 {
|
|
|
|
if i > 48 {
|
|
|
|
break
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
|
}
|
|
|
|
|
|
|
|
JD1 := sundown - 5.00/24.00/60.00
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
JD0 := JD1
|
|
|
|
JD0 := JD1
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
@ -1217,27 +1218,28 @@ func GetAsaTime(JD, Lon, Lat, TZ, An float64) float64 {
|
|
|
|
JD = math.Floor(JD) + 1.5
|
|
|
|
JD = math.Floor(JD) + 1.5
|
|
|
|
ntz := math.Round(Lon / 15)
|
|
|
|
ntz := math.Round(Lon / 15)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
dec := HSunSeeDec(tztime)
|
|
|
|
|
|
|
|
tmp := -Tan((math.Abs(Lat)+An)*(Lat/math.Abs(Lat))) * Tan(dec)
|
|
|
|
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
return -2 //极夜
|
|
|
|
return -2 //极夜
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
return -1 //极昼
|
|
|
|
return -1 //极昼
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
tmp = -Tan(Lat) * Tan(dec)
|
|
|
|
var sunrise float64
|
|
|
|
|
|
|
|
if math.Abs(tmp) <= 1 && Lat < 85 {
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
sunrise := tztime - rzsc/24 - 25.0/24.0/60.0
|
|
|
|
sunrise = tztime - rzsc/24 - 25.0/24.0/60.0
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sunrise = tztime
|
|
|
|
i := 0
|
|
|
|
i := 0
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) > An {
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) > An {
|
|
|
|
i++
|
|
|
|
i++
|
|
|
|
sunrise -= 15 / 60 / 24
|
|
|
|
sunrise -= 15.0 / 60.0 / 24.0
|
|
|
|
if i > 12 {
|
|
|
|
if i > 48 {
|
|
|
|
break
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
JD0 := JD1
|
|
|
|
JD0 := JD1
|
|
|
@ -1275,18 +1277,30 @@ func GetSunRiseTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
An = An - HeightDegreeByLat(HEI, Lat)
|
|
|
|
An = An - HeightDegreeByLat(HEI, Lat)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
dec := HSunSeeDec(tztime)
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
tmp := -Tan(Lat) * Tan(dec)
|
|
|
|
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < 0 {
|
|
|
|
|
|
|
|
return -2 //极夜
|
|
|
|
return -2 //极夜
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > 0 {
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
return -1 //极昼
|
|
|
|
return -1 //极昼
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//(sin(ho)-sin(φ)*sin(δ2))/(cos(φ)*cos(δ2))
|
|
|
|
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
|
|
|
|
var sunrise float64
|
|
|
|
|
|
|
|
if math.Abs(tmp) <= 1 && Lat < 85 {
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
sunrise := tztime - rzsc/24 - 5.0/24.0/60.0
|
|
|
|
sunrise = tztime - rzsc/24 - 25.0/24.0/60.0
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sunrise = tztime
|
|
|
|
|
|
|
|
i := 0
|
|
|
|
|
|
|
|
//TODO:使用二分法计算
|
|
|
|
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) > An {
|
|
|
|
|
|
|
|
i++
|
|
|
|
|
|
|
|
sunrise -= 15.0 / 60.0 / 24.0
|
|
|
|
|
|
|
|
if i > 48 {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
JD1 := sunrise
|
|
|
|
JD1 := sunrise
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
JD0 := JD1
|
|
|
|
JD0 := JD1
|
|
|
@ -1308,19 +1322,29 @@ func GetSunDownTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
An = An - HeightDegreeByLat(HEI, Lat)
|
|
|
|
An = An - HeightDegreeByLat(HEI, Lat)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
dec := HSunSeeDec(tztime)
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
tmp := -Tan(Lat) * Tan(dec)
|
|
|
|
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < 0 {
|
|
|
|
|
|
|
|
return -2 //极夜
|
|
|
|
return -2 //极夜
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > 0 {
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > An {
|
|
|
|
return -1 //极昼
|
|
|
|
return -1 //极昼
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
|
|
|
|
var sundown float64
|
|
|
|
|
|
|
|
if math.Abs(tmp) <= 1 && Lat < 85 {
|
|
|
|
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
|
|
|
|
sundown = tztime + rzsc/24.0 + 35.0/24.0/60.0
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sundown = tztime
|
|
|
|
|
|
|
|
i := 0
|
|
|
|
|
|
|
|
for LowSunHeight(sundown, Lon, Lat, ntz) > An {
|
|
|
|
|
|
|
|
i++
|
|
|
|
|
|
|
|
sundown += 15.0 / 60.0 / 24.0
|
|
|
|
|
|
|
|
if i > 48 {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rzsc := ArcCos(tmp) / 15.0
|
|
|
|
}
|
|
|
|
sunrise := tztime + rzsc/24 - 5.0/24.0/60.0
|
|
|
|
JD1 := sundown
|
|
|
|
JD1 := sunrise
|
|
|
|
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
JD0 := JD1
|
|
|
|
JD0 := JD1
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|