Calculation method based on time engine in aerospace scene
By using the RESTFUL interface and timer to update the system time and simulation time in real time in aerospace scenarios, the problems of time engine calculation delay and time error in the existing technology are solved, and higher calculation accuracy and stability are achieved.
Patent Information
- Application Number
- CN202411603615.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-02-18
AI Technical Summary
The calculation methods of existing time engines have time delay and time errors, especially when the network bandwidth is limited or the number of accesses is large, which can easily lead to service downtime.
The time engine calculation method based on aerospace scenarios is adopted to update the system time in real time through the RESTFUL interface, and the timer periodically calculates the simulation time, and updates the snapshot message when the state changes to correct the simulation time.
It effectively solves the problem of inaccurate time when network delay and large number of visits, improves the accuracy and stability of calculations, and avoids the risk of service downtime.
Smart Images

Figure CN119475782A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of aerospace simulation and space situation analysis, and in particular to a calculation method based on a time engine in an aerospace scenario. Background Art
[0002] Currently, most of the calculation methods of time engines are backend calculations, which are pushed to the front-end interface for display. During the push process, network problems such as bandwidth cause delays. When the step size is too large, the delay causes a large time error. When the number of visits is too large, the backend calculation volume surges, which can easily lead to service downtime. Summary of the invention
[0003] In order to solve the existing problems, the present invention provides a calculation method based on a time engine in a space scenario, and the specific scheme is as follows: A calculation method based on a time engine in a space scenario includes the following steps: S1, initialize and load the system time, and obtain the current system time currentSysTime through the RESTFUL interface; S2, after obtaining the current system time, starts the timer and updates the system time in real time; S3, call the RESUFUL interface once a minute to obtain the system time for update and correction, and repeat steps S1 to S2; S4, initialize the call to RESUFUL interface to obtain the last snapshot information of the time engine state, update duration timeInterval, simulation time lastSimTime and system time lastSysTime. If the current time engine state is start or reverse, calculate the current simulation time; S5, if the time engine state is start or reverse, the timer is started to calculate the simulation time in real time. The execution time of the timer is equationTime, and the update frequency is frequency. The simulation time calculation method is different according to the state; S6, when changing the time engine state, call the RESTFUL interface to update the snapshot message; S7, when the simulation time is updated several times, the RESTFUL interface is called to update the snapshot message and correct the simulation time.
[0004] Preferably, the step of loading the system time in step S1 is: Get the local time time1 before calling, and get the local time time2 after calling. The time taken after the RESTFUL interface is successfully called is interfaceTime=(time2-time1) / 2. The current step size is stepSize, and the current system time is: currentSysTime= currentSysTime+interfaceTime*stepSize.
[0005] Preferably, the formula for calculating the number of updates between the current system time and the last system time in the snapshot in step S4 is: updateFrequency=(currentSysTime - lastSysTime) / timeInterval; When the current time engine state is starting: currentSimTime = lastSimTime+updateFrequency*stepSize*1000; When the current time engine status is reverse: currentSimTime = lastSimTime-updateFrequency*stepSize*1000; If the current time engine state is other states, just assign the value directly: currentSimTime = lastSimTime.
[0006] Preferably, in step S5, the simulation time is calculated in different ways according to different states, as follows: Start state: currentSimTime=currentSimTime+stepSize*frequency*1000; Reverse state: currentSimTime=currentSimTime-stepSize*frequency*1000.
[0007] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. After the computer program is run, any of the above methods is executed.
[0008] The present invention also discloses a computer system, including a processor and a storage medium, wherein a computer program is stored on the storage medium, and the processor reads and runs the computer program from the storage medium to execute any of the methods described above.
[0009] The beneficial effects of the present invention are: The present invention can effectively solve the problem of inaccurate simulation time caused by various blockages such as network delay. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0011] Figure 1 It is a time flow chart of the system of the present invention; Figure 2 It is a simulation time flow chart of the present invention; Figure 3 This is an interface effect diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0012] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0013] At present, most of the calculation methods of the time engine are back-end calculations. When multiple users obtain simulation time at the same time, the back-end (JAVA) access volume increases and the execution rate is too slow. The simulation time obtained by different users varies greatly, and the difference is even greater when the network conditions are different.
[0014] The calculation method of the time engine in the aerospace scenario can better solve the above problems. It can independently calculate the simulation time. It is a multi-threaded calculation method that does not consider network delay.
[0015] The time engine states include reset, rewind, rewind, pause, start, and fast forward, and you can also decrease and increase the step size.
[0016] Reset; stop the time engine and restore the simulation time to the start time; Fast rewind: reduce one step time; Reverse: Start the simulation engine and reverse the simulation time; Pause: Pause the simulation engine, and the simulation time stops; Start: Start the simulation engine and the simulation time moves forward; Fast forward: add a step time; Step size: the actual change time of 1S time, in seconds (S). The currently implemented step sizes are [0.001, 0.005, 0.01, 0.1, 0.5, 1, 3, 5, 10, 30, 60, 180, 300, 600, 1800, 3600, 7200,.....] and so on; Reduce step size: reduce one step size unit; Increase Step Size: Increase the step size by one unit. Example 1
[0017] like Figure 1 and Figure 2 , the calculation method of the time engine based on the aerospace scenario includes the following steps: S1, initialize and load the system time, and obtain the current system time currentSysTime through the RESTFUL interface.
[0018] Specifically, the steps to load the system time are: Get the local time time1 before calling, and get the local time time2 after calling. The time taken after the RESTFUL interface is successfully called is interfaceTime=(time2-time1) / 2. The current step size is stepSize, and the current system time is: currentSysTime= currentSysTime+interfaceTime*stepSize.
[0019] S2, after obtaining the current system time, starts the timer, once every 100 milliseconds, to update the system time in real time; Considering various issues such as thread blocking, although the timer is executed once every 100 milliseconds, the execution time is not necessarily 100 milliseconds. The timer execution time is obtained by the time difference before and after execution timeDifference. The current system time is: currentSysTime=currentSysTime+timeDifference.
[0020] S3, call the RESUFUL interface once a minute to obtain the system time for update and correction, and repeat steps S1 to S2; S4, initialize the call to RESUFUL interface to obtain the snapshot information of the last time engine state, update duration timeInterval, simulation time lastSimTime and system time lastSysTime. If the current time engine state is start or reverse, calculate the current simulation time.
[0021] The formula for calculating the number of updates between the current system time and the last system time in the snapshot is: updateFrequency=(currentSysTime - lastSysTime) / timeInterval; When the current time engine state is starting: currentSimTime = lastSimTime+updateFrequency*stepSize*1000; When the current time engine status is reverse: currentSimTime = lastSimTime-updateFrequency*stepSize*1000; If the current time engine state is other states, just assign the value directly: currentSimTime = lastSimTime.
[0022] S5, if the time engine state is start or reverse, the timer is started to calculate the simulation time in real time. The execution time of the timer is equationTime, and the update frequency is frequency. The simulation time calculation method is different according to the state.
[0023] The simulation time is calculated differently according to the state, as follows: Start state: currentSimTime=currentSimTime+stepSize*frequency*1000; Reverse state: currentSimTime=currentSimTime-stepSize*frequency*1000.
[0024] S6, when the time engine state is changed, the RESTFUL interface is called to update the snapshot message.
[0025] S7, when the simulation time is updated 6000 times, the RESTFUL interface is called to update the snapshot message and correct the simulation time.
[0026] like Figure 3 , is the interface effect diagram of this embodiment. The icons from left to right represent reset, rewind, reverse, pause, start, fast forward, reduce step size, increase step size, the time shows the current simulation time, and finally shows the current step size.
[0027] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. After the computer program is run, any of the above methods is executed.
[0028] The present invention also discloses a computer system, including a processor and a storage medium, wherein a computer program is stored on the storage medium, and the processor reads and runs the computer program from the storage medium to execute any of the methods described above.
[0029] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or a combination of the two. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. The technician may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as resulting in a departure from the scope of the present invention.
[0030] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein may be implemented or performed with a 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, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in cooperation with a DSP core, or any other such configuration.
[0031] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module may reside in a RAM memory, a flash memory, a ROM memory, an EPROM memory, an EEPROM memory, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read and write information from / to the storage medium. In an alternative, a storage medium may be integrated into a processor. The processor and the storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and the storage medium may reside in a user terminal as discrete components.
[0032] In one or more exemplary embodiments, the functions described may be implemented in hardware, software, firmware, or any combination thereof. If implemented as a computer program product in software, each function may be stored on or transmitted by a computer-readable medium as one or more instructions or codes. Computer-readable media include both computer storage media and communication media, including any medium that facilitates the transfer of a computer program from one place to another. Storage media may be any available medium that can be accessed by a computer. As an example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer. Any connection is also properly referred to as a computer-readable medium. For example, if the software is transmitted from a website, a server, or other remote source using a coaxial cable, a fiber optic cable, a twisted pair, a digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwaves, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwaves are included in the definition of the medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, wherein disk often reproduces data magnetically, while disc reproduces data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0033] The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein, but should be granted the widest scope consistent with the principles and novel features disclosed herein.
[0034] Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A calculation method based on a time engine in a space scenario, characterized in that: The following steps are involved: S1, initialize and load the system time, and obtain the current system time currentSysTime through the RESTFUL interface; S2, after obtaining the current system time, starts the timer and updates the system time in real time; S3, call the RESUFUL interface once a minute to obtain the system time for update and correction, and repeat steps S1 to S2; S4, initialize the call to RESUFUL interface to obtain the last snapshot information of the time engine state, update duration timeInterval, simulation time lastSimTime and system time lastSysTime. If the current time engine state is start or reverse, calculate the current simulation time; S5, if the time engine state is start or reverse, the timer is started to calculate the simulation time in real time. The execution time of the timer is equationTime, and the update frequency is frequency. The simulation time calculation method is different according to the state; S6, when changing the time engine state, call the RESTFUL interface to update the snapshot message; S7, when the simulation time is updated several times, the RESTFUL interface is called to update the snapshot message and correct the simulation time.
2. The method according to claim 1, characterized in that The steps for loading the system time in step S1 are: Get the local time time1 before calling, get the local time time2 after calling, then the time used after the RESTFUL interface call is successful is interfaceTime = (time2-time1) / 2, the current step size is stepSize, then the current system time is currentSysTime= currentSysTime+interfaceTime*stepSize.
3. The method according to claim 1, characterized in that: The formula for calculating the number of updates between the current system time and the last system time in the snapshot in step S4 is: updateFrequency=(currentSysTime - lastSysTime) / timeInterval; When the current time engine state is starting: currentSimTime = lastSimTime+updateFrequency*stepSize*1000; When the current time engine status is reverse: currentSimTime = lastSimTime-updateFrequency*stepSize*1000; If the current time engine state is other states, just assign the value directly: currentSimTime = lastSimTime.
4. The method according to claim 1, characterized in that: In step S5, the simulation time is calculated in different ways according to different states, as follows: Start state: currentSimTime=currentSimTime+stepSize*frequency*1000; Reverse state: currentSimTime=currentSimTime-stepSize*frequency*1000.
5. A computer-readable storage medium, characterized in that: A computer program is stored on the medium, and after the computer program is run, the method according to any one of claims 1 to 4 is executed.
6. A computer system, characterized in that: The method comprises a processor and a storage medium, wherein a computer program is stored in the storage medium, and the processor reads and runs the computer program from the storage medium to execute the method as claimed in any one of claims 1 to 4.