Design of Real-Time Hardware-in-the-Loop TV Guidance System Simulation Platform

This paper presents a novel design of a real-time hardware-in-the-loop (HIL) missile TV guidance system simulation platform, which consists of a development computer, a target computer, a turntable, a control cabin, and a joystick. The guidance system simulation model is created on the development computer by Simulink and then downloaded to the target computer. Afterwards, Simulink Real-Time runs the model in real-time. Meanwhile, the target computer uploads the real-time simulation data back to the development computer. The hardware in the simulation loop is TV camera, encoders, control cabin, servomotors, and target simulator. In terms of hardware and software, the system has been simplified compared with the existing works. The volume of the turntable integrating the target simulator and the seeker simulator is about 0.036 cubic meters compared to the original 8 cubic meters, so it has a compact structure. The platform can perform the closed-loop control, so the simulation has high precision. Taking the TV guidance simulation as an example, in the case of target maneuvering, the final miss distance of the TV guidance missile is 0.11812m, while the miss distance of the original system is 13m.The trajectories obtained from the HIL andmathematical simulations substantially coincide. So the simulation results show that the proposed HIL simulation platform is effective.


Introduction
In recent years, with the breakthrough of computer, the mechanical and electrical control technologies are becoming more and more mature.The development and application of the system simulation technology also rise to a new stage.In order to improve the fidelity of the simulation, parts of the physical system are inserted into the simulation loop, instead of pure mathematical model.This simulation technique is called HIL simulation.Real-time is the most striking feature of the HIL simulation [1].
In order to assess the performance of missile, a lot of simulation experiments need to be done in the development process.Normally, the human, material, and financial resources consumption of the field experiments is so large that the field experiments are conducted in the final stage of the development of the missile.However, the missile's HIL simulation can be carried out repeatedly in the laboratory, and it is very economical.There are many related works in this field.Chen et al. [2] designed a hardware-in-the-loop simulation platform of infrared guidance system.Khamis et al. [3] designed an in progress investigation on the hardware in loop simulation (HILS) for semiactive homing guidance and control system.Fan et al. [4] designed a hardware-in-the-loop simulation system for guided shell based on laser semiactive seeker.However, each suffers from its own drawbacks, which are reliability, price, weight, and size.Pavic et al. [5] designed a new type of flight simulator for manual commands to lineof-sight guided missile.The simulator enables the operator to spot and track both the target and the missile on the monitor display and generates the steering commands by joystick in order to minimize the difference between the target and the missile line-of-sight.The simulator works well.But compared to [6], the physical parts in the simulation loop are only the operator and the joystick, so the simulation fidelity is not high enough.Liu et al. [6] designed a Simulink/RT-LAB based HIL missile guidance system simulation platform; the platform used infrared seeker, guidance processor, rudder control motors, airframe, and target simulator as the actual physical components in the simulation process.The whole simulation system is capable of simulating a number of guidance and control laws.The platform can simulate the actual engagement environment as much as possible, whereas each part is so large that the whole platform is about 8 m 3 .The structure and the process of simulation are complex.So it is inconvenient to employ.Moreover, the miss distance is nearly 13 m.The precision is low.Motivated by the difficulties experienced in the above, this paper presents a simple, small, and cheap design for missile TV guidance system HIL simulation platform.The presented platform can easily be used for engagement process simulation, attitude response testing, and seeker simulator performance testing.This paper explains in detail a realization of the platform for HIL simulation, its capability, and its advantages.
This paper is structured as follows.Section 2 introduces the hardware structure of the platform and the relationship between each part and the signal transfer process.Section 3 shows the realization process and simulation results of the TV guidance HIL simulation.Other functions that can be realized by the platform are implemented in Section 4. Conclusions and future work are finally given in Section 5.

System Structure
As shown in Figure 1, the overall platform adopts the structure of a development computer, a target computer, a turntable, a control cabin, and a joystick.It is mainly based on the latest version Matlab5 [7]'s real-time simulation module called "Simulink Real-Time" [8].
The operator can build, modify, and compile the simulation model conveniently by Simulink [9]'s powerful modeling capability and abundant mathematical calculation functions as well as Simulink Real-Time's extensive hardware support capability, efficient code compilation capacity, and real-time hardware emulation capacity.The simulation model built on Simulink can be downloaded to the target computer and then drives the seeker simulator and the target simulator.It becomes evident from Figure 2 that the system is simplified a lot as opposed to [6].
Each part of the platform will be introduced one by one in the following.Researchers can set up their own mathematical model on the Simulink, then use Simulink Real-Time to compile the dynamic system model into highly efficient C language codes, and download them to the target computer by the TCP/IP mode.Meanwhile, Simulink Real-Time also allows the development computer to receive the real-time data from the target computer, and then the development computer gets the information needed after the real-time data processing.
In the process of simulation, the development computer is also a video workstation for real-time video processing.After the analog video signal of the seeker simulator is transmitted to the video station, the analog signal is converted into digital signal by the video capture card.The deviation angle between the target center and the center of field of view can be obtained by a self-designed video processing software.This deviation angle is called missile boresight error .The development computer uses RS232 communication technology to transfer the missile boresight error information to the target computer.The guidance model running on the target computer takes the boresight error as guidance information.
A joystick is installed on the video workstation.The joystick signals are transmitted to the video station over USB.Before the missile is launched, the operator can change the position of the wave gate by manipulating the joystick in order to search and lock on the target.After the missile is launched, the operator monitors the entire process of engagement with the display terminal.If the target is lost or a more important target appears, the operator can relock on the target using the joystick.In this way, the "man-in-the-loop" TV guidance simulation is realized.

Target Computer.
The target computer is also an IPC, which is the operation center of the whole system.The target computer uses a U disk which has installed the DOS system as the starting disk.And some boot files generated from the development computer are put in the U disk in order to start the Simulink Real-Time in the target computer.
A NI-PCI 6601 [10] card is installed on the target computer, which collects the pulse signal from the corresponding encoders of the seeker and the target simulators' servomotors.The position, velocity, acceleration, and other pieces of information of the missile and target simulators can be obtained after signal processing.Meanwhile, the NI-PCI 6601 card outputs the motor control signals to the corresponding servomotors of the seeker and target simulators.
The target computer transfers the real-time data to development computer through Intel8254x gigabit network card by TCP/IP mode.

Control Cabin.
The self-designed control cabin is shown in Figure 3.The core of the control cabin is the Printed Circuit Board (PCB) which is mainly based on a single chip microcomputer (SCM).The SCM is the core of a series of circuit and communication interfaces.The control cabin has two modes of operation, automatic control, and manual control.
Unless the real-time model downloaded to the target computer is started, the control cabin operation mode is the manual control mode.The corresponding knobs under the LED display screens are used to manually adjust the target and the missile simulators' angular position.
When the real-time simulation model downloaded to the target computer is started, the control cabin turns to the automatic control mode.At this point, the two control knobs cannot control the motion of the seeker simulator or the target simulator.The control cabin receives the commands from the target computer, and these commands are processed by the SCM in order to control the servomotors in the turntable with the driving circuits for motors.Meanwhile, the control cabin receives signals from the corresponding encoders of the seeker simulator and the target simulator and passes them to the target computer for further processing.Thus, a closed-loop control is realized in the above process.

Turntable.
As shown in Figure 4, the self-designed turntable integrates the missile and target simulators into only one frame.The coaxial design achieves the concentric and independent rotation of the missile and the target.The special structure of the turntable makes itself very small and can be carried by a single hand.The turntable has been applied for national invention patent of China; the application number is 201610015363.
A TV camera (a CCD color camera) is installed on the top of the turntable, which is equivalent to the TV seeker.The image information collected by the CCD camera can be transmitted to the video workstation through a conductive ring and video lines.The TV camera's power is provided by the control cabin.By using the conductive ring, the seeker simulator can rotate 360 degrees freely, and the image quality of the video is high.
Another important part of the turntable is the target simulator which is used to simulate the motion of the target.In addition, the target simulator also provides the optical characteristic information for the seeker.
The motion of the seeker and target simulators are driven by their corresponding servomotors.The shafts of the seeker and target simulators drive the corresponding encoders, and the encoders generate pulse signals.The signals of encoders are transmitted through control cabin to the target computer for real-time processing.Meanwhile, the target computer uses the information to get the control commands for the motion of the seeker and target simulators and then transmit them back to the control cabin.The control cabin transforms the signals calculated from target computer to the motor driving commands.
The physical connection between the various parts of the HIL simulation platform is shown in Figure 5.

The Realization of HIL Simulation
By using the HIL simulation platform introduced above, a variety of simulation experiments can be carried out.
For example, the procession of the TV guidance engagement simulation is studied.

Mathematical Engagement Modeling.
A typical engagement model [11] studied in this paper is shown in Figure 6.
Here, the missile uses the proportional navigation guidance law.Theoretically, the proportional navigation guidance law issues acceleration commands, perpendicular to the instantaneous missile-target line-of-sight, which are proportional to the line-of-sight rate and closing velocity.Mathematically, the guidance law can be stated as where   is the acceleration command (in m/s 2 ),   is a unitless designer-chosen gain (usually in the range of 3-5) known as the effective navigation ratio,   is the missile-target closing velocity (in m/s), and λ is the line-of-sight (LOS) angle (in rad).The overdot indicates the time derivative of the LOS angle or the LOS rate.
In the engagement model, the target can maneuver evasively with acceleration magnitude   .Here, the target does the following maneuver: where  = 9.8 m/s 2 .Since target acceleration   in the preceding model is perpendicular to the target velocity vector, the angular velocity of the target β can be expressed as where   is the magnitude of the target velocity.Then, all of the differential equations required to model a complete missile-target engagement in two dimensions can be easily deduced from Figure 6.They are as follows: where 1 and the 2 in the subscript represent the horizontal and vertical directions, respectively. is the flight-path angle of the target,   is the magnitude of the missile velocity,   is the missile acceleration components in the Earth coordinate system, and   is the distance from the missile to the target.
The initial condition is as follows.
Here, the effective navigation ratio   is 4.

HIL Simulation Modeling.
Firstly, as shown in Figure 7, a simulation model based on the preceding engagement model is built by Simulink.The "engagement model" subsystem is based on the mathematical engagement model in the above section.The "LOS" system in Figure 7 is comprised of "Target_Motor," "Seeker_Motor," and "TV Seeker" subsystems as shown in Figure 8.The components and functions of the three subsystems are described in the following text.
The "engagement model" subsystem's output "lambda_dot," namely, λ , calculated from ( 4) is the input velocity command of "LOS" subsystem for driving the target simulator at certain velocities through one of the two motors fixed in the turntable.In the meantime, the other motor is used for driving the TV camera to follow the target as far as possible utilizing the input command "lambdadot_c" from the "TV Seeker" subsystem.Therefore, the control parameter of the motors in this HIL simulation is their angular velocity.Figure 9 shows the theoretical line-of-sight (LOS) rate of the engagement mathematical simulation.
The magnitude of the mathematical LOS rate is about 0.7 deg/s, and the whole engagement process costs 11.17 s.So the target simulator's rotation reach in the HIL simulation can be estimated according to Rotation reach = 0.7 deg/s × 11.17 s = 7.819 deg. ( However, this reach is so small that the rotation of the target simulator cannot be clearly observed in one simulation.In order to enlarge the rotation reach of the target simulator, Gain = 4 is inserted before the "Target_Motor" subsystem.Therefore, the target simulator rotation reach becomes about 30 deg.What is more, there should be a block 1/Gain = 1/4 for neutralizing the magnification. In this study, a PID controller design is considered for controlling the motor velocity since it does not require the knowledge of the dynamic model [12].The mathematical expression of the controller () is as follows: where () is the error of motor angular velocity command () and its response () which means that respectively.
Figure 10 is the "Target_Motor" subsystem.The red dashed box contains the proportional, integral, and derivative terms of the PID controller.The green dashed box provides motor pulse width modulation (PWM) signals using a PCI 6601 Pulse Generation block.The inputs to the Pulse Generation block are separate, one for the high count and one for the low count.The reference frequency for PCI 6601 [13] is 20 MHz, so the sum of the high count and the low count is 1000 if the PWM frequency is set to 20 KHz.It should be noted that this frequency can also be other values.Thus, a saturation block is placed before the green dashed box to make the high count less than or equal to 1000.In addition, the high count must be greater than or equal to zero.Besides, the direction command is taken from the red PID box through a sign block.The PCI 6601 Digital Output block transfers the direction commands to the motor driving circuit on the PCB installed in the control cabin.
The function of the blocks in the blue dashed box is motor angular velocity measuring.The encoders used in the study has 5000 counts per rotate (CPR), so each count of the PCI6601 ENC block means that the motor has turned 0.072 degrees.The sample time  is 0.05 s here.Therefore, the motor angular velocity [14] is where  is the motor instantaneous angular velocity and  is the count of the PCI6601 ENC block.The output count  of the PCI6601 ENC block is a signed integer, which means that the rotation of the motor can be determined through its sign.
The constant  = 1 enables the control cabin to work at the automatic control mode.
The "Seeker_Motor" subsystem shown in Figure 11 is similar to the "Target_Motor" subsystem.The output "lambdadot_real," namely, λ , is for calculating the missile command acceleration using (1).A low-pass filter is placed before the "lambdadot_real" output to smooth the actual angular velocity curve, because the encoders output discontinuous pulse signals, which causes that the actual angular velocity output curve is rough.
Sample plots of the angular velocity errors () are presented in Figure 12.In this experiment, initial angular velocities of the target and seeker simulators are zero, and the command angular velocities are set to 30 deg/s.As can be seen in Figure 12, the angular velocity errors are driven to the vicinity of zero.Additionally, the seeker simulator motor angular velocity response curve has bigger random fluctuation around zero compared with the target simulator motor angular velocity response curve, which is because that the shaft of the seeker simulator motor is more unsmooth.Still, this disturbance has little influence on the closed-loop HIL simulation; the simulation results are shown in the next section.
After setting the appropriate parameters for the simulation model, it is compiled and downloaded to the target computer.Until compiling and downloading the simulation model successfully, the operator operates the joystick and controls the direction of the seeker to find the target.When the target is found, the operator adjusts the wave gate to the position of the target and pulls on the joystick trigger.
Then, the wave gate locks on the target, and the missile can be fired at this time.Self-designed TV image processing program interface is shown in Figure 13.It needs to be noted that the target silhouette is constant over the time in one simulation.
As shown in Figure 14, after a series of video processing [15], the angle position deviation between the center of the International Journal of Aerospace Engineering target and the center of the TV seeker simulator field of view (FOV), namely, the missile boresight error , is achieved and transferred to the target computer by RS232.The "TV Seeker" subsystem shown in Figure 15 is a battery of blocks for obtaining the missile boresight error  during the HIL realtime simulation.
As shown in Figure 16, the basic geometry of the missile, seeker, and target for the platform here comes from [11].In Figure 16,  is the angle of the seeker optical axis measured counterclockwise from the reference axis.From the figure, here is By differentiation, we get According to [11], Paul Zarchan used a low-pass filter to estimate .The relationship of Ḋ and  is where  is the time constant of the low-pass filter.By substituting ( 12) into (11), we obtain Taking Laplace transform on the above equation, we get After some algebra, there is As time tends to infinity, 1/( + 1) tends to 1.In this case, the above equation becomes the following: which means that By letting  = 1/, then the following is gotten: λ in the above equation is the input "lambdadot_c" of the "Seeker_Motor" subsystem.It is the velocity command for driving the seeker simulator.The value of  affects the ability of the seeker to track the target.Let the target simulator rotate at certain velocities; then the performances of the seeker simulator are recorded when  is different values as shown in Figure 17.If  is small, which means that the time constant is great, the seeker simulator response is slow as shown in Figure 17(a).This causes that the seeker finally loses the target as shown in Figure 18.
With the increase of , the missile boresight error becomes smaller as can be seen in Figure 17, which reduces the requirement of missile attitude control acceleration in actual engagements [16].So  can be infinity in theory.However, in practice, a large  makes the seeker jitter as can be seen in Figures 17(g) and 17(h).If the jitter is even faster than the speed of video processing, the seeker also loses the target as shown in Figure 19.In the end,  equals 10 here, which makes the seeker simulator have an enough response speed and insignificant jitter.The reasons for the jitter are as follows.
A type of Brushless Direct Current Motor (BLDCM) is used in this study for driving both the seeker simulator and target simulators.In the HIL simulation, the PWM commands for the motors can be equivalent to the voltage commands.According to the DC motor theory [17], the voltage balance equation is as shown as follows: where  is armature control voltage,  is back electromotive force,  is armature current,  is armature windings resistance, and  is armature inductance.The motor angular velocity can be determined by where  denotes the angular velocity of motor and   is the back electromotive force constant.The transfer function of the motor can be obtained by combining the equations above and Laplace transform: where   = /,   = /    , and   is electromagnetic time constant,   is electromechanical time constant,  is equivalent moment of inertia to motor shaft, and   is electromagnetic torque coefficient.
After some algebra, there is It is a typical two-order system [18], so it can be written as the following form: where The characteristic equation of the two-order system is and the eigenvalue is Since the armature windings resistance , the armature inductance , the back electromotive force constant   , and electromagnetic torque coefficient   in (25) are characteristics of the motor, the above parameters' values of the motors used for driving the seeker and target simulators are nearly the same.However, due to the fact that load of the two motors are different, the equivalent moments of inertia to motor shaft  are different.The TV camera is empty except for a board with CCD, so its mass is very small.Besides, as can be seen in Figure 4, the TV camera has a short length, so the "equivalent moment of inertia to motor shaft"  TV of the motor for driving the TV camera has a small value.Then, the corresponding  TV calculated by equation is If the small  TV leads to 0 <  TV < 1, the characteristic equation has a pair of conjugate complex roots with negative real part.So the two-order system is an underdamped system whose step response is a damped oscillatory process.In a dynamical process, oscillation causes the constantly changing of the missile boresight error , as the black lines shown in Figure 17.According to (18), the oscillation of  makes the input λ of the motor constantly change.Therefore, the dynamical response is oscillatory.Furthermore, when  is larger, which means that λ is larger, the amplitude of the oscillation is greater.The results of the HIL simulation are consistent with the preceding theoretical analysis, as the blue lines shown in Figure 17.
On the other hand, the target simulator is an aluminum rod with long length and large mass and the center of rotation is on one of its ends in the HIL simulation, so the "equivalent moment of inertia to motor shaft"  Target of the motor for International Journal of Aerospace Engineering driving the target simulator is large.Then, the corresponding  Target calculated by equation is If the large  Target leads to 1 ≤  Target , the characteristic equation has a pair of real roots.So the two-order system's step response is a nonoscillatory process as the red lines shown in Figure 17.The HIL real-time simulation results and theoretical analysis are consistent.
Figure 20 shows the real-time state of the HIL simulation process.Figures 20(a  Based on the introduction above, the signal transmission process of the HIL simulation platform is achieved, as shown in Figure 21. In the simulation loop, the target simulator moves in accordance with the custom laws shown in (4); that is, The command angular velocity calculated by (18) drives the seeker simulator.The simulation model can acquire the LOS rate between the missile and the target.According to the proportional navigation guidance law, the command acceleration of the missile   is obtained.

Simulation Results
. The trajectory of the missile and the target is shown in Figure 22.It can be seen from the figure that the missile intercepts the target successfully.Furthermore, the HIL real-time simulation trajectory is almost coincident with the mathematical simulation trajectory, which illustrates that the results of real-time simulation are correct.The miss distance is shown in Figure 23.
During the HIL simulation, the relative distance between the missile and the target slips rapidly as the time goes on as can be seen in Figure 23.The final miss distance of the HIL simulation is only 0.09846 m which is almost the theoretical 0 m, so the missile can destroy the target.As shown in Figure 24, the actual LOS rate curve almost matches the theoretical curve.The initial value of the actual curve is larger, which is because that target is not in the center of the seeker FOV in the beginning as shown in Figure 25 according to (18).Although the actual curve fluctuates due to the principle shown in (18), the preceding results have illustrated that this phenomenon has no effect International Journal of Aerospace Engineering  on the simulation process or the simulation results.As can be seen in Figure 25, the missile boresight error decreases rapidly after the missile is fired and finally goes to around zero as a result of the guidance law controlling the missile to enter the collision triangle.
In order to illustrate the effectiveness of the HIL simulation platform better, we make the target do the S maneuver.After the seeker locks on the target, the seeker automatically

Other Functions of the Simulation Platform
The simulation platform can also be used to test the missile attitude response.Assuming that the initial yaw angle of the missile is 0 ∘ , it is required to adjust to 30 ∘ in the shortest time.A PID angular position feedback controller is adopted in this example.The diagram of motor servo control is shown in Figure 27, which is similar to the ones in the "LOS" subsystem described in the above section.What is different is that the feedback of the controller is the angular position of the motor.Moreover, in the case of   = 6 and   = 2, the results achieved by the controller is well as shown in Figure 28, so   is 0 in this example.
It can be seen from Figure 28 that there is nearly not any overshoot in the response process and the steady-state error is nearly zero.This is because that there is no disturbance present.The actual yaw angle reaches the command yaw angle within the time of 0.2 s.The above-mentioned facts indicate that the dynamic response characteristics of the missile are well.

Conclusions
From the above introduction and experiments, it can be concluded that the missile guidance system HIL simulation platform based on Simulink Real-Time can be used in the simulation loop of TV guidance simulation and navigation guidance law designing.The physical parts include TV seeker simulator, target simulator, servomotors, control cabin, and motion mechanism.The simulation process is real-time.Compared to the old results, the platform is more compact, lower cost, higher precision, and more practical.
In addition, this HIL real-time simulation platform has some potential improvements in the future such as the following: (1) Though the TV camera in this platform uses a manual zoom lens, the operator only manually adjusts the focus of the TV camera to make the image clear before the HIL simulation.On the other hand, the target silhouette is constant over the time in one simulation.Accordingly, the lens can be replaced by an automatic zoom lens driven through a servomotor, which enables the image of the target to be enlarged or reduced in order to simulate the change of the distance between the target and the seeker.Thus, the authenticity of missile-target engagement simulation will be further improved.(2) The simulator has only one degree of freedom for missile moving and only one degree of freedom for target moving.So the design of a multidegree of freedom target simulator or a multidegree of freedom seeker simulator can be considered.The nut for fixing the TV camera shown in Figure 4 can be replaced with a servomotor, which can provide a pitch freedom for the seeker simulator.Due to the small size of the turntable, designing a compact and flexible target simulator is also a worthy problem.
Furthermore, the dynamic characteristics of the turntable and the motors can be modeled in detail, so a method can be designed for restraining the oscillation of the seeker simulator's dynamic response.

2. 1 .
Development Computer.The development computer is an industrial personal computer (IPC) which uses the Windows 7 operating system.Matlab 2016b, Simulink, and Simulink Real-Time are installed on the development computer.Simulink Real-Time is a professional industrial real-time simulation module.It supports real-time simulation and testing, including rapid control prototyping, DSP and vision system prototyping, and HIL simulation.Simulink Real-Time and Speedgoat target computer hardware are expressly designed to work together to create real-time systems for desktop, lab, and field environments.Simulink Real-Time can also be used with custom target computer and I/O hardware.

Figure 3 :
Figure 3: (a) is the control cabin, and (b) is the PCB.

Figure 7 :
Figure 7: Simulation model built on the Simulink.

Figure 17 :
Figure 17: Seeker simulator tracking performance and missile boresight error corresponding to different  during the HIL simulation.The green line is the command angular velocity for the target simulator.The red line is the response of the target simulator for the velocity command.The blue line is the seeker simulator angular velocity when it tracks the target.And the black line is missile boresight error corresponding to the tracking process shown in (a), (c), (e), and (g).

Figure 18 :Figure 19 :
Figure 18: The process of the seeker tracking the target when  = 1.

Figure 20 :
Figure 20: The platform is implementing the TV guidance simulation.
) and 20(b) show the real-time scene that the seeker simulator is tracking the target simulator.
Figure 20(c) is the guidance cabin which is showing its own states and the angle position of the seeker and target simulators.Figure 20(d) is the output interface of Simulink Real-Time which shows the key parameters such as the miss distance, command acceleration, and boresight error.
Figure 24: Actual and theoretical LOS.

Figure 26 :
Figure 26: Seeker platform angle and LOS angle.

Figure 27 :Figure 28 :
Figure 27: The block diagram of motor servo control for yaw angle response testing.