CN113378364B - Joint simulation method for wireless network control system - Google Patents

Joint simulation method for wireless network control system Download PDF

Info

Publication number
CN113378364B
CN113378364B CN202110603119.8A CN202110603119A CN113378364B CN 113378364 B CN113378364 B CN 113378364B CN 202110603119 A CN202110603119 A CN 202110603119A CN 113378364 B CN113378364 B CN 113378364B
Authority
CN
China
Prior art keywords
model
ici
simulation
node
data
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
CN202110603119.8A
Other languages
Chinese (zh)
Other versions
CN113378364A (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.)
University of Shanghai for Science and Technology
Original Assignee
University of Shanghai for Science and Technology
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 University of Shanghai for Science and Technology filed Critical University of Shanghai for Science and Technology
Priority to CN202110603119.8A priority Critical patent/CN113378364B/en
Publication of CN113378364A publication Critical patent/CN113378364A/en
Application granted granted Critical
Publication of CN113378364B publication Critical patent/CN113378364B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C17/00Arrangements for transmitting signals characterised by the use of a wireless electrical link
    • G08C17/02Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W24/00Supervisory, monitoring or testing arrangements
    • H04W24/06Testing, supervising or monitoring using simulated traffic

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a joint simulation method of a wireless network control system, which combines network simulation software OPNET and system simulation software MATLAB to design a WNCS joint simulation system based on OPNET and Simulink. Meanwhile, in order to simulate a real network environment more accurately, a MANET (mobile ad hoc network) routing protocol is added into the built joint simulation system, and a WNCS joint simulation method based on the MANET is designed, so that joint simulation of a control system and the network environment under a network protocol framework is realized. The method not only can truly simulate the characteristics of the whole WNCS and provide a strong verification platform for the theoretical achievement of the WNCS, but also has good expansibility, and by utilizing the platform, different types of WNCS can be simulated, and the platform can be modified and adjusted to a certain extent according to the self needs of a user so as to realize the combination of WNCS joint simulation and other network protocols.

Description

