CN112650971A - Method, device and equipment for realizing formula calculation and storage medium - Google Patents
Method, device and equipment for realizing formula calculation and storage medium Download PDFInfo
- Publication number
- CN112650971A CN112650971A CN202011629836.XA CN202011629836A CN112650971A CN 112650971 A CN112650971 A CN 112650971A CN 202011629836 A CN202011629836 A CN 202011629836A CN 112650971 A CN112650971 A CN 112650971A
- Authority
- CN
- China
- Prior art keywords
- calculation
- formula
- period
- timing task
- grouping
- 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.)
- Granted
Links
- 238000004364 calculation method Methods 0.000 title claims abstract description 348
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000004590 computer program Methods 0.000 claims description 23
- 239000002699 waste material Substances 0.000 description 5
- 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
- 230000002159 abnormal effect Effects 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
- 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
Images
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 suitable for 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 corresponding to the time when a program is started; acquiring the 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 real-time acquisition; and determining the execution step of the calculation formula according to the real-time and the initial time. The invention enables the calculation formula to adopt a reasonable calculation period in the calculation process by setting the timing task, and solves the problems of the prior art that the calculation resource is wasted and the calculation frequency does not reach the standard due to unreasonable setting of the calculation period in the formula calculation process.
Description
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a method, a device, equipment and a storage medium for realizing formula calculation.
Background
At present, formula calculation in intelligent equipment generally calculates all configured formulas according to a uniform calculation period, but different formulas have great difference according to formula calculation periods corresponding to actual data requirements. If the unified calculation period is too short, more calculations need to be performed on each formula, which results in the waste of calculation resources, a large amount of garbage data and excessive occupation of service resources. If the unified calculation period is too short, the calculation frequency of some formulas may not meet the standard, so that the error of the final calculation result is large or the actual requirement on data cannot be met. In addition, formula calculation in the edge-side smart device generally only supports operations such as simple addition, subtraction, multiplication, and division on data, and because of the lack of supporting formulas, actual requirements such as abnormal value filtering, logic operation, bit operation, and the like cannot be realized.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, a device, and a storage medium for implementing formula calculation, so as to solve the problems in the prior art, such as the waste of calculation resources, the substandard calculation frequency, and the unreasonable calculation period in the formula calculation process, and the unreasonable actual requirements for formula calculation due to the lack of the supporting formula.
In a first aspect of the embodiments of the present invention, a method for implementing formula calculation is provided, including:
acquiring initial time, wherein the initial time is corresponding to the time when a program is started;
acquiring the 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 real-time acquisition;
and determining an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the steps that the calculation formula carries out calculation or the calculation formula waits for the next timing task.
In some embodiments, grouping the calculation formulas according to calculation periods of the calculation formulas 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.
In some embodiments, acquiring an execution cycle of the timing task according to the calculation cycle specifically includes:
acquiring the calculation periods of different grouping calculation formulas;
calculating the greatest common divisor of the calculation periods of all the grouping calculation formulas;
and determining the greatest common divisor as the execution period of the timing task.
In some embodiments, determining the progress state 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 the remainder after dividing the difference value by different grouping calculation periods;
respectively comparing the remainder of different grouping calculation periods with the size of the timing operation execution period;
if the remainder is less than the execution period of the timing operation, calculating a calculation formula corresponding to the grouping calculation period;
and if the remainder is larger than the execution period of the timing operation, waiting for the next timing task by the calculation formula corresponding to the grouping calculation period.
In some embodiments, before the calculating formula corresponding to the grouping calculation period performs the calculation, the method further includes:
configuring a calculation formula corresponding to the grouping calculation period;
and setting data to be acquired in the calculation formula as variables.
In some embodiments, after the data to be obtained in the calculation formula is set 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 configured calculation formula, and calculating.
In some embodiments, uploading the first data to a calculation formula after configuration is completed, and performing calculation specifically includes:
uploading the first data to a configured calculation formula;
replacing the variable with first data;
and resolving the calculation formula into a tree structure, and calculating.
In a second aspect of the embodiments of the present invention, an apparatus for implementing formula calculation is provided, including:
the initial time acquisition module is configured to acquire initial time, and the initial time is corresponding to the time when the program is started;
a calculation cycle acquisition module configured to acquire calculation cycles of all calculation 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 the timing task comprises acquiring real-time;
and 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 step that the calculation formula carries out calculation or the calculation formula waits for the next timing task.
In a third aspect of the embodiments of the present invention, a terminal device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the implementation method based on formula calculation are implemented.
In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, where a computer program is stored, and the computer program, when executed by a processor, implements the steps of the implementation method based on formula calculation.
The implementation method of formula calculation provided by the embodiment of the invention has the beneficial effects that at least: the embodiment of the invention provides a method for realizing formula calculation, which comprises the steps of firstly, acquiring initial time corresponding to program starting; secondly, obtaining the calculation periods of all calculation formulas; grouping the calculation formulas again according to the calculation periods corresponding to the calculation formulas; then setting a timing task, and acquiring an execution period of the timing task according to a calculation period, wherein the timing task comprises real-time acquisition; 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 step that the calculation formula carries out calculation or the calculation formula waits for the next timing task. Aiming at the scene that the calculation formula is continuously calculated, 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 obtained, 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 setting of the calculation period in the formula calculation process in the prior art are solved. The invention also adopts the mode of configuring the calculation formula in advance and setting the variable, and then analyzes the calculation formula into the tree structure for calculation, thereby solving the problem that the actual requirement of formula calculation caused by the shortage of the support formula in the prior art can not be realized; the formula supported by the invention realizes the calculation of various efficiencies and indexes of the equipment, the calculation of binary data such as bit operation, bit value and the like and the calculation of some logic judgment assignment formulas.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed for the embodiments or the prior art descriptions 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 it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a flow chart of a method for implementing formula calculation provided by an embodiment of the present invention;
FIG. 2 is a flowchart of an implementation of obtaining an execution cycle according to an embodiment of the present invention;
FIG. 3 is a flowchart of an implementation of steps for determining a calculation formula based on 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 flowchart of an apparatus for implementing formula calculation according to 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 particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the 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 can be derived by a person skilled in the art from the described embodiments of the invention, are within the scope of the invention. Unless otherwise specified, the technical means used in the examples are conventional means well known to those skilled in the art.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
First embodiment
FIG. 1 is a flow chart of a method for implementing formula calculation provided in an embodiment of the present invention.
As shown in FIG. 1, the implementation method of the formula calculation includes steps S110-S150:
s110, acquiring initial time;
s120, obtaining the 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 a calculation period;
and S150, determining the execution step of the 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, acquiring initial time corresponding to program starting; secondly, obtaining the calculation periods of all calculation formulas; grouping the calculation formulas again according to the calculation periods corresponding to the calculation formulas; then setting a timing task, and acquiring an execution period of the timing task according to a calculation period, wherein the timing task comprises real-time acquisition; 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 step that the calculation formula carries out calculation or the calculation formula waits for the next timing task. Aiming at the scene that the calculation formula is continuously calculated, 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 setting of the calculation period in the formula calculation process in the prior art are solved.
Specifically, in step S110, the initial time is the time corresponding to the program start, that is, the system time when the software corresponding to the implementation method of formula calculation starts to run in the present invention, and can be directly obtained. In particular, in the present embodiment, the initial time is a time corresponding specifically to seconds, for example, 12/30/11/32/21 in 2020.
Specifically, in step S130, grouping the calculation formulas according to the calculation periods corresponding to the calculation formulas 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 may correspond to different calculation periods according to actual data requirements, and different calculation formulas may also correspond to different calculation periods according to actual data requirements, where the calculation periods may be 1 second, 2 seconds, 3 seconds, 4 seconds, 5 seconds, 100 seconds, and the like. The calculation periods of the different calculation formulas can be obtained according to actual data requirements. Then judging whether the calculation periods of different calculation formulas are the same or not; if so, dividing the calculation formulas corresponding to the same calculation period into a group, so that the calculation periods of the calculation formulas in each group are the same.
Specifically, after the calculation formula grouping is completed, 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 obtain real time, which is also time specifically corresponding to seconds, such as 12 months and 30 days in 2020, 11:32: 28. The timing task is executed once per execution cycle, namely real-time is acquired once per execution cycle, and the execution cycle is fixed time. Referring to fig. 2, fig. 2 is a flowchart of an implementation method for obtaining an execution cycle according to an embodiment of the present invention.
As shown in fig. 2, obtaining the execution cycle may specifically include the following steps S210 to S230:
s210, acquiring calculation cycles 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 grouping calculation formulas is calculated, if an integer is a divisor of several integers at the same time, the integer is called as their common divisor; the largest of the common divisor is called the greatest common divisor; for any number of positive integers, 1 is the greatest common divisor. For example, the calculation formulas are divided into 3 groups of 5 seconds, 10 seconds and 15 seconds according to the calculation period, where 5 seconds is the greatest common divisor of the calculation periods of all the grouped calculation formulas, and 5 seconds is the execution period of the timing task. For example, the calculation formulas are divided into 4 groups of a calculation period of 2 seconds, a calculation period of 3 seconds, a calculation period of 4 seconds and a calculation period of 20 seconds according to the calculation periods, where 1 second is the greatest common divisor of the calculation periods of all the grouped calculation formulas, and then 1 second is the execution period of the timing task.
Specifically, after obtaining the execution period of the timing task, 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 an implementation of determining an execution step of a calculation formula according to real time and initial time according to an embodiment of the present invention.
As shown in fig. 3, the step of determining the execution 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 remainders obtained by dividing the difference values 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 less than the execution period of the timing operation, calculating a calculation formula corresponding to the grouping calculation period;
and S350, if the remainder is larger than the execution period of the timing operation, waiting for the next timing task by the calculation formula corresponding to the grouping calculation period.
Specifically, in step S310, in the step of calculating the difference between the real-time and the initial time, 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 of the difference divided by the calculation period of this packet is 1 second. Determining the execution period of the timing task according to the steps S210-S230, wherein if the execution period obtained through the steps S210-S230 is 2 seconds, the remainder is 1 second and is smaller than the execution period, and the calculation step is executed by the calculation formula corresponding to the packet corresponding to the remainder being 1 second; if the remainder obtained in step S310-S320 is 3, the remainder is 2 seconds longer than the execution period, and the calculation formula corresponding to the packet with 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, an execution period of the timing task is calculated according to the calculation period of the calculation formula, then real-time corresponding to the execution period is obtained, and a difference value between the real-time and initial time is calculated; respectively calculating the remainder after dividing the difference value by different grouping calculation periods; respectively comparing the remainder of different grouping calculation periods with the size of the timing operation execution period; if the remainder is less than the execution period of the timing operation, calculating a calculation formula corresponding to the grouping calculation period; if the remainder is larger than the timing operation execution period, waiting for the next timing task by the calculation formula corresponding to the grouping calculation period; therefore, the reasonable calculation period is adopted in the calculation process of the calculation formula, the problems of the prior art that the calculation resource is wasted and the calculation frequency does not reach the standard due to the unreasonable setting of the calculation period in the formula calculation process are solved, the calculation efficiency is improved, and the waste of the calculation resource is reduced.
Specifically, the calculation formula corresponding to the grouping calculation period is calculated, and the configuration of multiple formulas is also required to be completed. Please refer to fig. 4 for a specific implementation method of the configuration calculation formula, and fig. 4 is a flowchart of implementing the configuration calculation formula provided in an embodiment of the present invention.
As shown in fig. 4, configuring the calculation formula may specifically include the following steps S410 to S420:
s410, configuring a calculation formula corresponding to the grouping calculation period;
and S420, setting data needing to be acquired in the calculation formula as variables.
Specifically, in step S410, the calculation formula corresponding to the grouping calculation period is configured, including the operation sign and the operation relation of the calculation formula. In step S420, after the data required to be obtained in the calculation formula is set as a variable, the data required by the calculation formula in the intelligent device is also required to be obtained, so as to obtain first data; and then uploading the first data to a configured calculation formula, 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 performing calculation, specifically including:
uploading the first data to a configured calculation formula;
replacing the variable with first data;
and resolving the calculation formula into a tree structure, and calculating.
In the embodiment, the calculation formula is configured in advance and the variables are set, and then the calculation formula is analyzed into the tree structure for calculation, so that the problem that the actual requirement of formula calculation cannot be realized due to the lack of the support formula in the prior art is solved; the formula supported by the invention realizes the calculation of various efficiencies and indexes of the equipment, the calculation of binary data such as bit operation, bit value and the like and the calculation of some logic judgment assignment formulas.
Second embodiment
Based on the same inventive concept as the method in the first embodiment, correspondingly, the embodiment also provides a device for realizing formula calculation.
FIG. 5 is a flowchart of an apparatus for implementing formula calculation according to the present invention.
As shown in fig. 5, the illustrated apparatus 5 includes: the system comprises a 51 initial time acquisition module, a 52 calculation period acquisition module, a 53 grouping module, a 54 timing task setting module and a 55 working state determination module.
The initial time acquisition module is configured to acquire initial time, wherein the initial time is corresponding time when a program is started;
a calculation cycle acquisition module configured to acquire calculation cycles of all calculation 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 the timing task comprises acquiring real-time;
and 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 step that the calculation formula carries out calculation 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 calculation cycles of different calculation formulas are the same;
and the grouping unit is configured to group the calculation formulas corresponding to the same calculation period if the calculation formula is the same as the calculation formula.
In some exemplary embodiments, the timed task setting module specifically includes:
a calculation cycle acquisition unit configured to acquire calculation cycles of different grouping calculation formulas;
a greatest common divisor calculation unit configured to calculate greatest common divisors of calculation periods of all the grouping calculation formulas;
an execution period determination unit configured to determine the greatest common divisor as an execution period of a timing task.
In some exemplary embodiments, the working state determining module specifically includes:
a difference calculation unit configured to calculate a difference between the real time and the initial time;
a remainder calculation unit configured to calculate remainders after dividing the difference values by different grouping calculation periods, respectively;
a comparison unit configured to compare the remainders of different packet calculation periods with the sizes of the timing job execution periods, respectively;
the first execution unit is configured to calculate a calculation formula corresponding to the grouping calculation period if the remainder is less than the timing operation execution period;
the second execution unit is configured to wait for the next timing task by the 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;
the variable setting unit is configured to set data needing to be acquired in the calculation formula as variables;
the intelligent device comprises a first data acquisition unit, a second data acquisition unit and a data processing unit, wherein the first data acquisition unit is configured to acquire data required by a calculation formula in the intelligent device to obtain first data;
and the first data uploading unit is configured to upload the first data to the configured calculation formula and perform calculation.
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 calculation subunit is configured to analyze the calculation formula into a tree structure and perform calculation.
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 may be applied according to an embodiment of the present invention, and as shown in the drawing, 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 when the processor 60 executes the computer program 62, the steps of the implementation method such as the formula calculation are implemented. Such as the functions of the 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, the processor 60 and the memory 61. Those skilled in the art will appreciate that fig. 6 is merely an example of a device 6 and does not constitute a limitation of the terminal device 6, and may include more or less components than those shown, or some components in combination, or different components, for example, the terminal device may also include input output devices, network access devices, buses, etc.
The Processor 60 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. 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 memory Card (Flash Card) and the like provided on the device 6. Further, the memory 61 may also comprise both an internal storage unit of the device 6 and an external storage device. The memory 61 is used for storing the computer programs and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store 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 separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
Specifically, the present application further provides a computer-readable storage medium, which may be a computer-readable storage medium contained in the memory in the foregoing embodiments; or it may be a separate computer-readable storage medium 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 implementation method of the formula calculation.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of 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 processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
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 implementation. 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 ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.
Claims (10)
1. A method for realizing formula calculation is characterized by comprising the following steps:
acquiring initial time, wherein the initial time is corresponding to the time when a program is started;
acquiring the 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 real-time acquisition;
and determining an execution step of the calculation formula according to the real-time and the initial time, wherein the execution step comprises the steps that the calculation formula carries out calculation or the calculation formula waits for the next timing task.
2. The method according to claim 1, wherein grouping the calculation formulas according to their calculation periods specifically comprises:
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 according to claim 1, wherein obtaining the execution period of the timing task according to the calculation period specifically includes:
acquiring the calculation periods of different grouping calculation formulas;
calculating the greatest common divisor of the calculation periods of all the grouping calculation formulas;
and determining the greatest common divisor as the execution period of the timing task.
4. The method according to claim 1, wherein determining the progress state of the calculation formula according to the real-time and the initial time specifically comprises:
calculating the difference between the real-time and the initial time;
respectively calculating the remainder after dividing the difference value by different grouping calculation periods;
respectively comparing the remainder of different grouping calculation periods with the size of the timing operation execution period;
if the remainder is less than the execution period of the timing operation, calculating a calculation formula corresponding to the grouping calculation period;
and if the remainder is larger than the execution period of the timing operation, waiting for the next timing task by the calculation formula corresponding to the grouping calculation period.
5. The method according to claim 4, wherein before the calculating formula corresponding to the grouping calculating period performs the calculation, the method further comprises:
configuring a calculation formula corresponding to the grouping calculation period;
and setting data to be acquired in the calculation formula as variables.
6. The method of claim 5, wherein after setting the data to be obtained in the calculation formula as variables, further comprising:
acquiring data required by a calculation formula in intelligent equipment to obtain first data;
and uploading the first data to a configured calculation formula, and calculating.
7. The method according to claim 6, wherein uploading the first data to a configured calculation formula and performing calculation specifically comprises:
uploading the first data to a configured calculation formula;
replacing the variable with first data;
and resolving the calculation formula into a tree structure, and calculating.
8. An apparatus for implementing formula calculation, the apparatus comprising:
the initial time acquisition module is configured to acquire initial time, and the initial time is corresponding to the time when the program is started;
a calculation cycle acquisition module configured to acquire calculation cycles of all calculation 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 the timing task comprises acquiring real-time;
and 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 step that the calculation formula carries out calculation or the calculation formula waits for the next timing task.
9. An apparatus comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A storage medium storing a computer program, characterized in that the computer program realizes the steps of the method according to any one of claims 1 to 7 when executed by a processor.
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 true CN112650971A (en) | 2021-04-13 |
CN112650971B 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 (6)
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 |
US20190087232A1 (en) * | 2017-09-19 | 2019-03-21 | Shane Anthony Bergsma | System and method for distributed resource requirement and allocation |
US20200074323A1 (en) * | 2016-12-26 | 2020-03-05 | Morgan Stanley Services Group Inc. | Predictive asset optimization for computer resources |
CN110990141A (en) * | 2019-12-12 | 2020-04-10 | 深圳前海环融联易信息科技服务有限公司 | Timed task processing method and device, computing equipment and storage medium |
US20200264842A1 (en) * | 2019-02-14 | 2020-08-20 | 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 (6)
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 |
US20200074323A1 (en) * | 2016-12-26 | 2020-03-05 | Morgan Stanley Services Group Inc. | Predictive asset optimization for computer resources |
US20190087232A1 (en) * | 2017-09-19 | 2019-03-21 | Shane Anthony Bergsma | System and method for distributed resource requirement and allocation |
CN109298929A (en) * | 2018-10-12 | 2019-02-01 | 平安科技(深圳)有限公司 | Timing task carrying-out time recommended method, device, equipment and storage medium |
US20200264842A1 (en) * | 2019-02-14 | 2020-08-20 | International Business Machines Corporation | Performing processing using hardware counters in a computer system |
CN110990141A (en) * | 2019-12-12 | 2020-04-10 | 深圳前海环融联易信息科技服务有限公司 | Timed task processing method and device, computing equipment and storage medium |
Non-Patent Citations (3)
Title |
---|
张千;石;梁鸿;关新全;: "基于对等模式的虚拟计算环境下的一种任务调度算法", 计算机系统应用, no. 09 * |
郭瑶;罗兵;唐康华;何晓峰;罗勇;: "GPS接收机软件调度方法与性能分析及测试", 全球定位系统, no. 02 * |
黎海涛;杨磊磊;刘飞;袁海英;: "多元LDPC译码器的设计与实现", 高技术通讯, no. 12 * |
Also Published As
Publication number | Publication date |
---|---|
CN112650971B (en) | 2024-03-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111638690B (en) | Data acquisition method, device, system and equipment based on general information model | |
CN108334408B (en) | Code execution method and device, terminal equipment and computer readable storage medium | |
CN111858055B (en) | Task processing method, server and storage medium | |
CN107438832B (en) | Data refreshing method and device and computer readable storage medium | |
CN113300883B (en) | Protocol information generation method, device and terminal equipment | |
CN109241099A (en) | A kind of data query method and terminal device | |
CN111104178A (en) | Dynamic library loading method, terminal device and storage medium | |
CN111966712A (en) | Data processing method, device, server and storage medium | |
CN110598993A (en) | Data processing method and device | |
CN116894413B (en) | Logic mapping method, device, equipment and storage medium based on hardware | |
CN108463813B (en) | Method and device for processing data | |
CN107748711B (en) | Method for automatically optimizing Storm parallelism, terminal equipment and storage medium | |
CN112650971A (en) | Method, device and equipment for realizing formula calculation and storage medium | |
CN115373826B (en) | Task scheduling method and device based on cloud computing | |
CN111162792A (en) | Compression method and device for power load data | |
CN104901651A (en) | Realizing circuit and method of digital filter | |
CN110865877B (en) | Task request response method and device | |
CN112148470B (en) | Parameter synchronization method, computer device and readable storage medium | |
CN110264383B (en) | Electronic contract filing method and device, readable storage medium and server | |
CN111862894A (en) | Backlight brightness adjusting method, device, terminal and readable storage medium | |
CN112531629B (en) | Method and device for automatically setting protection setting value of power distribution network and terminal equipment | |
CN112835931A (en) | Method and device for determining data acquisition frequency | |
CN110968397B (en) | Analysis method and device for virtual machine capacity management | |
CN109344369B (en) | Certificate making method based on original value verification and terminal equipment | |
CN111061562B (en) | Software collaborative packaging method, system, terminal and storage medium |
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 |