Reusable Component Model Development Approach for Parallel and Distributed Simulation

Model reuse is a key issue to be resolved in parallel and distributed simulation at present. However, component models built by different domain experts usually have diversiform interfaces, couple tightly, and bind with simulation platforms closely. As a result, they are difficult to be reused across different simulation platforms and applications. To address the problem, this paper first proposed a reusable component model framework. Based on this framework, then our reusable model development approach is elaborated, which contains two phases: (1) domain experts create simulation computational modules observing three principles to achieve their independence; (2) model developer encapsulates these simulation computational modules with six standard service interfaces to improve their reusability. The case study of a radar model indicates that the model developed using our approach has good reusability and it is easy to be used in different simulation platforms and applications.


Introduction
With the rapid development of simulation platforms and simulation applications during the last decades, in particular for parallel and distributed simulation, one of the most important challenges is how to respond quickly to new application requirements while reducing the development costs [1][2][3]. Building application from existing simulation models rather than from scratch is considered as a promising approach to improve the development efficiency, as well as to minimize engineering efforts and resource costs [4][5][6]. Reuse-oriented models are developed to be reused across simulation platforms with little or even no modification. At the same time, the reuse of component models together with visual programming technology makes it possible to drag and drop existing component models to assemble the simulation application, thus significantly reducing development time [7][8][9]. In addition, model reuse not only improves productivity but also has a positive impact on the quality of software products because of the obvious fact that a simulation application will work properly if it has already worked before [10,11].
Motivated by the advantages of model reuse, various reusable model development approaches have been developed. (1) Based on a specific modeling language in which people designs special simulation function module as primitive and control module as simulator, different models created with the same modeling language can be reused for the corresponding simulator. However, most of simulation modeling languages are usually related to domain knowledge closely and each research field involves some specific platforms, so that there is congenitally deficiency for them to create models that can be reused across multidomain platforms, such as continue system simulation language ACSL [12], discrete event system simulation language GPSS [13], and multifield physical simulation language Modelica [14].
(2) Using a modeling specification which defines uniform internal structure, behavior constraint, and external interfaces for models, models will have good reusability if they do not bind with any platforms. However unfortunately, existing modeling specifications do not emphasize that model development should be independent with other simulation platforms. For example, ESA proposed a reusable simulation model description specification SMP (Simulation Model Portability Standards) [15,16]. It is not supported well to reuse the models on other runtime platforms, because the execution of a SMP model depends on services provided 2 The Scientific World Journal by the SMP simulation platform. The University of Arizona gives a thorough discussion of parallel discrete event system specification DEVS [17], which mostly focuses on the hierarchical structure of components. (3) Some models are based on simulation environment which provides runtime supporting platform for model running. The reusability of them is also limited. Taking HLA [18] for instance, each federate provides some interfaces which compiles with the HLA interface specification, and federates developed by different developers can communicate with each other via the runtime infrastructure using these interfaces. But these federates are hard to use in other simulation platforms, such as SUPE [19], POSE [20], and Charm++ [21], because these platforms cannot "identify" any HLA service interfaces. In summary, as far as the authors know, there is not an adapted approach to guide users to develop models to achieve model reuse across platforms currently. Therefore, we have to identify a reliable way to develop what we mean by a "reusable" component model. Such an approach may help us not only to learn how to build reusable components but also to recognize whether a component model can be reused in a new simulation application.
In this paper, we first discussed a reusable component model framework composed of a simulation computational module and six well-defined standard interfaces. Next we proposed a reusable component model development approach, which contains two phases. In the first phase, the independent simulation computational modules are implemented under three principles. In the next phase, model developers encapsulated these simulation modules with the six standard interfaces to improve their reusability. Our final goal is to achieve flexible cross-platform reuse and fast composition of component model in parallel and distributed simulation.
Section 2 discusses the process of a reusable component model-based simulation application development. Section 3 introduces a reusable component model framework and discusses the execution flow of six service interfaces. Section 4 presents our reusable model development approach which elaborates the three principles that domain experts must observe and the encapsulation process. Section 5 describes a case study in the field of military simulation, to create a reusable radar model which can be reused in air-defense and antimissile of naval vessel system. Finally, our conclusion will be made with an indication of the future work.

Reusable Component Model-Based Simulation Application
The term reusable component model refers to an independent replaceable part of a simulation application that can be independently developed and delivered as a unit and reused in different platforms [22]. Such component models can be selected from a model resource library, thus reducing both model developing time and costs when compared with a new development [23]. Meanwhile, reuse increases the reliability of the components, furnishing added "testing, " with the consequence that library component models are more reliable and less prone to faulty behavior [24].
Component-based software development is associated with a shift from object-oriented coding to system building by plugging together components [25]. Figure 1 shows the simulation application development process based on reusable component models in parallel and distributed simulation. Component models are selected from a model resource library to construct simulation executable units, namely, simulation entities, which are used to assemble a simulation application running on the corresponding simulation platform. Unidirectional dotted lines between component models represent that simulation entity dispatches component models to compute according to the input and output relationship, while bidirectional active lines between simulation entities represent that simulation entities communicate with each other via external services provided by the corresponding simulation platform. Because simulation entities are different between various simulation platforms, if there are no constrains for model development, these models will be hard to reuse across different simulation platforms. As discussed earlier, models which call HLA interfaces are hard to be used in any other discrete event simulation platforms. Thus, to achieve model reuse not only in HLA, but also in many other simulation environments, we have to define a component model framework as a standard reusable model specification first.

Reusable Component Model Framework
Our reusable component model framework mainly contains a simulation computational module and six standard service interfaces. The simulation computational module is the internal implementation which contains a set of mathematical functions to model a process or function in real world. Six service interfaces, including state restoring interface, input interface, dynamic data driven interface, business process interface, state getting interface, and output interface, are used to encapsulate the internal mathematical functions provided by the simulation computational model. Thanks to the six standard interfaces, the reusable component model is very easy to be assembled or replaced rapidly, which will decrease software development time. Figure 2 shows the reusable component model framework. As the figure shows, there is a configuration file parsing interface outside the simulation computational module. That is because most of component models have several attributes which need to be configured to satisfy the different demands for different simulation applications. Taking a radar model for example, we can assign different values for radar crosssection, probability of false alarm, or length of antennas to implement suitable radars for some specific applications. Moreover, our component model framework provides a state rolling back strategy, which makes the component model used in the simulation application with optimism mechanism. Different from many other methods storing the state of a model by itself, our strategy uses the state getting interface to get the model state data by the outside simulation entity. Then the simulation entity will define a roll back variable to save the state data, so no models need to do the "saving" thing. When rolling back happened, the simulation entity gets the value of   state variable referent to the current simulation time, and then it calls the state restoring interface using the state variable as parameter to roll back the state of the reusable component model. Figure 3 shows the execution flow for a reusable component model, the details of which are described in the following.
(1) Call state restoring interface setstate (S) to restore the state of the component model to S, which is a variable saving the state data of the simulation model. If this interface is called in the first time, S is on behalf of initial state data; otherwise, S is the state data stored by external simulation entity after once computation.

Two-Phase Development Approach
As discussed above, a component model can be considered as an implementation of a system, process, or function. It usually has a close relationship with multidisciplinary domain knowledge such as hydromechanics and aerodynamics, so that a software developer without domain expert's help cannot afford to create a model with high quality.
On the other hand, if we know there are some component models that we can use again, probably with some slight  modification, then we will do so as long as we trust the person who creates the model [26]. As lack of guideline for component model encapsulation, the models are usually characteristic of diversiform interfaces, coupled tightly, and bound together with simulation platforms. This implies that the integration of these models to a simulation application is a great challenge for developers, not to mention to reuse them.
In view of the above reasons, our reusable model development approach contains two phases shown in Figure 4. In the first phase, domain modelers create a simulation computational module distributed observing three principles in the following, not only to reduce the overlap time of development, but also to improve its credibility. In the next phase, this simulation computational module is encapsulated to a reusable component model by a model developer according to the above six service interfaces to improve its reusability.

Phase 1: Domain Modeler Implements Internal Simulation Computational
Module. According to component-based simulation application development paradigm, component models are to be reused across various products and product families. Since the internal state transmission functions are provided by the simulation computational module, to achieve model reuse across different platforms, the simulation computational module must be characterized and constrained properly. There are three principles that domain modeler must observe while creating simulation computational modules.  same simulation entity, like ModelA and ModelB, SimEntity1 will dispatch ModelB to compute first and then takes the output data of ModelB as the input data of ModelA. If the two models are in different simulation entity, like ModelB and ModelG, SimEntity1 will also dispatch ModelB to compute first and then transfers the output data of ModelB to SimEntity3, which will receive the data and paper it as the input data of ModelG.
(2) Simulation Computational Modules Should Be Independent with Simulation Platforms. Simulation execution can be taken as several simulation computational modules running on a simulation platform. The simulation platform provides runtime environment for these computational modules. However, there are great differences between the mechanisms of different simulation platforms. For example, in Figure 6, in HLA, component models are used to construct federates which communicate with each other via HLA service interfaces provided by the runtime infrastructure, while, in discrete event simulation, component models are used to construct simulation objects which communicate with each other by calling event-scheduling interface provided by corresponding simulation engine. As a consequence, to achieve model reuse across different simulation platforms, the implementation of computational modules should be independent with simulation platforms; in other words it cannot call any service provided by any simulation platforms. If a component model calls HLA service interfaces directly, it is hard to be reused in other simulation platforms. (

2) Input Interface (int input(InputDataTypeX inputData)).
This interface aims to provide input data for this model, where InputDataTypeX(X=0, 1, 2 . . .) is a user defined data type and inputData contains data of all the input variables needed to be assigned. Before calling this interface, the simulation entity applies enough memory for inputData to save data derived from another model output. The simulation entity usually needs to call this interface more than once for different input variables assignment because of various InputDataTypeX.
(3) Dynamic Data Driven Interface (int driven(Dynamic DataTypeX dynamicData)). This interface aims to provide dynamic data for this model, where DynamicDataTypeX (X=0, 1, 2, . . .) is a user defined data type and dynamicData contains data of all the dynamic input variables needed to be assigned. We design this interface to support that a model usually needs to receive some unexpected data to amend its behavior under execution, such as adjusting radar crosssection or length of antennas for a radar model. Before calling this interface, the simulation entity applies enough memory for dynamicData to store data derived from outside environment. The simulation entity usually needs to call this interface more than once for different dynamic input variables assignment.