Joint simulation method for wireless network control system
Technical Field
The invention belongs to the technical field of network system simulation, relates to a simulation method, and particularly relates to a joint simulation method of a wireless network control system.
Background
The simulation methods of the wireless network control system established by scholars at home and abroad at present can be roughly divided into two types. The first type is an extension to common emulation software, and there are generally two methods: the simulation method is characterized in that a network module is added in control system simulation software to realize simulation of a network environment, and a mathematical model and a control algorithm of nodes are defined in a network model to realize simulation of a control system.
The simulation tool obtained based on the extension of common simulation software can realize the real-time simulation of the control system and the network environment at the same time, but the application range is greatly restricted. The main reasons include: the added network module has limited functions, and is difficult to define in detail a control system with large scale and complex structure.
Most of the currently developed joint simulation platforms do not consider network protocols and cannot simulate a large-scale system. Node models in these simulation platforms are generally fixed, and point-to-point data transmission is performed between nodes according to a preset transmission path, so that the requirement of a wireless network node on mobility cannot be met, and a control system cannot transmit data according to a routing protocol. Most of the considered control systems are simple in structure, generally consist of a single controlled object and a single controller, and do not have the capacity of simulating a large-scale system.
In view of the above, there is an urgent need to design a new network control system simulation method to overcome some of the above-mentioned defects of the existing network control system simulation method.
Disclosure of Invention
The invention provides a joint simulation method of a wireless network control system, which can truly simulate the characteristics of the whole WNCS, provides a strong verification platform for the theoretical achievement of the WNCS and has good expansibility.
In order to solve the technical problem, according to one aspect of the present invention, the following technical solutions are adopted:
a joint simulation method of a wireless network control system comprises the following steps:
s1, analyzing the communication protocol, the communication equipment, the subnet equipment, the communication nodes and the number of subnets of a communication network to be simulated, constructing a process model, a node model and a network model of a corresponding OPNET (network simulation technology software package) model, and setting parameters of each model and network protocol; the step S1 comprises the following steps:
s11, selecting a dynamic source routing protocol DSR as a routing protocol of all mobile nodes, and modifying a data source module positioned in an application layer in a protocol model to cooperate with joint simulation;
step S12, modifying the node model provided by the OPNET Modler and having the related protocol to realize the simulation purpose;
step S13, using MANET library node MANET _ station _ adv provided by the OPNET protocol library as a protocol model, and modifying a data source module positioned at an application layer in the protocol model to cooperate with joint simulation, thereby realizing the combination of OPNET/Simulink joint simulation and MANET routing protocol;
step S14, carrying interface control information ICI when sending the data packet, wherein the ICI is a dynamic simulation entity and is created and destroyed according to the requirement in the process of executing the process; creating an ICI using the core function op _ ICI _ create () and returning a pointer to the ICI, which is used as a reference to the ICI; a newly created ICI does not contain any information and attributes must be added through core functions including op _ ICI _ attr _ set (), op _ ICI _ attr _ set _ ptr ();
step S15, the OPNET simulation core associates an ICI with an event through a binding mechanism, and each process can only bind one ICI at any time; binding a certain ICI to an output interrupt through a core function op _ ICI _ interrupt (), after binding, the ICI can be output to other layers in another process or model along with an output packet transfer function or other transfer functions; when an ICI is received by a process, the process can obtain a pointer of the ICI through a core function op _ intrpt _ ICI (), and obtain an attribute value of the ICI through op _ ICI _ attr _ get (); when an existing ICI is no longer needed, it can be destroyed by using op _ ICI _ store ().
S2, controlling a Simulink model of the MANET node by the MANET node through secondary development of the MANET node in the OPNET library, enabling the MANET node to receive/send data of a control system, and calling the Simulink models of a controlled object and a controller by respectively using two MATLAB engines in the controlled object node and the controller node; the two MATLAB engines are respectively used as interface modules of the OPNET, the controlled object module and the controller module, so that the data transmission and the simulation control command transmission between the two simulation software are independent, and the normal operation of simulation cannot be interfered by mutual influence; the transmission of data packets between the object node and the controller node is realized through a wireless network in the OPNET, so that a real-time feedback wireless network control system is formed; the step S2 comprises the following steps:
step S21, adding the definition and calling of an MATLAB engine to start joint simulation on the premise of ensuring that a data source module can normally communicate with other layers of a protocol, and realizing the creation, sending and receiving of a joint simulation data packet by adding various Simulink simulation control commands and self-defined calling functions; simultaneously, defining routing information required by a routing protocol to match with the protocol requirement of an IP layer; meanwhile, in order to ensure that the modified node can normally communicate with other MANET nodes, parts such as attribute declaration, various statistic operations and the like need to be reserved;
s22, processing a process model of the object node data source module; the method comprises the following steps:
step S221, the initialization of the module and the registration of the statistic are completed through five state machines, including calling in attributes and parameters defined by a user, initializing global variables of a process model and variables needed by joint simulation, and registering the statistic for the inquiry and identification of an ip _ encap layer; simultaneously opening an MATLAB engine to call a Simulink model of a controlled object and starting Simulink simulation; after the initialization is completed, waiting for other process models to be ready; then entering an idle state waiting for an interrupt, and responding to two interrupts by the process model, wherein one interrupt is self-interrupt PLANT _ SAMPLE for timing sampling data, and the other interrupt is PLANT _ ARRIVAL for data packet ARRIVAL;
step S222, reading Simulink model data of the controlled object, and packaging and sending the collected data and routing information required by the protocol; when the simulation time of the OPNET reaches the sampling time, responding to self-interruption, reading data of a controlled object Simulink model from a working space of the MATLAB, calling an plant _ send function to put the current state into a data packet, defining IP addresses of a source node plant and a destination node controller, writing the IP addresses into interface control information ICI of an IP _ encap model, and sending the data packet to an IP _ encap module, so that routing information in the ICI is sent out along with the data packet;
step S223, receiving a data packet returned from the controller and restarting Simulink simulation; calling an plant _ array function to receive data obtained from a controller once an interrupt of a data packet arrival is received, and simultaneously commanding the controlled object model to run according to the previous input parameters to compensate the measured delay time; writing the updated control information data into an MATLAB working space to update related parameters of a controlled object Simulink model, and finally restarting Simulink simulation until the next sampling moment;
s23, processing a process model of the controller node data source module; the method comprises the following steps:
s231, initializing a module, registering statistics, and calling a Simulink model of the controller;
step S232, receiving a data packet of the controlled object, and packaging and sending the output of the controller model and the routing information; when the received data packet reaches an interrupt, a controller immediately acquires a plant state in the data packet, and then writes the acquired data into an MATLAB working space to continuously update relevant parameters of a controller model; the controller controls the system according to the latest parameters; and then putting the output of the controller into the created data packet, simultaneously writing the IP addresses of the source node controller and the destination node plant into the ICI of the IP _ encap model, and finally sending the data packet to the IP _ encap module.
According to another aspect of the invention, the following technical scheme is adopted: a joint simulation method of a wireless network control system comprises the following steps:
s1, analyzing the communication protocol, the communication equipment, the subnet equipment, the communication nodes and the number of subnets of a communication network to be simulated, constructing a process model, a node model and a network model of a corresponding OPNET model, and setting parameters of each model and network protocol;
s2, realizing a method for controlling the Simulink model of the MANET node by the MANET node through secondary development of the conventional MANET node in the OPNET library, acquiring Simulink data, packaging and sending the Simulink data, and calling the Simulink models of the controlled object and the controller by respectively using two MATLAB engines in the controlled object node and the controller node; the two MATLAB engines are respectively used as interface modules of the OPNET, the controlled object module and the controller module, so that the data transmission and the simulation control command transmission between the two simulation software are independent from each other, and the normal operation of simulation cannot be interfered by each other; and the object node and the controller node realize the transmission of data packets through a wireless network in the OPNET, thereby forming a wireless network control system with real-time feedback.
As an embodiment of the present invention, the step S1 specifically includes:
s11, selecting a dynamic source routing protocol DSR as a routing protocol of all mobile nodes, and modifying a data source module positioned in an application layer in a protocol model to cooperate with joint simulation;
step S12, modifying the node model provided by the OPNET Modler and having the related protocol to realize the simulation purpose;
step S13, a MANET library node MANET _ station _ adv provided by an OPNET protocol library is used as a protocol model, and a data source module positioned at an application layer in the protocol model is modified to cooperate with joint simulation, so that the combination of OPNET/Simulink joint simulation and a MANET routing protocol is realized;
step S14, carrying interface control information ICI when sending the data packet, wherein the ICI is a dynamic simulation entity and is created and destroyed according to the requirement in the process of executing the process; creating an ICI using the core function op _ ICI _ create () and returning a pointer to the ICI, which is used as a reference to the ICI; a newly created ICI does not contain any information and attributes must be added through core functions including op _ ICI _ attr _ set (), op _ ICI _ attr _ set _ ptr ();
step S15, the OPNET simulation core associates an ICI with an event through a binding mechanism, and each process can only bind one ICI at any time; binding an ICI to an output interrupt through a core function op _ ICI _ interrupt (), wherein the ICI can be output to other processes or other layers in a model along with an output packet sending function or other sending functions after the binding; when an ICI is received by a process, the process can obtain a pointer of the ICI through a core function op _ intrpt _ ICI (), and obtain an attribute value of the ICI through op _ ICI _ attr _ get (); when an existing ICI is no longer needed, it can be destroyed by using op _ ICI _ store ().
As an embodiment of the present invention, the step S2 specifically includes:
step S21, adding the definition and calling of an MATLAB engine to start joint simulation on the premise of ensuring that a data source module can normally communicate with other layers of a protocol, and realizing the creation, sending and receiving of a joint simulation data packet by adding various Simulink simulation control commands and self-defined calling functions; simultaneously, defining routing information required by a routing protocol to match with the protocol requirement of an IP layer; meanwhile, in order to ensure that the modified nodes can normally communicate with other MANET nodes, parts such as attribute declarations, various statistic operations and the like need to be reserved;
s22, processing a process model of the object node data source module; the method comprises the following steps:
step S221, the initialization of the module and the registration of the statistic are completed through five state machines, including calling in attributes and parameters defined by a user, initializing global variables of a process model and variables needed by joint simulation, and registering the statistic for the inquiry and identification of an ip _ encap layer; simultaneously opening an MATLAB engine to call a Simulink model of a controlled object and starting Simulink simulation; after the initialization is completed, waiting for other process models to be ready; then entering an idle state waiting for an interrupt, wherein the process model can respond to two interrupts, namely self-interrupt PLANT _ SAMPLE for timing sampling data, and PLANT _ ARRIVAL for data packet ARRIVAL;
step S222, reading Simulink model data of the controlled object, and packaging and sending the collected data and routing information required by the protocol; when the simulation time of the OPNET reaches the sampling time, responding to self-interruption, reading data of a controlled object Simulink model from a working space of the MATLAB, calling a place _ send function to put the current state into a data packet, defining IP addresses of a source node place and a destination node controller at the same time, writing the IP addresses into interface control information ICI of an IP _ encap model, and then sending the data packet to the IP _ encap module, so that routing information in the ICI is sent out along with the data packet;
step S223, receiving a data packet returned from the controller and restarting Simulink simulation; calling the plant _ arrival function to receive data obtained from the controller immediately upon receiving the packet arrival interrupt, and simultaneously commanding the controlled object model to run according to the previous input parameters to compensate the measured delay time; writing the updated control information data into an MATLAB working space to update related parameters of a controlled object Simulink model, and finally restarting Simulink simulation until the next sampling moment;
s23, processing a process model of the controller node data source module; the method comprises the following steps:
s231, initializing a module, registering statistics, and calling a Simulink model of the controller;
step S232, receiving a data packet of the controlled object, and packaging and sending the output of the controller model and the routing information; when the received data packet reaches an interrupt, a controller immediately acquires a plant state in the data packet, and then writes the acquired data into an MATLAB working space to continuously update the relevant parameters of the controller model; the controller controls the system according to the latest parameters; and then putting the output of the controller into the created data packet, simultaneously writing the IP addresses of the source node controller and the destination node plant into the ICI of the IP _ encap model, and finally sending the data packet to the IP _ encap module.
According to another aspect of the invention, the following technical scheme is adopted: a wireless network control system co-simulation system, the co-simulation system comprising:
the model building module is used for analyzing the communication protocol, the communication equipment, the subnet equipment, the communication node and the number of subnets of the communication network to be simulated and building a process model, a node model and a network model of a corresponding OPNET model and parameter setting of each model and network protocol;
the simulation module is used for realizing a method for controlling the Simulink model of the MANET node by the MANET node through secondary development of the MANET node in the OPNET library, acquiring Simulink data, packaging and sending the Simulink data, and calling the Simulink models of the controlled object and the controller by respectively using two MATLAB engines in the controlled object node and the controller node; the two MATLAB engines are respectively used as interface modules of the OPNET, the controlled object module and the controller module, so that the data transmission and the simulation control command transmission between the two simulation software are independent, and the normal operation of simulation cannot be interfered by mutual influence; and the object node and the controller node realize the transmission of data packets through the wireless network in the OPNET, thereby forming a real-time feedback wireless network control system.
The invention firstly combines network simulation software OPNET with system simulation software MATLAB, and designs a WNCS (wireless network control system) combined simulation system based on OPNET and Simulink. Meanwhile, in order to simulate a real network environment more accurately, a MANET (mobile ad hoc network) routing protocol is added into the built joint simulation system, and a WNCS joint simulation method based on the MANET is designed, so that joint simulation of a control system and the network environment under a network protocol framework is realized. The method not only can truly simulate the characteristics of the whole WNCS, provides a strong verification platform for the theoretical achievement of the WNCS, but also has good expansibility, and can simulate different types of WNCS by utilizing the platform, and also can modify and adjust the platform to a certain extent according to the self needs of a user so as to realize the combination of the WNCS joint simulation and other network protocols.
The invention has the beneficial effects that: the wireless network control system joint simulation method and the wireless network control system joint simulation system can truly simulate the characteristics of the whole WNCS, provide a powerful verification platform for the theoretical achievement of the WNCS, and have good expansibility; the platform can be used for simulating different types of WNCS, and can be modified and adjusted to a certain extent according to the self needs of the user so as to realize the combination of WNCS joint simulation and other network protocols.
Drawings
Fig. 1 is a schematic diagram of joint simulation of a radio network control system according to an embodiment of the present invention.
Figure 2 is a schematic diagram of a wireless network model for WNCS co-simulation based on MANET in an embodiment of the present invention.
Fig. 3 is a schematic diagram of a node model of a controlled object according to an embodiment of the present invention.
FIG. 4 is a diagram illustrating a process model of plant _ src according to an embodiment of the present invention.
Fig. 5 is a schematic diagram of a process model of controller _ src in an embodiment of the present invention.
FIG. 6 is a diagram illustrating the setting of MANET routing protocol parameters in accordance with an embodiment of the present invention.
Fig. 7 is a flowchart of a joint simulation method of a rnc according to an embodiment of the present invention.
Fig. 8 is a schematic diagram illustrating the components of a rnc simulation system according to an embodiment of the present invention.
Detailed Description
Preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
For a further understanding of the invention, reference will now be made to the preferred embodiments of the invention by way of example, and it is to be understood that the description is intended to further illustrate features and advantages of the invention, and not to limit the scope of the claims.
The description in this section is for several exemplary embodiments only, and the present invention is not limited only to the scope of the embodiments described. It is within the scope of the present disclosure and protection that the same or similar prior art means and some features of the embodiments may be interchanged.
The steps in the embodiments in the specification are only expressed for convenience of description, and the implementation manner of the present application is not limited by the order of implementation of the steps. The term "connected" in the specification includes both direct connection and indirect connection.
Fig. 1 is a schematic diagram of joint simulation of a wireless network control system according to an embodiment of the present invention, and fig. 7 is a flowchart of a joint simulation method of a wireless network control system according to an embodiment of the present invention; referring to fig. 1 and 7, the joint simulation method includes:
step S1, a process model, a node model, and a network model of a corresponding OPNET (network simulation technology software package) model are constructed by analyzing the number of communication protocols, communication devices, subnet devices, communication nodes, and subnets of the communication network to be simulated, and setting parameters of each model and network protocol.
In an embodiment of the present invention, step S1 includes the following steps:
and S11, selecting a dynamic source routing protocol DSR as a routing protocol of all mobile nodes, and modifying a data source module positioned in an application layer in a protocol model to cooperate with joint simulation. The dynamic source routing protocol DSR is a simple and efficient routing protocol designed specifically for MANETs, and is also a relatively mature on-demand routing protocol currently used in MANET networks.
And step S12, modifying the node model provided by the OPNET Modler and having the related protocol to realize the simulation purpose.
There are generally two methods to add network protocols to the developed WNCS co-simulation platform: firstly, a user can create a network protocol according to the requirement of the user through a self-defined protocol module; and secondly, the node model provided by the OPNET Modler and provided with the relevant protocol is modified to a certain extent to realize the simulation purpose. Aiming at the existing protocol cluster models such as OSI, TCP/IP and the like, the OPNET Modler has a complete network protocol database including protocols such as Ethernet, ipv6, MANET, zigbee and the like, and source codes of the protocol modules are completely disclosed, and a user can directly modify a relevant protocol node model to realize simulation. Compared with the first method, the method is simpler and more convenient, the user only needs to care about the connection between the modified protocol module and the next protocol module, and other protocol modules do not need to be changed, so that the second method is selected.
And S13, adopting a MANET library node MANET _ station _ adv provided by an OPNET protocol library as a protocol model, and modifying a data source module positioned at an application layer in the protocol model to cooperate with joint simulation, so that the combination of OPNET/Simulink joint simulation and a MANET routing protocol is realized.
MANET _ station _ adv is one of the most important wireless node models in the MANET network model, and can realize an IP packet flow generator in a simulation way. In the model, a data source module sends a generated data packet to an IP _ encap layer, the IP _ encap layer encapsulates the packet into an IP form after receiving the data packet and sends the IP form to an IP layer, and the IP layer unpacks the data packet according to protocol requirements and sends the data packet to a MANET network for communication.
Step S14, in the protocol model set _ station _ adv, important routing information not contained in the data packet, such as IP addresses of the source node and the destination node, needs to be transferred between the network layers in addition to transmitting the service data through the data packet. Therefore, interface Control Information ICI (Interface Control Information)) is carried when sending a data packet, and ICI is a dynamic simulation entity and is created and destroyed as needed in the process of executing a process; creating an ICI using the core function op _ ICI _ create () and returning a pointer to the ICI, which is used as a reference to the ICI; a newly created ICI does not contain any information and attributes must be added through core functions including op _ ICI _ attr _ set (), op _ ICI _ attr _ set _ ptr (), etc.
Step S15, the OPNET simulation core associates an ICI with an event through a binding mechanism, and each process can only bind one ICI at any time; binding a certain ICI to an output interrupt through a core function op _ ICI _ interrupt (), after binding, the ICI can be output to other layers in another process or model along with an output packet transfer function or other transfer functions; when an ICI is received by a process, the process can obtain a pointer of the ICI through a core function op _ intrpt _ ICI (), and obtain an attribute value of the ICI through op _ ICI _ attr _ get (); when an existing ICI is no longer needed, it can be destroyed by using op _ ICI _ store (). Since the ICI does not strictly limit which process belongs to, any process can operate on the ICI as long as it can obtain the ICI pointer; for example, ICI may be destroyed by the creation process, and may also be destroyed by the receiving process.
Step S2, a MANET node is realized to control the Simulink model of the MANET node through secondary development of the MANET node in the OPNET library, the MANET node can receive/send data of a control system, and the Simulink model of a controlled object and the Simulink model of a controller are called by using two MATLAB engines in the controlled object node and the controller node respectively; the two MATLAB engines are respectively used as interface modules of the OPNET, the controlled object module and the controller module, so that the data transmission and the simulation control command transmission between the two simulation software are independent, and the normal operation of simulation cannot be interfered by mutual influence; the transmission of data packets between the object node and the controller node is realized through a wireless network in the OPNET, so that a real-time feedback wireless network control system is formed;
step S21, adding the definition and calling of an MATLAB engine to start joint simulation on the premise of ensuring that a data source module can normally communicate with other layers of a protocol, and realizing the creation, sending and receiving of a joint simulation data packet by adding various Simulink simulation control commands and self-defined calling functions; simultaneously, defining routing information required by a routing protocol to match with the protocol requirement of an IP layer; meanwhile, in order to ensure that the modified node can normally communicate with other MANET nodes, parts such as attribute declaration, various statistic operations and the like need to be reserved;
s22, processing a process model of the object node data source module; the method comprises the following steps:
step S221, the initialization of the module and the registration of the statistic are completed through five state machines, including calling in attributes and parameters defined by a user, initializing global variables of a process model and variables needed by joint simulation, and registering the statistic for the inquiry and identification of an ip _ encap layer; simultaneously opening an MATLAB engine to call a Simulink model of a controlled object and starting Simulink simulation; after the initialization is completed, waiting for other process models to be ready; then entering an idle state waiting for an interrupt, wherein the process model can respond to two interrupts, namely self-interrupt PLANT _ SAMPLE for timing sampling data, and PLANT _ ARRIVAL for data packet ARRIVAL;
step S222, reading Simulink model data of the controlled object, and packaging and sending the collected data and routing information required by the protocol; when the simulation time of the OPNET reaches the sampling time, responding to self-interruption, reading data of a controlled object Simulink model from a working space of the MATLAB, calling an plant _ send function to put the current state into a data packet, defining IP addresses of a source node plant and a destination node controller, writing the IP addresses into interface control information ICI of an IP _ encap model, and sending the data packet to an IP _ encap module, so that routing information in the ICI is sent out along with the data packet;
step S223, receiving the data packet returned from the controller and restarting Simulink simulation; calling the plant _ arrival function to receive data obtained from the controller immediately upon receiving the packet arrival interrupt, and simultaneously commanding the controlled object model to run according to the previous input parameters to compensate the measured delay time; then writing the updated control information data into MATLAB working space to update related parameters of a controlled object Simulink model, and finally restarting Simulink simulation until the next sampling moment;
s23, processing a process model of the controller node data source module; the method comprises the following steps:
s231, initializing a module, registering statistics, and calling a Simulink model of the controller;
step S232, receiving a data packet of the controlled object, and packaging and sending the output of the controller model and the routing information; when the received data packet reaches an interrupt, a controller immediately acquires a plant state in the data packet, and then writes the acquired data into an MATLAB working space to continuously update relevant parameters of a controller model; the controller controls the system according to the latest parameters; and then putting the output of the controller into the created data packet, simultaneously writing the IP addresses of the source node controller and the destination node plant into the ICI of the IP _ encap model, and finally sending the data packet to the IP _ encap module.
Fig. 8 is a schematic diagram illustrating a combined simulation system of a rnc according to an embodiment of the present invention; referring to fig. 8, the joint simulation system includes a model building module 1 and a simulation module 2.
The model building module 1 is used for analyzing the communication protocol, the communication equipment, the subnet equipment, the communication node and the number of subnets of the communication network to be simulated and building a process model, a node model and a network model of the corresponding OPNET model and parameter setting of each model and network protocol.
The simulation module 2 is used for realizing a method for controlling a Simulink model of a MANET node by the MANET node through secondary development of the MANET node in the OPNET library, acquiring Simulink data, packaging and sending the Simulink data, and calling the Simulink models of a controlled object and a controller by respectively using two MATLAB engines in the controlled object node and the controller node; the two MATLAB engines are respectively used as interface modules of the OPNET, the controlled object module and the controller module, so that the data transmission and the simulation control command transmission between the two simulation software are independent, and the normal operation of simulation cannot be interfered by mutual influence; and the object node and the controller node realize the transmission of data packets through the wireless network in the OPNET, thereby forming a real-time feedback wireless network control system.
The composition and specific implementation process of the model building module 1 and the simulation module 2 can be referred to the above description of the joint simulation method of the wireless network control system.
FIG. 2 is a schematic diagram of a wireless network model for WNCS co-simulation based on MANET in accordance with an embodiment of the present invention; referring to fig. 2, 12 wireless nodes are placed in the scene, including two special nodes plant, controller and 10 intermediate nodes, and each node moves randomly in the area to form a small wireless lan. The nodes communicate through wireless links, the wireless links are dynamically generated in the simulation process, exist between any group of wireless transmitters and wireless receivers, and the physical characteristics of the wireless links can be changed by changing parameters such as modulation types and transmission rates. In the wireless network, 10 intermediate nodes all adopt a library node manet _ station _ adv as a node model.
The MANET _ station _ adv is one of the most main wireless node models of the MANET network model, and can simulate to realize an IP packet flow generator, which is similar to a process module stack, and each group of process modules represents one layer of the O S I communication protocol model. And the data source module positioned at the application layer sends the generated data packet to the ip _ encap layer, the ip _ encap layer packages the packet into an ip form after receiving the data packet and sends the ip form to the ip layer, and the ip layer unpacks the packet according to protocol requirements and sends the packet to a MANET network for communication. FIG. 3 is a node model of a special node plant, which is modified based on the manet _ station _ adv, and is different from the manet _ station _ adv only in a data source module, and is identical to the manet _ station _ adv in other aspects. The node model of another special node controller is similar to the plant, and the data source module is modified.
The process model is used for realizing the functions of each module in the node model in detail, and supports the realization of the protocol through a powerful finite state machine. The process models of the data source modules plant _ src and controller _ src of two special nodes are mainly described here. FIG. 4 shows a process model of plant _ src, which includes 8 finite state machines, which respectively simulate the following states:
1) When simulation starts, a process model firstly enters the init state to carry out module initialization operation, wherein the operation content comprises the steps of calling in attributes and parameters defined by a user, initializing global variables of the process model and variables needed by joint simulation, setting interrupt priority, and registering statistics so as to facilitate ip _ encap query and identification. And simultaneously, opening a MATLAB engine to call a Simulink model of the controlled object and starting Simulink simulation.
2) The wait states wait _0, wait _1 and wait _2 states all function to wait for other processes of the node to be ready.
3) discover state: for dynamically discovering and observing IP blocks (specifically IP _ encap blocks) in a node.
4) dispatch indicates entry into an idle state waiting for an interrupt, and the PLANT _ src process model responds to two interrupts, a self-interrupt (PLANT _ SAMPLE) that periodically SAMPLEs data, and a packet ARRIVAL interrupt (PLANT _ ARRIVAL).
5) sample state: the data transmission of the controlled object node is time-driven, when the simulation time of the OPNET reaches the sampling moment, the data of the controlled object Simulink model is responded to self-interruption, the data of the controlled object Simulink model is read from the working space of the MATLAB, then the plan _ send () function is called to put the current state of palnt into a data packet, meanwhile, the IP addresses of a source node (plan) and a destination node (controller) are defined and written into ici (interface control information) of an IP _ encap model, then the data packet is transmitted to an IP _ encap module, and therefore routing information in the ici is also transmitted together with the data packet.
6) The continue state: when a packet ARRIVAL interrupt (PLANT _ ARRIVAL) is generated upon receipt of a data packet from a controller node, the PLANT _ src responds to the interrupt by calling the PLANT _ arrive () function to receive data from the controller, while commanding the controlled object model to run with the previous input parameters to compensate for the measured delay time. And then writing the updated control information data into MATLAB working space to update relevant parameters of a Simulink model of the controlled object, and finally restarting the Simulink simulation until the next sampling moment. After the above steps are completed, the process will return to dispatch state to continue waiting for the interrupt.
Fig. 5 shows a process model of controller _ src, which includes 7 finite state machines, the first six states are similar to plant _ src _ process, and mainly complete initialization of the module and registration of statistics, and call the Simulink model of the controller. But upon entering the dispatch state, controller _ src _ process responds only to packet ARRIVAL interrupts (ARRIVAL). When a data packet from a controlled object node is received, a controller _ arive () function is called immediately to acquire the plant state in the data packet, and then the obtained data is written into a working space of the MATLAB to continuously update the relevant parameters of the controller model. The controller controls the system according to the latest parameters. And then, putting the output of the controller into the created data packet by using a controller _ send () function, simultaneously writing the IP addresses of the source node (controller) and the destination node (plant) into the ici of the IP _ encap model, and finally sending the data packet to the IP _ encap module, so that the routing information in the ici is also sent out together with the data packet. The process will then return to dispatch state again.
In OPNET Modeler, the MANET model contains the following 5 typical routing protocols: on-demand driven distance vector routing protocol (AODV), dynamic source routing protocol (DSR), optimal link state routing protocol (OLSR), temporary routing demand protocol (TORA), and Geographical Routing Protocol (GRP). As shown in FIG. 6, the node is selected, right-click is performed to select attrbs, then ad-hoc routing protocol is selected, and a specific MANET routing protocol is selected in the pull-down option.
In summary, the joint simulation method and system for the wireless network control system provided by the invention can truly simulate the characteristics of the whole WNCS, provide a powerful verification platform for the theoretical result of the WNCS, and have good expansibility; the platform can be used for simulating different types of WNCS, and can be modified and adjusted to a certain extent according to the requirements of the user so as to realize the combination of WNCS joint simulation and other network protocols.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware; for example, it may be implemented using Application Specific Integrated Circuits (ASICs), general purpose computers, or any other similar hardware devices. In some embodiments, the software programs of the present application may be executed by a processor to implement the above steps or functions. As such, the software programs (including associated data structures) of the present application can be stored in a computer-readable recording medium; such as RAM memory, magnetic or optical drives or diskettes, and the like. In addition, some steps or functions of the present application may be implemented using hardware; for example, as circuitry that cooperates with the processor to perform various steps or functions.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The description and applications of the invention herein are illustrative and are not intended to limit the scope of the invention to the embodiments described above. Effects or advantages referred to in the embodiments may not be reflected in the embodiments due to interference of various factors, and the description of the effects or advantages is not intended to limit the embodiments. Variations and modifications of the embodiments disclosed herein are possible, and alternative and equivalent various components of the embodiments will be apparent to those of ordinary skill in the art. It will be clear to those skilled in the art that the present invention may be embodied in other forms, structures, arrangements, proportions, and with other components, materials, and parts, without departing from the spirit or essential characteristics thereof. Other variations and modifications of the embodiments disclosed herein may be made without departing from the scope and spirit of the invention.

