|
|
@ -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)
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
tmp := -Tan((math.Abs(Lat)+An)*(Lat/math.Abs(Lat))) * Tan(dec)
|
|
|
|
return -2 //极夜
|
|
|
|
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)
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > An {
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
return -1 //极昼
|
|
|
|
sunrise := tztime + rzsc/24.0 + 35.0/24.0/60.0
|
|
|
|
}
|
|
|
|
i := 0
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) < An {
|
|
|
|
var sundown float64
|
|
|
|
i++
|
|
|
|
if math.Abs(tmp) <= 1 && Lat < 85 {
|
|
|
|
sunrise -= 15 / 60 / 24
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
if i > 12 {
|
|
|
|
sundown = tztime + rzsc/24.0 + 35.0/24.0/60.0
|
|
|
|
break
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sundown = tztime
|
|
|
|
|
|
|
|
i := 0
|
|
|
|
|
|
|
|
for LowSunHeight(sundown, Lon, Lat, ntz) > An {
|
|
|
|
|
|
|
|
i++
|
|
|
|
|
|
|
|
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 {
|
|
|
|
for {
|
|
|
|
JD0 := JD1
|
|
|
|
JD0 := JD1
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
@ -1217,25 +1218,26 @@ 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)
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < An {
|
|
|
|
tmp := -Tan((math.Abs(Lat)+An)*(Lat/math.Abs(Lat))) * Tan(dec)
|
|
|
|
return -2 //极夜
|
|
|
|
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)
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
return -1 //极昼
|
|
|
|
sunrise := tztime - rzsc/24 - 25.0/24.0/60.0
|
|
|
|
}
|
|
|
|
i := 0
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) > An {
|
|
|
|
var sunrise float64
|
|
|
|
i++
|
|
|
|
if math.Abs(tmp) <= 1 && Lat < 85 {
|
|
|
|
sunrise -= 15 / 60 / 24
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
if i > 12 {
|
|
|
|
sunrise = tztime - rzsc/24 - 25.0/24.0/60.0
|
|
|
|
break
|
|
|
|
} else {
|
|
|
|
|
|
|
|
sunrise = tztime
|
|
|
|
|
|
|
|
i := 0
|
|
|
|
|
|
|
|
for LowSunHeight(sunrise, Lon, Lat, ntz) > An {
|
|
|
|
|
|
|
|
i++
|
|
|
|
|
|
|
|
sunrise -= 15.0 / 60.0 / 24.0
|
|
|
|
|
|
|
|
if i > 48 {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
|
JD1 := sunrise - 5.00/24.00/60.00
|
|
|
@ -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)
|
|
|
|
return -2 //极夜
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
}
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < 0 {
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > An {
|
|
|
|
return -2 //极夜
|
|
|
|
return -1 //极昼
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if SunHeight(tztime-0.5, Lon, Lat, ntz) > 0 {
|
|
|
|
//(sin(ho)-sin(φ)*sin(δ2))/(cos(φ)*cos(δ2))
|
|
|
|
return -1 //极昼
|
|
|
|
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
|
|
|
|
|
|
|
|
} 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
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
rzsc := ArcCos(tmp) / 15
|
|
|
|
|
|
|
|
sunrise := tztime - rzsc/24 - 5.0/24.0/60.0
|
|
|
|
|
|
|
|
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)
|
|
|
|
return -2 //极夜
|
|
|
|
if math.Abs(tmp) > 1 {
|
|
|
|
}
|
|
|
|
if SunHeight(tztime, Lon, Lat, ntz) < 0 {
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > An {
|
|
|
|
return -2 //极夜
|
|
|
|
return -1 //极昼
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if SunHeight(tztime+0.5, Lon, Lat, ntz) > 0 {
|
|
|
|
tmp := (Sin(An) - Sin(HSunSeeDec(tztime))*Sin(Lat)) / (Cos(HSunSeeDec(tztime)) * Cos(Lat))
|
|
|
|
return -1 //极昼
|
|
|
|
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
|
|
|
|
JD1 := sundown
|
|
|
|
sunrise := tztime + rzsc/24 - 5.0/24.0/60.0
|
|
|
|
|
|
|
|
JD1 := sunrise
|
|
|
|
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
JD0 := JD1
|
|
|
|
JD0 := JD1
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|
stDegree := SunHeight(JD0, Lon, Lat, ntz) - An
|
|
|
|