CN112650971B - Method, device, equipment and storage medium for realizing formula calculation - Google Patents
Method, device, equipment and storage medium for realizing formula calculation Download PDFInfo
- Publication number
- CN112650971B CN112650971B CN202011629836.XA CN202011629836A CN112650971B CN 112650971 B CN112650971 B CN 112650971B CN 202011629836 A CN202011629836 A CN 202011629836A CN 112650971 B CN112650971 B CN 112650971B
- Authority
- CN
- China
- Prior art keywords
- calculation
- period
- formula
- formulas
- timing task
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000004364 calculation method Methods 0.000 title claims abstract description 338
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000004590 computer program Methods 0.000 claims description 25
- 239000002699 waste material Substances 0.000 abstract description 7
- 238000012545 processing Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Computational Mathematics (AREA)
- Pure & Applied Mathematics (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Algebra (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention is applicable to the technical field of computers, and provides a method, a device, equipment and a storage medium for realizing formula calculation, wherein the method comprises the following steps: acquiring initial time, wherein the initial time is the time corresponding to the starting of a program; acquiring calculation periods of all calculation formulas; grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas; setting a timing task, and acquiring an execution period of the timing task according to a calculation period, wherein the timing task comprises acquiring real-time; and determining the execution step of the calculation formula according to the real-time and the initial time. The invention adopts reasonable calculation period in the calculation process by setting the timing task, and solves the problems of waste of calculation resources, unqualified calculation frequency and the like caused by unreasonable calculation period setting in the calculation process of the formula in the prior art.
Description
Technical Field
The present invention belongs to the field of computer technology, and in particular, relates to a method, an apparatus, a device, and a storage medium for implementing formula calculation.
Background
At present, in formula calculation in intelligent equipment, all configured formulas are generally calculated according to a unified calculation period, but different formulas have great differences according to formula calculation periods corresponding to actual data requirements. If the unified calculation period is too small, more calculation needs to be performed on each formula, so that the waste of calculation resources is caused, and a large amount of garbage data and excessive occupied service resources are generated. If the unified calculation period is too small, the calculation frequency of some formulas may not reach the standard, so that the error of the final calculation result is large or the actual requirement on the data cannot be met. In addition, the formula calculation in the edge side intelligent device generally only supports simple operations such as addition, subtraction, multiplication and division on data, and the actual demands such as outlier filtering, logical operation, bit operation and the like cannot be realized due to the lack of supporting formulas.
Disclosure of Invention
In view of this, the invention provides a method, a device and a storage medium for realizing formula calculation, so as to solve the problems of waste of calculation resources, substandard calculation frequency, incapability of realizing actual requirements of formula calculation caused by lack of support formulas and the like caused by unreasonable calculation period setting in the formula calculation process in the prior art.
In a first aspect of the embodiment of the present invention, a method for implementing formula calculation is provided, including:
acquiring initial time, wherein the initial time is the time corresponding to the starting of a program;
acquiring calculation periods of all calculation formulas;
grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas;
setting a timing task, and acquiring an execution period of the timing task according to a calculation period, wherein the timing task comprises acquiring real-time;
and determining an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the calculation of the calculation formula or the waiting of the calculation formula for the next timing task.
In some embodiments, the calculation formulas are grouped according to a calculation period of the calculation formulas, specifically including:
judging whether the calculation periods of different calculation formulas are the same or not;
if yes, the calculation formulas corresponding to the same calculation period are divided into a group.
In some embodiments, the acquiring the execution period of the timing task according to the calculation period specifically includes:
acquiring calculation periods of different grouping calculation formulas;
calculating the greatest common divisor of the calculation periods of all grouping calculation formulas;
and determining the greatest common divisor as the execution period of the timing task.
In some embodiments, determining the progress status of the calculation formula according to the real-time and the initial time specifically includes:
calculating the difference between the real-time and the initial time;
respectively calculating remainder after dividing the difference value by different grouping calculation periods;
comparing the remainder of the different grouping calculation periods with the size of the timing operation execution period respectively;
if the remainder is smaller than the timing operation execution period, calculating a calculation formula corresponding to the grouping calculation period;
and if the remainder is greater than the execution period of the timing job, waiting for the next timing task by a calculation formula corresponding to the grouping calculation period.
In some embodiments, before the calculation according to the calculation formula corresponding to the grouping calculation period, the method further includes:
configuring a calculation formula corresponding to the grouping calculation period;
and setting the data required to be acquired in the calculation formula as variables.
In some embodiments, after setting the data to be acquired in the calculation formula as a variable, the method further includes:
acquiring data required by a calculation formula in intelligent equipment to obtain first data;
and uploading the first data to a calculation formula after configuration is completed, and calculating.
In some embodiments, uploading the first data to a calculation formula after the configuration is completed, and calculating the calculation formula specifically includes:
uploading the first data to a calculation formula after configuration is completed;
replacing the variable with first data;
and analyzing the calculation formula into a tree structure and calculating.
In a second aspect of the embodiment of the present invention, there is provided an implementation apparatus for formula calculation, including:
the initial time acquisition module is configured to acquire initial time, wherein the initial time is corresponding to the starting time of the program;
the computing period acquisition module is configured to acquire computing periods of all computing formulas;
the grouping module is configured to group the calculation formulas according to the calculation periods corresponding to the calculation formulas;
a timing task setting module configured to set a timing task, the timing task including acquiring real-time;
the working state determining module is configured to determine an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the calculation formula to calculate or the calculation formula waits for the next timing task.
In a third aspect of the embodiments of the present invention, there is provided a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the implementation method based on formula calculation when executing the computer program.
In a fourth aspect of the embodiments of the present invention, there is provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method for implementing formula-based computation.
The implementation method of formula calculation provided by the embodiment of the invention has the beneficial effects that: the embodiment of the invention provides a method for realizing formula calculation, which comprises the steps of firstly obtaining initial time corresponding to program starting; secondly, acquiring calculation periods of all calculation formulas; grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas; setting a timing task, and acquiring an execution period of the timing task according to the calculation period, wherein the timing task comprises acquiring real-time; and finally, determining an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the calculation of the calculation formula or the waiting of the calculation formula for the next timing task. Aiming at the scene that the calculation formula is continuous calculation, the timing task is set, the execution period of the timing task is calculated according to the calculation period of the calculation formula, and then the real-time corresponding to the execution period is acquired, so that the calculation formula adopts a reasonable calculation period in the calculation process, and the problems of waste of calculation resources, unqualified calculation frequency and the like caused by unreasonable calculation period setting in the calculation process of the formula in the prior art are solved. The invention also adopts a mode of configuring a calculation formula in advance and setting variables, and then analyzes the calculation formula into a tree structure for calculation, thereby solving the problem that the actual requirement of formula calculation caused by the lack of support formulas in the prior art cannot be realized; the invention realizes the calculation of various efficiency and indexes of the equipment, the calculation of binary data such as bit operation, bit value and the like and the calculation of some value-assigned formulas requiring logic judgment through the formulas supported in the invention.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for implementing formula computation provided by an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for obtaining an execution cycle according to an embodiment of the present invention;
FIG. 3 is a flowchart showing the steps for determining a calculation formula according to real-time and initial time according to an embodiment of the present invention;
FIG. 4 is a flowchart of a configuration calculation formula provided in an embodiment of the present invention;
FIG. 5 is a flow chart of an implementation apparatus for formula computation provided by an embodiment of the present invention;
fig. 6 is a schematic diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail. All other embodiments, which are obtained by a person skilled in the art based on the described embodiments of the invention, fall within the scope of protection of the invention. The technical means used in the examples are conventional means well known to those skilled in the art unless otherwise indicated.
In order to illustrate the technical scheme of the invention, the following description is made by specific examples.
First embodiment
FIG. 1 is a flow chart of a method for implementing formula computation provided in one embodiment of the invention.
As shown in fig. 1, the implementation method of the formula calculation includes steps S110 to S150:
s110, acquiring initial time;
s120, acquiring calculation periods of all calculation formulas;
s130, grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas;
s140, setting a timing task and acquiring an execution period of the timing task according to the calculation period;
s150, determining an execution step of a calculation formula according to the real-time and the initial time.
The embodiment of the invention provides a method for realizing formula calculation, which comprises the steps of firstly obtaining initial time corresponding to program starting; secondly, acquiring calculation periods of all calculation formulas; grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas; setting a timing task, and acquiring an execution period of the timing task according to the calculation period, wherein the timing task comprises acquiring real-time; and finally, determining an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the calculation of the calculation formula or the waiting of the calculation formula for the next timing task. Aiming at the scene that the calculation formula is continuous calculation, the timing task is set, the execution period of the timing task is calculated according to the calculation period of the calculation formula, and then the execution period obtains the real-time corresponding to the execution period, so that the calculation formula adopts a reasonable calculation period in the calculation process, and the problems of waste of calculation resources, substandard calculation frequency and the like caused by unreasonable calculation period setting in the calculation process of the formula in the prior art are solved.
Specifically, in step S110, the initial time is the time corresponding to the starting time of the program, that is, the system time corresponding to the starting time of the software for implementing the formula calculation in the present invention, may be directly obtained. In particular, in the present embodiment, the initial time is a time specifically corresponding to seconds, for example, 11:32:21 on 12 months and 30 days in 2020.
Specifically, in step S130, the calculation formulas are grouped according to the calculation period corresponding to the calculation formulas, which specifically includes:
judging whether the calculation periods of different calculation formulas are the same or not;
if yes, the calculation formulas corresponding to the same calculation period are divided into a group.
Specifically, different calculation formulas can correspond to different calculation periods according to actual data requirements, different calculation formulas can also correspond to different calculation periods according to actual data requirements, and the calculation periods can be 1 second, 2 seconds, 3 seconds, 4 seconds, 5 seconds, 100 seconds and the like. The calculation period of different calculation formulas can be obtained according to the actual data requirement. Then judging whether the calculation periods of different calculation formulas are the same or not; if yes, the calculation formulas corresponding to the same calculation period are divided into a group, so that the calculation periods of the calculation formulas in each group are the same.
Specifically, after the calculation formula is grouped, a timing task needs to be set, and the execution period of the timing task is determined according to the grouping condition. In particular, the timing task is to acquire a real-time, which is also a time specifically corresponding to seconds, for example, 11:32:28 on 30 th month of 2020. The timing task is executed once every execution period, that is, the real-time is acquired once every execution period, and the execution period is a fixed time. Referring to fig. 2, fig. 2 is a flowchart illustrating a method for obtaining an execution cycle according to an embodiment of the present invention.
As shown in fig. 2, the execution cycle is obtained, which may specifically include the following steps S210 to S230:
s210, acquiring calculation periods of different grouping calculation formulas;
s220, calculating the greatest common divisor of the calculation periods of all the grouping calculation formulas;
and S230, determining the greatest common divisor as the execution period of the timing task.
Specifically, in step S220, the greatest common divisor of the calculation periods of all the group calculation formulas is calculated, and if an integer is a divisor of several integers at the same time, the integer is called as their common divisor; the greatest of the common divisors is called the greatest common divisor; for any number of positive integers, 1 is the greatest common divisor. For example, if the calculation formulas are divided into 3 groups each having a calculation period of 5 seconds, a calculation period of 10 seconds, and a calculation period of 15 seconds according to the calculation period, the greatest common divisor of the calculation periods of all the group calculation formulas is 5 seconds, and the execution period of the timing task is 5 seconds. For example, if the calculation formulas are divided into 4 groups of 2 seconds, 3 seconds, 4 seconds and 20 seconds according to the calculation period, 1 second is the greatest common divisor of the calculation periods of all the group calculation formulas, and 1 second is the execution period of the timing task.
Specifically, after the execution period of the timing task is obtained, the execution step of the calculation formula may be determined according to the timing task and the execution period thereof. Referring to fig. 3, fig. 3 is a flowchart of a method for determining an execution step of a calculation formula according to a real-time and an initial time, which is provided in an embodiment of the present invention.
As shown in fig. 3, the determining the execution step of the calculation formula according to the real-time and the initial time may specifically include the following steps S310 to S350:
s310, calculating a difference value between the real-time and the initial time;
s320, respectively calculating remainder after dividing the difference value by different grouping calculation periods;
s330, respectively comparing the remainder of different grouping calculation periods with the size of the timing operation execution period;
s340, if the remainder is smaller than the timing operation execution period, calculating a calculation formula corresponding to the grouping calculation period;
s350, if the remainder is greater than the timing job execution period, the calculation formula corresponding to the grouping calculation period waits for the next timing task.
Specifically, in step S310, the difference between the real-time and the initial time is calculated, and if the initial time is 11:32:21 and the real-time is 11:32:26, the difference between the real-time and the initial time is 5 seconds. If the calculation period of one packet is 4 seconds, the remainder of the calculation difference divided by the calculation period of this packet is 1 second. According to the steps S210-S230, the execution period of the timing task can be determined, if the execution period obtained in the steps S210-S230 is 2 seconds, the remainder is 1 second less than the execution period, and the calculation step is executed according to the calculation formula corresponding to the packet corresponding to the remainder 1 second; if the remainder obtained in the other group through steps S310-S320 is 3, the remainder is 2 seconds greater than the execution period, and the calculation formula corresponding to the packet corresponding to the remainder of 3 seconds waits for the next timing task.
Specifically, aiming at a scene that a calculation formula is continuously calculated, a timing task is set, the execution period of the timing task is calculated according to the calculation period of the calculation formula, then the real-time corresponding to the execution period is obtained, and the difference value between the real-time and the initial time is calculated; respectively calculating remainder after dividing the difference value by different grouping calculation periods; comparing the remainder of the different grouping calculation periods with the size of the timing operation execution period respectively; if the remainder is smaller than the timing operation execution period, calculating a calculation formula corresponding to the grouping calculation period; if the remainder is greater than the timing job execution period, waiting for the next timing task by a calculation formula corresponding to the grouping calculation period; therefore, a reasonable calculation period is adopted in the calculation process of the calculation formula, the problems of waste of calculation resources, substandard calculation frequency and the like caused by unreasonable calculation period setting in the calculation process of the formula in the prior art are solved, the calculation efficiency is improved, and the waste of calculation resources is reduced.
Specifically, the calculation formulas corresponding to the grouping calculation periods are calculated, and the configuration of multiple formulas is required to be completed. Referring to fig. 4, fig. 4 is a flowchart illustrating a configuration calculation formula according to an embodiment of the present invention.
As shown in fig. 4, the configuration calculation formula may specifically include the following steps S410 to S420:
s410, configuring a calculation formula corresponding to the grouping calculation period;
s420, setting data to be acquired in a calculation formula as variables.
Specifically, in step S410, a calculation formula corresponding to the grouping calculation period is configured, including an operation symbol and an operation relation of the configuration calculation formula. In step S420, after setting the data required to be acquired in the calculation formula as a variable, the data required by the calculation formula in the intelligent device is also required to be acquired, so as to obtain first data; and uploading the first data to a calculation formula after configuration is completed, and calculating. The data required by the calculation formula in the intelligent equipment is acquired, and the data of the intelligent equipment can be acquired through the sensor.
Specifically, uploading the first data to a calculation formula after configuration is completed, and calculating the calculation formula, specifically including:
uploading the first data to a calculation formula after configuration is completed;
replacing the variable with first data;
and analyzing the calculation formula into a tree structure and calculating.
In the embodiment, the calculation is performed by adopting a mode of configuring a calculation formula in advance and setting variables, and then analyzing the calculation formula into a tree structure, so that the problem that the actual requirement of formula calculation caused by the lack of a support formula in the prior art cannot be realized is solved; the invention realizes the calculation of various efficiency and indexes of the equipment, the calculation of binary data such as bit operation, bit value and the like and the calculation of some value-assigned formulas requiring logic judgment through the formulas supported in the invention.
Second embodiment
Based on the same inventive concept as the method in the first embodiment, correspondingly, the present embodiment further provides a device for implementing formula calculation.
Fig. 5 is a flowchart of an implementation apparatus for formula calculation provided in the present invention.
As shown in fig. 5, the illustrated device 5 comprises: an initial time acquisition module 51, a calculation period acquisition module 52, a grouping module 53, a timing task setting module 54 and an operating state determining module 55.
The initial time acquisition module is configured to acquire initial time, wherein the initial time is corresponding to the starting time of a program;
the computing period acquisition module is configured to acquire computing periods of all computing formulas;
the grouping module is configured to group the calculation formulas according to the calculation periods corresponding to the calculation formulas;
a timing task setting module configured to set a timing task, the timing task including acquiring real-time;
the working state determining module is configured to determine an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the calculation formula to calculate or the calculation formula waits for the next timing task.
In some exemplary embodiments, the grouping module specifically includes:
a judging unit configured to judge whether or not calculation periods of the different calculation formulas are the same;
and the grouping unit is configured to divide the calculation formulas corresponding to the same calculation period into a group if the calculation formulas are yes.
In some exemplary embodiments, the timing task setting module specifically includes:
a calculation period acquisition unit configured to acquire calculation periods of different grouping calculation formulas;
a greatest common divisor calculation unit configured to calculate greatest common divisors of calculation periods of all the group calculation formulas;
and an execution period determining unit configured to determine the greatest common divisor as an execution period of a timing task.
In some exemplary embodiments, the operation state determining module specifically includes:
a difference calculating unit configured to calculate a difference between the real time and the initial time;
a remainder calculation unit configured to calculate remainder of the difference divided by the different grouping calculation periods, respectively;
a comparison unit configured to compare the remainder of the different packet calculation periods with the size of the timing job execution period, respectively;
the first execution unit is configured to calculate a calculation formula corresponding to the grouping calculation period if the remainder is smaller than the timing operation execution period;
the second execution unit is configured to wait for the next timing task according to a calculation formula corresponding to the grouping calculation period if the remainder is greater than the timing job execution period;
a calculation formula configuration unit configured to configure a calculation formula corresponding to the grouping calculation period;
a variable setting unit configured to set data to be acquired in the calculation formula as a variable;
the first data acquisition unit is configured to acquire data required by a calculation formula in the intelligent equipment to obtain first data;
and the first data uploading unit is configured to upload the first data to the configured calculation formula and calculate the calculation formula.
In some exemplary embodiments, the first data uploading unit specifically includes:
the first data uploading subunit is configured to upload the first data to the configured calculation formula;
a replacement subunit configured to replace the variable with first data;
and the calculating subunit is configured to analyze the calculating formula into a tree structure and calculate the calculating formula.
Third embodiment
The method and the device can be applied to terminal equipment such as desktop computers, notebooks, palm computers and cloud servers.
Fig. 6 is a schematic diagram of a terminal device to which the above method and apparatus can be applied, provided in an embodiment of the present invention, where the device 6 includes a memory 61, a processor 60, and a computer program 62 stored in the memory 61 and executable on the processor 60, and the processor 60 implements steps of the implementation method of formula calculation when executing the computer program 62. Such as the functions of modules 51 to 55 shown in fig. 5.
The device 6 may be a computing device such as a cloud server. The terminal device may include, but is not limited to, a processor 60, the memory 61. It will be appreciated by those skilled in the art that fig. 6 is merely an example of the device 6 and does not constitute a limitation of the terminal device 6, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the terminal device may further include an input-output device, a network access device, a bus, etc.
The processor 60 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 61 may be an internal storage unit of the device 6, such as a hard disk or a memory of the device 6. The memory 61 may also be an external storage device of the device 6, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the device 6. Further, the memory 61 may also comprise both an internal storage unit and an external storage device of the device 6. The memory 61 is used for storing the computer program as well as other programs and data required by the terminal device. The memory 61 may also be used for temporarily storing data that has been output or is to be output.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each method embodiment described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
Specifically, as follows, the present embodiment further provides a computer readable storage medium, which may be a computer readable storage medium contained in the memory in the above embodiment; or may be a computer-readable storage medium, alone, that is not incorporated into the terminal device. The computer readable storage medium stores one or more computer programs:
a computer readable storage medium comprising a computer program stored thereon, which when executed by a processor, implements the steps of the method of implementing the formula calculation.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.
Claims (8)
1. A method for implementing formula computation, comprising:
acquiring initial time, wherein the initial time is the time corresponding to the starting of a program;
acquiring calculation periods of all calculation formulas;
grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas;
setting a timing task, and acquiring an execution period of the timing task according to a calculation period, wherein the timing task comprises acquiring real-time;
determining an execution step of a calculation formula according to the real-time and the initial time, wherein the execution step comprises the steps that the calculation formula calculates or the calculation formula waits for a next timing task;
the method for acquiring the execution period of the timing task according to the calculation period specifically comprises the following steps:
acquiring calculation periods of different grouping calculation formulas;
calculating the greatest common divisor of the calculation periods of all grouping calculation formulas;
determining the greatest common divisor as an execution period of a timing task;
the step of determining the execution of the calculation formula according to the real-time and the initial time specifically comprises the following steps:
calculating the difference between the real-time and the initial time;
respectively calculating remainder after dividing the difference value by different grouping calculation periods;
comparing the remainder of the different grouping calculation periods with the size of the timing operation execution period respectively;
if the remainder is smaller than the timing operation execution period, calculating a calculation formula corresponding to the grouping calculation period;
and if the remainder is greater than the execution period of the timing job, waiting for the next timing task by a calculation formula corresponding to the grouping calculation period.
2. The method according to claim 1, wherein the calculation formulas are grouped according to calculation periods of the calculation formulas, specifically comprising:
judging whether the calculation periods of different calculation formulas are the same or not;
if yes, the calculation formulas corresponding to the same calculation period are divided into a group.
3. The method of claim 1, wherein before the calculating according to the calculation formula corresponding to the grouping calculation period, further comprises:
configuring a calculation formula corresponding to the grouping calculation period;
and setting the data required to be acquired in the calculation formula as variables.
4. The method of claim 3, further comprising, after setting the data to be acquired in the calculation formula as a variable:
acquiring data required by a calculation formula in intelligent equipment to obtain first data;
and uploading the first data to a calculation formula after configuration is completed, and calculating.
5. The method according to claim 4, wherein uploading the first data to the configured calculation formula and calculating the calculation formula comprise:
uploading the first data to a calculation formula after configuration is completed;
replacing the variable with first data;
and analyzing the calculation formula into a tree structure and calculating.
6. An apparatus for implementing formula computation, the apparatus comprising:
the initial time acquisition module is configured to acquire initial time, wherein the initial time is corresponding to the starting time of the program;
the computing period acquisition module is configured to acquire computing periods of all computing formulas;
the grouping module is configured to group the calculation formulas according to the calculation periods corresponding to the calculation formulas;
the timing task setting module is configured to set a timing task and acquire an execution period of the timing task according to the calculation period, wherein the timing task comprises acquiring real-time; the method for acquiring the execution period of the timing task according to the calculation period specifically comprises the following steps: acquiring calculation periods of different grouping calculation formulas; calculating the greatest common divisor of the calculation periods of all grouping calculation formulas; determining the greatest common divisor as an execution period of a timing task;
the working state determining module is configured to determine an executing step of a calculation formula according to the real-time and the initial time, wherein the executing step comprises the steps that the calculation formula calculates or the calculation formula waits for a next timing task; the method specifically comprises the following steps: calculating the difference between the real-time and the initial time; respectively calculating remainder after dividing the difference value by different grouping calculation periods; comparing the remainder of the different grouping calculation periods with the size of the timing operation execution period respectively; if the remainder is smaller than the timing operation execution period, calculating a calculation formula corresponding to the grouping calculation period; and if the remainder is greater than the execution period of the timing job, waiting for the next timing task by a calculation formula corresponding to the grouping calculation period.
7. An apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 5 when the computer program is executed.
8. A storage medium storing a computer program which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011629836.XA CN112650971B (en) | 2020-12-31 | 2020-12-31 | Method, device, equipment and storage medium for realizing formula calculation |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011629836.XA CN112650971B (en) | 2020-12-31 | 2020-12-31 | Method, device, equipment and storage medium for realizing formula calculation |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112650971A CN112650971A (en) | 2021-04-13 |
CN112650971B true CN112650971B (en) | 2024-03-05 |
Family
ID=75366815
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011629836.XA Active CN112650971B (en) | 2020-12-31 | 2020-12-31 | Method, device, equipment and storage medium for realizing formula calculation |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112650971B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9407569B1 (en) * | 2010-05-28 | 2016-08-02 | Amazon Technologies, Inc. | Providing notification of computing resource availability for on-demand allocation |
CN109298929A (en) * | 2018-10-12 | 2019-02-01 | 平安科技(深圳)有限公司 | Timing task carrying-out time recommended method, device, equipment and storage medium |
CN110990141A (en) * | 2019-12-12 | 2020-04-10 | 深圳前海环融联易信息科技服务有限公司 | Timed task processing method and device, computing equipment and storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3560146B1 (en) * | 2016-12-26 | 2022-03-02 | Morgan Stanley Services Group Inc. | Predictive asset optimization for computer resources |
US10802880B2 (en) * | 2017-09-19 | 2020-10-13 | Huawei Technologies Co., Ltd. | System and method for distributed resource requirement and allocation |
US11029921B2 (en) * | 2019-02-14 | 2021-06-08 | International Business Machines Corporation | Performing processing using hardware counters in a computer system |
-
2020
- 2020-12-31 CN CN202011629836.XA patent/CN112650971B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9407569B1 (en) * | 2010-05-28 | 2016-08-02 | Amazon Technologies, Inc. | Providing notification of computing resource availability for on-demand allocation |
CN109298929A (en) * | 2018-10-12 | 2019-02-01 | 平安科技(深圳)有限公司 | Timing task carrying-out time recommended method, device, equipment and storage medium |
CN110990141A (en) * | 2019-12-12 | 2020-04-10 | 深圳前海环融联易信息科技服务有限公司 | Timed task processing method and device, computing equipment and storage medium |
Non-Patent Citations (3)
Title |
---|
GPS接收机软件调度方法与性能分析及测试;郭瑶;罗兵;唐康华;何晓峰;罗勇;;全球定位系统(第02期);全文 * |
基于对等模式的虚拟计算环境下的一种任务调度算法;张千;石;梁鸿;关新全;;计算机系统应用(第09期);全文 * |
多元LDPC译码器的设计与实现;黎海涛;杨磊磊;刘飞;袁海英;;高技术通讯(第12期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN112650971A (en) | 2021-04-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111475355B (en) | High-speed link signal integrity evaluation method, system, terminal and storage medium | |
CN112529061B (en) | Photovoltaic power abnormal data identification method and device and terminal equipment | |
CN110598993B (en) | Data processing method and device | |
US20210233027A1 (en) | Method for conducting statistics on insurance type state information of policy, terminal device and storage medium | |
CN108133005B (en) | Environment model simulation method based on memory database, terminal equipment and storage medium | |
CN111694677A (en) | Message queue management method, device, terminal and computer-readable storage medium | |
CN113300883A (en) | Protocol information generation method and device and terminal equipment | |
CN113407254B (en) | Form generation method and device, electronic equipment and storage medium | |
CN110865877A (en) | Task request response method and device | |
CN108595685B (en) | Data processing method and device | |
CN112650971B (en) | Method, device, equipment and storage medium for realizing formula calculation | |
CN112948380A (en) | Data storage method and device based on big data, electronic equipment and storage medium | |
CN113076231A (en) | Server application scene setting method, system, terminal and storage medium | |
CN107748711B (en) | Method for automatically optimizing Storm parallelism, terminal equipment and storage medium | |
CN110837537A (en) | Order data synchronization method and device, computer readable storage medium and server | |
CN111258585A (en) | Attendance calculation method, system and equipment | |
CN115686789A (en) | Discrete event parallel processing method, terminal equipment and storage medium | |
CN115643172A (en) | Abnormity detection method, abnormity detection device, terminal equipment and storage medium | |
CN112148470B (en) | Parameter synchronization method, computer device and readable storage medium | |
CN112531629B (en) | Method and device for automatically setting protection setting value of power distribution network and terminal equipment | |
CN111694628A (en) | Page display method based on application program thread and related equipment | |
CN112835931A (en) | Method and device for determining data acquisition frequency | |
CN110647543A (en) | Data aggregation method, device and storage medium | |
CN110968397B (en) | Analysis method and device for virtual machine capacity management | |
CN109471764B (en) | Method, device, terminal and storage medium for quickly reading system information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |