A train operation simulation method, device, equipment and storage medium
By generating spline models of virtual tracks and calculating train speed, the problem of train simulation stuttering caused by network latency was solved, achieving a smooth train operation simulation effect.
Patent Information
- Application Number
- CN202111500400.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-09
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-12-09
AI Technical Summary
In existing technologies, network latency causes severe lag during train simulation, affecting the simulation results.
By generating a spline model of a preset virtual track, the train displacement data within a preset delay time threshold is obtained using a predefined movement function, the train speed is calculated, and the virtual train is controlled to simulate operation on the virtual track based on the speed, ignoring network latency to achieve smooth simulation.
It achieves smoothness in the train operation simulation process, avoids simulation interruptions, closely approximates the effect of real train operation, and reduces simulation power consumption.
Smart Images

Figure CN114239257B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of train simulation, in particular to a train operation simulation method, device, equipment and storage medium. BACKGROUND
[0002] With the continuous development of the rail transportation industry, the types of trains are increasing, and the requirements for train simulation programs are also increasing. In the existing technology, the train position is sent by the server to perform train simulation.
[0003] Due to the instability of the network environment and the instability of the frame rate of the computer environment, if the network data sent by the server is directly used in the process of train operation, due to network delay, the train cannot always run smoothly, and there is a very serious stuttering phenomenon, which seriously affects the visual effect of simulation.
[0004] Therefore, there is an urgent need for a simulation method that can overcome the stuttering phenomenon and make the train run smoothly. SUMMARY
[0005] The present application relates to the field of train simulation, in particular to a train operation simulation method, device, equipment and storage medium.
[0006] To achieve the above-mentioned purpose, the technical solutions adopted by the embodiments of the present application are as follows:
[0007] In a first aspect, the embodiments of the present application provide a train operation simulation method, comprising:
[0008] generating a spline line model of a preset virtual track according to train operation data sent by a server;
[0009] obtaining train displacement data within a preset delay time threshold from the spline line model by using a moving function predefined in the spline line model;
[0010] calculating a train moving speed according to the train displacement data and the preset delay time threshold;
[0011] controlling a virtual train to simulate running on the virtual track according to the train moving speed.
[0012] Optionally, the generating a spline line model of a preset virtual track according to train operation data sent by a server comprises:
[0013] storing the train operation data into a continuous data set;
[0014] generating the spline line model according to the continuous data set.
[0015] Optionally, before the calculating the train moving speed according to the train displacement data and the preset delay time threshold, the method further comprises:
[0016] calculating a train cumulative running distance according to the train displacement data;
[0017] judging whether the train cumulative running distance is greater than or equal to a preset distance threshold;
[0018] the calculating the train moving speed according to the train displacement data and the preset delay time threshold comprises:
[0019] if less than the distance threshold, then controlling the virtual train to simulate running on the virtual track according to the train moving speed.
[0020] Optionally, the method further comprises:
[0021] if greater than or equal to the distance threshold, then deleting the train running data used to generate the spline model, and updating the spline model according to the re-received train running data.
[0022] Optionally, the calculating the train moving speed according to the train displacement data and the preset delay time threshold comprises:
[0023] calculating a train acceleration according to the train displacement data, the preset delay time threshold and a preset initial speed;
[0024] calculating the train moving speed according to the train acceleration and the preset delay time threshold.
[0025] Optionally, the continuous data set comprises a coordinate position data set; and the controlling the virtual train to simulate running on the virtual track according to the train moving speed comprises:
[0026] calling a predefined coordinate acquisition function in the spline model to obtain a coordinate position of the virtual train from the coordinate position data set according to the train moving speed;
[0027] controlling the virtual train to simulate running on the virtual track according to the coordinate position.
[0028] Optionally, the continuous data set further comprises a rotation data set; and the controlling the virtual train to simulate running on the virtual track according to the coordinate position comprises:
[0029] calling a predefined rotation acquisition function in the spline model to determine a rotation data index of the coordinate position in the rotation data set according to the coordinate position;
[0030] According to the rotation data index, two rotation data before and after the rotation data index in the rotation data group are interpolated to obtain target rotation data;
[0031] According to the coordinate position, the virtual train is controlled to simulate running on the virtual track with the target rotation data.
[0032] In a second aspect, an embodiment of the present application provides a train running simulation device, comprising:
[0033] A generation module is configured to generate a spline line model of a preset virtual track according to train running data sent by a server;
[0034] An acquisition module is configured to acquire train displacement data within a preset delay time threshold from the spline line model by using a moving function predefined in the spline line model;
[0035] A calculation module is configured to calculate a train moving speed according to the train displacement data and the preset delay time threshold;
[0036] A control module is configured to control a virtual train to simulate running on the virtual track according to the train moving speed.
[0037] In a third aspect, an embodiment of the present application provides a simulation device, comprising a processor and a storage medium, the processor and the storage medium are communicatively connected through a bus, the storage medium stores program instructions executable by the processor, and the processor invokes the program stored in the storage medium to execute steps of the train running simulation method according to any one of the first aspect.
[0038] In a fourth aspect, an embodiment of the present application provides a storage medium, the storage medium stores a computer program, and the computer program performs steps of the train running simulation method according to any one of the first aspect when the computer program is run by a processor.
[0039] Compared with the prior art, the present application has the following beneficial effects:
[0040] The application provides a train operation simulation method, device, equipment and storage medium. The method generates a spline line model of a preset virtual track according to train operation data sent by a server; acquires train displacement data within a preset delay time threshold from the spline line model by using a moving function predefined in the spline line model; calculates a train moving speed according to the train displacement data and the preset delay time threshold; and controls a virtual train to simulate operation on the virtual track according to the train moving speed. Thus, by setting the preset delay time threshold and ignoring network delay within the preset delay time threshold, continuous data is used for simulation when the train operation simulation is performed, the simulation discontinuity is avoided, the train virtual track data is updated according to each train operation data, and the simulation operation is performed according to the train moving speed, so that the train operation process is smoother and non-stuck, and the operation effect of a real train is approached. BRIEF DESCRIPTION OF DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the application, and therefore should not be regarded as a limitation to the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0042] Figure 1 A flowchart of a train operation simulation method provided by the embodiment of the application;
[0043] Figure 2 A flowchart of a method for generating a spline line model provided by the embodiment of the application;
[0044] Figure 3 A flowchart of a method for updating a spline line model provided by the embodiment of the application;
[0045] Figure 4 A flowchart of a method for calculating a train moving speed provided by the embodiment of the application;
[0046] Figure 5 A flowchart of a method for controlling train operation simulation based on a coordinate position data set provided by the embodiment of the application;
[0047] Figure 6 A flowchart of a method for controlling train operation simulation based on a rotation data set provided by the embodiment of the application;
[0048] Figure 7 A schematic diagram of a train operation simulation device provided by the embodiment of the application;
[0049] Figure 8A schematic diagram of a simulation device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0050] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some but not all of the embodiments of the present application. The components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0051] Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. All other embodiments obtained by a person of ordinary skill in the art without creative work based on the embodiments in the present application are within the scope of protection of the present application.
[0052] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0053] In addition, if the terms "first", "second" and the like are used, they are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.
[0054] It should be noted that, in the case of no conflict, the features in the embodiments of the present application can be combined with each other.
[0055] In order to make the train operation simulation effect more smooth and realistic, the present application provides a train operation simulation method, device, equipment and storage medium, which overcomes the influence of network delay on train operation simulation, so that the train operation simulation is not stuck and more smooth.
[0056] The train operation simulation method provided by the embodiments of the present application will be explained and described below through specific examples. Figure 1 A flowchart of a train operation simulation method provided by an embodiment of the present application is shown, the execution subject of the method can be a simulation device, which can be a device with a computing processing simulation function, such as a desktop computer, a notebook computer, etc. As shown in the figure, the method includes: Figure 1
[0057] S101, generating a spline line model of a preset virtual track according to train operation data sent by a server.
[0058] In the train operation simulation, the server sends train operation data required for the train operation simulation to the simulation device through the network. The train operation data is network data received by the simulation device. The simulation device determines the position coordinates of the preset virtual track of the train operation simulation according to the train operation data sent by the server, and generates a spline line model of the preset virtual track by using a three-dimensional space spline line in the simulation platform. The position coordinates of the preset virtual track are the position coordinates of the middle of the two rails of the pre-simulation track in reality, so as to simulate the track shape of the real track.
[0059] For example, the simulation platform can be ue4 (Unreal Engine 4, Unreal Engine 4), and the three-dimensional space spline line can be Spline Curves (Spline Curves) in ue4.
[0060] Optionally, in addition to using the three-dimensional space spline line to represent the preset virtual track, a continuous interpolation uniform point set can also be used to represent the preset virtual track.
[0061] S102, using a predefined movement function in the spline line model, obtaining train displacement data within the preset delay time threshold from the spline line model.
[0062] During the train operation simulation, due to the instability of the network environment, when the server sends the train operation data to the simulation device, network delays between the train operation data will occur, that is, the sent train operation data is discontinuous.
[0063] Therefore, after the train operation simulation starts, real-time simulation is performed by setting a preset delay time threshold, and after receiving the train operation data, the preset delay time threshold is used as the simulation time unit to perform train operation simulation within the preset delay time threshold. According to the train operation data within the preset delay time threshold, the corresponding train displacement data is determined, and the train operation simulation within the preset delay time threshold is directly performed, and the interval time between the received data within the preset delay time threshold is ignored, so that the train operation simulation is smoother, and sudden acceleration and deceleration do not occur. Since the interval time between the discontinuous data within the preset delay time threshold is much smaller than the preset delay time threshold, and the time interval is very small relative to the train operation speed, the influence on the train operation is negligible.
[0064] And due to the discontinuity of train operation data caused by network delay, the train operation data within the preset delay time threshold range is definitely less than the train operation data corresponding to the same time during the actual train operation, that is, the train operation displacement within the preset delay time threshold range is definitely less than the train operation displacement corresponding to the same time during the actual train operation. The displacement difference caused by the interval time between the discontinuous data is much smaller than the train operation displacement. Although the displacement difference will cause the final simulation result of the simulated train to be delayed compared with the real train operation, ignoring the interval time between the discontinuous data can make the train simulation operation smoother and more realistic.
[0065] The preset delay time threshold can be set as multiple times of the network receiving interval time, and the specific multiple can be set by the user. The larger the multiple, the better the continuity of the received train operation data. Since the network receiving interval time is not fixed, a fixed delay time threshold can also be used. The specific delay time threshold can be set by the user, for example, 1 second, so as to overcome more network receiving intervals within the delay time threshold. In the following embodiments, a fixed delay time threshold will be used as an example for explanation and description.
[0066] S103, calculating the train moving speed according to the train displacement data and the preset delay time threshold.
[0067] According to the train displacement data within the preset delay time threshold and the preset delay time threshold, the train moving speed within the preset delay time threshold is calculated, that is, the train moving speed within one simulation unit time. It is worth noting that the train moving speed is the real-time speed of the train movement, and is not a fixed speed value. By setting the delay time, the simulation device has enough train operation data for simulation calculation, and the calculated train moving speed is more uniform, and the train moving speed will not suddenly change.
[0068] S104, controlling the virtual train to simulate running on the virtual track according to the train moving speed.
[0069] According to the train moving speed within one simulation unit time, the virtual train is controlled to simulate running on the virtual track, so as to obtain the train simulation running effect within one simulation unit time. Since the train moving speed is the real-time speed of the train movement, the train simulation effect will be smoother and closer to the real train running effect. The virtual train is the center position point of a car of the real train, and the final train running simulation effect is that a point (virtual train) moves on a line (virtual track). A train has multiple cars, that is, multiple points move on a line, and the ratio of the interval between the multiple points to the distance between the center position points of the multiple cars is equal to the scale between the train running simulation environment and the real train running environment.
[0070] Optionally, the train in the train operation simulation method described above can be multiple trains. When the train is multiple trains, a MAP table is set, and information of each train and a simulation calculation method corresponding to each train are added in the MAP table, the information of the train is a key in the MAP table, and the simulation calculation method is a value in the MAP table. In the MAP table, the corresponding simulation calculation method can be queried through the information of the train. When multiple trains are simulated simultaneously, train operation data of the multiple trains is acquired simultaneously, and information of the trains is acquired according to the train operation data, and then the simulation calculation method corresponding to each train is acquired. The train moving speed of each train is calculated according to the train operation data of each train, and finally the multiple trains are controlled to be simulated and operated simultaneously. The simulation calculation of the multiple trains can be uniformly managed, and the multiple trains are directly driven to move in a data-driven manner, that is, the multiple trains are synchronously operated on multiple virtual tracks.
[0071] To sum up, the train operation simulation method provided by the embodiment of the application generates a spline line model of a preset virtual track according to train operation data sent by a server; acquires train displacement data within a preset delay time threshold from the spline line model by using a moving function defined in the spline line model in advance; calculates a train moving speed according to the train displacement data and the preset delay time threshold; and controls a virtual train to be simulated and operated on a virtual track according to the train moving speed. Thus, by setting a preset delay time threshold and ignoring network delay within the preset delay time threshold, continuous data is used for simulation when the train operation is simulated, the simulation is avoided to be interrupted, the virtual track data of the train is updated according to each time of train operation data, and the train is simulated and operated according to the train moving speed, so that the train operation process is smoother and does not jam, and the operation effect of the train is close to that of a real train.
[0072] In the above Figure 1 On the basis of the train operation simulation method described above, the embodiment of the application further provides a method for generating a spline line model. Figure 2 As shown in FIG. 1, the method for generating a spline line model provided by the embodiment of the application includes the following steps. Figure 2 As shown in FIG. 1, the method for generating a spline line model provided by the embodiment of the application includes the following steps.
[0073] S201, store the train operation data into a continuous data set.
[0074] In the process of train operation simulation, the received train operation data is in units of frames, and therefore, after obtaining the train operation data, the train operation data of each frame is stored to form a continuous data group of multiple frames. When storing the data, the train operation data within a preset time can be stored first, and with the progress of the train operation simulation, the train operation data within the next preset time is continuously and dynamically stored. The preset time can be a preset delay time threshold, or a multiple of the preset delay time threshold, and can be set by the user, and is not limited herein. The number of frames within the preset time can be a preset number of frames, which can be set by the user according to the preset time. It is worth noting that the greater the number of frames within the preset time, the more realistic the subsequent train operation simulation.
[0075] S202, generating a spline line model according to the continuous data group.
[0076] According to the multiple frames of continuous data in the continuous data group within the preset time, a preset virtual track within the preset time can be determined, and with the progress of the train operation simulation, the preset virtual track is dynamically and continuously formed in front of the train, which not only simulates the effect of the train running on the virtual track, but also maintains the continuity of the virtual track. According to the multiple frames of continuous data in the continuous data group within the preset time, a corresponding spline line model can be generated for further simulation calculation.
[0077] In summary, the method for generating a spline line model provided by the application embodiment stores the train operation data into a continuous data group, and generates a spline line model according to the continuous data group. Thus, before the train operation, the spline line model of the preset virtual track can be accurately determined according to the train operation data, and the subsequent simulation calculation is more convenient.
[0078] Based on the above Figure 1 Based on the train operation simulation method described above, the application embodiment further provides a method for updating a spline line model. Figure 3 The flowchart of the method for updating a spline line model provided by the application embodiment is shown in Figure 3 Before S103, calculating the train moving speed according to the train displacement data and the preset delay time threshold, the method further includes:
[0079] S301, calculating the train cumulative running distance according to the train displacement data.
[0080] For example, after completing a round of train operation simulation within a preset delay time threshold, the train displacement data within the round of preset delay time threshold is added to the train displacement data within the previous multiple rounds of preset delay time threshold, and the train cumulative running distance is calculated. In turn, after completing a round of train operation simulation within a preset delay time threshold, the train cumulative running distance corresponding to the completion time of the simulation is calculated.
[0081] S302, judge whether the train cumulative running distance is greater than or equal to the preset distance threshold.
[0082] The size relationship between the train cumulative running distance and the preset distance threshold is compared. The preset distance threshold is set by the user and is not limited here.
[0083] In S103, the train moving speed is calculated according to the train displacement data and the preset delay time threshold. The method comprises:
[0084] S303, if less than the distance threshold, control the virtual train to simulate running on the virtual track according to the train moving speed.
[0085] If the train cumulative running distance is less than the distance threshold, continue to control the virtual train to simulate running on the virtual track according to the train moving speed. The train running data is not processed, that is, the virtual track that the train has run through is retained, which is more close to the effect of the real train running on the track.
[0086] S304, if greater than or equal to the distance threshold, delete the train running data for generating the spline line model, and update the spline line model according to the newly received train running data.
[0087] In the process of train running simulation, the virtual track that the train has run through has no other effect except as the starting point of the virtual track generated by the newly received train running data, and with the running of the train, the virtual track that has been run through will be longer and longer, which cannot be displayed on the entire simulation display interface, and will increase the simulation power consumption. Therefore, the segment of the virtual track closest to the train among the virtual tracks that have been run through can be retained, and the remaining virtual tracks that have been run through are deleted, that is, the train running data that has been run through is deleted.
[0088] If the train cumulative running distance is greater than or equal to the distance threshold, delete the train running data that has been run through, that is, delete the virtual track that has been run through. And according to the newly received train running data, regenerate the spline line model. At the same time, continue to control the virtual train to simulate running on the virtual track according to the train moving speed.
[0089] In summary, the method for updating the spline line model provided in the embodiments of the present application calculates the cumulative running distance of the train according to the train displacement data, and determines whether the cumulative running distance of the train is greater than or equal to a preset distance threshold. If the cumulative running distance of the train is less than the distance threshold, the virtual train is controlled to simulate running on the virtual track according to the train moving speed. If the cumulative running distance of the train is greater than or equal to the distance threshold, the train running data used to generate the spline line model is deleted, and the spline line model is updated according to the re-received train running data. Thus, by setting the distance threshold, the train running data of the train that has run is deleted, the redundant data is reduced, and the spline line model is updated, thereby reducing the simulation power consumption on the basis of retaining the simulation effect of the train on the virtual track.
[0090] In the above Figure 3 Based on the method for updating the spline line model, the embodiments of the present application further provide a method for calculating the train moving speed. Figure 4 The flowchart of the method for calculating the train moving speed provided in the embodiments of the present application is shown in FIG. 4, which comprises the following steps. Figure 4 The method for calculating the train moving speed according to the train displacement data and the preset delay time threshold comprises the following steps.
[0091] S401, calculating the train acceleration according to the train displacement data, the preset delay time threshold, and the preset initial speed.
[0092] In the process of train running simulation, in order to make the train run more smoothly, the train moving speed needs to be calculated. The train moving speed is the real-time speed of the train, and the real-time speed is variable. Therefore, before calculating the train moving speed, the train acceleration is calculated first, and then the train moving speed is calculated according to the train acceleration, so that the train moving speed is more in line with the physical law, and the train simulation running is more smooth.
[0093] As known from the above embodiments, the preset delay time threshold and the train displacement data within the preset delay time threshold are known quantities, and the preset initial speed is 0 when the train starts simulation, and is the final speed of the last preset delay time threshold in the process of train running simulation. Therefore, the preset initial speed is also a known quantity.
[0094] Suppose that the preset delay time threshold is t, the train displacement data within the preset delay time threshold is x, the preset initial speed is v0, and the train acceleration is a. The train acceleration can be calculated by the following formula (1):
[0095]
[0096] In the embodiment of the present application, because the preset delay time threshold is small (for example, 1 second), within the preset delay time threshold, the motion of the train operation is regarded as uniform acceleration motion, uniform deceleration motion, uniform speed motion, and other motion modes (for example, uniform acceleration motion followed by uniform deceleration motion, etc.) are not considered. Therefore, after obtaining a constant train acceleration within the preset delay time threshold, the change of the speed can be shown, in which the acceleration of the uniform acceleration motion is positive, the acceleration of the uniform deceleration motion is negative, and the acceleration of the uniform speed motion is 0.
[0097] S402, calculate the train moving speed according to the train acceleration and the preset delay time threshold.
[0098] As can be seen from the above embodiment, within the preset delay time threshold, the train operation data is divided into multiple frames of train operation data, and it can be known that the train operation time of each frame is equal.
[0099] Within the preset delay time threshold, according to the frame in which the train operation position is located, the time that the train has run within the preset delay time threshold, that is, the sum of the multiple frame times, can be determined. Then, according to the preset initial speed, the train acceleration and the time that the train has run within the preset delay time threshold, the moving speed of the train in the frame can be calculated, and then the real-time speed of the train in each frame can be obtained.
[0100] In summary, the method for calculating the train moving speed provided in the embodiment of the present application calculates the train acceleration according to the train displacement data, the preset delay time threshold and the preset initial speed, and then calculates the train moving speed according to the train acceleration and the preset delay time threshold. Thus, the real-time moving speed of the train within the preset delay time threshold is obtained by calculating the train acceleration, and the running simulation effect of the train is smoother.
[0101] In the above Figure 2 On the basis of the method for generating the spline line model, the embodiment of the present application further provides a method for controlling train running simulation based on a coordinate position data group. Figure 5 As shown in the flowchart of the method for controlling train running simulation based on a coordinate position data group provided in the embodiment of the present application, Figure 5 According to the train moving speed, the coordinate position of the virtual train is obtained from the coordinate position data group by calling the coordinate acquisition function predefined in the spline line model.
[0102] S501, according to the train moving speed, calling a coordinate acquisition function predefined in the spline line model to obtain the coordinate position of the virtual train from the coordinate position data group.
[0103] The continuous data set within the preset delay time threshold comprises a coordinate position data set, wherein the coordinate position data is a coordinate position of the train at the beginning and end of each frame, and a virtual track in which the train will run within the preset delay time threshold can be obtained according to all the coordinate positions within the preset delay time threshold.
[0104] According to the real-time moving speed of the train and the time in which the train has run within the preset delay time threshold, the displacement in which the train has run within the preset delay time threshold is calculated, and the virtual train real-time coordinate position is obtained by sampling on the virtual track within the preset delay time threshold based on the first coordinate point within the preset delay time threshold and the displacement in which the train has run within the preset delay time threshold.
[0105] S502, according to the coordinate position, controlling the virtual train to simulate running on the virtual track.
[0106] According to the virtual train real-time coordinate position, the virtual train is controlled to move to the coordinate position, and sequentially move, so as to realize the simulation running of the virtual train on the virtual track. Since the distance of each movement is the running distance of the train in one frame, and the time and distance of each frame are very small, the smoothness of the simulation running of the virtual train on the virtual track is ensured.
[0107] In summary, the method for controlling train running simulation based on the coordinate position data set provided by the embodiments of the present application acquires the coordinate position of the virtual train from the coordinate position data set by calling the coordinate acquisition function defined in advance in the spline model according to the moving speed of the train, and then controls the virtual train to simulate running on the virtual track according to the coordinate position. By controlling the virtual train to move between each coordinate position, the smoothness of the train running simulation is increased while the simulation effect is ensured, and the train running simulation is closer to the real scene.
[0108] In the above Figure 5 Based on the method for controlling train running simulation based on the coordinate position data set, the embodiments of the present application further provide a method for controlling train running simulation based on a rotation data set. Figure 6 As shown in FIG. 6, the method for controlling train running simulation based on the rotation data set provided by the embodiments of the present application comprises the following steps. Figure 6 As shown in FIG. 6, the method for controlling train running simulation based on the rotation data set provided by the embodiments of the present application comprises the following steps.
[0109] S601, according to the coordinate position, calling the rotation acquisition function defined in advance in the spline model to determine the rotation data index of the coordinate position in the rotation data set.
[0110] The continuous data set within the preset delay time threshold further includes a rotation data set, wherein the rotation data set includes rotation point coordinate positions within the preset delay time threshold, and the train completes a rotation action between the rotation points.
[0111] A rotation acquisition function predefined in the spline model is called to compare the current coordinate position with the front and back relationships of all rotation point coordinate positions to determine a rotation data index of the coordinate position in the rotation point coordinate positions. That is, the current coordinate position is located between which two rotation point coordinate positions.
[0112] S602, according to the rotation data index, two rotation data before and after the rotation data index in the rotation data set are interpolated to obtain target rotation data.
[0113] According to the rotation data index, the position of the current coordinate position in the rotation point coordinate positions is determined, and the current coordinate position and the previous rotation point coordinate position and the next rotation point coordinate position are respectively interpolated to obtain a target rotation angle of the current coordinate position according to the interpolation result.
[0114] For example, the coordinate position information is a floating point type data, for example: the coordinate position information is 2.2, and according to the coordinate position information, the position of the current coordinate position in the rotation point coordinate positions is determined to be between the third rotation point coordinate position and the fourth rotation point coordinate position, then the third rotation point coordinate position and the fourth rotation point coordinate position are interpolated to obtain a relatively accurate target rotation angle.
[0115] S603, according to the coordinate position, the virtual train is controlled to run on the virtual track with the target rotation data.
[0116] At the current coordinate position, the virtual train is controlled to run on the virtual track with the target rotation angle. If the target rotation angle is 0, the virtual train is controlled to run straight on the virtual track at the train moving speed, and if the target rotation angle is not 0, the virtual train is controlled to rotate on the virtual track at the train moving speed combined with the target rotation angle.
[0117] In summary, the method for controlling train running simulation based on the rotation data set provided by the embodiment of the application determines the rotation data index of the coordinate position in the rotation data set by calling a rotation acquisition function predefined in the spline model according to the coordinate position, interpolates two rotation data before and after the rotation data index in the rotation data set according to the rotation data index to obtain target rotation data, and then controls the virtual train to run on the virtual track with the target rotation data according to the coordinate position. Thus, the rotation information of the train is obtained through interpolation, the train is smoothly run at the rotation position on the virtual track, and the simulation effect is more realistic.
[0118] The train operation simulation device, the equipment and the storage medium provided by the present application are described below. The specific implementation process and technical effects are described above, and will not be described again below.
[0119] Figure 7 A schematic diagram of a train operation simulation device provided by an embodiment of the present application is shown in Figure 7 The transmission device 700 can include:
[0120] The generation module 701 is configured to generate a spline line model of a preset virtual track according to train operation data sent by a server.
[0121] The acquisition module 702 is configured to acquire train displacement data within a preset delay time threshold from the spline line model by using a movement function predefined in the spline line model.
[0122] The calculation module 703 is configured to calculate a train movement speed according to the train displacement data and the preset delay time threshold.
[0123] The control module 704 is configured to control a virtual train to simulate operation on the virtual track according to the train movement speed.
[0124] Further, the generation module 701 is specifically configured to store the train operation data into a continuous data set, and generate the spline line model according to the continuous data set.
[0125] Further, the calculation module 703 is specifically configured to calculate the train movement speed according to the train displacement data and the preset delay time threshold, calculate a cumulative running distance of the train according to the train displacement data, determine whether the cumulative running distance of the train is greater than or equal to a preset distance threshold, control the virtual train to simulate operation on the virtual track according to the train movement speed if the cumulative running distance of the train is less than the distance threshold, and delete the train operation data used to generate the spline line model and update the spline line model according to newly received train operation data if the cumulative running distance of the train is greater than or equal to the distance threshold.
[0126] Further, the calculation module 703 is specifically configured to calculate a train acceleration according to the train displacement data, the preset delay time threshold and a preset initial speed, and calculate the train movement speed according to the train acceleration and the preset delay time threshold.
[0127] Further, the generation module 701 is specifically configured to call a coordinate acquisition function predefined in the spline line model to acquire a coordinate position of the virtual train from a coordinate position data set according to the train movement speed, and control the virtual train to simulate operation on the virtual track according to the coordinate position.
[0128] Further, the generating module 701 is specifically configured to: call a pre-defined rotation acquisition function in the spline line model according to the coordinate position, to determine a rotation data index of the coordinate position in a rotation data group; perform interpolation processing on two rotation data before and after the rotation data index in the rotation data group according to the rotation data index, to obtain target rotation data; and control the virtual train to run on the virtual track in simulation according to the coordinate position and the target rotation data.
[0129] The above modules can be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs), etc. For another example, when a certain module above is implemented in the form of a processing element scheduling code, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can invoke code. For another example, the modules can be integrated together to implement in the form of a system on a chip (SOC).
[0130] Figure 8 A schematic diagram of an embodiment of the simulation device is provided. The simulation device can be a device with a computing processing simulation function.
[0131] The simulation device 800 includes a processor 801 and a storage medium 802. The processor 801 and the storage medium 802 are connected through a bus.
[0132] The storage medium 802 is configured to store a program. The processor 801 invokes the program stored in the storage medium 802 to execute the above method embodiments. The specific implementation manners and technical effects are similar, and will not be described here.
[0133] Optionally, the present application also provides a program product, such as a computer readable storage medium, including a program. The program, when executed by a processor, is used to execute the above method embodiments.
[0134] In several embodiments provided by the present application, it should be understood that the disclosed apparatus and method can be implemented in other manners. For example, the described apparatus embodiments are merely schematic. The division of the units is merely a logical function division. There can be another division manner for the actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0135] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
[0136] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can be physically present separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0137] The integrated unit implemented in the form of software functional units can be stored in a computer readable storage medium. The software functional unit stored in the storage medium includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes a U disk, a mobile hard disk, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, and various program code storage media.
Claims
1. A train operation simulation method characterized by comprising: The method comprises the following steps: generating a spline model of a preset virtual track according to train operation data sent by a server; acquiring train displacement data within a preset delay time threshold from the spline model by using a movement function predefined in the spline model; calculating a train movement speed according to the train displacement data and the preset delay time threshold; controlling a virtual train to simulate operation on the virtual track according to the train movement speed. The method comprises the following steps: storing the train operation data within a preset time into a continuous data set; generating the spline model according to the continuous data set, wherein a preset virtual track within a preset time is determined according to multiple frames of continuous data in the continuous data set, and the preset virtual track is dynamically and continuously formed in front of the train as the train operation simulation proceeds. The continuous data set comprises a coordinate position data set, and the method of controlling the virtual train to simulate operation on the virtual track according to the train movement speed comprises the following steps: acquiring a coordinate position of the virtual train from the coordinate position data set by using a coordinate acquisition function predefined in the spline model according to the train movement speed, wherein the coordinate position data is the coordinate position of the train at the beginning and end of each frame, and all the coordinate positions within a preset delay time threshold are used to obtain the virtual track on which the train will run within the preset delay time threshold; controlling the virtual train to simulate operation on the virtual track according to the coordinate position, wherein the distance of each movement of the virtual train is the running distance of the train in each frame.
2. The method of claim 1, wherein, Before the step of calculating the train movement speed according to the train displacement data and the preset delay time threshold, the method further comprises the following steps: calculating a cumulative running distance of the train according to the train displacement data; determining whether the cumulative running distance of the train is greater than or equal to a preset distance threshold. The step of calculating the train movement speed according to the train displacement data and the preset delay time threshold comprises the following steps: if the cumulative running distance of the train is less than the distance threshold, controlling the virtual train to simulate operation on the virtual track according to the train movement speed.
3. The method of claim 2, wherein, The method further comprises the following steps: if the cumulative running distance of the train is greater than or equal to the distance threshold, deleting the train operation data used to generate the spline model, and updating the spline model according to newly received train operation data.
4. The method of claim 2, wherein, The step of calculating the train movement speed according to the train displacement data and the preset delay time threshold comprises the following steps: calculating a train acceleration according to the train displacement data, the preset delay time threshold and a preset initial speed; and calculating the train movement speed according to the train acceleration and the preset delay time threshold.
5. The method of claim 1, wherein, The continuous data set further comprises a rotation data set, and the step of controlling the virtual train to simulate operation on the virtual track according to the coordinate position comprises the following steps: determining rotation data indexes of the coordinate position in the rotation data set by using a rotation acquisition function predefined in the spline model according to the coordinate position. According to the rotation data index, two rotation data before and after the rotation data index in the rotation data group are interpolated to obtain target rotation data; According to the coordinate position, the virtual train is controlled to simulate running on the virtual track with the target rotation data.
6. A train operation simulation device characterized by comprising: Comprise: A generation module is configured to generate a spline line model of a preset virtual track according to train operation data sent by a server; An acquisition module is configured to acquire train displacement data within a preset delay time threshold from the spline line model by using a movement function predefined in the spline line model; A calculation module is configured to calculate a train movement speed according to the train displacement data and the preset delay time threshold; A control module is configured to control a virtual train to simulate running on the virtual track according to the train movement speed; The generation module is specifically configured to store the train operation data within a preset time into a continuous data group, and generate the spline line model according to the continuous data group, wherein a preset virtual track within a preset time is determined according to multiple frames of continuous data in the continuous data group, and the preset virtual track is dynamically and continuously formed in front of the train as the train operation simulation is performed; The continuous data group comprises a coordinate position data group, and the control module is specifically configured to acquire a coordinate position of the virtual train from the coordinate position data group by using a coordinate acquisition function predefined in the spline line model according to the train movement speed, wherein the coordinate position data is the initial and final coordinate positions of the train in each frame, and all the coordinate positions within the preset delay time threshold are used to obtain the virtual track on which the train will run within the preset delay time threshold, and the virtual train is controlled to simulate running on the virtual track according to the coordinate position, wherein the distance of each movement of the virtual train is the running distance of the train in one frame.
7. An emulation device, comprising: Comprise: A processor and a storage medium, the processor and the storage medium are communicatively connected through a bus, the storage medium stores program instructions executable by the processor, and the processor calls the program stored in the storage medium to execute the steps of the train operation simulation method according to any one of claims 1 to 5.
8. A storage medium, characterized by The storage medium stores a computer program, and the computer program performs the steps of the train operation simulation method according to any one of claims 1 to 5 when executed by the processor.
Citation Information
Patent Citations
Virtual train simulation method, device and equipment and storage medium
CN112765819A