CN110134025B - Real-time simulation system of small distributed hypersonic aircraft - Google Patents

Real-time simulation system of small distributed hypersonic aircraft Download PDF

Info

Publication number
CN110134025B
CN110134025B CN201910443127.3A CN201910443127A CN110134025B CN 110134025 B CN110134025 B CN 110134025B CN 201910443127 A CN201910443127 A CN 201910443127A CN 110134025 B CN110134025 B CN 110134025B
Authority
CN
China
Prior art keywords
simulation
module
data
real
time
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.)
Active
Application number
CN201910443127.3A
Other languages
Chinese (zh)
Other versions
CN110134025A (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.)
Tianjin University
Original Assignee
Tianjin University
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 Tianjin University filed Critical Tianjin University
Priority to CN201910443127.3A priority Critical patent/CN110134025B/en
Publication of CN110134025A publication Critical patent/CN110134025A/en
Application granted granted Critical
Publication of CN110134025B publication Critical patent/CN110134025B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B17/00Systems involving the use of models or simulators of said systems
    • G05B17/02Systems involving the use of models or simulators of said systems electric
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T90/00Enabling technologies or technologies with a potential or indirect contribution to GHG emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The utility model provides a real-time simulation system of a small distributed hypersonic aircraft, which consists of a main control module, a simulation module and a view module, and comprises a human-computer interaction interface, wherein a user can change relevant parameters of the aircraft at any time on the interface without interrupting the simulation, and simultaneously comprises a view interface, so that the user can clearly see the flight state of the aircraft under the current parameters on the interface, and the system has the characteristics of simplicity, high real-time performance and visualization.

Description

