#### Abstract

Continuous system can be discretized for computer simulation. Quantized state systems (QSS) method has been used to discretize time invariant systems based on the discretization of the state space. A HLA based QSS method is proposed in this paper to address issues of real-time advancements in simulation and an aircraft control example was introduced to illustrate our method. Moreover, to simulate time varying systems, a novel approach is also proposed and exemplified with a practical case.

#### 1. Introduction

Continuous system simulation is a topic which has advanced significantly with the appearance of modern computers. Based on classic methods for numerical resolution of ordinary differential equation (ODE) such as Euler and Runge-Kutta, several variable steps and implicit ODE solver methods were developed. These modern methods which usually make use of iteration rules and symbolic manipulation allow the efficient simulation of complex systems, including differential algebraic equation (DAE) and variable structure systems.

Although there are several differences between the mentioned ODE solver algorithms, all of them share a property: they are based on time discretization. That is, they give a solution obtained from a difference equation system (i.e., a discrete-time model) which is only defined in some discrete instants.

A completely different approach for ODE numerical simulation has been being developed since the end of the 90s. In this new approach, the time discretization is replaced by the state variables quantization and a discrete event simulation model (within the DEVS formalism framework) is obtained instead of a discrete-time one.

Discrete event system specification (DEVS) [1–3] is a formalism which allows representing and simulating any system having a finite number of changes in a finite interval of time. In that way, systems modelled by petri nets, state charts, event graphs, and even difference equations can be seen as particular cases of DEVS models.

The origin of the quantization based integration methods can be found in the definition of quantized systems and their representation in terms of DEVS models [4]. This idea was reformulated with the addition of hysteresis and it was formalized as a simulation method for ODEs in [5, 6] where the quantized state systems (QSS) were defined. Moreover, there exist some other approaches such as Backward QSS and Centered QSS [7–9]. But all the previous works using QSS to simulate continuous systems did not address the issue how to implement QSS in real-time distributed simulations such as high level architecture (HLA) and distributed interactive simulation (DIS). They did not mention the approach to extend QSS to time varying simulations either. As such, this paper proposes QSS based researches on both real-time and time varying simulation methods, where QSS must be extended for simulation. To accomplish this, we develop a way to keep the real-time synchronization in high level architecture (HLA) distributed simulation environment and propose a method to simulate time varying system.

The paper is structured as follows. In Section 2, key technologies of QSS are introduced and analyzed. Section 3 introduces the proposed distributed QSS framework to address real-time systems and a validation example is designed and results are shown and analyzed. In Section 4, a new method of time varying case is proposed and illustrated with a practical example. Finally, conclusions are drawn and future works are discussed.

#### 2. Quantized State Systems (QSS)

Consider a continuous system model:

represents a set of state variables, represents a set of input variables, represents a set of state derivate variables, represents a set of output variables, represents the state transform function, and represents the output function.

To deduce quantization function, let be a set of real numbers, where . Let be the set of piecewise continuous real valued trajectories and is a continuous trajectory. Let be a mapping and let , where the trajectory satisfies

Then the map is hysteretic quantization function [2]. is a set of quantized state variables used to simulate of (1), where the discrete values are called quantization levels and the distance is defined as quantum, which is usually constant. The width of the hysteresis window is . The values and are the lower and upper saturation values.

Replace on the right side of (1) with . The approximated model is as the following equation shows:

Kofman and Junco [1] proved that if has piecewise constant and bounded trajectories and is continuous and bounded, then , and have piecewise constant trajectories.

#### 3. Real-Time Simulation of Time Invariant System in HLA

Although previous works [7–9] introduced hysteretic quantization function above, they did not address the issue how to fulfill time management in real-time distributed simulations such as DIS and HLA systems. To tackle this problem, we propose using RTFederate in distributed simulations such as HLA and DIS systems. This method is about real-time management and is generic to all distributed simulations. Therefore we will use HLA as our example system in this section.

##### 3.1. RTFederate: A Time Control Member

As shown in Figure 1, RTFederate mainly has three components: Time Memory, Real Timer and RTI Interface. They are designed to ensure that the time scale in simulation is identical with that of real world time. RTFederate would be an independent federate in HLA, and its time management strategy is set as both Constrained and Regulation.

For the component of Time Memory, it needs to set a minimum time step denoted as ; it would be a positive integer.

RTFederate module would get the allowed advance time from RTI through RTI Interface and then add it to the Time Memory. If the value in Time Memory is smaller than , Time Memory would request time advance with through RTI Interface. Otherwise, Time Memory would transfer the value to Real Timer and then reset the value to zero. Real Timer would count of unit time. means the largest integer which is smaller than . At the end of the count, Real Timer would request time advance with through RTI Interface.