(4) Business Process Interface (int process(double dSimuTime)).
This aims to call internal transmission functions provided by the simulation computational module to implement the business logic, where dSimuTime refers to the current simulation logical time.

(5) Output Interface (int output(OutputDataType & ouput-Data)
). This interface aims to get output data from this model, where outputDataTypeX (X=0, 1, 2,. . .) is a user defined structure type and ouputData contains all of the  )). This interface aims to get the current state of simulation model, which will be stored in a string parameter, where simuState is a reference to a string parameter defined in the external simulation entity. After the component model execution finished, the simulation entity will use simuState as a parameter to call state restoring interface, where the state data of this model will be stored into parameter simuState. After encapsulation finished, component models can be tested and executed in other projects. In order to facilitate component models reused across various products and product families, interface parameters of models will be added into model's informal descriptions, which with "domain, " "purpose, " and "usage time" together will be written into a model description file using XML technology to help users understanding how the component model works; see Table 1.

Case Study: A Reusable Radar Model
Model reusability appears to be a topic of notable interest in the simulation research community and in selected application areas [27], especially in military simulation. Radar was originally developed to satisfy the needs of the military for surveillance and weapon control [28]. In this section, we take the radar model under a complex electromagnetic environment, for example, to test and verify our reusable model development approach. application are illustrated in the simple block diagram of Figure 7. The radar signal is generated by the transmitter and radiated into space by the antenna. Reflecting objects (targets) intercept and reradiate a portion of the radar signal, a small amount of which is returned in the direction of the radar. The returned echo signals which contain target echo signal, clutter echo signal, and interfering signal under complex electromagnetic environment are collected by the radar antenna. The thermal noise of radar itself will also be considered. According to the radar equation, after signal processing and data processing, we compute statistical probability of radar to detect a target. If the output of the radar receiver is sufficiently larger than a random variable, detection of a target is said to occur [29].