Real-time simulation system of small distributed hypersonic aircraft
Technical Field
The utility model belongs to the field of simulation, and particularly relates to a hypersonic aircraft-oriented small simulation platform design.
Background
With the continuous development of scientific technology, the attention on the aircraft is increased. Aircrafts, especially unmanned aircrafts such as hypersonic aircrafts and the like, play various roles in different fields, are widely applied to the fields of agriculture, commerce, military affairs and national defense, and have irreplaceable value and potential. However, the characteristics of multiple influencing factors of the performance of the aircraft, high manufacturing cost, easy damage and the like often restrict the development speed of the aircraft. For the achievements obtained at present, the practical feasibility of the achievements can not be directly verified, the simulation is widely applied to the control field, and the feasibility simulation of the achievements by utilizing the simulation platform has the advantage that the practical flight test is incomparable. The computer simulation platform is economical and safe, is not limited by fields and weather environments, can be controlled and tested repeatedly, and has the characteristics that the simulation platform occupies an important position in aircraft research, and countries in the world give high attention to the aircraft simulation platform and serve as key development projects.
In order to verify the performances of different design schemes, engineers usually use software such as MATLAB to perform offline simulation verification, but this method has great limitations, and we can analyze the performances of the design schemes only through data, images and the like in simulation results, but cannot see the real-time flight state of the aircraft under the current parameter condition. Secondly, the MATLAB simulation is off-line simulation, after the simulation is started, if some parameters of the system are changed, the simulation can only wait for the current simulation to be finished, or the simulation is directly stopped, the simulation is carried out again after the parameters are changed, and the dynamic change process of the system response when the parameters are changed cannot be obtained. Moreover, simulation in the Simulink environment is not real-time simulation, and changes the simulation time of the model to a certain extent.
Generally, in the existing aircraft simulation method, aircraft simulation can be divided into three categories, namely physical simulation, semi-physical simulation and full-digital simulation, according to different simulation model forms and different simulation modes. The aircraft simulation, especially the hypersonic aircraft simulation, needs a large amount of resources of different types, the higher the model precision, the more complex the structure and the longer the resolving time, and the real-time simulation of the model can hardly be completed in the single-machine simulation. Meanwhile, the simulation method needs that an operator can have enough programming simulation capability, cannot change parameters in real time for debugging, has high requirements and is relatively complex. At present, most of the better online real-time simulation systems have higher manufacturing cost, or have confidential technology, or are special systems and cannot be used by common engineering personnel. In addition, most of the existing simulation platforms have no mobility or poor mobility, and cannot meet the requirements of practicability and flexibility of simulation.
In consideration of the defects of the existing simulation method, including complex model establishment, non-continuous parameter adjusting process and incapability of intuitively observing the state of the aircraft in real time. The problems that the existing simulation method and the existing simulation platform have disadvantages including complex model establishment, incontinuous parameter adjusting process, incapability of intuitively observing the state of the aircraft in real time, poor mobility and the like are considered.
Disclosure of Invention
In order to solve the problems in the prior art, the utility model provides a design scheme of a real-time simulation platform of a small mobile distributed aircraft. According to the scheme, a design method for realizing real-time simulation is provided, and meanwhile, aiming at the problem that the parameters cannot be adjusted online in the simulation process, a user can directly modify instruction parameters in a Simulink model of a flight control program and realize the function of adjusting the state of the aircraft online in real time through an external mode; the system also comprises a visual interface, and a user can clearly see the real-time flight state of the aircraft under the current parameters on the interface; therefore, the scheme has the characteristics of simplicity, high real-time performance and visualization.
Aiming at the problems in the prior art, the method is realized by adopting the following technical scheme:
a real-time simulation system of a small distributed hypersonic flight vehicle comprises a main control module, a simulation module and a view module,
the main control module is a hub of the whole distributed simulation platform, simulates an aircraft model in a Simulink environment, performs data transmission with the simulation module in the simulation process, transmits attitude data to the view module, and has the functions of controlling simulation start and stop and storing simulation data;
the simulation module is equivalent to a controller of an aircraft, runs a flight control program and a server program which support a Simulink external mode, gives a control instruction through calculation according to aircraft attitude data and given parameters transmitted by the main control module, and transmits the control instruction to the main control module; the simulation module comprises a data receiving module, a data real-time display module, a data storage module, a data viewing module, a real-time curve drawing module and a human-computer interaction interface;
the vision module runs vision software and is responsible for receiving the aircraft attitude data transmitted by the main control module in real time, and the real-time state of the aircraft is expressed in an animation form, so that a user can observe the whole simulation process more intuitively, wherein: the visual module comprises an animation display unit, a visual display unit, a data receiving and processing unit, an aircraft model and a scene model.
The utility model also comprises the following steps:
s1, setting initial parameters by the simulation module;
s2, the master control module starts the simulation process;
2.1, switching a flight control program based on RTW;
2.2, constructing a conversion communication network;
2.3, carrying out real-time simulation processing;
s3, the simulation module receives and processes the corresponding data to realize the functions of real-time data display, real-time curve drawing and the like;
s4, the vision module receives the corresponding data and displays the flight state of the aircraft in the form of animation;
s5, a user can directly modify instruction parameters in a Simulink model of a flight control program, the function of real-time online adjustment of the state of the aircraft is realized through an external mode, and if the curve image in the simulation module and the state of the aircraft in the visual module meet the requirements, the simulation state is ended; otherwise, the process returns to step S2.
The main control module and the simulation module carry out data transmission based on a TCP/IP communication protocol, the main control module and the simulation module adopt a client/server mode, the client sends attitude data of the aircraft model to the server, the server receives the attitude data and sends a control instruction output by a flight control program to the aircraft model, and SOCKET SOCKET programming of C language is selected to compile client and server codes so as to realize normal sending and receiving functions of data.
Advantageous effects
1. The method has the advantages that the defects of the existing simulation method are considered, including complex model establishment, non-continuous parameter adjusting process and incapability of intuitively observing the state of the aircraft in real time; the utility model provides a design method for realizing real-time simulation, and simultaneously, aiming at the problem of non-adjustable parameters in the simulation process, the utility model can directly modify instruction parameters in a Simulink model of a flight control program without interrupting the simulation; the scheme also comprises a visual interface, and a user can clearly see the flight state of the aircraft under the current parameters on the interface; the method has the characteristics of simplicity, high real-time performance and visualization.
2. When simulation software such as MATLAB or a simulation platform is used for algorithm verification, a simulation result can not be displayed in real time generally, if system parameters are required to be modified, the simulation can be realized only when the current simulation is finished or stopped, and the modified result can not be displayed in real time, so that the real-time characteristic is difficult to embody. Therefore, the simulation platform aims to adjust system parameters as required when simulation is carried out, directly modify instruction parameters in a Simulink model of a flight control program and realize the function of real-time online adjustment of the state of the aircraft through an external mode. The simulation can be continued under the new parameters without interrupting the simulation, so that the change of the simulation result caused by the change of the parameters can be observed in real time, and the online parameter adjustment is realized.
3. The simulation time scale of the existing simulation platform is mostly far from the real system, and the platform can better approach the real system in the aspect of real-time performance; meanwhile, the vision module of the platform can display the flight state of the aircraft in the simulation process in real time, so that a user can know the current state of the aircraft more intuitively.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a schematic diagram of the interface layout of a simulation module according to the present invention;
FIG. 3 is a diagram of the effect of the data real-time display module;
FIG. 4 is a data view module effect diagram;
FIG. 5 is a simulation module human-computer interaction interface;
FIG. 6 is a block diagram of a view module architecture;
FIG. 7 is a diagrammatic view of an aircraft model;
FIG. 8 Process Block diagram for animation
FIG. 9 is a block diagram of a simulation system architecture;
FIG. 10 is a flow diagram of a view module simulation software implementation;
Detailed Description
The utility model relates to an online real-time simulation method based on MATLAB, which takes a longitudinal model of a hypersonic aircraft as an example, introduces a design method thereof and realizes the visual online real-time simulation of the hypersonic aircraft.
As shown in fig. 1, the overall design of the simulation platform is first given. The distributed simulation platform consists of three modules, namely a main control module, a simulation module and a view module.
The main control module is a hub of the whole distributed simulation platform, simulates an aircraft model in a Simulink environment, mutually transmits data with the simulation module in the simulation process, transmits attitude data to the view module, and has the functions of controlling simulation start and stop and storing simulation data.
The simulation module is equivalent to a controller of an aircraft, runs a flight control program and a server program which support a Simulink external mode, gives a control instruction through calculation according to aircraft attitude data and given parameters transmitted by the main control module, and transmits the control instruction to the main control module.
The vision module runs vision software and is responsible for receiving the attitude data of the aircraft transmitted by the main control module in real time and expressing the real-time state of the aircraft in an animation mode, so that a user can observe the whole simulation process more intuitively.
The utility model also comprises the following steps:
s1(101), setting initial parameters by the simulation module;
s2(102), the master control module starts the simulation process;
2.1, switching a flight control program based on RTW;
2.2, constructing a conversion communication network;
2.3, carrying out real-time simulation processing;
s3(103), the simulation module receives and processes the corresponding data to realize the functions of data real-time display, curve real-time drawing and the like;
s4, the vision module receives the corresponding data and displays the flight state of the aircraft in the form of animation;
s5(105), the user can directly modify the instruction parameters in the Simulink model of the flight control program, the function of real-time online adjustment of the state of the aircraft is realized through an external mode, and if the state of the aircraft in the curve image in the simulation module and the aircraft in the view module meet the requirements, the simulation state is ended; otherwise, returning to step S2, wherein:
1. main control module
According to the function of the main control module, the realization mainly comprises three parts: the method comprises the steps of flight control program conversion based on RTW, communication network construction and real-time simulation realization.
(1) Flight control program conversion based on RTW
In order to realize the conversion of the flight control program, a longitudinal model of the hypersonic aircraft is taken as an example, a backstepping method and a dynamic inversion method are combined, and a controller model is built in Simulink.
The main function of the controller is to calculate a control instruction according to the state of the aircraft model in the simulation process, change the parameters of the controller in real time and send the control instruction output by the controller to the aircraft model, so that the aircraft model makes corresponding changes, and the function of changing data in real time on line can be realized by utilizing the RTW tool kit. Thus, the model is saved as a flight _ ctrl.mdl file, and the generation of C code and external executable programs is performed on the controller model using RTW.
Before the conversion, in order to save the input aircraft model state quantity after the program simulation is finished, the output configuration is carried out on the input aircraft model state quantity: and opening a scope module in the model, selecting a History tab in the setting, canceling the Limit Data option, selecting the Save Data to work option, changing the variable name into All Data, and storing the All Data in an Array format.
Next, the generation options of the C code and the external program are carried out, and a Model Configuration Parameters panel is opened:
1. selecting a solution tab, changing the termination time into inf (infinite time), setting the fixed step length to be 0.05, selecting an ode4 algorithm with higher precision, and storing the setting;
2. selecting a Code Generation option card, clicking a Browse button in a Target selection option, opening a system Target file browser, changing a system Target file into an embedded real-time Target, namely ert.tlc, clicking an application, returning to the Code Generation option card, and canceling a Generation Code only option;
3. and selecting an MAT-file logging option to store the output data of the flight control program. And generating a flight _ ctrl. mat file after the program operation is finished, wherein rt _ yout in the file stores two paths of output data of the flight control program, and rt _ tout stores simulation time. In order to avoid data overflow, adding a statement Make _ rtw OPTS ″ -DDEFAULT _ BUFFER _ SIZE ═ 102400 ″ in a Make memory allocation reach 102400Byte, ensuring storage space, and adding ert _ default _ tmf in a Template makefile window;
4. selecting an Interface tab, selecting an External mode in the Interface tab, selecting tcpip in a Transport layer tab, enabling the generated Code to support External mode simulation, saving the setting, returning to the Code Generation tab, and clicking a Build button. After successful code generation, the flight _ ctrl.exe and ert _ main.c files will appear. flight _ ctrl.exe is the generated flight control program that supports the external mode, and ert _ main.c is the entry to the flight control program.
(2) Construction of communication network
As shown in fig. 9, the distributed aircraft simulation platform of the present invention performs data transmission based on a TCP/IP communication protocol, the main control module and the simulation module adopt a client/server mode, the client sends attitude data of the aircraft model to the server, the server receives the attitude data and sends a control instruction output by the flight control program to the aircraft model, and a C-language SOCKET programming is selected to program a client and a server code to implement normal sending and receiving functions of data:
firstly, finding and opening an ert _ main.c file generated in the previous step, finding an rt _ oneTep () function in an int _ T main () function, adding socket codes for creating, binding, monitoring, receiving connection and the like and related codes for receiving data before the function, adding related codes for sending data and disconnecting the connection and closing socket after the function, saving and carrying out C code generation on a flight control model again, so that a flight control program added with server codes is obtained, and a server in simulation platform communication is realized. After the program is started, the program is in a client monitoring state, and the flight control program can not continue to run until a client connection request comes;
and then, the client is established in the same way, and the difference is that after the client socket is established, the socket binding is not carried out by using a bind () function, but a connect () function is used for sending a connection request to a specified server socket.
After the communication network is built, taking the longitudinal model as an example, the aircraft model is built in the simulink. The controller has seven inputs, namely speed V, track angle gamma, attack angle alpha, accelerator opening beta, height h, pitch rate q and the first derivative of the accelerator opening
Figure GDA0003510135430000081
Has two outputs, namely an accelerator opening command betacAnd elevator deflection angle deltae. To ensure that the data output by the aircraft model and the data received by the flight control program are data with the same time and the same precision, the solver needs to be set to a fixed step size, the ode4 algorithm, and the fixed step size is 0.05 in the Configuration Parameters panel of the aircraft model, which is the same as the basic parameter setting of the flight control program.
In order to enhance the readability of the model, the model is packaged into a subsystem, a C-MEX Sfunction module is introduced to serve as a client, and the model is named as client.c and is communicated with a server of a flight control program. In the final aircraft model, the inputs to the C-MEX Sfunction module are the seven output variables of the aircraft model, and the outputs are the two input variables of the received aircraft model.
And then modifying the C-MEX Sfunction module and writing the code into a client code:
changing the name of the Sfunction module into a client, adding a header file required by a client code, defining a required variable, and setting 1 input port number in an mdlInitializeSizes () function of the Sfunction module, wherein the input dimension is 7; the number of output ports is 1, and the output dimension is 2; the sampling time was 0.05; other settings remain default;
secondly, declaring and defining a data type conversion function outside all the functions, creating a client socket in an mdlStart () function, and setting information of a server to be connected, such as an IP address and a port number; sending and receiving data in an mdlOutputs () function;
step three, closing the client socket in the mdltterminate () function and releasing system resources;
and finally, inputting a MEX client.c instruction in a command window of the MATLAB to compile the just edited C-MEX Sfunction.
(3) Implementation of real-time simulation
Because the simulation time of the simulation model is much faster than the system time, in order to make the time used for MATLAB simulation consistent with the real time, delay codes need to be added in the client and the server program, so that the aircraft model receives control instructions at certain time intervals. The time used by the current simulation can be conveniently obtained by using a Clock module in a Simulink module library, the time difference needing delaying is calculated, and the Sleep function in the C language is used for delaying so as to achieve the effect of real-time simulation. After the codes are modified, C codes and executable programs need to be regenerated for the flight control programs, and the Sfunction module of the aircraft model needs to recompile the client.c files.
As shown in fig. 2, the simulation module should be able to achieve five functions: the method comprises the steps of data real-time receiving, data real-time displaying, data storing, data checking and real-time curve drawing. The system block diagram is shown in fig. 1, the data receiving module receives data transmitted from a client, and the data are respectively transmitted to the data real-time display module, the data storage module and the real-time curve drawing module. The data storage module transmits the data into the data viewing module after processing. After all the background modules carry out relevant processing on the transmitted data, the data are transmitted to a human-computer interaction interface in a unified mode, and the data are displayed so that a platform user can check the data conveniently.
According to the functional requirements of the simulation module, the interface is planned as shown in fig. 2, wherein the upper left corner is an aircraft picture, the upper right corner is a data storage and viewing part, and a data analysis curve graph is arranged below the aircraft picture for displaying the real-time change process of each parameter.
The platform uses VC6.0 as a development tool and is programmed using C + +, the development process of which will be described below.
(1) Overall layout design
First, open VC6.0, create a new MFC single document exe program, save and name chap10, insert a new DIALOG, insert a static text in the middle position above, change its title to "distributed aircraft simulation platform simulation management software", add three group boxes in the DIALOG1, where the top right and bottom group boxes are named "data store and view" and "data analysis", respectively. And adding a picture control in the group frame at the upper left corner, and inserting the aircraft picture. And adding a list control into the data storage and analysis group frame, and simultaneously adding a data viewing button to prepare for realizing a data viewing module later. And finally, taking a longitudinal model of the hypersonic aircraft as an example, sequentially adding seven Teechart controls into a data analysis group frame, and properly adjusting the sizes of the seven Teechart controls to arrange the seven Teechart controls in order.
(2) Real-time reception of data
The method comprises the steps of setting a port address of a self server side, namely a management software socket, by using a server function, setting a socket attribute, binding the socket by using a server _ addr.sin _ port (6000), setting the management software, namely the server socket, to be in a monitoring state, and enabling the management software to be in a state of waiting for connection at all times.
When the management software, namely the server side, listens or receives a connection request of a client side, namely the aircraft model, the request is responded, and a new thread is established. And sending the description of the server to the client, waiting for the client to confirm the description, once the description is confirmed, establishing the connection, providing the corresponding service for the client by the server, enabling the server to be in the previous monitoring state again, and continuously waiting for receiving connection requests of other clients so as to finish communication and service. The Getdata () function is used to receive data, i.e. to provide the corresponding service to the request.
(3) Real-time display of data
For the data real-time display module, since new data comes every 20ms, the data needs to be updated once in 20 ms. Inserting a listbox control in a proper position of an interface, namely a data storage and viewing group frame, associating the control with a variable m _ list, labeling a variable name corresponding to each column in a first row in a list by using an m _ list. InsertItem () function in the initialization process of the control, uniformly converting seven data received in each loop in a data real-time receiving module from an int type (serial number, not received by a last module) and a double type variable (data received by a data receiving module) into a char type variable through a sprintf () function in a loop body, and displaying the seven data received in this time at a corresponding position of a corresponding table in a human-computer interaction interface in real time by using the m _ list. InsertItem () function (attention is required to be paid to line changing processing). The display effect is as in fig. 3.
(4) Data storage
After data is received, it needs to be stored for viewing in addition to being displayed. The floating point number is first converted to a string using the gcvt function, while a pointer to the string storage location, i.e., the buffer, is returned. And assigning values to the data [ i ], and sequentially representing the character strings pointed by the seven pointers respectively. And then generating and opening a named test data. txt file, writing a character string into the file by using an fputs function, and after the character string is successfully written, automatically moving a position pointer of the file backwards, thereby writing a group of data. And judging by using a conditional statement, and clearing the buffer area when writing seven data lines. This process is repeated until the aircraft simulation system stops operating.
(5) Data viewing and save-as-you-go
And the functions of data viewing and saving are realized on the basis of data storage. A "view data" button is added to the main interface, and the button is used for executing and controlling the function of a specified external program through a Shell execution () function. In the design of the external program, an edit box is added at a proper position, a variable m _ FileText is associated, two buttons, namely 'open' and 'save as', are respectively added on an interface, and the functions of opening a text document and saving the document as a path to other paths are realized.
The 'open' button clicks an event to open a text document to be displayed, sequentially reads contents in the document, closes the selected document, and displays the contents in the document in an edit box; the 'save as' button click event processing function displays the save as document path, creates a text document, acquires the content displayed in the edit box before, writes data in the edit box in the save as text document, and closes the save as text document through file. The effect diagram is shown in fig. 4.
(6) Real-time curve drawing
After each group of data is received, the received seven data are respectively in one-to-one correspondence with the time nodes, and are respectively added to the corresponding seven real-time curve graphs in a coordinate point mode, so that seven curves are formed.
Downloading and registering control Teechart, sequentially adding 7 Teechart controls in different positions of an interactive interface, namely a data analysis group frame, respectively initializing, such as naming, selecting a chart type, setting horizontal and vertical coordinates and the like, and respectively associating seven controls with seven variables of m _ chart, m _ chart1, m _ chart2, m _ chart3, m _ chart4, m _ chart5 and m _ chart 6. After each reception of seven real-time data, each data is plotted in the graph using the m _ cut. series (0). Add () function, looping the plotting process until the simulation is finished. The final interface is shown in fig. 5.
3. View module
The main function of the vision module in the simulation platform is to display the flight state of the aircraft in real time in the form of animation, and therefore the vision module needs to have a data receiving function and guarantee the real-time performance of animation transformation. The structure block diagram is shown in fig. 6. This patent uses OpenGL to accomplish basic scene and draws, based on VC + +, builds the software framework through MFC's exe program, reaches the effect of aircraft motion through the coordinate transformation, realizes the animation effect through two buffer memory functions, realizes real-time simulation function through data transmission module.
(1) Basic scene rendering
Firstly, the establishment of an aircraft model and a scene model is completed. And drawing and rendering the aircraft model by linking an OpenGL graphic library, wherein the simple model is shown in FIG. 7. In order to enable simulation to have a more real visual effect, functions such as glFrustum () and gluLookAt () are used for building a simulation space, a starry sky background is manufactured by synthesizing a random refreshing mode and a fixed point regular motion mode, and an earth model is added.
(2) Software framework building
And then, realizing an OpenGL function in an MFC single-document environment, and constructing the environment of the whole simulation software. The method comprises the steps of starting VC + +6.0 to create a new MFC single document exe program, changing a header file, adding # include gl \ gl. h and # include gl \ glu. h in front of the program, opening a link button, adding OpenGL32.Lib and glu32.Lib in front of various linked libraries, adding mydraw (), mypixformat (), and myfirst () functions, setting a pixel format in the mypixformat (), creating a rendering description table in the myfirst () function, setting a view field and a view point in the Onsize () function, adding background processing in the Ondraw (), adding a drawing statement in the mydraw (), editing various icon and button operations in Dialog, and completing the creation of the view field.
After the field of view is created, the drawn aircraft model and the simulation space model, including the starry sky and the earth, are imported. And starting a timer function through button operation, creating an inquiry network connection code in the timer function, realizing the establishment of a network channel by using a socket, and receiving and using data.
As shown in fig. 10, for easy observation, a new button is created in the toolbar, a corresponding command of the button is created, a class of the response function is added, and a full-screen display code is written in the obtained corresponding function. At the beginning, two mouse response functions are established, response codes are written in, the response codes respectively correspond to the pressing of a mouse key and the lifting of the mouse key, and the OpenGL program is opened.
OpenGL defines colors using the glColor () function, which defines the color values to be used next drawing by calling glColor3f (x, y, z), the three values of which are the display matrices of the three primary colors. However, sometimes the displayed color does not naturally represent the true color of the object, so OpenGL introduces the concepts of illumination and object material while defining the vertex color of the object.
OpenGL starts the LIGHTING application through the function glEnable (GL _ LIGHTING), turns off the LIGHTING through the function glDisable (GL _ LIGHTING), defines the LIGHTING attribute through the function glLightfv (GLenum light, GLenum pname, const GLfloat × p), and uses general global diffuse reflection LIGHTING here; OpenGL sets the material variables through the function glmaterial fv (GLenum face, GLenum pname, const GLfloat × p), where the most basic metalloid material settings are used.
Further, in order to make the image look softer, anti-aliasing processing is performed. OpenGL enables antialiasing of a POINT by glEnable (GL _ POINT _ SMOOTH), masks antialiasing by glDisable (GL _ POINT _ SMOOTH), and LINEs and POLYGONs correspond to LINEs and POLYGONs.
And finally, carrying out star map setting. OpenGL completes the rendering by directly operating on the pixel points and completing the bitmap operation of the image. The method comprises the following specific steps: OpenGL reads and stores a block of image in the color buffer by adopting a glReadPixels () function, the image of an array is drawn to the position of a screen raster by a glDrawPixels () function, and the glCopyPixels () function finishes copying the image from a screen to the position of the screen where the raster is positioned.
(3) Real-time animation and simulation
The construction of the simulation environment is completed, and the realization of animation and real-time simulation is carried out below. OpenGL uses a double-cache computer graphics technique to implement animation, and model changes are implemented by coordinate transformation, the process of which is shown in fig. 8.
When the coordinate transformation is used for drawing an image, a glTranslate (x, y, z) function can be called to perform displacement definition on the position of the model displayed in the screen; calling a glRotate (angle, x, y, z) function to respectively express that the angle is rotated around the x, y and z axes, and realizing the control of the angle of the aircraft; representing the change situation of far, small and near by calling a glScalef (a, b, c) function; the method comprises the steps of starting a PROJECTION matrix by calling a glMatrixMode (GL _ PROJECTION) function, carrying out PROJECTION transformation, transforming a three-dimensional coordinate into a two-dimensional screen coordinate, and displaying a three-dimensional virtual object on a computer screen, so that a user has the concepts of viewing distance and viewing field, and the viewing experience is more real; by calling the function glViewport (0,0, cx, cy) to define the scope of the view region, the split screen effect can be generated, i.e. multiple view regions are displayed in the same window.
In order to realize animation effect, a switch variable flykey is added into a public variable, a button function response myflykey () is added into the public function, a code SetTimer (1, 50, NULL) for starting a system timer is added into the myflykey () function, after a start key is pressed down to enter a flight state, the timer is continuously refreshed, an image refreshed each time is drawn, a double-cache technology is utilized, a SwapBuffers () function is called after calculation for screen updating drawing is completed, and alternate display of a screen and a background cache image is completed, so that animation effect is generated.
For the real-time receiving and processing of the data, firstly, the communication is established with a simulation module by referring to the preamble, a code for receiving the data is added into a timer function of a main program, and the flight attitude data is received in real time and is drawn by means of the circulation of the main program.
The simulation platform is built based on a Windows operating system, an aircraft model and a controller are built and simulated by using MATLAB, a simulation module is developed by using C + + based on VC6.0, a scene module is developed by using VC + + based on OpenGL, and joint simulation is performed.
The three modules are connected to the same switch by using three Ethernet lines, and the IP addresses of local connection are respectively set in network neighbors, so that the IP addresses of the three modules can be in the same network segment. To test whether the three modules can communicate, after the 'ping target IP address' is input in the windows command prompt, the modules can automatically perform communication test.
And after the test is correct, the distributed aircraft simulation platform can be started. In client/server mode, the server program must be started prior to the client program, otherwise communication cannot be performed smoothly. The simulation module and the view module are started first.
Then the following instructions are input into the MATLAB command window of the master control module:
!flight_ctrl-tf inf-w&
the function of the command is to open the flight control external program in an infinite operation state, and the start and stop of the program are controlled by Simulink. And then click the connect and run button in the Simulink model of the flight control program. After all the server programs are started, the corresponding programs are blocked until the aircraft model transmits data through the client, and all the programs can continue to run.
After all the server programs are started, the operation button is clicked in the aircraft model in a normal simulation mode, and the distributed aircraft simulation platform starts to operate. In the running process of the simulation platform, the simulation can be suspended and continued at any time through a suspension button in the main control module, and the simulation is terminated through a stop button. The user can directly modify the instruction parameters in the Simulink model of the flight control program, and the function of adjusting the state of the aircraft in real time on line is realized through an external mode.
Firstly, off-line simulation of the aircraft model and the controller is carried out, and the configuration is consistent with that of a simulation platform. And comparing the result of the simulation platform with the result of the standard to verify the feasibility of the simulation platform.
It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (1)