Claims (1)

1. A joint simulation method for a wireless network control system is characterized by comprising the following steps:
s1, analyzing the communication protocol, the communication equipment, the subnet equipment, the communication node and the number of subnets of a communication network to be simulated, and constructing a process model, a node model and a network model of a corresponding OPNET model and parameter setting of each model and network protocol; the step S1 comprises the following steps:
s11, selecting a dynamic source routing protocol DSR as a routing protocol of all mobile nodes, and modifying a data source module positioned in an application layer in a protocol model to cooperate with joint simulation;
s12, modifying the node model provided by the OPNET Modler and having the related protocol to realize the simulation purpose;
step S13, using MANET library node MANET _ station _ adv provided by the OPNET protocol library as a protocol model, and modifying a data source module positioned at an application layer in the protocol model to cooperate with joint simulation, thereby realizing the combination of OPNET/Simulink joint simulation and MANET routing protocol;
step S14, carrying interface control information ICI when sending the data packet, wherein the ICI is a dynamic simulation entity and is created and destroyed according to the requirement in the process of executing the process; creating an ICI using the core function op _ ICI _ create () and returning a pointer to the ICI, which is used as a reference to the ICI; a newly created ICI does not contain any information, and attributes must be added through core functions, including op _ ICI _ attr _ set (), op _ ICI _ attr _ set _ ptr ();
step S15, the OPNET simulation core associates an ICI with an event through a binding mechanism, and each process can only bind one ICI at any time; binding a certain ICI to an output interrupt through a core function op _ ICI _ interrupt (), after binding, the ICI can be output to other layers in another process or model along with an output packet transfer function or other transfer functions; when an ICI is received by a process, the process can obtain a pointer of the ICI through a core function op _ intrpt _ ICI (), and obtain an attribute value of the ICI through op _ ICI _ attr _ get (); when an existing ICI is no longer needed, it can be destroyed by using op _ ICI _ store ();
s2, controlling a Simulink model of the MANET node by the MANET node through secondary development of the MANET node in the OPNET library, enabling the MANET node to receive/send data of a control system, and calling the Simulink models of a controlled object and a controller by using two MATLAB engines in the controlled object node and the controller node respectively; the two MATLAB engines are respectively used as interface modules of the OPNET, the controlled object module and the controller module, so that the data transmission and the simulation control command transmission between the two simulation software are independent, and the normal operation of simulation cannot be interfered by mutual influence; the object node and the controller node realize the transmission of data packets through a wireless network in the OPNET, thereby forming a real-time feedback wireless network control system; the step S2 comprises the following steps:
step S21, adding the definition and calling of an MATLAB engine to start the joint simulation on the premise of ensuring that a data source module can normally communicate with other layers of a protocol, and realizing the creation, transmission and reception of a joint simulation data packet by adding various Simulink simulation control commands and self-defined calling functions; simultaneously, defining routing information required by a routing protocol to match with the protocol requirement of an IP layer; meanwhile, in order to ensure that the modified nodes can normally communicate with other MANET nodes, attribute declarations and various statistic operations need to be reserved;
s22, processing a process model of the object node data source module; the method comprises the following steps:
step S221, initializing a data source module and registering statistics through five finite state machines, wherein the initialization comprises calling user-defined attributes and parameters, initializing global variables of a process model and variables needed by joint simulation, and registering the statistics for inquiry and identification of an ip _ encap layer; simultaneously opening an MATLAB engine to call a Simulink model of a controlled object and starting Simulink simulation; waiting for other process models to be ready after initialization is completed; then entering an idle state waiting for an interrupt, wherein the process model can respond to two interrupts, namely self-interrupt PLANT _ SAMPLE for timing sampling data, and PLANT _ ARRIVAL for data packet ARRIVAL;
step S222, reading Simulink model data of the controlled object, and packaging and sending the collected data and routing information required by the protocol; when the simulation time of the OPNET reaches the sampling time, responding to self-interruption, reading data of a controlled object Simulink model from a working space of the MATLAB, calling a place _ send function to put the current state into a data packet, defining IP addresses of a source node place and a destination node controller at the same time, writing the IP addresses into interface control information ICI of an IP _ encap model, and then sending the data packet to the IP _ encap module, so that routing information in the ICI is sent out along with the data packet;
step S223, receiving the data packet returned from the controller and restarting Simulink simulation; calling an plant _ array function to receive data obtained from a controller once an interrupt of a data packet arrival is received, and simultaneously commanding the controlled object model to run according to the previous input parameters to compensate the measured delay time; writing the updated control information data into an MATLAB working space to update related parameters of a controlled object Simulink model, and finally restarting Simulink simulation until the next sampling moment;
s23, processing a process model of the controller node data source module; the method comprises the following steps:
s231, initializing a module, registering statistics, and calling a Simulink model of the controller;
step S232, receiving a data packet of the controlled object, and packaging and sending the output of the controller model and the routing information; when the received data packet reaches an interrupt, a controller immediately acquires a plant state in the data packet, and then writes the acquired data into an MATLAB working space to continuously update relevant parameters of a controller model; the controller controls the system according to the latest parameters; then putting the output of the controller into the created data packet, simultaneously writing the IP addresses of the source node controller and the destination node plant into ICI of the IP _ encap model, and finally sending the data packet to the IP _ encap module;
the process model is used for specifically realizing the functions of each module in the node model, and the realization of the protocol is supported by a powerful finite state machine; the process model comprises 8 finite state machines which respectively simulate the following states:
1) init state: when simulation starts, a process model firstly enters an init state to carry out module initialization operation, wherein the operation content comprises the steps of calling in attributes and parameters defined by a user, initializing global variables of the process model and variables needed by joint simulation, setting interrupt priority, and registering statistics for facilitating ip _ encap query and identification; simultaneously opening an MATLAB engine to call a Simulink model of a controlled object and starting Simulink simulation;
2) wait state: the wait _0, wait _1 and wait _2 states all function to wait for other processes of the node to be ready;
3) discover state: the IP module is used for dynamically discovering and observing the IP module in the node;
4) dispatch indicates entry into an idle state waiting for an interrupt, and the PLANT _ src process model responds to two interrupts, one is self-interrupt PLANT _ SAMPLE that periodically SAMPLEs data, and the other is packet ARRIVAL at interrupt PLANT _ ARRIVAL;
5) sample state: the data transmission of the controlled object node is time-driven, when the simulation time of OPNET reaches the sampling time, the data transmission of the controlled object Simulink model responds to self-interruption, the data of the controlled object Simulink model is read from the working space of MATLAB, then the plant _ send () function is called to put the current state of pall into a data packet, the IP addresses of the source node plant and the destination node controller are defined at the same time and written into the interface control information ici of the IP _ encap model, and then the data packet is transmitted to the IP _ encap module, so that the routing information in the ici is also transmitted together with the data packet;
6) The continue state: when a data packet sent by a controller node is received, generating a packet ARRIVAL interrupt PLANT _ ARRIVAL, responding to the interrupt by the PLANT _ src, calling a PLANT _ arive () function to receive data obtained from a controller, and simultaneously commanding a controlled object model to run according to the previous input parameters to compensate the measured delay time; writing the updated control information data into an MATLAB working space to update related parameters of a controlled object Simulink model, and finally restarting Simulink simulation until the next sampling moment; after the above steps are completed, the process will return to dispatch state to continue waiting for the interrupt.
CN202110603119.8A 2021-05-31 2021-05-31 Joint simulation method for wireless network control system Active CN113378364B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110603119.8A CN113378364B (en) 2021-05-31 2021-05-31 Joint simulation method for wireless network control system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110603119.8A CN113378364B (en) 2021-05-31 2021-05-31 Joint simulation method for wireless network control system

