The long-time propulsion method of small step based on conserved mechanism
Technical field
The present invention relates to a kind of time-marching method based on conserved mechanism in Computer Simulation field, particularly simulation process.
Background technology
Along with widening of Computer Simulation application, Computer Simulation needs the problem solved also to become increasingly complex, many problems cannot solve by single analogue system, multiple analogue system must be relied on to carry out combination and cooperation emulation, with traditional individual system simulation ratio, the key of distributed simulation is the Interoperability between multiple analogue system, U.S. national defense field proposes the High Level Architecture (high level architecture, hereinafter referred to as HLA) of modeling and simulation for this reason.In HLA, federal referring to combines by several simulation subsystems the whole analogue system formed, federal member refers to and forms each federal simulation subsystem, federation execution refers to a federal whole period run, mutual between federal operation and federal member and coordinate to be all realized by operational support system, OSS (Run Time Infrastructure, hereinafter referred to as RTI).Federal member sends event to RTI, sends event to relevant federal member by RTI.
In simulating developer process, RTI provides time management scheme to coordinate the Message Transmission between federal member.In a federation, the time is constantly advancing.But the time stepping method precision of different federal members may be different.The task of time management is exactly the sequence consensus that the order of time generation in simulation process is occurred with true messages, ensures that each federal member with the generation of same sequential observation to message, and can coordinate the correlated activation between them.The propelling in what HLA time management was paid close attention to is how control time when federation execution, but Time Advance Mechanism must match with message passing mechanism.Because message can be with " time stamp ", and show by " time stamp " time that message occurs, and the time management mechanism of HLA relies on the transmission coordinating band " time stamp " message just, realizes the propelling of simulation time.
The Time Advance Mechanism of HLA can be divided into two classes: a class is conservative Time Advance Mechanism, and another kind of is optimistic Time Advance Mechanism.Conservative Time Advance Mechanism is divided into again the time stepping method of stepping and the time stepping method based on event.Time Advance Mechanism in maintainability support simulation can adopt the conservative time stepping method mode based on event.
In HLA, conservative Time Advance Mechanism is based on the conservative approach of Parallel Discrete Event Simulation, time stamp order event (hereinafter referred to as TSO event) will be produced in this Time Advance Mechanism, TSO event refers to the event with time stamp, produced by the federal member with time controling attribute, act on the federal member with the limited time attribute, TSO event is all placed in simulated events list, and each federal member has oneself simulated events list.
The time-marching method of current conserved mechanism is: first federal member judges whether have logout in the simulated events list of self, when there being logout, federal member with the time stamp of top event in simulated events list for parameter to RTI submission time advance request.When RTI disapproves, federal member then stops executing the task; If ratify this time stepping method request, be then the time stamp of top event in the simulated events list of this federal member by time stepping method, when the time arrives the time stamp of top event in this simulated events list, federal member performs corresponding task.Federal member judge whether to produce next event while tasks carrying and the event that whether produces between federal member mutual, when do not have next event produce or federal member between event is not mutual time, after task is finished, the termination time advances, and tasks carrying complete time is T
current.When there being next event to occur, extract the time interval T of next event
lookahead, and determine that the time stamp of next event is " T=T
current+ T
lookahead", T is inserted the relevant position in simulated events list, and etc. pending next event.
Federal member carrys out the propelling of regulation time by the logic control assembly of RTI, but all events must appear at " T
current+ T
lookahead" time or afterwards, namely analogue system must meet realizability and predictability.
Realizability is the message and state that receive before the message sent in the guarantee system a certain moment only depends on this moment.Predictability is the situation that guarantee system at a time can dope after this moment, and under the prerequisite observing local causality constraint condition, realizes the correct emulation to system.
Local causality constraint condition is: the discrete events simulation be made up of one group of logical process, carries out alternately by means of only time stamp.And and if only if when each logical process presses the time stamp order process event of non-decreasing, follow local causality constraint condition.
In maintainability support simulation, the impact of relevant federal member can be subject between each federal member in Maintenance Support System, namely can there is the mutual of event, the deadline of such as maintenance task, it caused the uncertainty of emulation often by the impact on average ensureing delay time at stop (hereinafter referred to as MLDT).MLDT is the mean value of Support Resource delay time at stop in official hour, mainly refers to the delay time at stop caused for obtaining necessary Support Resource.GJB451 will be defined as the delay time at stop: because Support Resource supply or administrative reason fail to ensure the incured loss through delay time to product in time, be the ingredient of down time.MLDT mainly comprises: spare part time delay, personnel time delay, equipment time delay, technical information time delay, transport delay time, maintenance facility time delay, administration time delay.When the time stepping method under the uncertain maintenance task deadline affects by MLDT, federal member cannot know the concrete time that certain maintenance task completes, Maintenance Support System can not ensure that system dopes the message (ε >0) in t+ ε moment in t due to the impact of MLDT, violate Time Advance Mechanism predictability conservative in HLA, simulation process must be caused to violate local causality constraint condition, cause RTI to report an error, correctly can not emulate Maintenance Support System.
Summary of the invention
The technical matters that the present invention mainly solves is to provide a kind of time-marching method based on conserved mechanism, for solving the problem causing due to the predictability of Time Advance Mechanism conservative in violation HLA correctly emulating in maintainability support simulation process, to ensure the correctness of maintainability support simulation.
For solving the problems of the technologies described above, the technical solution used in the present invention is as follows.
The long-time propulsion method of small step based on conserved mechanism, the method is based on the conservative Time Advance Mechanism in HLA, and described time-marching method carries out according to the following steps:
A. first federal member judges whether have logout in the simulated events list of self, and when there being logout, federal member advances request for parameter to RTI submission time with the time stamp of top event in simulated events list, carries out step B; When without logout, carry out step D;
After B.RTI receives time stepping method request, verify time stepping method request and determine whether ratify this time stepping method request, if disapproved, federal member then stops executing the task; If ratify this time stepping method request, be then the time stamp of top event in the simulated events list of this federal member by time stepping method, when the time arrives the time stamp of top event in this simulated events list, federal member performs corresponding task;
C. federal member judge whether to produce next event while tasks carrying and the event that whether produces between federal member mutual, when do not have next event produce or federal member between event is not mutual time, after task is finished, termination time advances, and tasks carrying complete time is T1; When there being next event to occur, extracting the time interval t1 of next event, and determining that the time stamp of next event is T2=T1+t1, T2 being inserted the relevant position in simulated events list, and etc. pending next event; Exist when between federal member event mutual time, be that time stamp sends this interactive information to RTI with T1, request time advance, return step B;
D. when without logout, insert the null event that time stamp is T3=T1+ △ t in simulated events list, △ t is that little step-length advances the time; Be now that time stamp advances request to RTI transmitting time with T3, after RTI receives time stepping method request, verify time stepping method request and determine whether ratify this time stepping method request, if disapproved, federal member then stops executing the task; If ratify this time stepping method request, be then T3 by time stepping method, and perform null event;
E., after null event is complete, judging whether that the time of receipt (T of R) is spaced apart the large step-length event of t2, as do not received, then returning step D; As the time of receipt (T of R) is spaced apart the large step-length event of t2, then federal member advances the size of time △ t and large step-length event time interval t2 to compare to little step-length, when the time interval t2 of large step-length event is less than little step-length propelling time △ t, be that time stamp submits the time stepping method request of alternative events to RTI with T5=T3+t2, and insert in the simulated events list of this federal member, perform large step-length event;
When the time interval t2 of large step-length event is greater than little step-length propelling time △ t, is that time stamp directly inserts in the simulated events list of this federal member with T4=T3+t2, and returns steps A.
△ t during described small step advances for a long time is specially: little step-length advances time △ t to be any one mode in fixed step size or ratio step-length.And described little step-length advances the priority level of time in conservative time mechanism minimum.
Owing to have employed technique scheme, the technical progress acquired by the present invention is as follows.
The present invention carries out perfect to conservative time management mechanism in HLA, adopt when the uncertain propelling time, insert a null event by force, namely add one in current time and there is the long event of small step, this small step had not only been conducive to time stepping method efficiency for a long time but also had not violated the logic of emulation, avoid the generation due to Time Advance Mechanism predictability situation conservative in the violation HLA that causes by MLDT affects in federal member simulation process, can ensure that the logical process of each member in federation follows the local causality constraint condition of RTI, fully ensure that the accuracy of emulation.
Accompanying drawing explanation
Fig. 1 is process flow diagram of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in further details.
The long-time propulsion method of small step based on conserved mechanism, the method is used for emulating Maintenance Support System, simulation process is based on the conservative Time Advance Mechanism in HLA, federal member in Maintenance Support System comprises task and produces member, maintenance support member and equipment warehouse member, and time-marching method specifically carries out according to the following steps:
A. first maintenance support member judges whether have logout in the simulated events list of self, and when there being logout, maintenance support member advances request for parameter to RTI submission time with the time stamp of top event in simulated events list, carries out step B; When without logout, carry out step D.
After B.RTI receives time stepping method request, verify time stepping method request and determine whether ratify this time stepping method request, if disapproved, maintenance support member then stops executing the task; If ratify this time stepping method request, be then the time stamp of top event in the simulated events list of maintenance support member by time stepping method, when the time arrives the time stamp of top event in this simulated events list, maintenance support member performs corresponding task.
C. maintenance support member judge whether to produce next event while tasks carrying and the event that whether produces between federal member mutual, when do not have next event produce or federal member between event is not mutual time, after task is finished, termination time advances, and tasks carrying complete time is T1; When there being next event to occur, extracting the time interval t1 of next event, and determining that the time stamp of next event is T2=T1+t1, T2 being inserted the relevant position in simulated events list, and etc. pending next event; Exist when between federal member event mutual time, be that time stamp sends this interactive information to RTI with T1, request time advance, return step B.
Such as in Maintenance Support System, it is the maintenance task of ta that task produces member A generation time, and have submitted time stepping method request to RTI, and this maintenance task need repairing ensure member complete, so RTI will send maintenance instructions to maintenance support member, and that is task produces member A and creates alternative events.
D. when without logout, insert the null event that time stamp is T3=T1+ △ t in simulated events list, △ t is that little step-length advances the time; Be now that time stamp advances request to RTI transmitting time with T3, after RTI receives time stepping method request, verify time stepping method request and determine whether ratify this time stepping method request, if disapproved, federal member then stops executing the task; If ratify this time stepping method request, be then T3 by time stepping method, and perform null event;
Continuation of the previous cases, when maintenance support member is before carrying out maintenance task, the spare part judging the maintenance support members needs that equipment warehouse member stores is needed whether to meet maintenance needs, when satisfying the demand, maintenance support member directly can perform maintenance task, and when spare part can not meet maintenance needs, maintenance support member then needs to insert null event and waits for that spare part meets maintenance condition.
Or when there is no maintenance task in the simulated events list of maintenance support member, need equally to insert null event, wait task instruction.
Little step-length advances time △ t to be any one mode in fixed step size or ratio step-length, and wherein the little step-length of fixed step size advances the time comparatively practical for ordi-nary maintenance task, but then larger for the maintenance task error of different phase length; The little step-length of ratio step-length advances the time to adopt the fixed proportion of maintenance task phases-time to advance, and such as 1% of maintenance task phases-time, the step-length of 2% etc.
E., after null event is complete, judging whether that the time of receipt (T of R) is spaced apart the large step-length event of t2, as do not received, then returning step D; As the time of receipt (T of R) is spaced apart the large step-length event of t2, then RTI advances the size of time △ t and large step-length event time interval t2 to compare to little step-length, when the time interval t2 of large step-length event is less than little step-length propelling time △ t, be that time stamp submits the time stepping method request of alternative events to RTI with T5=T3+t2, and insert in the simulated events list of this federal member, perform large step-length event;
When the time interval t2 of large step-length event is greater than little step-length propelling time △ t, is that time stamp directly inserts in the simulated events list of this federal member with T4=T3+t2, and returns steps A.
Continuation of the previous cases, when the spare part of equipment warehouse member has met the requirement of maintenance task, then equipment warehouse member can propose time stepping method request to RTI, i.e. large step-length event, and RTI then judges large step-length event.
Above-mentioned little step-length advances the priority level of time minimum, also just say that federal member receives major issue propel signal, then abandon little step-length advance mechanism, then the event that changes into advances, when program to judge within the time of the unknown that event occurs but cannot the time point of decision event time again then the propelling of little step-length.
The long-time propulsion method of small step of the present invention, is applicable to each federal member adopting conservative time mechanism.