1. The utility model provides a real-time simulation system of small-size distributed hypersonic aircraft, comprises host system, simulation module and view module, its characterized in that:
the main control module is a hub of the whole distributed simulation platform, simulates an aircraft model in a Simulink environment, performs data transmission with the simulation module in the simulation process, transmits attitude data to the view module, and has the functions of controlling simulation start and stop and storing simulation data;
adding delay codes in corresponding programs of the main control module and the simulation module, namely the client and the server, so that the aircraft model receives control instructions at certain time intervals; obtaining the time used by current simulation by using a Clock module in a Simulink module library, calculating the time difference needing delaying, and delaying by using a Sleep function in the C language;
the simulation module runs a flight control program and a server program which support a Simulink external mode, gives a control instruction through calculation according to the aircraft attitude data and the given parameters transmitted by the main control module and transmits the control instruction to the main control module; the simulation module comprises a data receiving module, a data real-time display module, a data storage module, a data viewing module, a real-time curve drawing module and a human-computer interaction interface;
the simulation module runs a flight control program supporting a Simulink external mode, and when simulation is carried out, if system parameters are required to be adjusted, a user can directly modify instruction parameters in a Simulink model of the flight control program, and the simulation can be carried out continuously under new parameters without interruption, so that the change of a simulation result caused by the change of the parameters can be observed in real time, and the online adjustment of the instruction parameters is realized;
the simulation module adopts VC6.0 autonomous development design to realize the functions of data real-time receiving, data real-time displaying, data storing, data checking and real-time curve drawing, and carries a man-machine interaction interface; the data receiving module receives data transmitted from the client and respectively transmits the data to the data real-time display module, the data storage module and the real-time curve drawing module; the data storage module transmits the data into the data viewing module after processing; after all the background modules perform relevant processing on the transmitted data, the data are transmitted to a human-computer interaction interface in a unified mode, and the data are displayed so that a platform user can check the data conveniently;
the vision module runs vision software and is responsible for receiving the aircraft attitude data transmitted by the main control module in real time, and the real-time state of the aircraft is expressed in an animation form, so that a user can observe the whole simulation process more intuitively, wherein: the visual module comprises an animation display unit, a visual display unit, a data receiving and processing unit, an aircraft model and a scene model;
the method comprises the following steps:
s1, setting initial parameters by the simulation module;
s2, the master control module starts the simulation process;
2.1, switching a flight control program based on RTW;
2.2, constructing a conversion communication network;
2.3, carrying out real-time simulation processing;
s3, the simulation module receives and processes the corresponding data to realize real-time data display and real-time curve drawing;
s4, the vision module receives the corresponding data and displays the flight state of the aircraft in the form of animation;
s5, a user can directly modify instruction parameters in a Simulink model of a flight control program, and the function of real-time online adjustment of the state of the aircraft is realized through an external mode; if the curve image in the simulation module and the aircraft state in the visual module meet the requirements, ending the simulation state; otherwise, the process returns to step S2.
CN201910443127.3A 2019-05-26 2019-05-26 Real-time simulation system of small distributed hypersonic aircraft Active CN110134025B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910443127.3A CN110134025B (en) 2019-05-26 2019-05-26 Real-time simulation system of small distributed hypersonic aircraft

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910443127.3A CN110134025B (en) 2019-05-26 2019-05-26 Real-time simulation system of small distributed hypersonic aircraft