Publications (2)

Publication Number Publication Date
CN113378364A CN113378364A (en) 2021-09-10
CN113378364B true CN113378364B (en) 2022-11-11

Family

ID=77574972

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110603119.8A Active CN113378364B (en) 2021-05-31 2021-05-31 Joint simulation method for wireless network control system

Country Status (1)

Country Link
CN (1) CN113378364B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113904946A (en) * 2021-10-20 2022-01-07 中国人民解放军海军航空大学岸防兵学院 Communication simulation interrupt control method and system
CN114071529B (en) * 2021-11-18 2023-06-16 南京航空航天大学 Exata and Docker-based wireless network simulation method
CN114547886A (en) * 2022-02-22 2022-05-27 杭州杉石科技有限公司 State machine model and Simulink joint simulation method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6708329B1 (en) * 2000-05-26 2004-03-16 Itt Manufacturing Enterprises, Inc. Method and apparatus for producing modules compatible with a target system platform from simulation system modules utilized to model target system behavior
CN101360020B (en) * 2008-09-28 2011-04-06 西安电子科技大学 Simulation platform and method based on IEEE802.1X security protocol of EAP
US20140365196A1 (en) * 2010-08-25 2014-12-11 Telefonaktiebolaget L M Ericsson (Publ) Infrastructure Model Generation System And Method
CN110457747B (en) * 2019-07-02 2023-04-07 浙江工业大学 NS3 and MATLAB-based networked control system collaborative simulation method

Also Published As

Publication number Publication date
CN113378364A (en) 2021-09-10

Similar Documents

Publication Publication Date Title
CN113378364B (en) Joint simulation method for wireless network control system
Flammini et al. Wired and wireless sensor networks for industrial applications
Qin et al. Modeling and analysis of data aggregation from convergecast in mobile sensor networks for industrial IoT
CN101925102B (en) Wireless network topology simulation method adopting Ethernet promiscuous mode
Ferrari et al. Improving simulation of wireless networked control systems based on WirelessHART
CN104052759A (en) System for realizing add-and-play technology of internet of things
CN105634902A (en) Hardware In The Loop simulation system and communication method therefor
Wiberg Porting AODV-UU implementation to ns-2 and Enabling Trace-based Simulation
CN112327667A (en) Semi-physical simulation element design method for large-scale unmanned cluster network
CN101588272B (en) Movable self-organization network test platform and method thereof
CN104836737A (en) Internet of things communication method taking named data as center
Wang et al. NCTUns network simulation and emulation for wireless resource management
Gorgen et al. Jane-the java ad hoc network development environment
Zhao Presents the technology, protocols, and new innovations in Industrial Internet of Things (IIoT)
Zema et al. The CUSCUS simulator for distributed networked control systems: Architecture and use-cases
CN115361704A (en) C2D communication system and I/O data communication method based on base station MAC sublayer direct transmission
CN114063468A (en) Data interaction method suitable for wireless ad hoc network semi-physical simulation system
Paquereau et al. A module-based wireless node for ns-2
CN105472632A (en) Construction method, construction device and construction system for simulation wireless network
CN102186258A (en) Communication protocol method of wireless sensor network based on linear long distance
Krishna et al. Wireless network topological routing in wireless sensor networks
Tran et al. Mobile agents assisted data collection in wireless sensor networks utilizing ZigBee technology
Padmapriya et al. Minimizing Communication Cost In Wireless Sensor Networks To Avoid Packet Retransmission
CN100401705C (en) Wired local network analog platform construction method of mobile radio self-organizing network
Nitzel et al. Exploiting dynamic source routing to enable undersea networking over an ad-hoc topology

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