Create Simulation Computational
(1) The radar equation gives the range of a radar in terms of the radar characteristics, one form of which gives the received signal power as [29] = 4 2 × 4 2 × .
The received signal powers are influenced by three factors to represent the physical process. The first factor is the power density at distance meters from radar that radiates a peak power of watts from an antenna of transmission gain . The value of the second factor is the target cross-section in square meters. The third parts contain antenna reception gain , radar wavelength , and radar comprehensive loss .
(2) The receiver noise power generated by radar is described as [29] = . ( The thermal noise is equal to , where is Boltzmann's constant, = 290 K is the temperature (approximately room temperature), and is receiver bandwidth. The receiver noise is the thermal noise multiplied by the factor .
(3) When the detection of the radar signal is influenced by an external noise source, such as a deliberate noise jammer, the receiver noise power is now that determined by the jammer (radar active interfering) rather than the receiver noise [30] where = jammer range from radar, = jammer bandwidth, = jammer power, = jammer antenna gain, = jammer comprehensive loss.
(4) The interfering unwanted clutter echoes can severely limit the detect ability of the target, such as chaff interfering signal in military simulation. So the receiver passive interfering signal power is described as [31] where is chaff antenna gain, is chaff cross-section, and is chaff range from radar. (5) The minimum detectable signal can be expressed as the signal-to-noise ratio required for reliable detection times the receiver noise [32] SNR = + + .
So in complex electromagnetic environment, the probability of radar to detect target can be written as where is radar anti-interference factor, is number of pulses, and is the probability of a false alarm.
(6) Because radar equation generates statistical probability of detection, it needs a random variable to make decision. Supposing between [0, 1] is a random variable generated through Monte Carlo, if ≤ , we said that the target has been found.
We analyze the above mathematical formulas and transform them to the state transmission functions of the radar module in Table 2. According to parameter sources, we divided them into two categories. One is initialization parameter which is derived from the radar configure file, while the other is input parameter, which is derived from the output of other models.

Encapsulate with Service
Interfaces. According to the state transmission functions of radar module in Table 2, ParseConfigure provides access to radar configured file for external simulation entity. The dynamic data driven interfaces driven (JammerStruct jammer) and driven (ChaffStruct chaff) provide dynamic data for functions ComputeJam-merPower and ComputeChaffPower. The input interface input(TargetStruct target) provides target data for function ComputeEchoPower. The business process interface will call ComputeEchoPower, ComputeJammerPower, ComputeChaff-Powe, ComputeProbability, and ComputeDetected to implement behavior logic of the radar model according to the 8 The Scientific World Journal Use state getting interface to get value of parameter detected that represents whether the target has been found or not. The execution flow of the radar reusable component model is described in the following; see Figure 8.
To illustrate the code structure of our reusable component model framework, we use C++ programming language for example to implement the radar component model shown in Algorithm 1.

Results and Discussion
Air-defense and antimissile of naval vessel is a typical scene in military simulation application [33,34]. It usually contains three kinds of simulation entities: naval vessel, battle plane, and guided missile. The procedure of air-defense and antimissile of naval vessel is that, firstly, the battle plane opens its radar to search targets (naval vessel). Once it finds an enemy naval vessel, the battle plane will launch a guided missile to attack it; secondly, the guided missile flies to the enemy naval vessel under the control, and in the end of flight, it will opens its radar to locate the target by itself; finally, the naval vessel detects the guided missile using its radar and then uses jammer and interceptor missile for antimissile and airdefense. Figure 9 shows the discrete event simulation application of air-defense and antimissile of naval vessel built with our visual modeling tool. A rectangular block represents a simulation entity and a small picture within the rectangular block represents a model in the right editing area. The component models, such as radar model, jammer model, and interceptor missile model, can be dragged and dropped from model resource panel on the left to construct simulation entities. They are connected with bidirectional active lines to build the air-defense and antimissile of naval vessel simulation application. Comparing with more than one hour cost through writing code manually, we only take less than 10 minutes to finish it using the visual modeling tool shown in Figure 10. It is only needed to move the mouse and the application code will be generated automatic in the background, thus significantly reducing development time.
We can see that each simulation entity, the naval vessel, the battle plane, or the guided missile, contains a radar component model. Although there are discrepancies between the radar component models in different simulation entities, maybe different wavelength, different transmission gain, or different interface parameters, it only needs to modify the configured file or adjust the external parameters to satisfy different demands rather than developing different models. For instance, while comparing the radar model in the guided missile within the naval vessel, the former has jammer and chaff data as parameters in its execution, but the latter has not. In this situation, the radar model in naval vessel will not  call driven interface, and that is why we call it dynamic data driven interface. We can also assign different values for radar transmission gain or radar wavelength in the configure file to achieve suitable radars for the three kinds of simulation entities. Thus the same model can be used in different simulation entities that illustrates that the models developed using our approach have good reusability.
Moreover, the radar model has been used in a training simulation system based on HLA [35,36]. Figure 11 shows the architecture of the training simulation system. The airborne radar federate and the ground radar are the detection radars which are used to detect targets in two orientations. The radar countermeasure federate searches and parses the detection radar signal under complex electromagnetic environment. Based on the detection radar signal information, the radar jammer federate produces the external noise to interfere the two detection radar federates. The display federate, the data process federate, the effect evaluation federate, and the scene simulation federate are used to process data, display detecting result, and interfering effect.
In the radar countermeasure training simulation system, the airborne radar federate and the ground radar federate use   Figure 11: The architecture of a radar training simulation system. the same radar model to implement their functionality. The practical project illustrates that the radar model is also very easy to be assembled in HLA-based distributed simulation system.

Conclusions and Future Work
Model reusability is very important for parallel and distributed simulation application development, not only for minimizing engineering efforts and resource costs, but also for improving the reliability. Current model development methods face several obstacles hindering model reuse across simulation platforms and simulation applications, such as diversiform interfaces, coupled tightly, and bound together with simulation platforms. To solve these problems, in this paper, we first presented a framework to define what we mean by "reusable" component model and then proposed a two-phase model development approach. In the first phase, the domain modeler builds a computational module that is independent with other models and simulation platforms.
In the second phase, the model developer encapsulates the module with the framework as a model specification. At last, we tested our reusable component model development approach using a radar model and its application of airdefense and antimissile of naval vessel. Our method has been successfully applied in several projects. The case study and these practical applications illustrate that the simulation models created with our method have good reusability and facilitation to be assembled. They can also be used in different simulation platforms and applications. As for our future work, we plan to study the algorithm for component models selection to suggest how to select component model to fulfill the requirements of different clients.