Publications (2)

Publication Number Publication Date
CN110134025A CN110134025A (en) 2019-08-16
CN110134025B true CN110134025B (en) 2022-05-27

Family

ID=67581722

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910443127.3A Active CN110134025B (en) 2019-05-26 2019-05-26 Real-time simulation system of small distributed hypersonic aircraft

Country Status (1)

Country Link
CN (1) CN110134025B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021035702A1 (en) * 2019-08-30 2021-03-04 深圳市大疆创新科技有限公司 Application program testing method, device and storage medium
CN113435012A (en) * 2021-06-02 2021-09-24 上海华穗电子科技有限公司 Distributed aircraft simulation method and device and electronic equipment
CN113658340B (en) * 2021-07-07 2024-01-02 中国人民解放军火箭军工程大学 Semi-physical simulation system of hypersonic aircraft navigation and control system
CN115222851B (en) * 2022-07-05 2024-01-26 上海烜翊科技有限公司 Visual simulation method, simulation system, computer equipment and storage medium
CN117555252A (en) * 2023-11-14 2024-02-13 天津大学 Wide-speed-domain hypersonic aircraft control virtual simulation verification system and assessment method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426424A (en) * 2011-09-28 2012-04-25 天津大学 Visual emulation method of near-space flying vehicle based on distributed framework
CN102800130A (en) * 2012-07-04 2012-11-28 哈尔滨工程大学 Water level-close aircraft maneuvering flight visual scene simulation method
CN103093047A (en) * 2013-01-12 2013-05-08 天津大学 Typical aircraft visual simulation system
CN105159136A (en) * 2015-07-23 2015-12-16 中国商用飞机有限责任公司北京民用飞机技术研究中心 Flight simulation visual display method and system

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101950157B (en) * 2010-07-30 2012-07-04 北京航空航天大学 Flight simulation system with high instantaneity
US8700363B2 (en) * 2010-09-08 2014-04-15 The Boeing Company ETOPS IFSD risk calculator
CN109709821B (en) * 2018-11-28 2022-02-08 北京空天技术研究所 Method for measuring delay of on-board communication

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102426424A (en) * 2011-09-28 2012-04-25 天津大学 Visual emulation method of near-space flying vehicle based on distributed framework
CN102800130A (en) * 2012-07-04 2012-11-28 哈尔滨工程大学 Water level-close aircraft maneuvering flight visual scene simulation method
CN103093047A (en) * 2013-01-12 2013-05-08 天津大学 Typical aircraft visual simulation system
CN105159136A (en) * 2015-07-23 2015-12-16 中国商用飞机有限责任公司北京民用飞机技术研究中心 Flight simulation visual display method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于实时飞行仿真的无人机任务规划系统设计;张健 等;《数学的实践与认识》;20171231;第47卷(第23期);全文 *
飞行器定时航迹规划及其交互仿真平台设计;孙明玮 等;《系统仿真学报》;20180831;第30卷(第8期);全文 *

