Sunrise and sunset time acquisition method, apparatus, device, and medium
By using iterative calculations of time iteration functions and latitude and longitude parameters, the problems of insufficient accuracy and high cost in sunrise and sunset time predictions have been solved, realizing an efficient and low-cost prediction method.
Patent Information
- Application Number
- CN202311154290.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-07
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2043-09-07
AI Technical Summary
Existing technologies have poor accuracy in predicting sunrise and sunset times, and internet-based query systems are costly.
By using an iterative calculation method, sunrise and sunset times are predicted using a time iteration function and latitude and longitude parameters until the iteration error is less than the error threshold, thereby improving the accuracy and precision of the prediction and reducing costs.
It improves the accuracy and precision of sunrise and sunset time prediction, reduces prediction costs, and optimizes the practicality and applicability of the prediction method.
Smart Images

Figure CN117312720B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, and in particular to a sunrise and sunset time acquisition method, device, equipment and medium. BACKGROUND
[0002] With the development of technology, the prediction of sunrise and sunset time is increasingly important in related control scenarios, such as photovoltaic power station grid-connected control scenarios.
[0003] In the related art, the sunrise and / or sunset time of a certain region can be predicted according to the obliquity of the ecliptic of the region, and the accuracy is not good enough. In addition, the sunrise and / or sunset time can be queried based on the Internet, and the system cost is high. SUMMARY
[0004] The present application aims to at least partially solve one of the technical problems in the related art.
[0005] To this end, one object of the present application is to provide a sunrise and sunset time acquisition method.
[0006] The time iteration function of the target region, the first operation parameter of the time iteration function in the first calculation round, and the latitude and longitude parameters of the target region are obtained. Based on the first operation parameter and the latitude and longitude parameter, the first predicted time output by the time iteration function in the first calculation round is obtained. The second predicted time of the historical prediction of the time iteration function is obtained, and the first iteration error value of the time iteration function in the first calculation round is obtained based on the first predicted time and the second predicted time. Further, when the first iteration error value is less than or equal to a preset error threshold, the time iteration function is iteratively calculated based on the first iteration error value until the iteration ends, and the target predicted time of the target region is obtained. In the present application, the target predicted time of the target region is obtained by iterative calculation, which improves the accuracy and precision of the sunrise and / or sunset time prediction. Compared with the scene of obtaining the sunrise and / or sunset time based on the additional device specially set in the Internet, the prediction cost of the sunrise and / or sunset time is reduced, the prediction method and prediction effect of the sunrise and / or sunset time are optimized, and the practicality and applicability of the sunrise and / or sunset time prediction method are improved.
[0007] A second object of the present application is to provide a sunrise and sunset time acquisition device.
[0008] A third object of the present application is to provide an electronic device.
[0009] A fourth object of the present application is to provide a non-transitory computer readable storage medium.
[0010] A fifth object of the present application is to provide a computer program product.
[0011] To achieve the above objects, the first aspect of the present application provides a sunrise and sunset time acquisition method, comprising: acquiring a first operation parameter of a time iteration function of a target region in a current first calculation round, and a latitude and longitude parameter of the target region, and obtaining a first predicted time output by the time iteration function in the first calculation round based on the latitude and longitude parameter and the first operation parameter, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target region; acquiring a second predicted time of a historical prediction of the time iteration function, and acquiring a first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time; in response to the first iteration error being greater than or equal to a preset error threshold, returning to continue the iteration calculation of the time iteration function based on the first iteration error until the iteration ends, to obtain a target predicted time of the target region, wherein the target predicted time comprises at least one of a target predicted sunrise time and a target predicted sunset time of the target region.
[0012] The sunrise and sunset time acquisition method provided by the present application acquires the time iteration function of the target region, the first operation parameter of the time iteration function in the first calculation round, and the latitude and longitude parameter of the target region, obtains the first predicted time output by the time iteration function in the first calculation round based on the first operation parameter and the latitude and longitude parameter, acquires the second predicted time of the historical prediction of the time iteration function, and acquires the first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time. Further, when the first iteration error value is less than or equal to the preset error threshold, the iteration calculation of the time iteration function is continued based on the first iteration error value until the iteration ends, to obtain the target predicted time of the target region. In the present application, the target predicted time of the target region is obtained through iteration calculation, which improves the accuracy and precision of the prediction of the sunrise time and / or the sunset time, reduces the prediction cost of the sunrise time and / or the sunset time compared to the scene of acquiring the sunrise time and / or the sunset time based on the additional device specially set in the Internet, optimizes the prediction method and prediction effect of the sunrise time and / or the sunset time, and improves the practicality and applicability of the prediction method of the sunrise time and / or the sunset time
[0013] According to one embodiment of the present application, the time iteration function of the target area is obtained in the first operation parameter in the current first calculation round, and the latitude and longitude parameters of the target area, and based on the latitude and longitude parameters and the first operation parameter, the first predicted time output by the time iteration function in the first calculation round is obtained, comprising: obtaining the first operation reference date of the time iteration function in the first calculation round, the operation start time in the predicted time range and the first real-time time stamp of the first calculation round as the first operation parameter of the time iteration function; input the latitude and longitude parameters and the first operation parameter into the time iteration function, to obtain the first predicted time output by the time iteration function in the first calculation round, wherein the first predicted time includes at least one of the predicted sunrise time and the predicted sunset time of the target area.
[0014] According to one embodiment of the present application, the second predicted time of the time iteration function history prediction is obtained, comprising: identifying whether the first calculation round is the first calculation round in the predicted time range; in response to identifying that the first calculation round is the first calculation round in the predicted time range, determining the operation start time of the time iteration function in the predicted time range as the second predicted time; in response to identifying that the first calculation round is not the first calculation round in the predicted time range, determining the predicted time output by the time iteration function in the second calculation round adjacent to the first calculation round as the second predicted time.
[0015] According to one embodiment of the present application, in response to the first iteration error being greater than or equal to a preset error threshold, the iterative calculation of the time iteration function based on the first iteration error is continued until the iteration ends, and the target predicted time of the target area is obtained, comprising: in response to the first iteration error value being greater than the preset error threshold, obtaining the second operation parameter in the third calculation round, and according to the latitude and longitude parameters, the first iteration error and the second operation parameter, obtaining the third predicted time output by the time iteration function in the third calculation round, wherein the third calculation round is the subsequent adjacent calculation round of the first calculation round; according to the third predicted time and the first predicted time, the second iteration error value of the time iteration function in the third calculation round is obtained, until the second iteration error value is less than or equal to the error threshold, the iterative calculation of the time iteration function is ended, and the target predicted time of the target area is obtained.
[0016] According to one embodiment of the present application, the method further comprises: in response to the first iteration error value being less than or equal to the error threshold, determining the first predicted time as a target predicted time of the target region.
[0017] According to one embodiment of the present application, the second operation parameter comprises a second operation reference date of the time iteration function after parameter adjustment in the third calculation round, the operation start time within the predicted time range, and a second real-time timestamp of the third calculation round.
[0018] According to one embodiment of the present application, the time iteration function comprises:
[0019] T (i) =L_fun(year0,month0,day0,t_real,lo,la,k*err(i-1))
[0020] wherein L_fun represents a time calculation function in the time iteration function, year0, month0 and day0 represent an operation reference date, t_real represents a real-time timestamp, lo represents a longitude parameter, la represents a latitude parameter, k represents an iteration control parameter, wherein 0 < k < 1, and err(i-1) represents a calculation of an iteration error value.
[0021] To achieve the above object, a second embodiment of the present application provides a sunrise and sunset time acquisition device, comprising: a first acquisition module configured to acquire a first operation parameter of a time iteration function of a target region in a current first calculation round, and longitude and latitude parameters of the target region, and obtain a first predicted time output by the time iteration function in the first calculation round based on the longitude and latitude parameters and the first operation parameter, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target region; an error calculation module configured to acquire a second predicted time predicted by the time iteration function in history, and acquire a first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time; and an iteration module configured to, in response to the first iteration error being greater than or equal to a preset error threshold, return to continue iteration calculation of the time iteration function based on the first iteration error until iteration ends, and obtain a target predicted time of the target region, wherein the target predicted time comprises at least one of a target predicted sunrise time and a target predicted sunset time of the target region.
[0022] The sunrise and sunset time acquisition device provided in the embodiments of the present application obtains a time iteration function of a target region, a first operation parameter of the time iteration function in a first calculation round, and a longitude and latitude parameter of the target region, obtains a first predicted time output by the time iteration function in the first calculation round based on the first operation parameter and the longitude and latitude parameter, obtains a second predicted time of a historical prediction of the time iteration function, and obtains a first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time. Further, when the first iteration error value is less than or equal to a preset error threshold, the time iteration function is continuously iterated based on the first iteration error value until iteration ends, and a target predicted time of the target region is obtained. In the present application, the target predicted time of the target region is obtained through iteration, which improves the accuracy and precision of the sunrise time and / or sunset time prediction, reduces the prediction cost of the sunrise time and / or sunset time compared with the scene of obtaining the sunrise time and / or sunset time based on an additional device specially set in the Internet, optimizes the prediction method and prediction effect of the sunrise time and / or sunset time, and improves the practicality and applicability of the sunrise time and / or sunset time prediction method
[0023] According to an embodiment of the present application, the first acquisition module is further configured to: acquire a first operation reference date of the time iteration function in the first calculation round, an operation start time in a prediction time range, and a first real-time time stamp of the first calculation round as the first operation parameter of the time iteration function; and input the longitude and latitude parameter and the first operation parameter into the time iteration function to obtain the first predicted time output by the time iteration function in the first calculation round, wherein the first predicted time includes at least one of a predicted sunrise time and a predicted sunset time of the target region.
[0024] According to an embodiment of the present application, the error calculation module is further configured to: identify whether the first calculation round is a first calculation round in a prediction time range; in response to identifying that the first calculation round is the first calculation round in the prediction time range, determine the operation start time of the time iteration function in the prediction time range as the second predicted time; and in response to identifying that the first calculation round is a non-first calculation round in the prediction time range, determine a predicted time output by the time iteration function in a second calculation round adjacent to the first calculation round as the second predicted time.
[0025] According to an embodiment of the present application, the iteration module is further configured to: in response to the first iteration error value being greater than a preset error threshold, obtain a second operation parameter in a third calculation round, and obtain a third predicted time output by the time iteration function in the third calculation round according to the latitude and longitude parameter, the first iteration error and the second operation parameter, wherein the third calculation round is a subsequent adjacent calculation round of the first calculation round; and obtain a second iteration error value of the time iteration function in the third calculation round according to the third predicted time and the first predicted time, until the second iteration error value is less than or equal to the error threshold, and end the iteration calculation of the time iteration function to obtain a target predicted time of the target area.
[0026] According to an embodiment of the present application, the iteration module is further configured to: in response to the first iteration error value being less than or equal to the error threshold, determine the first predicted time as the target predicted time of the target area.
[0027] According to an embodiment of the present application, the second operation parameter comprises a second operation reference date of the time iteration function after parameter adjustment in the third calculation round, the operation start time in the predicted time range, and a second real-time time stamp of the third calculation round.
[0028] According to an embodiment of the present application, the time iteration function comprises:
[0029] T (i) = L_fun(year0, month0, day0, t_real, lo, la, k*err(i-1))
[0030] wherein L_fun represents a time calculation function in the time iteration function, year0, month0 and day0 represent an operation reference date, t_real represents a real-time time stamp, lo represents a longitude parameter, la represents a latitude parameter, k represents an iteration control parameter, wherein 0 < k < 1, and err(i-1) represents the calculation of an iteration error value.
[0031] To achieve the above object, a third aspect embodiment of the present application provides an electronic device, comprising: a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the sunrise and sunset time obtaining method according to the first aspect embodiment of the present application.
[0032] To achieve the above object, the fourth aspect of the present application provides a non-transitory computer readable storage medium, which stores a computer program, and the program is executed by a processor to implement the sunrise and sunset time acquisition method according to the first aspect of the present application.
[0033] To achieve the above object, the fifth aspect of the present application provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the sunrise and sunset time acquisition method according to the first aspect of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 A flowchart of the sunrise and sunset time acquisition method according to an embodiment of the present application is shown in FIG. 1.
[0035] Figure 2 A flowchart of the sunrise and sunset time acquisition method according to another embodiment of the present application is shown in FIG. 2.
[0036] Figure 3 A flowchart of the sunrise and sunset time acquisition method according to another embodiment of the present application is shown in FIG. 3.
[0037] Figure 4 A schematic diagram of the sunrise and sunset time acquisition system according to an embodiment of the present application is shown in FIG. 4.
[0038] Figure 5 A schematic diagram of the sunrise and sunset time acquisition device according to an embodiment of the present application is shown in FIG. 5.
[0039] Figure 6 A schematic diagram of the electronic device according to an embodiment of the present application is shown in FIG. 6. DETAILED DESCRIPTION
[0040] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the drawings, in which the same or similar notations represent the same or similar elements or elements having the same or similar functions. The embodiments described below by referring to the drawings are exemplary and are intended to explain the present application, and cannot be understood as a limitation of the present application.
[0041] The sunrise and sunset time acquisition method and device according to the embodiments of the present application are described below in combination with the drawings.
[0042] Figure 1 A flowchart of the sunrise and sunset time acquisition method according to an embodiment of the present application is shown in FIG. 1. Figure 1 The method comprises:
[0043] S101, obtain a first operation parameter of the time iteration function in a first calculation round for the target region, and obtain a latitude and longitude parameter of the target region, and obtain a first predicted time output by the time iteration function in the first calculation round based on the latitude and longitude parameter and the first operation parameter, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target region.
[0044] In the embodiments of the present application, the prediction of the sunrise time and the sunset time can be implemented based on a preconfigured time calculation function.
[0045] The region for which the prediction of the sunrise time and / or the sunset time is needed can be determined as the target region.
[0046] Optionally, an iteration method corresponding to the time calculation function can be obtained, and the time calculation function can be iterated based on the obtained iteration method, and the time calculation function capable of iterative optimization can be determined as the time iteration function of the target region.
[0047] In the embodiments of the present application, the time iteration function can be used to predict the sunrise time and the sunset time of the target region based on iterative calculation of multiple rounds.
[0048] The round in which the time iteration function currently performs the prediction calculation can be marked as the first calculation round of the time iteration function.
[0049] Optionally, the time iteration function needs to obtain corresponding parameters, and the parameters needed by the time iteration function in the prediction operation of the sunrise time and / or the sunset time in the first calculation round can be marked as the first operation parameter of the time iteration function in the first calculation round.
[0050] In this scenario, the latitude and longitude parameter of the target region can be obtained, and the sunrise time and / or the sunset time of the target region can be predicted based on the obtained latitude and longitude parameter and the first operation parameter needed by the time iteration function in the first calculation round for the prediction operation.
[0051] The result output by the time iteration function in the first calculation round can be determined as the first predicted time output by the time iteration function in the first calculation round.
[0052] It should be noted that the time iteration function can be used to predict the sunrise time of the target region, and can also be used to predict the sunset time of the target region, so the first predicted time output by the time iteration function in the first calculation round can comprise at least one of the predicted sunrise time and the predicted sunset time of the target region obtained by the time iteration function in the first calculation round.
[0053] S102, acquire a second predicted time of the time iteration function history prediction, and acquire a first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time.
[0054] In the embodiments of the present application, the predicted time output by the time iteration function in the historical time range can be marked as a second predicted time.
[0055] Optionally, based on the first predicted time and the second predicted time, an error value of the time iteration function in the first calculation round can be acquired, wherein the error value can be determined as the first iteration error value of the time iteration function in the first calculation round.
[0056] As an example, the first predicted time and the second predicted time can be algorithmically processed based on a preset error value algorithm, and then the first iteration error value of the time iteration function in the first calculation round can be obtained according to the result of the algorithmic processing.
[0057] The formula of the error value algorithm can be as follows:
[0058] err(i-1)=abs(T(i)-T(i-1))
[0059] In the above formula, err(i-1) represents the first iteration error value of the time iteration function in the first calculation round, T(i) represents the first predicted time, T(i-1) represents the second predicted time, and i represents the calculation round of the time iteration function.
[0060] As another example, based on the above formula, it is set that the first calculation round is the calculation round when i is 2. In this example, the first iteration error value of the time iteration function in the first calculation round can be as follows:
[0061] err(1)=abs(T(2)-T(1))
[0062] In the above formula, err(1) represents the first iteration error value of the time iteration function in the first calculation round when i is 2, T(2) represents the first predicted time, and T(1) represents the second predicted time.
[0063] S103, in response to the first iteration error being greater than or equal to a preset error threshold, continue the iterative calculation of the time iteration function based on the first iteration error until the iteration ends, and obtain a target predicted time of the target region, wherein the target predicted time includes at least one of a target predicted sunrise time and a target predicted sunset time of the target region.
[0064] In the embodiment of the present application, the first iteration error can be compared with a preset error threshold. When the first iteration error is less than or equal to the error threshold, it can be determined that the accuracy of the first predicted time output by the first calculation round cannot meet the preset prediction accuracy condition of the sunrise time and / or the sunset time.
[0065] In this scenario, the time iteration function needs to be iteratively calculated based on the first iteration error. For the subsequent adjacent calculation rounds of the first calculation round, the first iteration error of the first predicted time output by the first calculation round of the time iteration function based on the second predicted time can be used as the input of the time iteration function in the subsequent adjacent calculation rounds of the first calculation round.
[0066] Further, based on the data required for the operation of the time iteration function in the subsequent adjacent calculation rounds, the iterative calculation of the time iteration function is continued until the iteration is completed, and the target predicted time of the target region is obtained. The target predicted time includes at least one of the target predicted sunrise time and the target predicted sunset time of the target region.
[0067] Optionally, the iteration end condition can also be set based on the iteration error value of the time iteration function. When the iteration error value output by the time iteration function in a certain round meets the preset iteration end condition, the iterative calculation of the time iteration function can be stopped, and the result output by the last round of calculation is determined as the target predicted time of the target region.
[0068] The method for obtaining the sunrise and sunset time provided in the present application obtains the time iteration function of the target region, the first operation parameter of the time iteration function in the first calculation round, and the latitude and longitude parameters of the target region. Based on the first operation parameter and the latitude and longitude parameter, the first predicted time output by the time iteration function in the first calculation round is obtained. The second predicted time of the historical prediction of the time iteration function is obtained, and the first iteration error value of the time iteration function in the first calculation round is obtained based on the first predicted time and the second predicted time. Further, when the first iteration error value is less than or equal to the preset error threshold, the time iteration function is iteratively calculated based on the first iteration error value until the iteration is completed, and the target predicted time of the target region is obtained. In the present application, the target predicted time of the target region is obtained through iterative calculation, which improves the accuracy and precision of the sunrise time and / or sunset time prediction. Compared with the scenario of obtaining the sunrise time and / or sunset time based on the additional device specially set in the Internet, the prediction cost of the sunrise time and / or sunset time is reduced, the prediction method and prediction effect of the sunrise time and / or sunset time are optimized, and the practicality and applicability of the sunrise time and / or sunset time prediction method are improved.
[0069] In the above embodiments, in addition to the above, the target prediction time including the target prediction sunrise time and the target prediction sunset time can also be obtained by combining Figure 2 It is further understood that Figure 2 A flowchart of a method for obtaining sunrise and sunset times according to another embodiment of the present application is shown in FIG. 4. As shown in FIG. 4, the method includes the following steps. Figure 2
[0070] In S201, a first operation reference date of the time iteration function in a first calculation round, an operation start time within a prediction time range, and a first real-time timestamp of the first calculation round are obtained as first operation parameters of the time iteration function.
[0071] Optionally, the calculation formula of the time iteration function can be as follows:
[0072] T (i) = L_fun(year0, month0, day0, t_real, lo, la, k*err(i-1))
[0073] wherein L_fun represents a time calculation function in the time iteration function, year0, month0, and day0 represent the operation reference date, t_real represents the real-time timestamp, lo represents the longitude parameter, la represents the latitude parameter, k represents the iteration control parameter, wherein 0 < k < 1, and err(i-1) represents the calculation of the iteration error value.
[0074] It should be noted that the iteration control parameter k in the above formula is used to adjust the iteration number and / or iteration accuracy of the time iteration function. The value of k can be adjusted before the time iteration function starts iteration calculation, and the iteration of the time iteration function is performed after the adjustment is completed. The value of k satisfies 0 < k < 1.
[0075] In this scenario, the first operation parameters required for the time iteration function to perform prediction operation in the first calculation round can be obtained based on the above formula, including the first operation reference date of the time iteration function in the first calculation round, the operation start time within the prediction time range, and the first real-time timestamp of the first calculation round.
[0076] The operation start time can be understood as the start time of the first calculation round of the time iteration function within the prediction time range, and the first real-time timestamp can be understood as the real-time timestamp when the time iteration function performs prediction of the sunrise time and / or the sunset time in the first calculation round.
[0077] S202, input the latitude and longitude parameters and the first operation parameter into the time iteration function to obtain a first predicted time output by the time iteration function in a first calculation round, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target area.
[0078] In the embodiments of the present application, after obtaining the latitude and longitude parameters of the target area and the first operation parameter required by the time iteration function in the first calculation round, the latitude and longitude parameters and the first operation parameter can be input into the time iteration function for calculation, and a calculation result can be obtained.
[0079] In this scenario, the calculation result can be determined as the first predicted time output by the time iteration function in the first calculation round.
[0080] The first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target area.
[0081] S203, obtaining a second predicted time predicted by the time iteration function, and based on the first predicted time and the second predicted time, obtaining a first iteration error value of the time iteration function in the first calculation round.
[0082] Optionally, whether the first calculation round is the first calculation round in the predicted time range is identified.
[0083] In the embodiments of the present application, whether the first calculation round is the first calculation round of the time iteration function in the predicted time range can be identified, and the second predicted time can be obtained according to the identification result.
[0084] Optionally, in response to identifying that the first calculation round is the first calculation round in the predicted time range, an operation start time of the time iteration function in the predicted time range is determined as the second predicted time.
[0085] It can be understood that if it is identified that the first calculation round is the first calculation round of the time iteration function in the predicted time range, the first calculation round does not have a previous round adjacent thereto, and in this scenario, an operation start time of the time iteration function in the predicted time range for starting the predicted operation of the first calculation round can be determined as the second predicted time corresponding to the first predicted time.
[0086] Optionally, in response to identifying that the first calculation round is not the first calculation round in the predicted time range, a predicted time output by the time iteration function in a second calculation round adjacent to the first calculation round is determined as the second predicted time.
[0087] It can be understood that if it is identified that the first calculation round is not the first calculation round of the time iteration function in the prediction time range, the first calculation round has a previous round adjacent to it, and in this case, the previous round adjacent to the first calculation round in the prediction time range can be taken as the second calculation round, and the prediction time output by the time iteration function in the second calculation round can be taken as the second prediction time.
[0088] Further, based on the preset error value acquisition algorithm, the first prediction time and the second prediction time are algorithmically processed, and then according to the result of the algorithmic processing, the first iteration error value of the time iteration function in the first calculation round is obtained.
[0089] S204, in response to the first iteration error being greater than or equal to the preset error threshold, the iteration calculation of the time iteration function based on the first iteration error is continued until the iteration ends, and the target prediction time of the target region is obtained.
[0090] Optionally, in response to the first iteration error value being less than or equal to the error threshold, the first prediction time is determined as the target prediction time of the target region.
[0091] In the embodiments of the present application, when the first iteration error value is less than or equal to the preset error threshold, it can be determined that the accuracy of the first prediction time output by the time iteration function in the first calculation round meets the preset accuracy standard, and the first prediction time output by the time iteration function in the first calculation round can be determined as the target prediction time of the target region.
[0092] Optionally, in response to the first iteration error value being greater than the preset error threshold, a second operation parameter in a third calculation round is obtained, and a third prediction time output by the time iteration function in the third calculation round is obtained according to the latitude and longitude parameters, the first iteration error and the second operation parameter, wherein the third calculation round is a subsequent adjacent calculation round of the first calculation round.
[0093] In the embodiments of the present application, the first iteration error value can be compared with the preset error threshold, and when the first iteration error value is greater than the preset error threshold, it can be determined that the accuracy of the first prediction time output by the time iteration function in the first calculation round cannot meet the preset accuracy standard.
[0094] In this case, the first iteration error of the current first calculation round can be taken as the input of the subsequent adjacent calculation round of the first calculation round, and the next calculation round of the subsequent adjacent calculation of the first calculation round in the prediction time range can be determined as the third calculation round.
[0095] Optionally, the second operational parameters required for the operation of the time iteration function in the third calculation round can be obtained, and the sunrise and / or sunset times calculated by the time iteration function in the third calculation round can be obtained based on the latitude and longitude parameters, the first iteration error and the second operational parameters, and marked as the third predicted time output by the time iteration function in the third calculation round.
[0096] The second calculation parameter includes the second calculation reference date of the time iteration function after parameter adjustment in the third calculation round, the calculation start time within the prediction time range, and the second real-time timestamp of the third calculation round.
[0097] Optionally, based on the third prediction time and the first prediction time, the second iteration error value of the time iteration function in the third calculation round is obtained, and the iterative calculation of the time iteration function ends when the second iteration error value is less than or equal to the error threshold, so as to obtain the target prediction time of the target area.
[0098] In this embodiment of the application, the error value between the third prediction time and the first prediction time can be obtained as the second iteration error value, and the second iteration error value can be compared with a preset error threshold.
[0099] In scenarios where the second iteration error value is greater than the preset error threshold, it is necessary to continue iterating the time iteration function based on the second iteration error value until the iteration ends, and obtain the target prediction time of the target area.
[0100] If the error value of the second iteration is less than or equal to the preset error threshold, it can be determined that the accuracy of the third prediction time output by the time iteration function in the third calculation round has met the preset accuracy standard. Therefore, the third prediction time output by the time iteration function in the third calculation round can be determined as the target prediction time for the target area.
[0101] The sunrise and sunset time acquisition method proposed in this application obtains the target predicted time of the target area through iterative calculation, which improves the accuracy and precision of sunrise and / or sunset time prediction. Compared with the scenario of obtaining sunrise and / or sunset time based on specially set additional devices in the Internet, it reduces the prediction cost of sunrise and / or sunset time, optimizes the prediction method and prediction effect of sunrise and / or sunset time, and improves the practicality and applicability of sunrise and / or sunset time prediction method.
[0102] To better understand the above embodiments, it can be combined with Figure 3 , Figure 3 This is a flowchart illustrating a method for obtaining sunrise and sunset times according to another embodiment of this application, as shown below. Figure 3 As shown, the method includes:
[0103] For the target area, the first operation parameter and the latitude and longitude parameter of the target area are obtained and input to the time iteration function for calculation to obtain the predicted time output by the time iteration function at the i corresponding calculation round.
[0104] Optionally, the iteration error value err(i) of the time iteration function at the i corresponding calculation round is obtained, and the iteration error value err(i) obtained at the i corresponding calculation round is compared with the preset error value threshold dete.
[0105] Optionally, when err(i) is greater than dete, it can be understood that the accuracy of the predicted time obtained by the time iteration function at the i corresponding calculation round does not meet the preset accuracy standard, and in this scenario, the time iteration function needs to be iteratively calculated based on the iteration error value until the iteration ends to obtain the target predicted time T(i) of the target area.
[0106] Optionally, when err(i) is less than or equal to dete, it can be understood that the accuracy of the predicted time obtained by the time iteration function at the i corresponding calculation round meets the preset accuracy standard, and in this scenario, the predicted time output by the time iteration function at the i corresponding calculation round can be determined as the target predicted time T(i) of the target area.
[0107] As a possible implementation manner, the sunrise and sunset time of the target area can be obtained by Figure 4 the system shown in the figure.
[0108] As shown in Figure 4 , the device includes a storage component, a control calculation component, and a controlled component, wherein the storage component can be used to obtain the latitude and longitude parameters of the target area and store them, and then transmit the obtained latitude and longitude parameters to the control calculation component.
[0109] Optionally, the control calculation component is provided with a real-time clock function, and the operation parameters required for the time iteration function operation can be obtained through the real-time clock function.
[0110] Further, based on the latitude and longitude parameters and the operation parameters, the time iteration function is iteratively calculated by the control calculation component to obtain the target predicted time of the target area, including the target predicted sunrise time and / or the target predicted sunset time.
[0111] It should be noted that, Figure 4 the system shown in the figure is also provided with a controlled component, and the control of the iterative calculation of the time iteration function can be realized through the controlled component.
[0112] The sunrise and sunset time acquisition method provided in the application obtains the target prediction time of the target area through iterative calculation, improves the accuracy and precision of the sunrise time and / or sunset time prediction, reduces the prediction cost of the sunrise time and / or sunset time compared with the scene of acquiring the sunrise time and / or sunset time based on the additional device specially set in the Internet, optimizes the prediction method and prediction effect of the sunrise time and / or sunset time, and improves the practicability and applicability of the sunrise time and / or sunset time prediction method.
[0113] Corresponding to the sunrise and sunset time acquisition method provided in the above embodiments, one embodiment of the application further provides a sunrise and sunset time acquisition device. Since the sunrise and sunset time acquisition device provided in the embodiment of the application corresponds to the sunrise and sunset time acquisition method provided in the above embodiments, the implementation modes of the above sunrise and sunset time acquisition method are also applicable to the sunrise and sunset time acquisition device provided in the embodiment of the application, which will not be described in detail in the following embodiments.
[0114] Figure 5 FIG. 1 is a structural diagram of a sunrise and sunset time acquisition device according to one embodiment of the application, as shown in FIG. 1, the sunrise and sunset time acquisition device 500 comprises a first acquisition module 51, an error calculation module 52 and an iteration module 53, wherein: Figure 5
[0115] The first acquisition module 51 is configured to acquire the first operation parameter of the time iteration function of the target area in the current first calculation round and the longitude and latitude parameters of the target area, and obtain the first prediction time output by the time iteration function in the first calculation round based on the longitude and latitude parameters and the first operation parameter, wherein the first prediction time comprises at least one of the predicted sunrise time and the predicted sunset time of the target area.
[0116] The error calculation module 52 is configured to acquire the second prediction time of the historical prediction of the time iteration function, and acquire the first iteration error value of the time iteration function in the first calculation round based on the first prediction time and the second prediction time.
[0117] The iteration module 53 is configured to, in response to the first iteration error being greater than or equal to the preset error threshold, continue the iterative calculation of the time iteration function based on the first iteration error until the iteration ends, and obtain the target prediction time of the target area, wherein the target prediction time comprises at least one of the target predicted sunrise time and the target predicted sunset time of the target area.
[0118] According to an embodiment of the present application, the first obtaining module 51 is further configured to: obtain, as first operation parameters of the time iteration function, a first operation reference date of the time iteration function in the first calculation round, an operation start time in the prediction time range, and a first real-time timestamp of the first calculation round; and input the latitude and longitude parameters and the first operation parameters into the time iteration function to obtain a first prediction time output by the time iteration function in the first calculation round, wherein the first prediction time comprises at least one of a predicted sunrise time and a predicted sunset time of the target region.
[0119] According to an embodiment of the present application, the error calculation module 52 is further configured to: identify whether the first calculation round is a first calculation round in the prediction time range; in response to identifying that the first calculation round is the first calculation round in the prediction time range, determine the operation start time of the time iteration function in the prediction time range as the second prediction time; and in response to identifying that the first calculation round is not the first calculation round in the prediction time range, determine a prediction time output by the time iteration function in a second calculation round adjacent to the first calculation round as the second prediction time.
[0120] According to an embodiment of the present application, the iteration module 53 is further configured to: in response to the first iteration error being greater than or equal to a preset error threshold, return to continue iteration calculation of the time iteration function based on the first iteration error until iteration ends, to obtain a target prediction time of the target region, comprising: in response to the first iteration error value being greater than the preset error threshold, obtaining second operation parameters in a third calculation round, and obtaining a third prediction time output by the time iteration function in the third calculation round according to the latitude and longitude parameters, the first iteration error, and the second operation parameters, wherein the third calculation round is a subsequent adjacent calculation round of the first calculation round; and obtaining a second iteration error value of the time iteration function in the third calculation round according to the third prediction time and the first prediction time, until the second iteration error value is less than or equal to the error threshold, to end the iteration calculation of the time iteration function, and obtain the target prediction time of the target region.
[0121] According to an embodiment of the present application, the iteration module 53 is further configured to: in response to the first iteration error value being less than or equal to the error threshold, determine the first prediction time as the target prediction time of the target region.
[0122] According to an embodiment of the present application, the second operation parameters comprise a second operation reference date of the time iteration function in the third calculation round after parameter adjustment, an operation start time in the prediction time range, and a second real-time timestamp of the third calculation round.
[0123] According to an embodiment of the present application, the time iteration function comprises:
[0124] T(i) =L_fun(year0,month0,day0,t_real,lo,la,k*err(i-1))
[0125] Wherein, L_fun represents a time calculation function in a time iteration function, year0, month0 and day0 represent an operation reference date, t_real represents a real-time timestamp, lo represents a longitude parameter, la represents a latitude parameter, k represents an iteration control parameter, wherein, 0 < k < 1, and err(i-1) represents a calculation of an iteration error value.
[0126] The sunrise and sunset time obtaining device provided in the present application obtains a time iteration function of a target region, a first operation parameter of the time iteration function in a first calculation round, and longitude and latitude parameters of the target region, obtains a first predicted time output by the time iteration function in the first calculation round based on the first operation parameter and the longitude and latitude parameters, obtains a second predicted time of a historical prediction of the time iteration function, and obtains a first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time. Further, when the first iteration error value is less than or equal to a preset error threshold, the time iteration function is iteratively calculated based on the first iteration error value until the iteration ends, and a target predicted time of the target region is obtained. In the present application, the target predicted time of the target region is obtained through iterative calculation, which improves the accuracy and precision of the sunrise time and / or the sunset time prediction, reduces the prediction cost of the sunrise time and / or the sunset time compared with the scene of obtaining the sunrise time and / or the sunset time based on an extra device specially set in the Internet, optimizes the prediction method and prediction effect of the sunrise time and / or the sunset time, and improves the practicability and applicability of the sunrise time and / or the sunset time prediction method.
[0127] To achieve the above-mentioned embodiments, the present application also provides an electronic device 600, as shown in the figure, which comprises a memory 601, a processor 602, and a computer program stored in the memory 601 and executable on the processor 602. The processor 602 executes the program to implement the sunrise and sunset time obtaining method of the present application. Figure 6 As shown in the figure, the electronic device 600 comprises a memory 601, a processor 602, and a computer program stored in the memory 601 and executable on the processor 602. The processor 602 executes the program to implement the sunrise and sunset time obtaining method of the present application. Figures 1 to 4 The present application also provides a computer program product, which comprises a computer program and a computer readable storage medium, wherein the computer readable storage medium stores the computer program, and the computer program is executable on a processor to implement the sunrise and sunset time obtaining method of the present application. The present application also provides a computer program product, which comprises a computer program and a computer readable storage medium, wherein the computer readable storage medium stores the computer program, and the computer program is executable on a processor to implement the sunrise and sunset time obtaining method of the present application.
[0128] The present application also provides a computer program product, which comprises a computer program and a computer readable storage medium, wherein the computer readable storage medium stores the computer program, and the computer program is executable on a processor to implement the sunrise and sunset time obtaining method of the present application. Figures 1 to 4 The present application also provides a computer program product, which comprises a computer program and a computer readable storage medium, wherein the computer readable storage medium stores the computer program, and the computer program is executable on a processor to implement the sunrise and sunset time obtaining method of the present application.
[0129] To achieve the above-mentioned embodiments, the embodiments of the present application further provide a computer program product comprising a computer program, wherein the computer program is executed by a processor to implement the method according to any one of the above-mentioned embodiments. Figures 1 to 4 The sunrise and sunset time acquisition method of the embodiments.
[0130] In addition, the terms "first", "second", "third", etc. are used herein only to describe various circumstances, and cannot be understood as indicating or implying relative importance or implying the number of the technical features indicated. Therefore, the features defined with "first", "second", etc. can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "a plurality of" is two or more, unless otherwise specifically limited.
[0131] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present application, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the skilled in the art can combine and combine the different embodiments or examples described in the present application and the features of the different embodiments or examples without contradiction.
[0132] Although the embodiments of the present application have been shown and described above, it can be understood that the above-mentioned embodiments are exemplary and cannot be understood as limiting the present application, and those skilled in the art can make changes, modifications, replacements and variations to the above-mentioned embodiments within the scope of the present application.
Claims
1. A method for obtaining sunrise and sunset times, characterized by, The method comprises: obtaining a first operation parameter of a time iteration function of a target area in a current first calculation round, and a longitude and latitude parameter of the target area, and obtaining a first predicted time output by the time iteration function in the first calculation round based on the longitude and latitude parameter and the first operation parameter, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target area; obtaining a second predicted time of a historical prediction of the time iteration function, and obtaining a first iteration error value of the time iteration function in the first calculation round based on the first predicted time and the second predicted time; in response to the first iteration error being greater than or equal to a preset error threshold, returning to continue iteration calculation of the time iteration function based on the first iteration error until iteration ends, to obtain a target predicted time of the target area, comprising: in response to the first iteration error value being greater than the preset error threshold, obtaining a second operation parameter in a third calculation round, and obtaining a third predicted time output by the time iteration function in the third calculation round according to the longitude and latitude parameter, the first iteration error and the second operation parameter, wherein the third calculation round is a subsequent adjacent calculation round of the first calculation round; obtaining a second iteration error value of the time iteration function in the third calculation round according to the third predicted time and the first predicted time, until the second iteration error value is less than or equal to the error threshold, ending the iteration calculation of the time iteration function, to obtain the target predicted time of the target area, wherein the target predicted time comprises at least one of a target predicted sunrise time and a target predicted sunset time of the target area; the time iteration function comprises: wherein L_fun represents a time calculation function in the time iteration function, year0, month0 and day0 represent an operation reference date, t_real represents a real-time time stamp, lo represents a longitude parameter, la represents a latitude parameter, and k represents an iteration control parameter, wherein 0 < k < 1, and err(i-1) represents a calculation of an iteration error value.
2. The method of claim 1, wherein, The method comprises: obtaining a first operation parameter of a time iteration function of a target area in a current first calculation round, and a longitude and latitude parameter of the target area, and obtaining a first predicted time output by the time iteration function in the first calculation round based on the longitude and latitude parameter and the first operation parameter, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target area; obtaining a first operation reference date of the time iteration function in the first calculation round, an operation start time within a predicted time range and a first real-time time stamp of the first calculation round as the first operation parameter of the time iteration function; inputting the longitude and latitude parameter and the first operation parameter into the time iteration function to obtain the first predicted time output by the time iteration function in the first calculation round, wherein the first predicted time comprises at least one of a predicted sunrise time and a predicted sunset time of the target area.
3. The method of claim 2, wherein, The second prediction time of the time iteration function history prediction is obtained, comprising: identifying whether the first calculation round is the first calculation round in the prediction time range; in response to identifying that the first calculation round is the first calculation round in the prediction time range, determining the operation start time of the time iteration function in the prediction time range as the second prediction time; in response to identifying that the first calculation round is not the first calculation round in the prediction time range, determining the prediction time output by the time iteration function in the second calculation round adjacent to the first calculation round as the second prediction time.
4. The method of claim 1, wherein, The method further comprises: in response to the first iteration error value being less than or equal to the error threshold, determining the first prediction time as the target prediction time of the target area.
5. The method of claim 2, wherein, The second operation parameter comprises a second operation reference date of the time iteration function after parameter adjustment in the third calculation round, the operation start time in the prediction time range, and a second real-time timestamp of the third calculation round.
6. A sunrise / sunset time acquisition apparatus characterized by comprising: The device comprises: a first acquisition module configured to acquire a first operation parameter of a time iteration function of a target area in a current first calculation round, and a latitude and longitude parameter of the target area, and obtain a first prediction time output by the time iteration function in the first calculation round based on the latitude and longitude parameter and the first operation parameter, wherein the first prediction time comprises at least one of a predicted sunrise time and a predicted sunset time of the target area; an error calculation module configured to acquire a second prediction time of a time iteration function history prediction, and acquire a first iteration error value of the time iteration function in the first calculation round based on the first prediction time and the second prediction time; an iteration module configured to, in response to the first iteration error being greater than or equal to a preset error threshold, continue the iteration calculation of the time iteration function based on the first iteration error until the iteration ends, and obtain a target prediction time of the target area, comprising: in response to the first iteration error value being greater than the preset error threshold, acquiring a second operation parameter in a third calculation round, and acquiring a third prediction time output by the time iteration function in the third calculation round according to the latitude and longitude parameter, the first iteration error, and the second operation parameter, wherein the third calculation round is a subsequent adjacent calculation round of the first calculation round; and acquiring a second iteration error value of the time iteration function in the third calculation round according to the third prediction time and the first prediction time, until the second iteration error value is less than or equal to the error threshold, ending the iteration calculation of the time iteration function, and obtaining the target prediction time of the target area, wherein the target prediction time comprises at least one of a target predicted sunrise time and a target predicted sunset time of the target area. The time iteration function comprises: Wherein, L_fun represents a time calculation function in the time iteration function, year0, month0 and day0 represent an operation reference date, t_real represents a real-time time stamp, lo represents a longitude parameter, la represents a latitude parameter, k represents an iteration control parameter, wherein, 0 < k < 1, and err(i-1) represents a calculation of an iteration error value.
7. An electronic device, comprising: Comprising: A memory, a processor and a computer program stored on the memory and loadable into the processor, the processor executing the program to implement the method of any of claims 1-5.
8. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor for implementing the method of any of claims 1-5.