CN110083945B - Distributed multi-node simulation management method - Google Patents
Distributed multi-node simulation management method Download PDFInfo
- Publication number
- CN110083945B CN110083945B CN201910352591.1A CN201910352591A CN110083945B CN 110083945 B CN110083945 B CN 110083945B CN 201910352591 A CN201910352591 A CN 201910352591A CN 110083945 B CN110083945 B CN 110083945B
- Authority
- CN
- China
- Prior art keywords
- management
- simulation
- transceiver
- program
- data packet
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/16—Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
- G06F15/161—Computing infrastructure, e.g. computer clusters, blade chassis or hardware partitioning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a distributed multi-node simulation management method, which is a method for providing a plurality of management computers, setting initial conditions of simulation tasks and controlling a simulation operation process from a plurality of places and nodes; the state of a plurality of management computers is kept consistent, and the state caused by the management operation on one management computer is reflected on all other management computers; the management instructions issued on the management computer are ensured to be received by the target program once and only once according to the issuing sequence, so that the defect that network bandwidth is wasted due to unreliability or periodic transmission of udp transmission is avoided; after one or more computers participating in communication are restarted, the communication relation during the last operation can be automatically recovered, and reliable communication can still be continued.
Description
Technical Field
The invention discloses a distributed multi-node simulation management method, in particular to a method for issuing simulation management instructions from a plurality of simulation management nodes and realizing the management of simulation tasks in a distributed environment, and relates to the technical field of computer simulation management.
Background
In a distributed simulation system such as a flight simulator, it is necessary to manage simulation initial conditions, simulation operation processes, and the like of simulation. For example, a flight simulator, the management of simulation initial conditions includes the setting of the initial position of the airplane, the oil mass, the load, the meteorological conditions and the like; the management of the simulation running process comprises the execution, the ending, the suspension and the like of the simulation task. The current approach to such simulation management is to provide a simulation management computer on which a simulation management program is run, the simulation management program providing a human-machine interface, typically a graphical human-machine interface. People manage the simulation initial conditions, the simulation running process and the like by operating a human-computer interface. At present, the technical scheme of the disclosure is that a simulation management computer is located in a simulated cabin or on an instructor console far away from the simulated cabin, that is, only one simulation management node is provided. If a method for managing simulation from a plurality of places and nodes can be provided, the beneficial effects of convenient management and improvement of simulation operation efficiency can be obtained.
Disclosure of Invention
The invention aims to disclose a distributed multi-node simulation management method, which is a method for providing a plurality of management computers, setting initial conditions of simulation tasks and controlling a simulation operation process from a plurality of places and nodes; the state of a plurality of management computers is kept consistent, and the state caused by the management operation on one management computer is reflected on all other management computers; the management instructions issued on the management computer are ensured to be received by the target program once and only once according to the issuing sequence, so that the defect that network bandwidth is wasted due to unreliability or periodic transmission of udp transmission is avoided; after one or more computers participating in communication are restarted, the communication relation during the last operation can be automatically recovered, and reliable communication can still be continued.
In order to achieve the above object, the present invention provides a distributed multi-node simulation management method, the technical solution thereof is as follows:
comprises a first simulation computer, a second simulation computer, \8230, an Mth simulation computer, a first management computer, a second management computer, \8230, and an Nth management computer; also includes a route computer; the computers are connected through an Ethernet switch to form an intercommunicated Ethernet;
the first simulation computer, the second simulation computer, \ 8230, the Mth simulation computer respectively run a first simulation program, a second simulation program, \\8230, and the Mth simulation program;
the first management computer, the second management computer, 8230 the management computer N runs the first management program, the second management program, \8230, and the management program N;
running a routing program on the routing computer;
the simulation program executes a specific simulation task, and receives the simulation condition configuration and the simulation operation control of the management program;
the management program issues simulation condition configuration and simulation operation control instructions (hereinafter referred to as management instructions) to the simulation program;
the simulation condition configuration is related to a specific simulation task executed by a specific simulation program;
the simulation operation control comprises control items for controlling the execution, the termination, the suspension and the like of a simulation program;
the management program provides a human-computer interface for issuing the management instruction;
the routing program distributes the management instructions between the emulation program and the management program;
the simulation program, the simulation program and the routing program have a communication automatic synchronization function, namely, after any simulation program, simulation program and routing program are restarted, the management instruction can still be transmitted among the programs; any management instruction can be selected from the human-computer interface of any management program, the selected management program is called a current management program, and the selected management instruction is called a current management instruction;
the process of distributing the management instruction among the management program, the simulation program and the routing program is as follows:
step 1, selecting a current management instruction from a human-computer interface of a current management program;
step 2, the current management program transmits the current management instruction to the routing program through the Ethernet;
step 3, the routing program transmits the current management instruction to all other management programs and all simulation programs through the Ethernet;
step 4, updating respective human-computer interface display by all other management programs according to the current management instruction, so that all the management programs are always kept in a consistent state;
and 5, executing a response corresponding to the current management instruction by all the simulation programs.
And the transmission communication of the management instructions among the management program, the simulation program and the routing program adopts a reliable transmission mode.
The reliable transmission mode adopts tcp protocol.
The reliable transmission mode can also adopt a connectionless reliable transmission mode based on the udp protocol.
The method for realizing the connectionless reliable transmission mode based on the udp protocol comprises the steps of a kind of UdpReliable; the objects of the udp relieable class are called transceivers; each transceiver includes a local IP port pair and a remote IP port pair; the IP port pair consists of an IP address and a port number; two mutually matched transceivers form a logic channel; the matching is that the local IP port pair and the remote IP port pair of the transceiver at one end of the logic channel are respectively equal to the remote IP port pair and the local IP port pair of the transceiver at the other end of the logic channel; after sending data by using Send operation of the transceiver at one end of the logical channel, recv operation of the transceiver at the other end of the logical channel can ensure that the data is received in sequence and only once; the Send operation of the transceiver sends data with the source address of its local IP port pair and the destination address of its remote IP port pair; the recipient address of a Recv operation of a transceiver is its local IP port pair and only data whose source address is its remote IP port pair is received; a program can establish N logical channels with one or more other programs via N (N > 1) transceivers; the simulation program, the management program and the routing program establish a logical channel through a transceiver, send a management instruction to the logical channel through the Send operation of the transceiver at one end of the logical channel, and receive the management instruction from the logical channel through the Recv operation of the transceiver at the other end of the logical channel; the first simulation program creates a first simulation transceiver, the second simulation program creates a second simulation transceiver, \8230; the first management program creates a first management transceiver, the second management program creates a second management transceiver, \8230; the routing program creates (M + N) transceivers, which are respectively called a first route simulation transceiver, a second route simulation transceiver, \8230, an Mth route simulation transceiver, a first route management transceiver, a second route management transceiver, \8230, and an Nth route management transceiver; the first route emulation transceiver and the first emulation transceiver form a logic channel, the second route emulation transceiver and the second emulation transceiver form a logic channel, \8230; the first route management transceiver and the first management transceiver form a logic channel, the second route management transceiver and the second management transceiver form a logic channel, \8230, and the Nth route management transceiver and the Nth management transceiver form a logic channel.
The transceiver comprises a sending queue and a receiving queue, wherein the sending queue is used for storing sending data packets, and the receiving queue is used for storing receiving data packets; the udp-like enable maintains a background thread, which is responsible for driving each transceiver in a program to perform the following operations:
a) Sending a sending data packet at the head of the sending queue, and deleting the sending data packet from the sending queue after the sending data packet is successfully received;
b) Receiving a sending data packet, and adding an effective data packet into the tail of a receiving queue; the effective data packet is a sending data packet which is ensured to be received once in sequence and only received once;
c) Realizing the communication automatic synchronization function;
the sending data packet is a protocol data unit which is used for network transmission and takes the management instruction as user data; the received data packet refers to an upper data unit for storing the management command.
The method for realizing the communication automatic synchronization function comprises the following steps:
a) The transceiver maintains a transmission count with an initial value of 0;
b) The transceiver maintains a receive count with an initial value of 0;
c) The transceiver transmits the transmission count with the transmission data packet, wherein the transmission count in the transmission data packet is called a data packet transmission count; after the transmission data packet is successfully received, adding 1 to the transmission count;
d) When the transceiver receives a data packet, the transmitting count is equal to the receiving count, and the receiving count is increased by 1;
e) The transceiver sends a response data packet when receiving repeated sending data packets, wherein the response data packet comprises the current value of the receiving count, and the receiving count in the response data packet is called as a data packet receiving count;
f) After the transceiver continuously receives a certain number (the specific number depends on different embodiments) of sending packets or response packets that satisfy the following conditions:
the first condition is that all data packets are sent or all response data packets are sent;
the second condition is that the data packet sending count of all the sending data packets is 0, or the data packet receiving count of all the response data packets is 0;
the third condition is that the data packet sending count of all the sending data packets is smaller than the receiving count, or the data packet receiving count of all the response data packets is smaller than the sending count;
performing a communication autosynchronization operation as follows:
e.1 Empty the transmit queue and the receive queue;
e.2 Set the transmit count and the receive count to 0;
the Send operation of the transceiver is responsible for generating a sending data packet and adding the sending data packet to the tail of the sending queue; and the Recv operation of the transceiver is responsible for acquiring the received data packet at the head of the receiving queue and deleting the received data packet.
The invention has the positive effects that:
1. the management computers are provided, so that simulation can be managed at a plurality of places and nodes, and the convenience of simulation management and the high efficiency of simulation operation can be improved;
2. the reliable transmission mode is adopted, so that the management instructions issued on the management computer are received by the target program once and only once according to the issuing sequence, and the defect that the network bandwidth is wasted due to unreliability or periodic transmission of pure udp transmission is avoided;
3. a transceiver mechanism is adopted to establish a logic channel and send and receive a management instruction, so that the development of a simulation program, a management program and a routing program is very convenient;
4. the management instruction set distribution mechanism of the routing program is adopted, so that the management data flow of the whole simulation system is clearer, and the simulation program and the management program are very easy to expand;
5. the autonomous characteristics of the operation of each host of the distributed simulation are fully considered, when one or more hosts are restarted due to abnormal operation caused by system faults and the like, the communication relation of the management instructions can be automatically recovered, the whole system does not need to be reset, and the simulation is avoided from the beginning.
Description of the drawings:
FIG. 1 is a simulation system architecture employing a distributed multi-node simulation management method;
FIG. 2 is a particular flight simulator communication architecture employing a distributed multi-node simulation management approach.
Detailed Description
The invention will be further described with reference to a preferred embodiment thereof.
As shown in FIG. 1, a distributed management method for simulation operation is characterized by comprising a first simulation computer, a second simulation computer, \8230;, an Mth simulation computer, a first management computer, a second management computer, \8230;, and an Nth management computer; also includes a route computer; the computers are connected through an Ethernet switch to form an intercommunicated Ethernet; the first simulation computer, the second simulation computer, \ 8230, the Mth simulation computer respectively run a first simulation program, a second simulation program, \\8230, and the Mth simulation program; the method comprises the steps of operating a first management program, operating a second management program, \8230ona first management computer, operating a second management program, \8230ona second management computer, and operating an Nth management program on the Nth management computer; running a routing program on the routing computer; the simulation program executes a specific simulation task and receives the simulation condition configuration and the simulation operation control of the management program; the management program issues simulation condition configuration and simulation operation control instructions (hereinafter referred to as management instructions) to the simulation program; the simulation condition configuration is related to a specific simulation task executed by a specific simulation program; the simulation operation control comprises control items for controlling the execution, the termination, the suspension and the like of a simulation program; the management program provides a human-computer interface for issuing the management instruction; the routing program distributes the management instructions between the emulation program and the management program; the simulation program, the simulation program and the routing program have a communication automatic synchronization function, namely, after any simulation program, simulation program and routing program are restarted, the management instruction can still be transmitted among the programs; any management instruction can be selected from the human-computer interface of any management program, the selected management program is called a current management program, and the selected management instruction is called a current management instruction; the process of distributing the management instruction among the management program, the simulation program and the routing program is as follows:
step 1, selecting a current management instruction from a human-computer interface of a current management program;
step 2, the current management program transmits the current management instruction to the routing program through the Ethernet;
step 3, the routing program transmits the current management instruction to all other management programs and all simulation programs through the Ethernet;
step 4, updating respective human-computer interface display by all other management programs according to the current management instruction, so that all the management programs are always kept in a consistent state;
and 5, executing a response corresponding to the current management instruction by all the simulation programs.
And the transmission communication of the management instructions among the management program, the simulation program and the routing program adopts a reliable transmission mode.
The reliable transmission mode adopts tcp protocol.
The reliable transmission mode can also adopt a connectionless reliable transmission mode based on the udp protocol.
The method for realizing the connectionless reliable transmission mode based on the udp protocol comprises the steps of a kind of UdpReliable; the objects of the udp relieable class are called transceivers; each transceiver includes a local IP port pair and a remote IP port pair; the IP port pair consists of an IP address and a port number; two mutually matched transceivers form a logic channel; the matching is that the local IP port pair and the remote IP port pair of the transceiver at one end of the logic channel are respectively equal to the remote IP port pair and the local IP port pair of the transceiver at the other end of the logic channel; after sending data by using Send operation of the transceiver at one end of the logical channel, recv operation of the transceiver at the other end of the logical channel can ensure that the data is received in sequence and only once; the Send operation of the transceiver sends data with the source address of its local IP port pair and the destination address of its remote IP port pair; the recipient address of a Recv operation of a transceiver is its local IP port pair and only data whose source address is its remote IP port pair is received; a program can establish N logical channels with one or more other programs via N (N > 1) transceivers; the simulation program, the management program and the routing program establish a logical channel through a transceiver, send a management instruction to the logical channel through the Send operation of the transceiver at one end of the logical channel, and receive the management instruction from the logical channel through the Recv operation of the transceiver at the other end of the logical channel; the first simulation program creates a first simulation transceiver, the second simulation program creates a second simulation transceiver, \8230; the first management program creates a first management transceiver, the second management program creates a second management transceiver, \8230; the routing program creates (M + N) transceivers, which are respectively called a first route simulation transceiver, a second route simulation transceiver, \8230, an Mth route simulation transceiver, a first route management transceiver, a second route management transceiver, \8230, and an Nth route management transceiver; the first route emulation transceiver and the first emulation transceiver form a logic channel, the second route emulation transceiver and the second emulation transceiver form a logic channel, \8230; the first route management transceiver and the first management transceiver form a logic channel, the second route management transceiver and the second management transceiver form a logic channel, \8230, and the Nth route management transceiver and the Nth management transceiver form a logic channel.
The udp like reliatable implements the following constructor:
UdpReliable(const char *l_ip, unsigned short l_port,
const char *r_ip, unsigned short r_port);
wherein l _ ip is a local ip address, and the decimal point character string has a standard format; l _ port is the local port number, represented in host order; r _ ip is a remote ip address, and a decimal point character string standard format; r _ port is a local port number, represented in host order; information equivalent to l _ ip, l _ port, r _ ip, r _ port is stored; the stored information equivalent to l _ ip and l _ port is denoted as (l _ ip, l _ port); the stored information equivalent to r _ ip and r _ port is denoted as (r _ ip, r _ port).
As shown in fig. 1, the establishment procedure of each logical channel is as follows:
a) Udp Reliable first management Transceiver(s) ((
"128.1.1.1",1024, "128.1.1.7",11024);
Udp reliable first route management transceiver(s) (ii)
"128.1.1.7",11024, "128.1.1.1",1024);
b) Udp Reliable second management Transceiver (
"128.1.1.2",1024, "128.1.1.7",11025);
Udp Reliable second route management Transceiver(s) ((R))
"128.1.1.7",11025, "128.1.1.2",1024);
c) Udp Reliable Nth management Transceiver (
"128.1.1.3",1024, "128.1.1.7",11026);
Udp reliable N route management transceiver(s) (ii)
"128.1.1.7",11026, "128.1.1.3",1024);
d) Udp Reliable first emulation transceiver(s) ((
"128.1.1.4",1024, "128.1.1.7",21024);
Udp reliable first route emulation transceiver(s) (ii)
"128.1.1.7",21024, "128.1.1.4",1024);
e) Udp Reliable second emulation transceiver(s) ((
"128.1.1.5",1024, "128.1.1.7",21025);
Udp reliable second route emulation transceiver(s) ((R))
"128.1.1.7",21025, "128.1.1.5",1024);
f) Udp Reliable Mth emulation transceiver(s) ((
"128.1.1.6",1024, "128.1.1.7",21026);
Udp reliable M route emulation transceiver(s) ((
"128.1.1.7",21026, "128.1.1.6",1024);
The transceiver comprises a sending queue and a receiving queue, wherein the sending queue is used for storing sending data packets, and the receiving queue is used for storing receiving data packets; the sending data packet is a protocol data unit which is used for network transmission and takes the management instruction as user data; the received data packet refers to an upper data unit for storing the management command.
The definition of the sending data packet is as follows:
struct SendPDU
{
an unscheduled short size; // total number of bytes of packet, including local field
char type// packet type, must be 1
Signaled long recvCount// expected received sequence number
Signaled long sendCount// sendsequence number
The management instruction is determined according to the specific simulation application
};
The received data packet is defined as follows:
struct RecvPDU
{
an unscheduled short size; // total number of bytes of packet, including local field
The management instruction is determined according to the specific simulation application
};
In this embodiment, the element of the send queue is a pointer of a struct SendPDU type data packet, and the element of the receive queue is a pointer of a struct RecvPDU type data packet.
In this embodiment, the response packet is defined as follows
struct AckPDU
{
An unscheduled short size; // total number of bytes of packet, including local field
char type// packet type, must be 2
Signaled long recvCount// expected received sequence number
};
The udp class defines the following data members:
a) Local socket
SOCKET m_sock;
b) Remote ip addresses, represented in binary network order;
unsigned long m_remoteIp;
c) Remote port numbers, expressed in network order;
unsigned short m_remotePort;
d) Transmit count
unsigned long m_sendCount;
e) Send queue
std::vector<struct SendHead*> m_sendPDUs;
f) Receive count
unsigned long m_recvCount;
g) Receive queue
std::vector<struct RecvPDU*> m_recvPDUs;
f) Synchronous filtering counting
int m_synCount;
The udp link class also defines the following static data members:
a) Set of pointers to udp-like objects
std::vector<UdpReliable*> ms_allLinks;
The udp relieable class also defines a static thread function:
void Update();
the structure function of the udp relieable class:
UdpReliable(const char *l_ip, unsigned short l_port,
const char *r_ip, unsigned short r_port);
the following initialization operations are specifically performed:
step 1, creating a UDP local socket m _ sock;
step 2, the m _ sock local socket bind is sent to the local ip address l _ ip and the local port number l _ port;
step 3, converting the remote ip address r _ ip into a binary network sequence representation and storing the binary network sequence representation in the m _ remotepip, and converting the remote port number r _ port into a network sequence representation and storing the network sequence representation in the m _ remotePort;
step 4, setting m _sendcountto 0; m _ sendPDUs are emptied; m _ recvCount is set to 0; the m _ recvPDUs are empty; m _ recvSynCount is set to 0;
step 5, if ms _ allLinks is empty, creating a thread which takes an Update function as a thread to execute the function;
step 6, adding the pointer (this) of the object into ms _ allLinks;
step 7, finishing the operation;
the udp relieable class maintains a background thread, which is created in step 5 above. The thread takes an Update function as a thread execution function, and the Update function is responsible for driving each transceiver in a program to complete the following operations:
a) Transmitting a transmission data packet positioned at the head of the transmission queue, and deleting the transmission data packet from the transmission queue after the transmission data packet is successfully received;
b) Receiving a sending data packet, and adding an effective data packet into the tail of a receiving queue; the effective data packet is a sending data packet which is ensured to be received once in sequence and only received once;
c) The method for realizing the automatic synchronization function of the communication comprises the following steps:
the method for realizing the communication automatic synchronization function comprises the following steps:
c.1 The transceiver transmits the transmission count with the transmission data packet, the transmission count in the transmission data packet being referred to as a data packet transmission count; after the transmission data packet is successfully received, adding 1 to the transmission count;
c.2 For each transmitted packet received by the transceiver with a packet transmit count equal to the receive count, the receive count is incremented by 1;
c.3 The transceiver sends a response data packet when receiving repeated sending data packets, wherein the response data packet comprises the current value of the receiving count, and the receiving count in the response data packet is called as a data packet receiving count;
c.4 After the transceiver continuously receives a certain number (128 in this embodiment) of transmission packets or response packets that satisfy the following conditions:
the first condition is that all data packets are sent or all response data packets are sent;
the second condition is that the data packet sending count of all the sending data packets is 0, or the data packet receiving count of all the response data packets is 0;
the third condition is that the data packet sending count of all the sending data packets is smaller than the receiving count, or the data packet receiving count of all the response data packets is smaller than the sending count;
performing a communication autosynchronization operation as follows:
c.4.1 Empty the transmit queue and the receive queue;
c.4.2 Setting the transmission count and the reception count to 0.
Based on the above analysis, a detailed algorithm that can obtain the Update function is as follows:
step 1, defining a data packet receiving area buf, wherein the buf represents the head address of the data packet receiving area buf and points to struct SendPDU
A pointer to the type;
step 2, taking the next link in the ms _ allLinks (returning to the first element if the last element in the set is reached), and executing:
step 2.1, receiving data from link- > m _ sock and storing the data to buf;
step 2.2, if the sender of the data packet is not (link- > m _ remoteIp, link- > m _ remotePort), turning to step 2;
step 2.3, if buf- > type is 1, the data packet is a transmission data packet, and the following steps are executed:
step 2.1, if buf- > sendCount = = m _ rechcount, then
a) Applying for memory, p = (struct RecvPDU)' new char [ sizeof (struct RecvPDU) + buf- > size-sizeof (struct SendPDU) ];
b)p->size= sizeof(struct RecvPDU)+ buf->size- sizeof(struct SendPDU);
c) From buf->data copy buf->size-size of (struct SendPDU) byte-to-p->data;
d) p is added to the tail of the m _ recvPDUs queue;
e)m _recvCount++;m_synCount=0;
f) Acknowledgement packet ack:
ack. size=sizeof(struct AckPDU);
ack.type=2;
ack. recvCount = m _recvCount;
sending an ack from m _ sock to (m _ remoteIp, m _ remotePort);
step 2.2, if buf- > sendCount = =0, and buf- > sendCount < m _ rechcount, then
m_synCount++;
If m _ synCount >128, the following synchronization operations are performed:
a) Emptying m _ sendPDUs and m _ recvPDUs;
b) Setting m _ sendCount and m _ rechcount to 0;
c) Acknowledgement packet ack:
ack. size=sizeof(struct AckPDU);
ack.type=2;
ack. recvCount = m _recvCount;
sending ack from m _ sock to (m _ remoteIp, m _ remoteiport), go to step 2.
Step 2.4, if buf- > type is 2, the data packet is a response data packet, and the following steps are executed:
step 2.4.1, if m _ sendPDUs are not empty and buf- > reccount = = m _ sendPDUs queue head element- > sendCount, removing the m _ sendPDUs queue head element and releasing the memory thereof, and turning to step 2, wherein m _ synCount = 0.
Step 2.4.2, if buf- > recvCount = =0 and buf- > recvCount < m _ recvCount
m_synCount++;
If m _ synCount >128, perform the following synchronization operations:
a) Emptying m _ sendPDUs and m _ recvPDUs;
b) Setting m _ sendCount and m _ rechcount to 0;
c) Acknowledgement packet ack:
ack. size=sizeof(struct AckPDU);
ack.type=2;
ack. recvCount = m _recvCount;
sending ack from m _ sock to (m _ remoteIp, m _ remoteiport), go to step 2.
And 2.5, turning to the step 2.
The class transceiver implements the following transmit function Send:
int Send(void *buf,int size);
wherein buf is the transmitted user data, and size (greater than 0) is the number of bytes of the user data; the return value is greater than 0 and represents the number of bytes successfully sent; the return value is less than 0, which indicates that the transmission fails;
the Send function Send performs the following operations:
step 1, applying for a data packet memory:
p=new char[sizeof(struct SendPDU)+size];
if p = NULL, return to (-1), the operation ends;
step 2, data packet header setting:
p->size=sizeof(struct SendPDU)+size;
p->type=1;
p-> recvCount=0;
p-> sendCount = m_ sendCount;
m_ sendCount++;
copying data, namely copying the size byte data from buf to p- > data;
step 4, adding p to the tail of the m _ sendPDUs, returning to the size value, and ending the operation;
the class transceiver implements the following receive function Recv:
int Recv(void *buf,int size);
wherein buf is a received data buffer, and size (greater than 0) is the number of bytes in the received data buffer; the return value is greater than 0 and represents the number of bytes successfully received; the return value is equal to 0 and indicates that the synchronous data packet is received, and the return value is less than 0 and indicates that no data arrives and the receiving fails;
the send function Recv performs the following operations:
step 1, m _recvPDUsare empty, the operation returns to (-1), and the operation is finished;
step 2, removing the queue head data packet of the m _ recvPDUs to a struct RecvPDU type pointer p;
step 3, copying data, namely copying the data of the total p- > size bytes to buf;
and 4, releasing the memory pointed by the p, returning to the size value and finishing the operation.
As shown in fig. 2, a specific flight simulator communication architecture employing a distributed multi-node simulation management method is described. The system adopts two management computers, one is a teacher's desk management computer located in a teacher's desk, namely a first management computer, which runs a first management program; one is a cabin management computer located in the cabin, i.e., a second management computer, which runs a second management program; the first management program and the second management program provide graphical user interfaces and can respond to mouse and keyboard operations of a user; the system comprises three simulation computers, wherein one simulation computer is a flight simulation computer, namely a first simulation computer, and a flight simulation program for flight performance simulation, namely a first simulation program, runs in the flight simulation computer; one is a platform simulation computer, namely a second simulation computer, which runs a platform simulation program for airplane dynamic simulation, namely a second simulation program; one is an imaging simulation computer, namely a third simulation computer, which runs an imaging simulation program for visual simulation, namely a third simulation program; the system uses a routing computer that runs a routing program. The first management program, the second management program, the flight simulation program, the platform simulation computer, the imaging simulation program and the routing program complete one-time data exchange according to the following three steps:
step 1, a user uses the graphical user interfaces provided by the first management program and the second management program to operate, and according to the operation of the user, the first management program calls the Send operation of the first management transceiver, and the second management program calls the Send operation of the second management transceiver to issue corresponding management data units; the type of the management data unit is defined as:
struct {
unsigned short type;
double value;
};
wherein, type is the kind of management data unit, and is a natural number;
value is the actual data of the management data unit;
the management data unit is defined as follows:
a) type =0, value = airplane longitude, unit angle;
b) type =1, value = aircraft latitude, unit angle;
c) type =2, value = aircraft altitude, in meters;
d) type =3, value = aircraft heading angle, unit angle;
e) type =4, value = aircraft oil quantity in kilograms;
f) type =5, value = airplane payload, in kilograms;
g) type =6, value = cloud height, in meters;
h) type =7, value = cloud thickness, unit meter;
i) type =8, value = visibility, in meters;
j) type =9, value = imaging view time, unit of minute;
k) type =10, value = heavy snow, medium snow, small snow, heavy rain, medium rain, small rain, cloudy day, sunny day, enumerated type, unitless;
l) type =11, value = execution, end, pause, enumeration type, unitless of the simulation task.
Step 2, the routing program periodically executes the following operations: calling Recv operation of a first route management transceiver to receive a first management program, calling Recv operation of a second route management transceiver to receive the management data unit of a second management program, calling Send operation of the first route simulation transceiver to be distributed to a flight simulation program, calling Send operation of the second route simulation transceiver to be distributed to a platform simulation program, and calling Send operation of a third route simulation transceiver to be distributed to an imaging simulation program;
and 3, periodically calling Recv operation of the first simulation transceiver by the flight simulation program, periodically calling Recv operation of the second simulation transceiver by the platform simulation program, periodically calling Recv operation of the third simulation transceiver by the imaging simulation program to receive the management data unit distributed by the routing program, interpreting the management data unit according to the type of the management data unit, and executing the operation specified by the management data unit.
Claims (8)
1. A distributed multi-node simulation management method is characterized in that:
comprises a first simulation computer, a second simulation computer, \8230, an Mth simulation computer, a first management computer, a second management computer, \8230, and an Nth management computer; also includes a route computer; the computers are connected through an Ethernet switch to form an intercommunicated Ethernet;
the first simulation computer, the second simulation computer, \ 8230, the Mth simulation computer respectively run a first simulation program, a second simulation program, \\8230, and the Mth simulation program; the method comprises the steps of operating a first management program, operating a second management program, \8230ona first management computer, operating a second management program, \8230ona second management computer, and operating an Nth management program on the Nth management computer;
running a routing program on the routing computer;
the simulation program executes a specific simulation task and receives the simulation condition configuration and the simulation operation control of the management program;
the management program issues a management instruction for carrying out simulation condition configuration and simulation operation on the simulation program;
the simulation condition configuration is related to a specific simulation task executed by a specific simulation program;
the simulation operation control comprises control items for controlling the execution, the termination, the suspension and the like of a simulation program;
the management program provides a human-computer interface for issuing the management instruction;
the routing program distributes the management instructions between the emulation program and the management program; the simulation program and the routing program have a communication automatic synchronization function, namely, after any simulation program and any routing program are restarted, the management instruction can still be transmitted among the programs; any management instruction can be selected from the human-computer interface of any management program, the selected management program is called a current management program, and the selected management instruction is called a current management instruction;
the process of distributing the management instruction among the management program, the simulation program and the routing program is as follows:
step 1, selecting a current management instruction from a human-computer interface of a current management program;
step 2, the current management program transmits the current management instruction to the routing program through the Ethernet;
step 3, the routing program transmits the current management instruction to all other management programs and all simulation programs through the Ethernet;
step 4, updating respective human-computer interface display by all other management programs according to the current management instruction, so that all the management programs are always kept in a consistent state;
and 5, executing a response corresponding to the current management instruction by all the simulation programs.
2. The distributed multi-node simulation management method according to claim 1, wherein:
and the transmission communication of the management instructions among the management program, the simulation program and the routing program adopts a reliable transmission mode.
3. The distributed multi-node simulation management method according to claim 2, wherein:
the reliable transmission mode adopts tcp protocol.
4. The distributed multi-node simulation management method according to claim 2, wherein:
the reliable transmission mode adopts a connectionless reliable transmission mode based on a udp protocol.
5. The distributed multi-node simulation management method according to claim 4, wherein:
the method for realizing the connectionless reliable transmission mode based on the udp protocol comprises the steps of a kind of UdpReliable; the objects of the udp relieable class are called transceivers; each transceiver includes a local IP port pair and a remote IP port pair; the IP port pair consists of an IP address and a port number; two mutually matched transceivers form a logic channel; the matching is that the local IP port pair and the remote IP port pair of the transceiver at one end of the logic channel are respectively equal to the remote IP port pair and the local IP port pair of the transceiver at the other end of the logic channel; after sending data by using Send operation of the transceiver at one end of the logical channel, recv operation of the transceiver at the other end of the logical channel can ensure that the data is received in sequence and only once; the Send operation of the transceiver sends data with the source address of its local IP port pair and the destination address of its remote IP port pair; the recipient address of a Recv operation of a transceiver is its local IP port pair and only data whose source address is its remote IP port pair is received; a program may establish N logical channels with one or more other programs via N transceivers; the simulation program, the management program and the routing program establish a logical channel through a transceiver, send a management instruction to the logical channel through the Send operation of the transceiver at one end of the logical channel, and receive the management instruction from the logical channel through the Recv operation of the transceiver at the other end of the logical channel; the first simulation program creates a first simulation transceiver, the second simulation program creates a second simulation transceiver, \8230; the first management program creates a first management transceiver, the second management program creates a second management transceiver, \8230; the routing program creates a first route simulation transceiver, a second route simulation transceiver, \8230, an Mth route simulation transceiver, a first route management transceiver, a second route management transceiver, \8230, and an Nth route management transceiver; the first route emulation transceiver and the first emulation transceiver form a logic channel, the second route emulation transceiver and the second emulation transceiver form a logic channel, \8230; the first route management transceiver and the first management transceiver form a logic channel, the second route management transceiver and the second management transceiver form a logic channel, \8230, and the Nth route management transceiver and the Nth management transceiver form a logic channel.
6. The distributed multi-node simulation management method according to claim 5, wherein:
the transceiver comprises a sending queue and a receiving queue, wherein the sending queue is used for storing sending data packets, and the receiving queue is used for storing receiving data packets; the udp-like enable maintains a background thread, which is responsible for driving each transceiver in a program to perform the following operations:
a) Sending a sending data packet at the head of the sending queue, and deleting the sending data packet from the sending queue after the sending data packet is successfully received;
b) Receiving a sending data packet, and adding an effective data packet into the tail of a receiving queue; the effective data packet is a sending data packet which is ensured to be received once in sequence and only received once;
c) Realizing the communication automatic synchronization function;
the sending data packet is a protocol data unit which is used for network transmission and takes the management instruction as user data; the received data packet refers to an upper data unit for storing the management command.
7. The distributed multi-node simulation management method according to claim 6, wherein the communication automatic synchronization function is implemented as follows:
a) The transceiver maintains a transmission count with an initial value of 0;
b) The transceiver maintains a receive count with an initial value of 0;
c) The transceiver transmits the transmission count with the transmission data packet, wherein the transmission count in the transmission data packet is called a data packet transmission count; after the transmission data packet is successfully received, adding 1 to the transmission count;
d) When the transceiver receives a data packet, the transmitting count is equal to the receiving count, and the receiving count is increased by 1;
e) The transceiver sends a response data packet when receiving repeated sending data packets, wherein the response data packet comprises the current value of the receiving count, and the receiving count in the response data packet is called as a data packet receiving count;
f) After the transceiver continuously receives a predetermined number of transmission data packets or response data packets satisfying the following conditions:
the first condition is that all data packets are sent or all response data packets are sent;
the second condition is that the data packet sending count of all the sending data packets is 0, or the data packet receiving count of all the response data packets is 0;
thirdly, the data packet sending count of all the sending data packets is smaller than the receiving count, or the data packet receiving count of all the answering data packets is smaller than the sending count;
performing a communication autosynchronization operation as follows:
1) Emptying the sending queue and the receiving queue;
2) Setting the transmission count and the reception count to 0.
8. The distributed multi-node simulation management method according to claim 6, wherein a Send operation of the transceiver is responsible for generating a transmission data packet and adding the transmission data packet to the tail of the transmission queue; and the Recv operation of the transceiver is responsible for acquiring the received data packet at the head of the receiving queue and deleting the received data packet.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910352591.1A CN110083945B (en) | 2019-04-29 | 2019-04-29 | Distributed multi-node simulation management method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910352591.1A CN110083945B (en) | 2019-04-29 | 2019-04-29 | Distributed multi-node simulation management method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110083945A CN110083945A (en) | 2019-08-02 |
CN110083945B true CN110083945B (en) | 2023-03-24 |
Family
ID=67417490
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910352591.1A Active CN110083945B (en) | 2019-04-29 | 2019-04-29 | Distributed multi-node simulation management method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110083945B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104880961A (en) * | 2015-04-29 | 2015-09-02 | 北京理工大学 | Real-time simulation experiment system of multi-unmanned plane distributed synergetic hardware in loop |
CN105763570A (en) * | 2016-04-26 | 2016-07-13 | 北京交通大学 | Virtualization-technology-based distributed real-time network simulation system |
CN106571888A (en) * | 2016-11-10 | 2017-04-19 | 中国人民解放军空军航空大学军事仿真技术研究所 | Automatic synchronous reliable communication method for simulation system |
CN109188933A (en) * | 2018-09-21 | 2019-01-11 | 北京大翔航空科技有限公司 | A kind of cluster unmanned plane distributed hardware is in loop simulation system |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170329635A1 (en) * | 2016-05-13 | 2017-11-16 | University Of Utah Research Foundation | Systems and methods for distributed computing |
-
2019
- 2019-04-29 CN CN201910352591.1A patent/CN110083945B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104880961A (en) * | 2015-04-29 | 2015-09-02 | 北京理工大学 | Real-time simulation experiment system of multi-unmanned plane distributed synergetic hardware in loop |
CN105763570A (en) * | 2016-04-26 | 2016-07-13 | 北京交通大学 | Virtualization-technology-based distributed real-time network simulation system |
CN106571888A (en) * | 2016-11-10 | 2017-04-19 | 中国人民解放军空军航空大学军事仿真技术研究所 | Automatic synchronous reliable communication method for simulation system |
CN109188933A (en) * | 2018-09-21 | 2019-01-11 | 北京大翔航空科技有限公司 | A kind of cluster unmanned plane distributed hardware is in loop simulation system |
Non-Patent Citations (2)
Title |
---|
Research on Clock Synchronization Mechanism of Distributed Simulation System based on DDS;Wu Yongliang et al;《2019 IEEE 3rd Information Technology,Networking,Electronic and Automation Control Conference》;20190317;全文 * |
一种分布式仿真通讯软件总线实现方法;何波玲;《实践方法》;20150531;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110083945A (en) | 2019-08-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101645813B (en) | Distributed semi-physical network simulation system and controlling method of semi-physical port thereof | |
CN105491123B (en) | Communication means and device between container | |
US7103646B1 (en) | Distributed control system and information processing system | |
US6993769B2 (en) | System and method for replacing underlying connection-based communication mechanisms in real time systems at run-time | |
CN106452563A (en) | Unmanned aerial vehicle (UAV) data link universal access system based on communication satellites | |
CN110838954B (en) | Lightweight large-scale autonomous network protocol function test method | |
CN109690510A (en) | Multicast device and method for multiple receivers by data distribution into high-performance calculation network and network based on cloud | |
CN113572815B (en) | Cross-heterogeneous-platform communication technical method, system and medium | |
US10609125B2 (en) | Method and system for transmitting communication data | |
CN105978817A (en) | Method for transmitting data, storage, and network adapter | |
CN110114760A (en) | RPC conversion process system and RPC transform method | |
US9292455B1 (en) | Interconnection of peripheral devices on different electronic devices | |
CN106919386B (en) | The method and apparatus of code is generated based on ARINC653 operating system | |
JP2001209407A (en) | Simulator for executing plc program | |
CN110083945B (en) | Distributed multi-node simulation management method | |
CN110674584A (en) | Multi-aircraft combined simulation system | |
CN106571888B (en) | A kind of analogue system automatic synchronization reliable communication method | |
US7526420B2 (en) | Method and system for virtual injection of network application codes into network simulation | |
CN112947125A (en) | Embedded unmanned aerial vehicle cluster simulation system based on high-speed serial bus | |
Steinman | Interactive speedes | |
CN116032880A (en) | System, method, electronic equipment and storage medium for session synchronization | |
CN113542415B (en) | Heterogeneous data resource scheduling system and method based on configurable subscription chain | |
CN109194517A (en) | A kind of method and apparatus for being initialized to virtual switch component | |
CN104267609B (en) | A kind of method of simulation hardware control amount access transport | |
Gräupl et al. | Simple and efficient integration of aeronautical support tools for human-in-the-loop evaluations |
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 |