Also Published As

Publication number Publication date
CN110134025A (en) 2019-08-16

Similar Documents

Publication Publication Date Title
CN110134025B (en) Real-time simulation system of small distributed hypersonic aircraft
US8756044B2 (en) Graphical partitioning for parallel execution of executable block diagram models
CN111192354A (en) Three-dimensional simulation method and system based on virtual reality
US20110102299A1 (en) Display Configuration Method for a Remote Visualization System
CN103886631A (en) Three-dimensional virtual indoor display system based on mobile equipment
CN107016170A (en) A kind of LED lamp three-dimensional customization emulation mode based on WebGL
CN110765620A (en) Aircraft visual simulation method, system, server and storage medium
CN110855482A (en) Three-dimensional dynamic communication network analog simulation method, system and storage medium
JP2005501314A (en) Hardware-adaptive data visualization tool for use in complex data analysis and engineering design
CN105718643A (en) Optimization view angle based ship production design drawing-inspection device implementation method
CN115457224B (en) Three-dimensional geospatial digital twin architecture method and system
CN111724462A (en) Three-dimensional rendering method in Chrome browser
CN104881518A (en) Three-dimensional vision simulation system for aerial vehicles
CN111724471A (en) Three-dimensional model display method and device, computer equipment and storage medium
CN112904827A (en) Unmanned virtual simulation test system for multiple ICUs
CN116610881A (en) WebGL browsing interaction method based on low-code software
EP0899695A1 (en) Pattern data generator, pattern data generating method and its medium
Wloka Interacting with virtual reality
CN109615709B (en) Multi-person cooperation three-dimensional scene modeling and drawing method based on cloud computing
CN113253965A (en) Mass data multi-view-port visual interaction method, system, equipment and storage medium
CN117576359B (en) 3D model construction method and device based on Unity webpage platform
JPH0887608A (en) Method and device for deforming three-dimensional shape model
JPH1166351A (en) Method and device for controlling object operation inside three-dimensional virtual space and recording medium recording object operation control program
LU504427B1 (en) Bim based dynamic visualization of noise field for prefabricated buildings adjacent to railways
Dubetz et al. A network implementation of real-time dynamic simulation with interactive animated graphics

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant