CN102346681B - General-purpose simulator - Google Patents

General-purpose simulator Download PDF

Info

Publication number
CN102346681B
CN102346681B CN201010282456.3A CN201010282456A CN102346681B CN 102346681 B CN102346681 B CN 102346681B CN 201010282456 A CN201010282456 A CN 201010282456A CN 102346681 B CN102346681 B CN 102346681B
Authority
CN
China
Prior art keywords
entity
event
module
simulation
resource
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201010282456.3A
Other languages
Chinese (zh)
Other versions
CN102346681A (en
Inventor
史殿习
杨永志
王怀民
丁博
刘惠
尹刚
滕猛
张威
饶翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
National University of Defense Technology
Original Assignee
National University of Defense Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by National University of Defense Technology filed Critical National University of Defense Technology
Priority to CN201010282456.3A priority Critical patent/CN102346681B/en
Publication of CN102346681A publication Critical patent/CN102346681A/en
Application granted granted Critical
Publication of CN102346681B publication Critical patent/CN102346681B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a general-purpose simulator. The general-purpose simulator comprises a model-derived entity module, an interactive support module, a multithreaded concurrent execution module, a distributed support module and a virtual host module, wherein, the model-derived entity module comprises a plurality of simulation groups, each simulation group comprises a plurality of simulation nodes, and each simulation node comprises resource-based entities formed by packaging functional units of a target system to be simulated; the interactive support module realizes interaction among simulation entities in the model-derived entity module; the distributed support module realizes migration of the transferable entities in the model-derived entity module to different hosts; the multithreaded concurrent execution module realizes multithreaded concurrent processing on coincident events on the host where the general-purpose simulator is located; and the virtual host module is used in an abstract physical host and is used for accommodating various entities in the general-purpose simulator and assisting the distributed support module in realizing transparent support on distribution.

Description

A kind of universal simulator
Technical field
The present invention relates to Computer Simulation field, particularly a kind of universal simulator.
Background technology
System emulation is that a kind of system model that utilizes is tested real system or hypothetical system, by experimental result is analyzed, Study system running status and over time process, obtain simulation data parameter and the fundamental characteristics of system, with this, estimate feature and the performance with inference system, and then the experimental and comprehensive subject making a policy.System emulation is based on system model, and system model can be divided into two large classes according to characteristic, and a class is continuous system, and another kind of is discrete event system.The key distinction of two type systematic models is system state rule over time, and the former changes in time continuously, and the latter only changes on some discrete time point.In discrete event system model, the variation of its state only occurs on some discrete time points, and between adjacent two time points, any variation does not occur state.The behavior that causes system state change is called as event, and it is core and the driving force of discrete event system, and the generation of event and processing are promoting the operation of discrete event system one by one just.
Along with the development of computer technology, utilize computer implemented system emulation to be widely used and promote, this system emulation realizing is on computers called as computer simulation.The computer software for a certain system of emulation of operation is called as simulator on computers, since nineteen fifty-five, first numerical integration simulation software came out, has occurred a large amount of, polytype simulator.But existing simulator mostly for specific goal systems or field, for example, carries out the SimScalor of Computer Architecture simulation, carries out the NS2 of computer network simulation, the GPSS of the system simulation of ranking.These simulators for its for field optimize, make it can be in its territory simulate goal systems, but be difficult to simulate for the goal systems in other field.There is thus following problem: 1, increased user learning burden, when user need to simulate the system in different field, need to learn the simulator in different field; 2,, when the goal systems that will simulate is cross-cutting, is difficult to integrate different simulators and simulates.
Summary of the invention
The object of the invention is to overcome the goal systems that existing simulator can only be simulated specific area, the defect that versatility is poor, thus the universal simulator that a kind of versatility is good is provided.
To achieve these goals, the invention provides a kind of universal simulator, comprise model deriving custom entities module, Cross support module, multi-thread concurrent execution module, distribution support module and fictitious host computer module; Wherein,
Described model deriving custom entities module comprises a plurality of simulation groups, and the simulation group described in each includes a plurality of simulation nodes, and described simulation node comprises that the functional unit by the goal systems that will simulate encapsulates the resource-type entity forming; Described simulation group, simulation node and resource-type entity are all called as simulation entity;
Described Cross support module has realized and described in described model deriving custom entities module, has simulated the mutual of inter-entity; The mutual representations of events of using of described simulation inter-entity;
Described distribution support module has been realized the migration on different main frames by the transportable entity in described model deriving custom entities module;
Described multi-course concurrency execution module has been realized a plurality of threads on the main frame of described universal simulator place to there is the concurrent processing of event simultaneously;
Described fictitious host computer module, for abstract physical host, is held the various entities in described universal simulator, and auxiliary described distribution support module is realized the transparent support to distributing.
In technique scheme, described model deriving custom entities module also includes the system entity for the goal systems that will simulate is monitored and controlled, described system entity comprises for monitoring the probe of described simulation entity inner case, and for controlling the controller of described universal simulator;
Described Cross support module has also realized between described system entity and described system entity and described simulation inter-entity mutual; This uses representations of events alternately.
In technique scheme, described Cross support module is when the alternative events for the treatment of of simulated inter-entity, according to the destination address of described event by this case distribution to simulation the resource-type entity in entity, described resource-type entity calls corresponding event handler and processes this event.
In technique scheme, described Cross support module, when the alternative events of disposal system inter-entity or system entity and simulation inter-entity, to the invoke function of having realized the respective objects of interface Invokable, is processed this case distribution by this function.
In technique scheme, described Cross support module also comprises that the event by described resource-type entity is sent takes turns doing by name assembling and fetches the dependence between decoupling zero resource entity by name chain; Wherein,
Describedly by name assembling, comprise and specify the target of the event that described resource-type entity sends and specify the event another name of this target when receiving; Describedly by name link, comprise that the event that described resource-type entity is sent sends to the analog node at target resource type entity place.
In technique scheme, described Cross support module also comprises that the event source of managing the event of sending with event object set is to the linking relationship between the event target of reception event; Described event target collection comprises the description to described linking relationship, and the event link relation generating according to strategy.
In technique scheme, described Cross support module adopts synchronous event interactive mode to process event.
In technique scheme, described distribution support module adopts the object broker method based on simplifying to realize the migration of transportable entity on different main frames; Wherein,
The object broker method of described simplification adopts the class of a counterfoil by name, such generates corresponding object stub for described transportable entity on another main frame, described object stub compare with corresponding transportable entity there is same simulation node, same simulation group; To calling of described object stub, can be forwarded to the transportable entity of the correspondence being distributed on other main frame.
In technique scheme, in described fictitious host computer module, preserve the entity list that is positioned at local transportable entity for recording, and for recording the counterfoil table of local all object stubs used; Described fictitious host computer module creates, obtains, destroys transportable entity according to described entity list and counterfoil table.
In technique scheme, described multi-course concurrency execution module is distributed with reclaim mechanism and is realized multithreading to there is the concurrent processing of event simultaneously by token.
The invention has the advantages that: versatility is good, applied widely, can simulate the goal systems of different field.
Accompanying drawing explanation
Fig. 1 is universal simulator of the present invention structural representation in one embodiment;
Fig. 2 is the schematic diagram of system abstract model related in the present invention;
Fig. 3 is the type map of alternative events related in the present invention;
Fig. 4 is the schematic diagram of transportable entity and the corresponding Stub object of transportable entity;
Fig. 5 is the schematic diagram of service distribution between different main frames;
Fig. 6 is token distribution and the process schematic diagram reclaiming.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is illustrated.
The work that simulator will complete is the emulation realizing on computers goal systems.Although goal systems has different types, by analyzing, dissimilar goal systems can take out following key element:
1, entity.Entity refers to have internal logic and can carry out mutual independent existence, such as CPU, RAM, main frame, software module etc. with outside.
2, the interactive mode of inter-entity, as shared bus, network channel, message passing mechanism etc.
3, the membership credentials of inter-entity, for example, be divided into group by entity by physical region, with a plurality of entities, forms new larger entity, as entity CPU, RAM etc. form a computer entity.
Simulator needs to embody above-mentioned element in the process of simulated target system.In addition, consider the needs of user to simulator distributivity, concurrency and the property monitored, simulator also should have following characteristic:
4, the distribution of entity and concurrency, the entity simulateding in simulator should be able to be distributed in different computing machines with certain granularity, and is simulated concurrently.
5, the entity simulateding should be able to be detected and control.
Foregoing is the fundamental characteristics that each simulator all should possess.The present invention will realize a kind of universal simulator that can be applicable to polytype goal systems, therefore in universal simulator of the present invention, also should possess above-mentioned characteristic.It needs to be noted, universal simulator of the present invention can complete the basic function of simulator, but if this universal simulator to be applied to a certain concrete goal systems, also on the basis of described universal simulator, add according to described goal systems a small amount of technology contents.Below the basic structure of universal simulator of the present invention is illustrated.
Universal simulator of the present invention comprises model deriving custom entities module, Cross support module, multi-thread concurrent execution module, distribution support module and fictitious host computer module.Wherein, model deriving custom entities module is connected with Cross support module, multi-thread concurrent execution module respectively, described Cross support module, multi-thread concurrent execution module are connected respectively on distribution support module, by the fictitious host computer module on this module and other main frame, communicate, other module in universal simulator is all moved in fictitious host computer module.Hereinafter the function to modules is respectively done to specific description.
Fictitious host computer module (Virtual Host)
Fictitious host computer module is for abstract physical host, and this module at least comprises two functions, and the one, as container, hold the various entities in simulator, the 2nd, auxiliary distribution support module is realized the transparent support to distributing.When start a fictitious host computer module on each main frame after, can generate therein various entities.When generating transportable entity, fictitious host computer module is informed distribution support module, enables the consistance of keeping system view.When access is during transportable entity, if target entity not in this fictitious host computer module, fictitious host computer module can, by asking to be accordingly transmitted to distribution support module, finally complete this request.The aforesaid operations process relevant with fictitious host computer module is described further in the description of correlation module hereinafter.
The programmed environment that the realization of fictitious host computer module adopts with universal simulator is relevant, in one embodiment of the invention, as shown in Figure 1, uses JavaMachine as fictitious host computer module.The function of JavaMachine and fictitious host computer module noted earlier do not have large difference, and just this module can only be applied in Java Virtual Machine.
Model deriving custom entities module
Model deriving custom entities module is for describing all kinds of entities that universal simulator of the present invention comprises.The kind of contained entity in model deriving custom entities module, the contents such as annexation between different entities are relevant with concrete goal systems, and all kinds of entities are obtained by the derivation of system abstract model, therefore, for convenience of description, first the related content of system abstract model is described.
Described system abstract model is for realizing abstract to goal systems and universal simulator.Fig. 2 is system abstract model schematic diagram in one embodiment.In this embodiment, system abstract model adopts Java programming language to be described, but in other embodiments, also can abstract model be described with the programming language of other type, described abstract model with the described abstract model of Java language, compare, except the difference causing because of programming language feature separately, there is no difference in essence.
Mention in the preceding article, include entity, and in simulator, also include entity in goal systems, for all entities, be all conceptualized as the interface IEntity in Java in abstract model, each IEntity has an ID that the overall situation is unique.As shown in Figure 2, in abstract model, IEntity is divided into two classes: a class is for expressing ISimEntity (the Simulation Entity of goal systems entity, simulation entity), another kind of is for expressing the ISysEntity (System Entity, system entity) of simulator self system entity.Below this two class IEntity is illustrated respectively.
1, simulation entity
Simulation entity ISimEntity is for the entity of simulated target system, obviously, in a goal systems that will simulated, must include the entity of polytype, a plurality of quantity, therefore in the process of simulation, will represent these entities with a plurality of simulation entities.The relation of investigating the inter-entity in goal systems, can be divided into three kinds:
The paradigmatic relation of a, composite type;
The paradigmatic relation of b, share type;
The subject and object of c, behavior, i.e. common incidence relation.
Above-mentioned three kinds of relations of simulation inter-entity will have further description hereinafter.Simulation entity can be divided into ISimStructure (structural type entity) and ISimResource (resource-type entity) according to its content.Described resource-type entity ISimResource is for encapsulating the unit that goal systems has logic function, such as RAM, ROM, CPU etc.Described structural type entity ISimStructure organizes resource-type entity ISimResource, to obtain the more functional unit of coarsegrain.
Described structural type entity ISimStructure can be further divided into ISimNode (the Simulation Node for expressing composite types of polymerization relation, simulate node) and for expressing the ISimGroup (Simulation Group, simulation group) of share types of polymerization relation.In an analog node ISimNode, can comprise a plurality of resource-type entity ISimResource, a simulation group ISimGroup can comprise a plurality of structural type entity ISimStructure.It should be noted that, for analog node and simulation group, their involved implications comprising are not identical, and analog node ISimNode is kept at described resource-type entity in self, and simulation group ISimGroup has only recorded the ID of structural type entity.
Mention in the preceding article between the entity in goal systems and have interactive relation, this interactive relation is presented as mutual between simulation entity ISimEntity in simulator.Between simulation entity ISimEntity, be commonly referred to as alternately mutual between resource-type entity ISimResource, in fact show as the event in discrete event system, participating in mutual resource-type entity ISimResource is respectively transmit leg and the reception & disposal side of event.Described event can use SimEvent (Simulation Event, modeling event) to represent.
According to goal systems, some simulation entity should be transportable, some simulation entity should call, for these simulation entities and other simulation entity are distinguished, with reference to Fig. 2, in abstract model, adopt interface IPortable to identify transportable simulation entity, adopt interface Invokable to identify the entity that can call.Abstract model has also adopted interface IEventTargetSet to simplify the event target collection to complicated event transmitting-receiving relation management.
2, system entity
In order to support the monitoring of goal systems and control, abstract model derives and is responsible for monitoring simulation entity inner case from system entity ISysEntity, and receive the IProber (probe) that simulation entity initiatively sends information, and for being responsible for user to the directly actuated IMonitor of simulator (controller).
Each simulation entity ISimEntity can set a probe I Prober.On the one hand, probe I Prober can detect the variation occurring in simulation entity ISimEntiy, for example, received an event SimEvent; On the other hand, simulation entity ISimEntity can initiatively send to probe I Prober by some information of self.In Java, IProbable interface is used for identifying an entity and whether can inserts probe I Prober and monitor.Because ISimEntity has realized IProbable, therefore all simulation entity ISimEntity and subclasses thereof all can be monitored.In addition, because simulator is in fact the simulation entity ISimEntity that comprises a plurality of simulation entity ISimEntity.Therefore,, in Fig. 2, represent that the ISimulator of special simulation group inherits from described simulation group ISimGroup.Each simulation group ISimulator needs to have controller IMonitor cooperating with it, and this IMonitor must be ISimMonitor (Simulator Monitor, simulator watch-dog).
System entity ISysEntity, except the content mentioned above, also comprises for simplifying the IEventTargetSet to the management of complicated event transmitting-receiving relation.These system entitys can and be used by customization.
Mention in the preceding article, the generation of model deriving custom entities module is except outside the Pass having with system abstract model, also relevant with concrete goal systems.In the process by goal systems generation model deriving custom entities module, the functional unit in goal systems need to be embodied as to resource-type entity ISimResource, and reuse described structural type entity ISimStructure and system entity ISysEntity.As need carry out special control and detection, customizable required controller IMonitor, simulator watch-dog ISimMonitor and probe I Prober.In order to simplify the setting of interactive relation between resource and management, go back the required EventTargetSet of definable (realizing IEventTargetSet, hereinafter to be referred as ETS).
Be above to system abstract model and how by the description of goal systems generation model deriving custom entities module, below the basic structure of model deriving custom entities module be illustrated.As shown in Figure 1, described model deriving custom entities module comprises a special simulation group ISimulator, and this simulation group ISimulator has a controller IMonitor for cooperating with it.In described ISimulator, can insert a plurality of simulation group ISimGroup.These simulation groups ISimGroup may be arranged in other JavaMachine module, but to its access mode of user with identical to the access of this locality group.In each simulation group ISimGroup, can insert a plurality of simulation node ISimNode, simulation node may be arranged in other JavaMachine module equally.In each simulation node, can put into a plurality of resource-type entity ISimResource.Resource-type entity must with its under simulation node in same JavaMachine module.In addition, user can put into probe I Prober in simulation group and simulation node, also can in JavaMachine module, put into controller IMonitor.According to the definition of abstract model, transportable entity can make it to move in other JavaMachine module by JavaMachine module.
Cross support module
Mutual between each entity that Cross support module comprises for implementation model deriving custom entities module.From a plurality of angles, Cross support module is illustrated below.
A, the processing to dissimilar event
Inter-entity can be divided into alternately following two kinds, alternately can be by dissimilar representations of events for different types of inter-entity.
1, mutual between simulation entity ISimEntity, that between resource-type entity ISimResource, by transmitting-receiving modeling event SimEvent, is undertaken is mutual.
2, have mutual that system entity ISysEntity participates in, this comprises mutual between system entity ISysEntity, and between system entity ISysEntity and simulation entity ISimEntity alternately.
The first is the behavior in goal systems alternately.For example, when resource-type entity ISimResourceRi needs and resource-type entity ISimResource Rj carries out when mutual, it sends a modeling event SimEvent to Rj, thereby initiation is once mutual.Between simulation entity ISimEntity, can be subdivided into two classes alternately: synchronous interaction and asynchronous interactive.Synchronous interaction needs target entity synchronously to return to interaction results, is similar to linear function and calls.Asynchronous interactive does not need to return to any result, is similar to a message and sends.
The second is actually simulation entity ISimEntity or the adjustment of simulator user to simulator in goal systems alternately.For example, simulator user wishes to change the report manner of data in probe I Prober, or a network node in goal systems is revised the IP address of self.StarSim is treated to the behavior outside goal systems by this interbehavior, with IInvokable, represents to carry out this type of mutual entity IEntity.It should be noted that, using Invocation to carry out when mutual, not affecting simulated clock simulation clock, can not cause simulated clock simulation clock to be pushed ahead.
In Fig. 3, to distinguishing for mutual event, SimEvent representative is for representing the modeling event of the first type of interaction, and Invocation represents for representing the event of calling of the second type of interaction.This two classes event all has following key element:
1, event name, for distinguishing different interbehaviors, is similar to the function name in method call;
2, event data, parameter when mutual for transmitting and possible result.
The event of which kind of type no matter, is all the list of a key-value pair for the event data of presentation of events, and each data has a title for distinguishing.
Cross support module based on event has different disposal routes for dissimilar event.
A), the modeling event SimEvent that sends out for resource entity, Cross support module by according to the event target of setting in this resource entity by case distribution in the resource of appointment.In each resource, there are some event handlers for the treatment of event (IEventHandler).The resource entity that user need to be oneself according to the form of event handler is write some events processor.Modeling event SimEvent is distributed to after the resource of appointment, and first simulator obtains the event handler of processing this modeling event SimEvent, then calls event handler modeling event is processed.
B), for calling event Invocation, the invoke function that Cross support module is directly distributed to by it respective objects that has realized interface Invokable, is processed by this function.
Dependence between B, decoupling zero resource entity
Cross support module based on event, except the previously mentioned classification to event is processed, also has other function.
In creating the process of simulator, often can run into such problem: when user defines a resource-type entity in simulator, be conventionally difficult to determine the particular type that carries out with it other mutual resource-type entity.For example, during definition CPU this resource-type entity, although know that it will access the data in storage space, and that do not know to provide data is resource-type entity RAM/ROM or resource-type entity Cache.This is obviously unfavorable for the successful establishment of simulator.As a kind of preferred implementation, the Cross support module based on event can overcome by the dependence between decoupling zero resource entity this problem.
With above-mentioned, resource-type entity CPU is defined as to example, in definition during CPU, determines that it need to read and data writing by being called the event of " READ_MEM " and the event of " WRITE_MEM " respectively.In definition during RAM, determine the event of reading that it can response data and write event, and by these two events called afters " DATA_READ " and " DATA_WRITE " respectively.When CPU and RAM are combined in simulator, only need to be by the READ_MEM event link of CPU the event handling unit to DATA_READ event in RAM, make the event of the READ_MEM by name that CPU sends can simulated device and be distributed to RAM, as the event of READ_MEM by name in RAM, this process is also referred to as the link assembling of event name.In like manner, when needs are first connected to Cache by CPU, while being connected to RAM by Cache again, only need to the READ_MEM event link of CPU be arrived to the CACHE_READ event of Cache when link assembling, and the MISS_MEM_READ event of Cache (when cache is miss, the internal memory of initiating reads event) is linked to the DATA_READ event in RAM.Link by event name is assembled, and has both guaranteed the reusability of resource-type entity, has increased again the dirigibility of system.
Above just the link assembling process of event name has been done to simple explanation, below the specific implementation process of the dependence between the Cross support module decoupling zero resource entity based on event has been illustrated.
First, the event of resource-type entity being sent is done by name and is assembled.Described assembles by name target and the event another name of target when receiving that refers to the event that allocated resource entity sends.
Described realizes by the object listing of establishment event by name assembling.The object listing of each event is the Key-Values Mapping implementation to a plurality of target informations by an event name.Each target information in object listing has been described the following content of respective objects: the event another name when ID of the ID of target resource entity, target resource entity place analog node ISimNode, target resource entity receive.
Secondly, event links by name.The described event that refers to the EventName by name that resource-type entity ISimResource is sent by name link, sends to target resource entity ISimResource as the event of AliasEventName by name.
In by the process of name link, when the resource-type entity ISimResource as mutual promoter sends modeling event SimEvent, simulator by the object listing creating in name assigning process, obtains the following information of target according to the name lookup of event: the event another name when ID of the ID of target resource entity, target resource entity place analog node ISimNode, target resource entity receive.After obtaining the above-mentioned information of target, just can according to relevant information, event be sent to by simulator to the analog node ISimNode at target resource place, by it, at correct simulator, from target resource type entity, obtain processing the event handler of this event another name constantly, and transfer to this event handler to process.In by the process of name link, the overhead that (being the transmitting terminal of event) brings to the unnecessary transmission of destination for fear of extraneous events from source can also carry out filter operation before case distribution.Described filter operation is realized by event filter, and event filter checks whether current event needs to deliver to destination end, if desired, just carries out follow-up distribution operation.Owing to whether needing event filter and adopting which kind of event filter may be different on different target, so the relevant information of event filter also can be kept in object listing in advance.
The assembling of C, complicated event chain
Be more than the description to the link assembling basic process of event, no matter in goal systems, include how many resource-type entities, simulator can utilize this link assembling process to complete the mutual of resource-type inter-entity.Even so, event transmitting-receiving relation between resource entity is not simple single source single goal or single source multiple goal, but during complicated multi-source multi-target, rely on merely one by one the transmission target in allocate event source to complete and will make assembly work become loaded down with trivial details to the event link of resource entity.For example in to a room in the simulation of WiFi network, the WiFi network interface card on each main frame simulateding needs to be connected with other WiFi network interface card in room---and be that the event that its produces need to send to the WiFi network interface card in other all effective ranges.If assembly chaining one by one, needs N * N time link (N is network interface card number), and to safeguard that the cost that this link will spend is larger.For example certain node adds and exits and all need to revise the linking relationship on other all nodes.In order to reduce in such cases link number of times, reduce maintenance cost, as a kind of preferred implementation, adopt in another embodiment " event target collection " (IEventTargetSet, ETS) to come Admin Events source to the linking relationship between event target.First described ETS comprises the description to these linking relationships, then according to predetermined strategy, automatically generates event link relation, and is distributed to event source node.When event link relation need to change, directly notify ETS, by ETS, upgraded.For example, can pre-define the ETS of a WiFi, then all network interface cards and position thereof be put into ETS, by ETS according to the coverage of each network interface card and its event link relation of location positioning.When site position changes, only need to revise ETS, by ETS, automatically upgrade the event link relation between the node relating to.Like this, no matter be initialization or renewal, user only needs to set for 1 time.
D, synchronous event interactive mode
In the typical discrete event system of prior art, event from produce to send and whole process that the side of being received processes normally asynchronous, i.e. after transmit leg transmission event, no longer wait for that take over party is disposed and continues down to carry out.This asynchronous event interactive mode, can increase the complexity of entity internal event response logic.For example, when CPU entity need to read in RAM entity data, due to asynchronous event interactive mode, made this operation to send a READ event by CPU, then wait for that RAM entity sends the READ_ACK event of returning, only have after receiving READ_ACK event, read operation just completes.This deficiency in view of asynchronous event interactive mode, internal logic when simplifying entity interaction, in a preferred embodiment of the invention, the Cross support module based on event adopts synchronous event interactive mode, and this interactive mode is also referred to as CallByEvent mechanism.In synchronous event interactive mode, transmit leg need to wait for that take over party is complete by event handling, and take over party need to explicitly inform that event handling is complete.Under the support of synchronous event, CPU sends after READ event, automatically in waiting status, until RAM puts into data READ event and returns; And RAM is in sense data and put into after READ event, need explicitly inform that event handling is complete.When the sending action of CPU is returned, in READ event, there are the data of reading in RAM.Compare alternately with asynchronous event, in synchronous event reciprocal process, take over party does not need one of explicit transmission to reply event, initiator does not need to write the IEventHandler that processes the event of replying yet, reduce the assembling synchronous event interactive mode (or CallByEvent mechanism) of an event link simultaneously, therefore simplified the mutual of inter-entity.
Distribution support module
Mention in the preceding article, some the simulation entity in simulator is transportable, and adopts interface IPortable to identify and support transportable simulation entity.The auxiliary lower realization in aforementioned fictitious host computer module by described distribution support module to the migration of simulation entity.
In one embodiment of the invention, distribution support module is realized based on simplifying ORB.Described ORB is object broker, and typical object broker method comprises CORBA, DCOM, J2EE etc.Due to these typical methods need to process complex network environment, cross-platform, across many difficult problems such as language, therefore conventionally all very complicated.The running environment facing in view of simulator is comparatively simple, for example, by LAN (Local Area Network) TCP/IP is interconnected reliably at a high speed, do not have the problem across programming language, therefore can adopt the object broker method after simplification.Object broker method after described simplification only comprises three functions: 1, the relation between maintenance host, and there is which main frame to participate in simulation, how to access them; 2, the location management of transportable object, is positioned at which main frame (computing machine of operation simulator); 3, the access to transportable object.In the present invention, relate generally to the ORB how utilizing after simplification and realize to transportable object the distribution on different main frames and follow-up interactive access.
Realize the support of transportable entity on different main frames, need to adopt a class to be called the class of counterfoil (Stub), Stub class is the Stub object that transportable solid generation is corresponding.Stub object is compared with its corresponding transportable entity, there is identical simulation group ISimGroup, special simulation group ISimulator and simulation node ISimNode, therefore user is when using described transportable entity, and not needing to distinguish is entity itself or its corresponding Stub object.Stub object can be forwarded to calling of it correspondent entity being distributed on other main frame by guaranteeing, and returns results, thereby makes user can access the entity being distributed on different main frames, and does not need to be concerned about how bottom realizes this remote request.For user, be distributed in entity on different main frames just as moving on a main frame.Fig. 4 is the schematic diagram of transportable entity and the corresponding Stub object of transportable entity, and right side has wherein represented described Stub object.Stub object is sightless for user, and the dotted line in figure represents implementation relation, and Stub object is realized the transportable object being connected with its dotted line.Solid line in figure represents inheritance, and Stub object is inherited the transportable object being connected with its solid line.By aforesaid operations, can guarantee user transparent and use Stub, but think that what use is corresponding transportable object.
For the ease of user, handle each main frame in compartment system, preserved two tables in described fictitious host computer module, one is the entity list that is positioned at local transportable entity for recording, and another is for recording the counterfoil table of local all Stub used.In addition, fictitious host computer module has also used one for realizing the IJVMORB object of the ORB after simplification and the fictitious host computer module on other main frame, to carry out alternately.To the access of remote dummy host module, can be undertaken by obtaining its Stub.But the startup of fictitious host computer module can not be undertaken by Stub, must manual on main frame, start and move a fictitious host computer module.Fictitious host computer module will be found other fictitious host computer module, and completed necessary information synchronous working after starting according to predetermined strategy.
After in the preceding article Stub and fictitious host computer module being described, below just can be illustrated the management process of transportable entity.The management process of transportable entity comprises establishment, destroys and migration.State in realization in management process, fictitious host computer module provides the calling interface of migration, and these calling interfaces support module of actual action being transferred to distribute in inside is carried out.So just realized the transparency of distribution support module to user, thereby different distribution support modules can be according to circumstances provided.Specific implementation process is as follows.
When user creates a transportable entity, first by fictitious host computer module, generate this entity, and put into described entity list; Then, fictitious host computer module generates the Stub that this entity is corresponding, puts into described counterfoil table; Then, fictitious host computer module re-uses the notifyAddMobile method that the fictitious host computer module for notifying on other main frame in IJVMORB is added a transportable entity; Last fictitious host computer module is returned to the Stub of generation to the user that need to create transportable entity.
When user obtains transportable entity according to ID, first fictitious host computer module searches the Stub that whether has this ID in described counterfoil table, has and directly returns to this Stub, without creating a Stub, and created Stub is put into counterfoil table, and returns to this Stub.
When user will destroy a transportable entity, fictitious host computer module judges that whether this entity is in this locality, if delete and destroy from described entity list in this locality, then call the notifyRemoveMobile method for notifying fictitious host computer module on other main frame to delete a transportable entity in IJVMORB, and then delete the Stub of this object that may exist in counterfoil table.If the getHostJVM method that the entity of deleting not in this locality, is used the requirement in IJVMORB to return to designated entities place fictitious host computer module numbering obtains the Stub of the fictitious host computer module at this entity place, then forward the request of destruction.
It is all Stub that user calls the transportable entity that in fictitious host computer module, method obtains.When user initiates to call to Stub, call and will be intercepted and captured by Stub.The ID of the entity that first Stub acts on behalf of according to self searches this entity in local virtual host module, if entity, in the entity list of fictitious host computer module, will call and be transmitted to this entity.Otherwise the nrmi method that is transmitted to local virtual host module will be called.In nrmi method, the getHostJVM method that fictitious host computer module is called IJVMORB obtains the Stub of the fictitious host computer module at this entity place, then calls the remoteCalled method in the Stub of fictitious host computer module.Because the Stub of fictitious host computer module is managed by IJVMORB, so in fact StarSim incorporates the basic-level support of distribution into IJVMORB and manages.Therefore,, for the host computer system of different characteristics, can realize by the IJVMORB with different improving the performance that bottom distributes.
Fig. 5 has provided an example under Java environment, in the figure, the transportable entity of the circular expression of solid line, dashed circle represents Stub, ellipse representation JavaMachine module.When the user in JavaMachine module 1 accesses transportable entity B, the access of B is intercepted and captured by the corresponding Stub b of transportable entity B, and be forwarded to the nrmi method of JavaMachine module 1 by it.The nrmi of JavaMachine module 1 calls the Stub j2 that IJVMORB1 obtains JavaMachine module 2.Because j2 is that IJVMORB1 creates, therefore it may comprise the information such as the network address of JavaMachine module 2, thereby request can be forwarded to JavaMachine module 2, and return results.
Multi-thread concurrent execution module
In the simulation of discrete event, it is a problem solving not yet theoretically that the complete parallel of event is processed with unified propelling of simulated clock simulation clock.Concurrency inevitably runs into " causal sequence " problem in simulated time completely, and the unified concurrency that can greatly reduce event handling that advances of clock.Therefore, in the present invention, adopt multi-thread concurrent execution module to carry out the concurrent processing of multithreading to there is event (occurring in the event on same simulator clock) when a large amount of existence in large scale system.
Multi-thread concurrent execution module is distributed with the mechanism support of reclaiming and is used the parallel processing of multithreading to event by token, guarantees that the unified of clock advances simultaneously.As shown in Figure 6, at simulation moment Ti, on structural solid (ISimStructure) N, there is k concurrent E1, ..., Ek, by the clock of N, advance function (advance) to create k thread, and the Token that the thread that calls advance is held is divided into k part, is distributed to this k thread.Then start this k thread and process respectively these events.The thread that calls advance starts after all sub-threads, waits for and collects k the sub-Token having distributed, and after collection is neat, could continue.After every sub-thread execution, to main thread, give back held sub-Token.On each structural solid, repeat this process, make the processing procedure on each structural solid roughly the same.Because structural solid can be distributed on different main frames, therefore distributivity can be supported and utilize to concurrent thread.This concurrent mechanism is without the participation of the defined resource entity of user, thereby is transparent to user.
Mention in the preceding article, in a kind of preferred implementation of the present invention, can adopt synchronous event interactive mode (CallByEvent) to realize the processing to event.Multi-thread concurrent treatment mechanism is equally applicable to CallByEvent.Specifically, event sending party S calls for realizing the mutual callByEvent function of synchronous event, first this function calls dispatchEvent event is sent to target entity D, then by the token token of self, give back main thread, and realize the obstruction of current sub-thread T is slept by calling waitForACKEvent, with returning of waiting event.When target entity D handles after event, call returnEvent function.This function will wake the thread T sleeping up, makes callByEvent function call to continue execution.When it obtains after the event that target entity returns, complete and exit.
It is more than the detailed description to universal simulator of the present invention.From finding out the detailed description of universal simulator modules, the present invention is that the goal systems simulateding is set up general, simple model, make the universal simulator can be for the simulation of most events system, and reduce the difficulty that objectives system is simulated.
In addition, universal simulator of the present invention provides the interaction mechanism of the inter-entity based on event, decoupling zero between this mechanism support entity is to improve the reusability of entity, and synchronous event interaction mechanism (CallByEvent) can be simplified the event handling logic of entity inside, event target collection ETS can also simplify the assembling of complicated event transmitting-receiving relation.
Universal simulator of the present invention also supports to simulate the distribution of entity.The present invention is based on ORB (Object Request Broker) thought of simplification, simulation entity is distributed to different main frames simulates, while solving simulator operation, the problem of unit performance deficiency, also hides the bottom details while distributing, and the control that simulation entity is distributed is provided.
Universal simulator of the present invention is also supported the parallel processing of simultaneous events: use token distribution and multithreading, the modeling event that the same simulation of parallel processing that a plurality of threads in a plurality of main frames and same main frame can be transparent is occurred constantly.
Customizable monitoring and the control of universal simulator support of the present invention to simulation system, by customizable monitoring and control method are provided, makes user can monitor flexibly and control the entity in goal systems.
It should be noted last that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described.Although the present invention is had been described in detail with reference to embodiment, those of ordinary skill in the art is to be understood that, technical scheme of the present invention is modified or is equal to replacement, do not depart from the spirit and scope of technical solution of the present invention, it all should be encompassed in the middle of claim scope of the present invention.

Claims (9)

1. a universal simulator, is characterized in that, comprises model deriving custom entities module, Cross support module, multi-thread concurrent execution module, distribution support module and fictitious host computer module; Wherein, model deriving custom entities module is connected with Cross support module, multi-thread concurrent execution module respectively, described Cross support module, multi-thread concurrent execution module are connected respectively on distribution support module, by the fictitious host computer module on described distribution support module and other main frame, communicate, other module in universal simulator is all moved in fictitious host computer module;
Described model deriving custom entities module comprises a plurality of simulation groups, and the simulation group described in each includes a plurality of simulation nodes, and described simulation node comprises that the functional unit by the goal systems that will simulate encapsulates the resource-type entity forming; Described simulation group, simulation node and resource-type entity are all called as simulation entity; Described model deriving custom entities module also comprises the system entity for the goal systems that will simulate is monitored and controlled, described system entity comprises for monitoring the probe of described simulation entity inner case, and for controlling the controller of described universal simulator;
Described Cross support module has realized to be simulated between inter-entity, described system entity described in described model deriving custom entities module and described system entity and described simulation inter-entity mutual; Between described simulation inter-entity, described system entity and described system entity and described simulation inter-entity mutual by representations of events;
Described distribution support module has been realized the migration on different main frames by the transportable entity in described model deriving custom entities module;
Described multi-thread concurrent execution module has been realized a plurality of threads on the main frame of described universal simulator place to there is the concurrent processing of event simultaneously;
Described fictitious host computer module, for abstract physical host, is held the various entities in described universal simulator, and auxiliary described distribution support module is realized the transparent support to distributing.
2. universal simulator according to claim 1, it is characterized in that, described Cross support module is when the alternative events for the treatment of of simulated inter-entity, according to the destination address of described event by this case distribution to simulation the resource-type entity in entity, described resource-type entity calls corresponding event handler and processes this event.
3. universal simulator according to claim 1, it is characterized in that, described Cross support module is when the alternative events of disposal system inter-entity or system entity and simulation inter-entity, this case distribution, to the invoke function of having realized the respective objects of interface Invokable, is processed by this function.
4. universal simulator according to claim 1, is characterized in that, described Cross support module also comprises that the event by described resource-type entity is sent takes turns doing by name assembling and fetches the dependence between decoupling zero resource entity by name chain; Wherein,
Describedly by name assembling, comprise and specify the target of the event that described resource-type entity sends and specify the event another name of this target when receiving; Describedly by name link, comprise that the event that described resource-type entity is sent sends to the analog node at target resource type entity place.
5. according to the universal simulator described in claim 1 or 4, it is characterized in that, described Cross support module also comprises that the event source of managing the event of sending with event object set is to the linking relationship between the event target of reception event; Described event target collection comprises the description to described linking relationship, and the event link relation generating according to strategy.
6. according to the universal simulator described in claim 1 or 4, it is characterized in that, described Cross support module adopts synchronous event interactive mode to process event.
7. universal simulator according to claim 1, is characterized in that, described distribution support module adopts the object broker method based on simplifying to realize the migration of transportable entity on different main frames; Wherein,
The object broker method of described simplification adopts a kind of name to be called the class of counterfoil, such generates corresponding object stub for described transportable entity on another main frame, described object stub compare with corresponding transportable entity there is same simulation node, same simulation group; To calling of described object stub, can be forwarded to the transportable entity of the correspondence being distributed on other main frame.
8. universal simulator according to claim 7, is characterized in that, preserves the entity list that is positioned at local transportable entity for recording in described fictitious host computer module, and for recording the counterfoil table of local all object stubs used; Described fictitious host computer module creates, obtains, destroys transportable entity according to described entity list and counterfoil table.
9. universal simulator according to claim 1, is characterized in that, described multi-thread concurrent execution module is distributed with reclaim mechanism and realized multithreading to there is the concurrent processing of event simultaneously by token.
CN201010282456.3A 2010-07-26 2010-09-10 General-purpose simulator Expired - Fee Related CN102346681B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010282456.3A CN102346681B (en) 2010-07-26 2010-09-10 General-purpose simulator

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201010239352.4 2010-07-26
CN201010239352 2010-07-26
CN201010282456.3A CN102346681B (en) 2010-07-26 2010-09-10 General-purpose simulator

Publications (2)

Publication Number Publication Date
CN102346681A CN102346681A (en) 2012-02-08
CN102346681B true CN102346681B (en) 2014-11-26

Family

ID=45545384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010282456.3A Expired - Fee Related CN102346681B (en) 2010-07-26 2010-09-10 General-purpose simulator

Country Status (1)

Country Link
CN (1) CN102346681B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105743668A (en) * 2014-12-09 2016-07-06 中兴通讯股份有限公司 Method and device for achieving function of package transmitting and receiving
CN109412834A (en) * 2018-09-11 2019-03-01 叮联信息技术有限公司 Event is uninterruptedly transmitted at random and shared information methods of exhibiting

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1805424A (en) * 2005-12-31 2006-07-19 华中科技大学 Gridding emulation method and its emulator
CN101309186A (en) * 2008-06-23 2008-11-19 南京大学 Design method of expandable general purpose type P2P network simulator

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW576999B (en) * 2002-09-24 2004-02-21 Inst Information Industry Flexible system simulation structure and interface thereof

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1805424A (en) * 2005-12-31 2006-07-19 华中科技大学 Gridding emulation method and its emulator
CN101309186A (en) * 2008-06-23 2008-11-19 南京大学 Design method of expandable general purpose type P2P network simulator

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《一个通用移动agent仿真平台的设计与实现》;曾鸿,李旭晖,何炎祥;《计算机应用研究》;20081231;第25卷(第12期);第3835-3838页 *
曾鸿,李旭晖,何炎祥.《一个通用移动agent仿真平台的设计与实现》.《计算机应用研究》.2008,第25卷(第12期),第3835-3838页. *