##### 3.2. Real-Time Simulation

Each of the subsystems would be discretized with QSS method and be treated as a federate in HLA. The time management mode of all the federates should be set as “both Constrained and Regulating”. Also, RTFederate module needs to be set with the same mode. In HLA, Runtime Infrastructure (RTI) software would allow time advance only if all of the federates request to advance and the least requested time step would be allowed. Figure 2 shows the procedure of time advance.

Only if RTFederate especially requests to advance, RTI would allow its time advancement. So the simulation speed would be controlled by RTFederate module and then it would support real-time simulation.

##### 3.3. Example of Time Invariant System

Consider a vertical control system of a plane as the following equation shows:

The symbols in the equation are listed below.

*The Symbols in (4).* The symbols are as follows: : change value of plane velocity, state variable; : change value of attack angle, state variable; : change value of pitch angle, state variable; : change value of pitch rate, state variable; : derivative coefficient of -axis force (body axis) caused by velocity; : derivative coefficient of -axis force (body axis) caused by attack angle; : derivative coefficient of -axis force (body axis) caused by pitch angle; : derivative coefficient of -axis force (body axis) caused by throttle control lever; : derivative coefficient of -axis force (body axis) caused by velocity; : derivative coefficient of -axis force (body axis) caused by attack angle; : derivative coefficient of -axis force (body axis) caused by the deflection of elevator; : derivative coefficient of rolling moment caused by velocity; : derivative coefficient of rolling moment caused by attack angle; : derivative coefficient of rolling moment caused by changing rate of attack angle; : the derivative coefficient of rolling moment caused by pitch rate; : the derivative coefficient of rolling moment caused by throttle control lever; : the derivative coefficient of rolling moment caused by the deflection of elevator; : change of deflection angle of elevator; and : changes of the position of thrust lever.

The system is discretized with QSS method, the quantum unit is and so as the hysteresis, and the initial conditions are .

Figure 3 shows the response of , which is a long period transition process.

As seen from Figure 3, the step intervals became smaller when gets close to peak values, where the values change severely. On the other hand, the step intervals get bigger when reaches a relatively stable status, where the value does not change much.

Table 1 shows the step interval around the first peak value, and Table 2 shows the step intervals in relative stable status. The results indicate that the QSS method reduces the redundant calculation and improves the simulation efficiency.

To be simulated in distributed environment each of the state variables would be treated as a federate and in addition to RTFederate module it has five federates in total. Considering the procedure of time advance shown in Figure 4, we have the following time advance equations for these federates: Federate1: ; Federate2: ; Federate3: ; Federate4: .

#### 4. QSS for Time Varying System

##### 4.1. QSS Method for Time Varying System

In the previous section, a QSS method of time invariant system is proposed. However, in practical systems, there exist time varying state variables. And in this section, we proceed to propose a QSS approach of time varying system (TVS).

Consider the TVS as follows:

When (), (5) follows to be

At this point, state derivative is and simulation advances to . When , (5) can be rewritten asand the state derivative is . If and have the same signs, the state derivative of is regarded as and simulation is advanced to based on selected quantum of . If and have different signs, it means the sign changes during ; then advance time should be shortened half as :

Reconsider ; if and have the same signs, then state derivative of is and simulation advances to . Otherwise the advance time is shortened half again until the two state variables have the same signs.

##### 4.2. Example of Time Varying System

Consider

Equation (9) is an instance of TVS, with the initial conditions: . At initial time . The quantum of is set to and the advancing step is . In the first step, the simulation time advances to and . As and have the same signs, state derivative of is .

The analytical solution of (9) is and Figure 5 shows the trajectories of (9) produced by QSS method and the analytical solution, respectively. As we can see, they are almost identical with each other, except the difference in step intervals. The QSS method is more computationally efficient.

The trajectory values at some time points are listed in Table 3. We can also get the conclusion that the result of our method corresponds to analytic curve with minor errors.

#### 5. Conclusions and Future Work

The paper discretizes the continuous system using QSS method which is based on the quantization of the state space to improve the simulation efficiency. QSS method transforms the continuous system to the discrete event model. The paper introduces both time invariant and time varying methods to support different system simulations. QSS method guarantees the stability and convergence under some conditions and it is not adapted to all the continuous system simulations yet. We need to extend the application range in the future.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgments

The research in this paper was supported by Grants 61473013 and 61104057 from the Natural Science Foundation of China and funding of the Science and Technology on Complex Land Systems Simulation Laboratory (63963). The authors thank the reviewers for their comments. This work is based on one of our conference papers of AsiaSim 2012 [10]. The simulation section is extended to cover time varying systems and the results of time invariant system are further explained and corrected.