|
|
|
@ -1179,28 +1179,29 @@ func GetBanTime(JD, Lon, Lat, TZ, An float64) float64 {
|
|
|
|
|
JD = math.Floor(JD) + 1.5
|
|
|
|
|
ntz := math.Round(Lon / 15)
|
|
|
|
|
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 {
|
|
|
|
|
return -2 //极夜
|
|
|
|
|
}
|
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > An {
|
|
|
|
|
return -1 //极昼
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tmp = -Tan(Lat) * Tan(dec)
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) < An {
|
|
|
|
|
for LowSunHeight(sundown, Lon, Lat, ntz) > An {
|
|
|
|
|
i++
|
|
|
|
|
sunrise -= 15 / 60 / 24
|
|
|
|
|
if i > 12 {
|
|
|
|
|
sundown += 15.0 / 60.0 / 24.0
|
|
|
|
|
if i > 48 {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
|
|
}
|
|
|
|
|
JD1 := sundown - 5.00/24.00/60.00
|
|
|
|
|
for {
|
|
|
|
|
JD0 := JD1
|
|
|
|
|
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
|
|
|
|
|
ntz := math.Round(Lon / 15)
|
|
|
|
|
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 {
|
|
|
|
|
return -2 //极夜
|
|
|
|
|
}
|
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
|
return -1 //极昼
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tmp = -Tan(Lat) * Tan(dec)
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) > An {
|
|
|
|
|
i++
|
|
|
|
|
sunrise -= 15 / 60 / 24
|
|
|
|
|
if i > 12 {
|
|
|
|
|
sunrise -= 15.0 / 60.0 / 24.0
|
|
|
|
|
if i > 48 {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
|
|
for {
|
|
|
|
|
JD0 := JD1
|
|
|
|
@ -1275,18 +1277,30 @@ func GetSunRiseTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
|
|
|
|
|
}
|
|
|
|
|
An = An - HeightDegreeByLat(HEI, Lat)
|
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
|
dec := HSunSeeDec(tztime)
|
|
|
|
|
tmp := -Tan(Lat) * Tan(dec)
|
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < 0 {
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
|
return -2 //极夜
|
|
|
|
|
}
|
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > 0 {
|
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
for {
|
|
|
|
|
JD0 := JD1
|
|
|
|
@ -1308,19 +1322,29 @@ func GetSunDownTime(JD, Lon, Lat, TZ, ZS, HEI float64) float64 {
|
|
|
|
|
}
|
|
|
|
|
An = An - HeightDegreeByLat(HEI, Lat)
|
|
|
|
|
tztime := GetSunTZTime(JD, Lon, ntz)
|
|
|
|
|
dec := HSunSeeDec(tztime)
|
|
|
|
|
tmp := -Tan(Lat) * Tan(dec)
|
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < 0 {
|
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
|
return -2 //极夜
|
|
|
|
|
}
|
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > 0 {
|
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > An {
|
|
|
|
|
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 := sunrise
|
|
|
|
|
}
|
|
|
|
|
JD1 := sundown
|
|
|
|
|
for {
|
|
|
|
|
JD0 := JD1
|
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|
|