Also Published As

Publication number Publication date
CN102346681A (en) 2012-02-08

Similar Documents

Publication Publication Date Title
Abuseta et al. Design patterns for self adaptive systems engineering
Pokahr et al. The active components approach for distributed systems development
Diaconescu et al. Automatic performance management in component based software systems
Agirre et al. QoS aware middleware support for dynamically reconfigurable component based IoT applications
Farahbod et al. An abstract machine architecture for web service based business process management
Trubiani et al. Guilt-based handling of software performance antipatterns in palladio architectural models
Sahli et al. A bigraphical model for specifying cloud-based elastic systems and their behaviour
Kattepur Workflow composition and analysis in Industry 4.0 warehouse automation
US20150039285A1 (en) Methods and systems for scalable session emulation
CN102346681B (en) General-purpose simulator
RU2696299C2 (en) Control when initiating elementary tasks on server platform
Qasim et al. Formal specification and verification of real-time multiagent systems using timed-arc petri nets
Jrad et al. STRATFram: A framework for describing and evaluating elasticity strategies for service-based business processes in the cloud
Cesari et al. Formalising adaptation patterns for autonomic ensembles
Alelaimat et al. Xplam: a toolkit for automating the acquisition of BDI agent-based digital twins of organizations
Cicirelli et al. Using time stream Petri nets for workflow modelling analysis and enactment
Jarray et al. New adaptive middleware for real-time embedded operating systems
Arellanes Self-organizing software models for the internet of things: complex software structures that emerge without a central controller
Emery et al. Updating IEEE 1471: architecture frameworks and other topics
Qasim et al. Formal modelling of real-time self-adaptive multi-agent systems
Greulich et al. Cyber-physical multiagent-simulation in production logistics
Al Maghayreh et al. A framework for monitoring the execution of distributed multi-agent programs
Liu et al. Dynamic service integration for reliable and sustainable capability provision
Liu et al. Modelling and simulation of network enabled capability on service-oriented architecture
Moreland Jr Experimental Research and Future Approach on Evaluating Service‐Oriented Architecture (SOA) Challenges in a Hard Real‐Time Combat System Environment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20141126

Termination date: 20180910

CF01 Termination of patent right due to non-payment of annual fee