CN110457747A - A kind of network control system synergy emulation method based on NS3 and MATLAB - Google Patents

A kind of network control system synergy emulation method based on NS3 and MATLAB Download PDF

Info

Publication number
CN110457747A
CN110457747A CN201910596703.8A CN201910596703A CN110457747A CN 110457747 A CN110457747 A CN 110457747A CN 201910596703 A CN201910596703 A CN 201910596703A CN 110457747 A CN110457747 A CN 110457747A
Authority
CN
China
Prior art keywords
simulation
module
matlab
event
emulation
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.)
Granted
Application number
CN201910596703.8A
Other languages
Chinese (zh)
Other versions
CN110457747B (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.)
Zhejiang University of Technology ZJUT
Original Assignee
Zhejiang University of Technology ZJUT
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 Zhejiang University of Technology ZJUT filed Critical Zhejiang University of Technology ZJUT
Priority to CN201910596703.8A priority Critical patent/CN110457747B/en
Publication of CN110457747A publication Critical patent/CN110457747A/en
Application granted granted Critical
Publication of CN110457747B publication Critical patent/CN110457747B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Computer And Data Communications (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A kind of network control system synergy emulation method based on NS3 and MATLAB, planned network networked control systems cooperating simulation platform overall plan first, including design and simulation plateform system framework, it determines network control system cooperating simulation platform comprising modules and determines cooperating simulation platform data exchange and transmission scheme, the running environment of Liang Zhong simulation software is built in linux operating system, planned network networked control systems cooperating simulation platform Time Synchronizing later, collaborative simulation system is the analogue system that a kind of pair of real-time and timing are strict with, it needs to execute by simultaneously advancing two emulators, therefore three kinds of collaborative simulation Time Synchronizings are devised, and two of them is selected to be achieved, and improve the design of synchronous interaction model, next to each module program design of NS3, and design NS 3 emulation scripts, finally carry out the design of each modular program of MATLAB/Simulink.

Description

A kind of network control system synergy emulation method based on NS3 and MATLAB
Technical field
The present invention relates to for two different simulation software NS3 and MATLAB, pass through design feature framework and synchronous side Case, the method for making the two be able to carry out collaborative simulation.
Background technique
Network control system (NCS) is the system and actuator by be controlled, the control system of sensor and controller composition System, operation are coordinated by communication network, therefore NCS includes control and the communication visual angle of coupling.NCS is total using multipurpose The element for enjoying network connection spatial distribution leads to flexible framework, and typically reduces cost of installation and maintenance.Therefore, NCS It is applied in the wide range of areas such as industrial control system and unmanned vehicle (UAV).
However, existing simulation software concentrates on control system or communication network, the emulation of NCS is also based on pair The redevelopment of single simulation software.For example most common NCS emulation tool is namely based on the truetime software of MATLAB exploitation Packet.It has the function of accurate physical model and powerful to MATLAB, and supports the matrix operation of complicated algorithm, but even if makes Still certain communication networks can not be accomplished more accurately to emulate with truetime software package.The simulation software of communication system NS3 is a kind of discrete event simulator of open source extensively, it is intended to promote the emulation of network stack different levels network protocol, make With NS3, different network topologies can be constructed, and the mixing of several network technologies or multiple network can be simulated.If A kind of effective mode, which can be found, to be combined both, and allow two software to accomplish have complementary advantages, it will to greatly improve imitative Genuine accuracy.
Summary of the invention
The present invention to overcome the prior art can only a kind of system of accurate simulation the shortcomings that, propose it is a kind of based on NS3 and The network control system synergy emulation method of MATLAB.
In order to analyze the coupling effect of NCS, synergy emulation method is considered as one of most promising solution, this hair The bright advantages characteristic based on NS3 and MATLAB in respectively emulation field, proposes a kind of networking control based on NS3 and MATLAB Systematic collaboration emulation platform processed.
A kind of network control system synergy emulation method based on NS3 and MATLAB, first planned networkization control system System cooperating simulation platform overall plan, including design and simulation plateform system framework determine that network control system collaborative simulation is flat Platform comprising modules and determining cooperating simulation platform data exchange and transmission scheme, two kinds are built in linux operating system and is imitated The running environment of true software, later planned network networked control systems cooperating simulation platform Time Synchronizing, collaborative simulation system It is the analogue system that a kind of pair of real-time and timing are strict with, needs to execute by simultaneously advancing two emulators, therefore design Three kinds of collaborative simulation Time Synchronizings, and select two of them to be achieved, and improve the design of synchronous interaction model, it connects Get off to each module program design of NS3, and design NS3 emulation script, is finally designed each module journey of MATLAB/Simulink The design of sequence, including MATLAB Simulation drive module, Simulink control system model, MATLAB client component and MATLAB The design of the several modules of user interface.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of network control system synergy emulation method based on NS3 and MATLAB, contains following steps:
(1) planned network networked control systems cooperating simulation platform overall plan;
Step 11: design and simulation plateform system framework;
Emulation platform system can functionally be divided into control layer, Communication Layer and model layer three parts.Control layer by MATLAB user interface composition, is responsible for the overall operation situation of monitoring system, realizes that system parameter, control parameter are set It sets, issue communication command, control command and receives the data information acquired in simulation model.The function of Communication Layer passes through association It is realized with emulation socket word modules, is mainly responsible for exchanging for data between MATLAB and NS3.Model layer uses the emulation received Model cootrol instruction is with data needed for simulation model operation as inputting, and furthermore two kinds of simulators call respective emulation respectively Drive module promotes simulation process.
Step 12: determining network control system cooperating simulation platform comprising modules;
The comprising modules of emulation platform NS3 include NS3core module, and NS3 emulates script, NS3 node number and topology text Part module, multiple modules such as application module, wifi module, LTE module and mobility model module, MATLAB form mould Block includes MATLAB Simulation drive module, Simulink control system model, MATLAB client component, MATLAB user's interaction Interface, MATLAB element task space and emulation tracking statistics and visualization model.
Step 13: determining cooperating simulation platform data exchange and transmission scheme;
Data exchange between simulation software is covered using using MATLAB as the leading software of emulation using socket Interprocess communication when word realizes two simulation process operation collaborative simulation is connect, and will be emulated using the mode for establishing file cache area In initial start node number pass to NS3 simulating scenes script with node location and parsed, while MATLAB collaboration is imitative The initial parameter for the NS3 simulating scenes being arranged in true interface will start NS3 simulation process by the system order of MATLAB, And use parameter initialization simulating scenes.
For the data transmitting in single analog device, the parameter and MATLAB element task sky that are related in collaborative simulation interface Between information exchange, in MATLAB client component in MATLAB element task space information exchange and Simulink with The information exchange of MATLAB working space.
(2) planned network networked control systems cooperating simulation platform Time Synchronizing;
Step 21: collaborative simulation system is the analogue system that a kind of pair of real-time and timing are strict with, and is needed by same Step promotes two emulators to execute, but since MATLAB/Simulink is different from the Simulation drive mode of NS3, MATLAB/ Simulink is time driving, and NS3 is event-driven, therefore visual angle and definition of two emulators to collaborative simulation synchronous event It will be different.
Step 22: devising three kinds of collaborative simulation Time Synchronizings, and two of them is selected to be achieved;
Three kinds of different synchronization schemes are respectively that time stepping, master-slave mode are synchronous with clobal driving.According to emulation mesh The difference for marking scene, the two is realized after selection, the synchronous collaborative simulation scheme for realizing time driving of master-slave mode, principal and subordinate Formula, which synchronizes, considers influence of the asynchronous network event to control system in step-length synchronizing cycle, because without accumulation system error, However master-slave mode synchronizes and does not account for control system and timely respond to asynchronous network event, control system is only capable of same in the period Step event time point triggers network event when executing period transmission event.Clobal driving is synchronous for realizing based on controller Event driven collaborative simulation scheme, master-slave mode it is synchronous not only without accumulation system error but also can control system timely respond to it is certain non- The asynchronous network event in period.
Step 23: design synchronous interaction model.Simultaneously in order to realize the interaction with Simulink model, to synchronous interaction mould Type improves, because client-side program operation Simulink model need to be jumped out, then constantly establishes TCP connection again using client It closes the mode that socket disconnects to interact, structural body will be sent and received between client is established and disconnected For synchronizing.The server of NS3 will exist as iteration server at this time, and the connection that main socket is used to listen to client is asked It asks, and main socket will constantly create closing child socket, child socket is used to receive new connection request and sends and connect Receive structural body.
(3) each module program design of NS3;
Step 31: being provided in patent " the associative simulation interface method integrated based on the NS3 of Transmission Control Protocol and MATLAB " To NS3 default emulator, UDP application class and its assistant's class improvement, furthermore in order to record client transmission number The sending time that lower status number and data packet are transmitted according to the number of packet, the status number of data packet, more packets, separately designs Tetra- kinds of tag class of PacketNumTag, PacketPortTag, StateNumTag and SendTimeTag.
Step 32: design NS3 emulates script;
User is needed to write artificial foot when using NS3 and built network simulation scene originally, and simulating scenes pass through waf work Tool is compiled and runs, and the execution process for emulating script is as follows: execution principal function → use initialization list initialization test Script type → simulation parameter → operation Run () function is arranged using command line parameter starts to build simulating scenes → operation Random number seed → operation Configure_phyMode_Defaults () function of SeedManager () function setup emulation Configuration physical layer transmission mode simultaneously configures global parameter → operation CreateNodesphymacmobility () function, function It include: 1. node number and node location 2. to be extracted from NS3 node number and topological file module using call back function to set Standby addition physical layer and mac layers of transmission and packet loss tracking 3. are that node configures mobile property and node location readjustment 4. with glove Reason layer (channel model) and mac layer and communication equipment is installed on node, and opening network tracking file generated, have ascii with Two kinds of file types of pcap → operation Set_ExternallyDrivenSim_config () function configures external drive simulator Parameter → operation InstallInternetStack () function install internet protocol stack, function includes: 1. installation IP Layer Routing Protocol opens routing table tracking file generated 2. and installs internet protocol stack and be the interface point of all node devices With IP address → operation InstallApplication () function, function includes: the application journey of 1. selections installation TCP or UDP If 2. user of sequence selects LTE network, the carrying of activation side chain road, and configures LTE network tracking file generated 3. if it is desire to association It is run with emulation using the delay of setting and packet loss, operation Set_delayloss () function is configured → runs SetupWaveMessages () function is arranged if the physical layer modes of user are selected as WAVE agreement and sends bsm (substantially Security message) data packet → operation ConfigureLogTracing function generates some additional tracking files, and judges whether Necessary log component → operation Runsimulation () function in log system is opened, function is dynamic for Configuration network node It draws, data traffic file generated → simulating scenes are built and finished, start and terminate to emulate.
(4) each module program design of MATLAB/Simulink;
Step 401: design MATLAB Simulation drive module;
MATLAB Simulation drive module is made of the MATLAB script submodule of one group of mutual tight association, including emulation is just Beginningization module, emulation major cycle module, single step Simulation drive module, notice parsing and single step planning module, Simulink are emulated Start-up and shut-down control module.
Step 402: design and simulation initialization module;
Simulation initialisation module is used to initialize the series of parameters of simulation run, and opens and emulated Simulink model file, at the same allow Simulink execute one solution step-length time to start Control System Imitation, when with When Simulink initialization button is pressed at family in collaborative simulation interactive interface, which will be run.When simulation initialisation module Between driving with event driven difference be that initiation parameter is slightly different, while the module will save this under event-driven Node after solving step-length sends state, for using the transmission data packet in event driven client setting notification architecture body Trigger signal.
Step 403: design and simulation major cycle module;
It emulates major cycle module and operation is triggered by the beginning collaborative simulation button of interactive interface, emulation major cycle module will The single step between collaborative simulation event in continuous circular flow emulation in MATLAB time shaft, to promote MATLAB/ The simulation process of control system in Simulink, progress bar will be created to constantly update display entirely by addition emulating major cycle module The progress of collaborative simulation.Emulation major cycle module time driving is only in that with event driven difference: when module brings into operation, The client source Program Generating groups of clients for calling the driving of mex compiler compilation time will be will use using the module of time driving Part will use always the component to complete the interaction with NS3 in next entire simulation process, and use event driven imitative The step is not carried out in Allah's loop module.
Step 404: design single step Simulation drive module;
The single step between the collaborative simulation event in emulation in MATLAB time shaft is run by single step Simulation drive module, Single step Simulation drive module will differ widely in the process of two kinds of driving methods, using will directly run emulation when time driving When compiling the time driving client component of generation in major cycle module, and being synchronized every time with NS3 under event-driven, visitor Modification is set in the trigger signal of transmission data packet in the notification architecture body of family end, in order to ensure modified values are correctly sent, often An event-driven client source file will be all compiled before secondary operation single step Simulation drive module.Later, single step Simulation drive mould Block will be separately operable the parsing of respective notice and single step planning module and Simulink emulation start-up and shut-down control module, under event-driven It also needs to run controller respond module and possible controller response is completed.Finally, will will be deleted solve step-length maximum and Minimum value and external input variable, eliminate each run single step when by these variable dimensions it is inconsistent caused by emulate it is different Often.
Step 405: the parsing of design notice and single step planning module;
The text file that client is generated using the notification architecture body received, notice parsing are read with single step planning module These text files simultaneously parse, and notice parsing later plans a following single step according to different modes from single step planning module In simulation parameter and process.The core concept that notice parsing is realized with single step planning module is: Control System Imitation reproduction In same single step in network simulation control system operating condition, in addition notice parsing defines two kinds with single step planning module The data packet processing mode of application layer, a kind of mode are the threshold values of setting received data packet delay, prevent reception delay excessive Data packet, it is another then be to compile the current package number for receiving event with the data packet that event post-simulation uses is received before Number be compared, if the number for being currently received data packet be greater than before received data packet number, use the number According to data in wrapping, the packet data is otherwise then abandoned.Notice parsing setting under two kinds of driving methods with single step planning module Count thought and operational process it is also quite different, under time driving, single step be one synchronizing cycle step-length, if synchronizing cycle step Data packet is not received by length, in the single step by the packet delay be approximately one synchronizing cycle step-length, by being saved Point each reception event time delay across synchronizing cycle step-length number and the time span in current step, this is same A series of combination that step-length index value range is divided into bounds is solved in step period step-length, these combinations will be used in determination Next segmentation executes the index of the solution step-length of step-length synchronizing cycle emulation, is collected simultaneously data packet each time and receives event Relevant information be saved in structural body, and structural body is carried out by bubble sort according to the precedence of the event of reception, after sequence Structural body will successively reappear received data packet event after being used for, and under event-driven, single step is between adjacent two subsynchronous Simulation time, therefore only need to can be performed the single step by the corresponding bound for solving step-length index of the simulation time.Separately The lower limit of the outer solution step-length index for being determined certain section of emulation using truthful data packet delay different from time driving, event-driven are adopted The lower limit for the solution step-length index for being postponed to determine the single step with " reckoning ".
Step 406: design Simulink emulates start-up and shut-down control module;
Emulation start-up and shut-down control module directly controls Control System Imitation model in Simulink to complete the imitative of a single step Very, emulation start-up and shut-down control module is by using set_param function call Simulink emulation command in each solution step-length Start, pause, step and stop are realized to be emulated in each solution step-length start and stop Simulink, to reach in a certain precise time Point updates the purpose of exterior input.Notice parsing and list obtained in single step planning module are successively executed under time driving Each received data packet sequence of events in step, the bound indexed when received data packet event occurs using new solution step-length, And the external input of more new model, circulating start and outage execute each solution step-length until next case point, when sequence of events does not have The single step executes completion when remaining event, and the bound operation only indexed by the solution step-length of certain single step under event-driven Adjacent two it is subsynchronous between emulation, updating external input variable later is the model received in alternative events next time External input.The node location to control system is collected with velocity information after the completion of the single step run and redundancy is set The trigger signal that node is sent.
Step 407: design Simulink suspends callback module;
Call back function Stopfcn is set in Simulink simulation model, and call back function Stopfcn will be walked in each solution Readjustment Simulink suspends callback module when long pause, and Simulink suspends callback module and selected according to two kinds of driving methods of emulation Two kinds of readjustment subprograms of operation are selected, the internal state of control system in solution step-length each in emulation are saved in output corresponding In variable, and it is written in text file.
Step 408: design controller respond module;
Under event-driven mode, controller respond module executes after each controller receives data packet and calculates control amount Task, and save each node data packet of the control system under the event and send mark and read for client.Similar Simulink The start stop mode in start-up and shut-down control module is emulated, controller respond module determines that controller receives data packet and controller should not Packet discard then runs one and solves step-length to obtain the control amount of controller, and having executed the solution step-length post-simulation will return The state before executing the solution step-length is fallen back on, because executing the purpose of controller respond module just for the sake of obtaining controller Control amount, the purpose of rollback be in order to prevent collaborative simulation Time Inconsistency the problem of.
Step 409: design simulation model closedown module.
Step 410: design Simulink control system model;
By in a certain control system sensor and actuator regard as to rely on the same node of controlled device, and controller Regard another node as.Therefore two subsystems module is created in the control system file of Simulink to represent two sections Point.
Step 411: design MATLAB client component;
MATLAB client component is also divided into two kinds according to the difference of driving method, client from MATLAB working space with And obtained in text file Simulink emulate single step as a result, and NS3 circulation clothes will be sent to after its customized encapsulation Business device, enters data packet comprising new round simulation result of the blocking model until receiving NS3 transmission later, and resolve packet is complete It will be closed at rear client.
Step 412: design MATLAB user interface;
According to demand analysis, user is needed the settable simulation parameter of user is divided into global ginseng according to different simulating scenes Number, control system parameter, node network interface card parameter, NS3 parameter and redundant node send setting parameter, and furthermore user can be used Boundary is exited in the loading of simulation model, the control of collaborative simulation process, the drafting of simulation result, simulating scenes flash demo and resetting 5, face function.
The invention has the advantages that using strong synchronous between socket realization NS3 and MATLAB, with effective and true needle Network control system is emulated.
Detailed description of the invention
Fig. 1 is the architecture diagram of the method for the present invention;
Fig. 2 is master-slave mode synchronization schematic diagram of the present invention;
Fig. 3 is clobal driving synchronization schematic diagram of the present invention;
Fig. 4 is tag class uml class figure of the present invention;
Fig. 5 is simulation initialisation module operational flow diagram of the present invention;
Fig. 6 is present invention emulation major cycle module operational flow diagram;
Fig. 7 is single step Simulation drive module operational flow diagram of the present invention;
Fig. 8 a is the parsing of present invention notice and single step planning module operational flow diagram (time driving);
Fig. 8 b is the parsing of present invention notice and single step planning module operational flow diagram (event-driven);
Fig. 9 is Simulink emulation start-up and shut-down control module operational flow diagram of the present invention;
Figure 10 is the schematic diagram of the embeddable Simulink control system model of the present invention;
Figure 11 is MATLAB user interface figure of the present invention;
Figure 12 is the complete block diagram of closed-loop system that observer, adjuster and front device is added of the embodiment of the present invention 1;
Figure 13 is the trolley position tracking effect picture of the embodiment of the present invention 1;
Figure 14 be the embodiment of the present invention 1 two schemes under trolley position tracking effect contrast figure.
Specific embodiment
Understand for the ease of those of ordinary skill in the art and implement the present invention, with reference to the accompanying drawings and examples to this hair It is bright to be described in further detail.
A kind of network control system synergy emulation method based on NS3 and MATLAB, contains following steps:
(1) planned network networked control systems cooperating simulation platform overall plan;
Step 11: design and simulation plateform system framework;
Emulation platform system can functionally be divided into control layer, Communication Layer and model layer three parts.Control layer by MATLAB user interface composition, is responsible for the overall operation situation of monitoring system, realizes that system parameter, control parameter are set It sets, issue communication command, control command and receives the data information acquired in simulation model.The function of Communication Layer passes through association It is realized with emulation socket word modules, is mainly responsible for exchanging for data between MATLAB and NS3.Model layer uses the emulation received Model cootrol instruction is with data needed for simulation model operation as inputting, and furthermore two kinds of simulators call respective emulation respectively Drive module promotes simulation process.
Step 12: determining network control system cooperating simulation platform comprising modules;
The comprising modules of emulation platform NS3 include NS3core module, and NS3 emulates script, NS3 node number and topology text Part module, multiple modules such as application module, wifi module, LTE module and mobility model module, MATLAB form mould Block includes MATLAB Simulation drive module, Simulink control system model, MATLAB client component, MATLAB user's interaction Interface, MATLAB element task space and emulation tracking statistics and visualization model.
Step 13: determining cooperating simulation platform data exchange and transmission scheme;
Data exchange between simulation software is covered using using MATLAB as the leading software of emulation using socket Interprocess communication when word realizes two simulation process operation collaborative simulation is connect, and will be emulated using the mode for establishing file cache area In initial start node number pass to NS3 simulating scenes script with node location and parsed, while MATLAB collaboration is imitative The initial parameter for the NS3 simulating scenes being arranged in true interface will start NS3 simulation process by the system order of MATLAB, And use parameter initialization simulating scenes.
For the data transmitting in single analog device, the parameter and MATLAB element task sky that are related in collaborative simulation interface Between information exchange, in MATLAB client component in MATLAB element task space information exchange and Simulink with The information exchange of MATLAB working space.
(2) planned network networked control systems cooperating simulation platform Time Synchronizing;
Step 21: collaborative simulation system is the analogue system that a kind of pair of real-time and timing are strict with, and is needed by same Step promotes two emulators to execute, but since MATLAB/Simulink is different from the Simulation drive mode of NS3, MATLAB/ Simulink is time driving, and NS3 is event-driven, therefore visual angle and definition of two emulators to collaborative simulation synchronous event It will be different.
Step 22: devising three kinds of collaborative simulation Time Synchronizings, and two of them is selected to be achieved;
Three kinds of different synchronization schemes are respectively that time stepping, master-slave mode are synchronous with clobal driving.According to emulation mesh The difference for marking scene, the two is realized after selection, the synchronous collaborative simulation scheme for realizing time driving of master-slave mode, principal and subordinate Formula, which synchronizes, considers influence of the asynchronous network event to control system in step-length synchronizing cycle, because without accumulation system error, However master-slave mode synchronizes and does not account for control system and timely respond to asynchronous network event, control system is only capable of same in the period Step event time point triggers network event when executing period transmission event.Clobal driving is synchronous for realizing based on controller Event driven collaborative simulation scheme, master-slave mode it is synchronous not only without accumulation system error but also can control system timely respond to it is certain non- The asynchronous network event in period.
Step 23: design synchronous interaction model.Simultaneously in order to realize the interaction with Simulink model, to synchronous interaction mould Type improves, because client-side program operation Simulink model need to be jumped out, then constantly establishes TCP connection again using client It closes the mode that socket disconnects to interact, structural body will be sent and received between client is established and disconnected For synchronizing.The server of NS3 will exist as iteration server at this time, and the connection that main socket is used to listen to client is asked It asks, and main socket will constantly create closing child socket, child socket is used to receive new connection request and sends and connect Receive structural body.
(3) each module program design of NS3;
Step 31: being provided in patent " the associative simulation interface method integrated based on the NS3 of Transmission Control Protocol and MATLAB " To NS3 default emulator, UDP application class and its assistant's class improvement, furthermore in order to record client transmission number The sending time that lower status number and data packet are transmitted according to the number of packet, the status number of data packet, more packets, separately designs Tetra- kinds of tag class of PacketNumTag, PacketPortTag, StateNumTag and SendTimeTag.
Step 32: design NS3 emulates script;
User is needed to write artificial foot when using NS3 and built network simulation scene originally, and simulating scenes pass through waf work Tool is compiled and runs, and the execution process for emulating script is as follows: execution principal function → use initialization list initialization test Script type → simulation parameter → operation Run () function is arranged using command line parameter starts to build simulating scenes → operation Random number seed → operation Configure_phyMode_Defaults () function of SeedManager () function setup emulation Configuration physical layer transmission mode simultaneously configures global parameter → operation CreateNodesphymacmobility () function, function It include: 1. node number and node location 2. to be extracted from NS3 node number and topological file module using call back function to set Standby addition physical layer and mac layers of transmission and packet loss tracking 3. are that node configures mobile property and node location readjustment 4. with glove Reason layer (channel model) and mac layer and communication equipment is installed on node, and opening network tracking file generated, have ascii with Two kinds of file types of pcap → operation Set_ExternallyDrivenSim_config () function configures external drive simulator Parameter → operation InstallInternetStack () function install internet protocol stack, function includes: 1. installation IP Layer Routing Protocol opens routing table tracking file generated 2. and installs internet protocol stack and be the interface point of all node devices With IP address → operation InstallApplication () function, function includes: the application journey of 1. selections installation TCP or UDP If 2. user of sequence selects LTE network, the carrying of activation side chain road, and configures LTE network tracking file generated 3. if it is desire to association It is run with emulation using the delay of setting and packet loss, operation Set_delayloss () function is configured → runs SetupWaveMessages () function is arranged if the physical layer modes of user are selected as WAVE agreement and sends bsm (substantially Security message) data packet → operation ConfigureLogTracing function generates some additional tracking files, and judges whether Necessary log component → operation Runsimulation () function in log system is opened, function is dynamic for Configuration network node It draws, data traffic file generated → simulating scenes are built and finished, start and terminate to emulate.
(4) each module program design of MATLAB/Simulink;
Step 401: design MATLAB Simulation drive module;
MATLAB Simulation drive module is made of the MATLAB script submodule of one group of mutual tight association, including emulation is just Beginningization module, emulation major cycle module, single step Simulation drive module, notice parsing and single step planning module, Simulink are emulated Start-up and shut-down control module.
Step 402: design and simulation initialization module;
Simulation initialisation module is used to initialize the series of parameters of simulation run, and opens and emulated Simulink model file, at the same allow Simulink execute one solution step-length time to start Control System Imitation, when with When Simulink initialization button is pressed at family in collaborative simulation interactive interface, which will be run.When simulation initialisation module Between driving with event driven difference be that initiation parameter is slightly different, while the module will save this under event-driven Node after solving step-length sends state, for using the transmission data packet in event driven client setting notification architecture body Trigger signal.
Step 403: design and simulation major cycle module;
It emulates major cycle module and operation is triggered by the beginning collaborative simulation button of interactive interface, emulation major cycle module will The single step between collaborative simulation event in continuous circular flow emulation in MATLAB time shaft, to promote MATLAB/ The simulation process of control system in Simulink, progress bar will be created to constantly update display entirely by addition emulating major cycle module The progress of collaborative simulation.Emulation major cycle module time driving is only in that with event driven difference: when module brings into operation, The client source Program Generating groups of clients for calling the driving of mex compiler compilation time will be will use using the module of time driving Part will use always the component to complete the interaction with NS3 in next entire simulation process, and use event driven imitative The step is not carried out in Allah's loop module.
Step 404: design single step Simulation drive module;
The single step between the collaborative simulation event in emulation in MATLAB time shaft is run by single step Simulation drive module, Single step Simulation drive module will differ widely in the process of two kinds of driving methods, using will directly run emulation when time driving When compiling the time driving client component of generation in major cycle module, and being synchronized every time with NS3 under event-driven, visitor Modification is set in the trigger signal of transmission data packet in the notification architecture body of family end, in order to ensure modified values are correctly sent, often An event-driven client source file will be all compiled before secondary operation single step Simulation drive module.Later, single step Simulation drive mould Block will be separately operable the parsing of respective notice and single step planning module and Simulink emulation start-up and shut-down control module, under event-driven It also needs to run controller respond module and possible controller response is completed.Finally, will will be deleted solve step-length maximum and Minimum value and external input variable, eliminate each run single step when by these variable dimensions it is inconsistent caused by emulate it is different Often.
Step 405: the parsing of design notice and single step planning module;
The text file that client is generated using the notification architecture body received, notice parsing are read with single step planning module These text files simultaneously parse, and notice parsing later plans a following single step according to different modes from single step planning module In simulation parameter and process.The core concept that notice parsing is realized with single step planning module is: Control System Imitation reproduction In same single step in network simulation control system operating condition, in addition notice parsing defines two kinds with single step planning module The data packet processing mode of application layer, a kind of mode are the threshold values of setting received data packet delay, prevent reception delay excessive Data packet, it is another then be to compile the current package number for receiving event with the data packet that event post-simulation uses is received before Number be compared, if the number for being currently received data packet be greater than before received data packet number, use the number According to data in wrapping, the packet data is otherwise then abandoned.Notice parsing setting under two kinds of driving methods with single step planning module Count thought and operational process it is also quite different, under time driving, single step be one synchronizing cycle step-length, if synchronizing cycle step Data packet is not received by length, in the single step by the packet delay be approximately one synchronizing cycle step-length, by being saved Point each reception event time delay across synchronizing cycle step-length number and the time span in current step, this is same A series of combination that step-length index value range is divided into bounds is solved in step period step-length, these combinations will be used in determination Next segmentation executes the index of the solution step-length of step-length synchronizing cycle emulation, is collected simultaneously data packet each time and receives event Relevant information be saved in structural body, and structural body is carried out by bubble sort according to the precedence of the event of reception, after sequence Structural body will successively reappear received data packet event after being used for, and under event-driven, single step is between adjacent two subsynchronous Simulation time, therefore only need to can be performed the single step by the corresponding bound for solving step-length index of the simulation time.Separately The lower limit of the outer solution step-length index for being determined certain section of emulation using truthful data packet delay different from time driving, event-driven are adopted The lower limit for the solution step-length index for being postponed to determine the single step with " reckoning ".
Step 406: design Simulink emulates start-up and shut-down control module;
Emulation start-up and shut-down control module directly controls Control System Imitation model in Simulink to complete the imitative of a single step Very, emulation start-up and shut-down control module is by using set_param function call Simulink emulation command in each solution step-length Start, pause, step and stop are realized to be emulated in each solution step-length start and stop Simulink, to reach in a certain precise time Point updates the purpose of exterior input.Notice parsing and list obtained in single step planning module are successively executed under time driving Each received data packet sequence of events in step, the bound indexed when received data packet event occurs using new solution step-length, And the external input of more new model, circulating start and outage execute each solution step-length until next case point, when sequence of events does not have The single step executes completion when remaining event, and the bound operation only indexed by the solution step-length of certain single step under event-driven Adjacent two it is subsynchronous between emulation, updating external input variable later is the model received in alternative events next time External input.The node location to control system is collected with velocity information after the completion of the single step run and redundancy is set The trigger signal that node is sent.
Step 407: design Simulink suspends callback module;
Call back function Stopfcn is set in Simulink simulation model, and call back function Stopfcn will be walked in each solution Readjustment Simulink suspends callback module when long pause, and Simulink suspends callback module and selected according to two kinds of driving methods of emulation Two kinds of readjustment subprograms of operation are selected, the internal state of control system in solution step-length each in emulation are saved in output corresponding In variable, and it is written in text file.
Step 408: design controller respond module;
Under event-driven mode, controller respond module executes after each controller receives data packet and calculates control amount Task, and save each node data packet of the control system under the event and send mark and read for client.Similar Simulink The start stop mode in start-up and shut-down control module is emulated, controller respond module determines that controller receives data packet and controller should not Packet discard then runs one and solves step-length to obtain the control amount of controller, and having executed the solution step-length post-simulation will return The state before executing the solution step-length is fallen back on, because executing the purpose of controller respond module just for the sake of obtaining controller Control amount, the purpose of rollback be in order to prevent collaborative simulation Time Inconsistency the problem of.
Step 409: design simulation model closedown module.
Step 410: design Simulink control system model;
By in a certain control system sensor and actuator regard as to rely on the same node of controlled device, and controller Regard another node as.Therefore two subsystems module is created in the control system file of Simulink to represent two sections Point.
Step 411: design MATLAB client component;
MATLAB client component is also divided into two kinds according to the difference of driving method, client from MATLAB working space with And obtained in text file Simulink emulate single step as a result, and NS3 circulation clothes will be sent to after its customized encapsulation Business device, enters data packet comprising new round simulation result of the blocking model until receiving NS3 transmission later, and resolve packet is complete It will be closed at rear client.
Step 412: design MATLAB user interface;
According to demand analysis, user is needed the settable simulation parameter of user is divided into global ginseng according to different simulating scenes Number, control system parameter, node network interface card parameter, NS3 parameter and redundant node send setting parameter, and furthermore user can be used Boundary is exited in the loading of simulation model, the control of collaborative simulation process, the drafting of simulation result, simulating scenes flash demo and resetting 5, face function.
Embodiment 1:
For the validity for examining the cooperating simulation platform to run, we are flat at this for overhead crane tele-control system Platform carries out emulation testing.Due to overhead crane driving system (open loop) be in itself it is unstable, from adjust control technology angle say, Certain often can be used and adjusts control means, if overall-finished housing closed loop negative regulator controls, makes the variation at the angle θ (relative to steady-state value Departure) control in the range of a very little.Since the position sA of trolley is that the controlled device state that can be observed becomes Amount, it is possible to state observer reconfiguration system state be set using the measured value of small truck position sA, and cooperate total state anti- Feedback output feedback quantity makes control system closed-loop stabilization, and the feedback parameter of overall-finished housing device passes through according to POLE PLACEMENT USING situation Ackerman formula determines, as shown in figure 12, for the complete box of closed-loop system that observer, adjuster and front device is added Figure.In general, overall-finished housing device and state observer can be seen as controller as a whole, usually this The controller of class industry spot is to carry out field control by embedded scm or PLC, and live wiring generally passes through wired The operation of network, such as field bus system or Ethernet, network does not have a great impact to control precision, but if scene Controller receive damage, in order to keep remaining in operation for control system, it is contemplated that by allowing long-range control by wireless network Device intervention control processed, at this moment the characteristic of communication network will generate large effect to control system.The parameter setting of simulating scenes As shown in table 1 below.
The setting of 1 crane tele-control system simulation parameter of table
Parameter list Selected parameter
Node number 2
Single step size 30ms
Simulation accuracy 1ms
Emulate duration 40 seconds
Simulation drive mode Time driving
Channel path propagation model Logarithm distance decay model
Interchannel noise model NormalRandom plus Nakagami
Physical layer protocol 802.11b
Node motion model Normal position model
Transport layer protocol UDP
Routing Protocol aodv
Physical layer transmission rate mode Normal rate mode DsssRate11Mbps
Controller is placed sequentially in the position from controlled device distance 30m, 35m, 40m, and successively emulated (including Non-delay scene).Set forth herein lower hypothesis: 1. complete controlled device sensings and control information are held by single data packet respectively It carries, size is respectively 33 bytes and 17 bytes.Data package size is smaller to be ensure that short packet transmission time and generates low network flow Amount.2. the task time that sampling, driving and control amount calculate can be ignored compared with network delay.As shown in figure 13, it is The simulation result of the small truck position sA tracking performance influenced by controller distance.
It can be seen that by simulation result, when controller distance is 30m, since internodal data connection is sufficiently stable, thus Postpone very little and almost without packet loss, trolley position tracking curve overshoot is 2.8%, compared to the overshoot under undelayed 2.6% is only high by 2%, therefore influence of the communication network to control performance is very little.And when controller distance is more than 30m Afterwards, since channel power attenuation rising makes receiver that can not detect lower-powered data packet, packet loss is caused to rise, time delay Become larger and establish Connection Time extension, the tracking performance of small truck position reduces rapidly, and when controller distance is 35m, tracking is bent Line is shaken, and trolley is just effectively controlled after driving in the wrong direction occurs in 12s to 19s, the aircraft pursuit course when controller distance is 40m It is acutely directly dissipated after concussion, trolley has been unable to get control, therefore it is table 2 within 30 meters that controller, which effectively disposes distance, Illustrate system performance of the controller under different distance.
Influence of the 2 controller distance of table to system performance
In order to solve controlled device to a certain extent since what dynamic property caused by increasing with controller distance deteriorated asks Topic uses the state compensation scheme based on time delay in the controller, and state observer is at the k moment from received data packet under the program The controlled device k- τ that middle estimation obtainssc,kSystem mode x (the k- τ that moment sendssc,k), wherein τsc,kIt is sent for this from sensor To the time delay of the data packet of controller, which is obtained to the discrete steps of time delay divided by control system state update cycle T τstep,sc,k, and at the k moment according to time delay discrete steps τstep,sc,kIt carries outThe status predication of step is (wherein), status predication updated value is calculated using based on controlled device state-space model hereIn the time for not receiving new data packet after the k moment, then used in each time step The current state predicted value saved in controllerThe calculating of a step is carried out based on plant model with shape State forecast updating valueWherein l is prediction step total till now after k reception to the data packet Number, controller will send the control amount being calculated according to status predication updated value in each sample period time point, use this Scheme is to compensate for the hysteretic state estimated from state observer, prevents from sending the control amount lagged.As shown in figure 14, For using the compensation scheme and trolley dynamic property comparison diagram when not using.It can be seen that from the curve in figure in controller Trolley aircraft pursuit course is set to eliminate shake and reverse movement using the compensation scheme when distance is 35m, dynamic property is good, is controlling Trolley aircraft pursuit course is set to eliminate violent concussion using the compensation scheme when device distance processed is 40m, although aircraft pursuit course has more Apparent overshoot, but unstable diverging is eliminated, it is capable of the reference input of effective tracking system.
Content described in this specification embodiment is only enumerating to the way of realization of inventive concept, protection of the invention Range should not be construed as being limited to the specific forms stated in the embodiments, and protection scope of the present invention is also and in art technology Personnel conceive according to the present invention it is conceivable that equivalent technologies mean.

Claims (1)

1. a kind of network control system synergy emulation method based on NS3 and MATLAB, contains following steps:
(1) planned network networked control systems cooperating simulation platform overall plan;
Step 11: design and simulation plateform system framework;
Emulation platform system can functionally be divided into control layer, Communication Layer and model layer three parts;Control layer is by MATLAB User interface composition, is responsible for the overall operation situation of monitoring system, realizes the setting of system parameter, control parameter, issues The data information acquired in communication command, control command and reception simulation model;The function of Communication Layer passes through collaborative simulation It is socketed word modules to realize, is mainly responsible for exchanging for data between MATLAB and NS3;Model layer uses the simulation model control received System instruction is with data needed for simulation model operation as inputting, and furthermore two kinds of simulators call respective Simulation drive mould respectively Block promotes simulation process;
Step 12: determining network control system cooperating simulation platform comprising modules;
The comprising modules of emulation platform NS3 include NS3 core module, and NS3 emulates script, NS3 node number and topological file mould Block, multiple modules such as application module, wifi module, LTE module and mobility model module, MATLAB comprising modules packet Include MATLAB Simulation drive module, Simulink control system model, MATLAB client component, MATLAB user's interaction circle Face, MATLAB element task space and emulation tracking statistics and visualization model;
Step 13: determining cooperating simulation platform data exchange and transmission scheme;
Socket socket is utilized using using MATLAB as the leading software of emulation for the data exchange between simulation software Realize interprocess communication when two simulation process run collaborative simulation, and will be first in emulation using the mode for establishing file cache area Start node number and the node location of beginning passes to NS3 simulating scenes script and is parsed, while MATLAB collaborative simulation circle The initial parameter for the NS3 simulating scenes being arranged in face will start NS3 simulation process by the system order of MATLAB, and make With parameter initialization simulating scenes;
For the data transmitting in single analog device, the parameter and MATLAB element task space that are related in collaborative simulation interface Information exchange, in MATLAB client component in MATLAB element task space information exchange and Simulink with The information exchange of MATLAB working space;
(2) planned network networked control systems cooperating simulation platform Time Synchronizing;
Step 21: collaborative simulation system is the analogue system that a kind of pair of real-time and timing are strict with, and needs to push away by synchronizing It is executed into two emulators, but since MATLAB/Simulink is different from the Simulation drive mode of NS3, MATLAB/Simulink is Time driving, and NS3 is event-driven, therefore two emulators will not to the visual angle of collaborative simulation synchronous event and definition Together;
Step 22: devising three kinds of collaborative simulation Time Synchronizings, and two of them is selected to be achieved;
Three kinds of different synchronization schemes are respectively that time stepping, master-slave mode are synchronous with clobal driving;According to simulation objectives field The difference of scape, the two is realized after selection, the synchronous collaborative simulation scheme for realizing time driving of master-slave mode, and master-slave mode is same Step considers influence of the asynchronous network event to control system in step-length synchronizing cycle, because without accumulation system error, however Master-slave mode, which synchronizes, not to be accounted for control system and timely responds to asynchronous network event, and control system is only capable of in cycle synchronisation thing Part time point triggers network event when executing period transmission event;Clobal driving is synchronous for realizing based on controller event The collaborative simulation scheme of driving, master-slave mode it is synchronous not only without accumulation system error but also can control system timely respond to it is certain aperiodic Asynchronous network event;
Step 23: design synchronous interaction model;Simultaneously in order to realize the interaction with Simulink model, to synchronous interaction model into Row improves, because client-side program operation Simulink model need to be jumped out, then constantly establishes TCP connection using client and closes again The mode that socket disconnects interacts, and will send and receive structural body between client is established and disconnected and be used for It is synchronous;The server of NS3 will exist as iteration server at this time, and main socket is used to listen to the connection request of client, and Main socket will constantly create closing child socket, and child socket is for receiving new connection request and sending and receiving structure Body;
(3) each module program design of NS3;
Step 31: being provided in patent " the associative simulation interface method that NS3 based on Transmission Control Protocol and MATLAB are integrated " pair NS3 default emulator, UDP application class and its assistant's class improvement, furthermore in order to record client transmission data The number of packet, the status number of data packet, more packets transmit the sending time of lower status number and data packet, separately design Tetra- kinds of tag class of PacketNumTag, PacketPortTag, StateNumTag and SendTimeTag;
Step 32: design NS3 emulates script;
User is needed to write artificial foot when using NS3 and built network simulation scene originally, simulating scenes by waf tool into Row compiling and operation, the execution process for emulating script are as follows: execution principal function → use initialization list initialization test script Class → simulation parameter → operation Run () function is arranged using command line parameter starts to build simulating scenes → operation Random number seed → operation Configure_phyMode_Defaults () function of SeedManager () function setup emulation Configuration physical layer transmission mode simultaneously configures global parameter → operation CreateNodesphymacmobility () function, function It include: 1. node number and node location 2. to be extracted from NS3 node number and topological file module using call back function to set Standby addition physical layer and mac layers of transmission and packet loss tracking 3. are that node configures mobile property and node location readjustment 4. with glove Reason layer (channel model) and mac layer and communication equipment is installed on node, and opening network tracking file generated, have ascii with Two kinds of file types of pcap → operation Set_ExternallyDrivenSim_config () function configures external drive simulator Parameter → operation InstallInternetStack () function install internet protocol stack, function includes: 1. installation IP Layer Routing Protocol opens routing table tracking file generated 2. and installs internet protocol stack and be the interface point of all node devices With IP address → operation InstallApplication () function, function includes: the application journey of 1. selections installation TCP or UDP If 2. user of sequence selects LTE network, the carrying of activation side chain road, and configures LTE network tracking file generated 3. if it is desire to association It is run with emulation using the delay of setting and packet loss, operation Set_delayloss () function is configured → runs SetupWaveMessages () function is arranged if the physical layer modes of user are selected as WAVE agreement and sends bsm (substantially Security message) data packet → operation ConfigureLogTracing function generates some additional tracking files, and judges whether Necessary log component → operation Runsimulation () function in log system is opened, function is dynamic for Configuration network node It draws, data traffic file generated → simulating scenes are built and finished, start and terminate to emulate;
(4) each module program design of MATLAB/Simulink;
Step 401: design MATLAB Simulation drive module;
MATLAB Simulation drive module is made of the MATLAB script submodule of one group of mutual tight association, including simulation initialisation Module, emulation major cycle module, single step Simulation drive module, notice parsing and single step planning module, Simulink emulate start and stop Control module;
Step 402: design and simulation initialization module;
Simulation initialisation module is used to initialize the series of parameters of simulation run, and opens and emulated Simulink model file, at the same allow Simulink execute one solution step-length time to start Control System Imitation, when with When Simulink initialization button is pressed at family in collaborative simulation interactive interface, which will be run;When simulation initialisation module Between driving with event driven difference be that initiation parameter is slightly different, while the module will save this under event-driven Node after solving step-length sends state, for using the transmission data packet in event driven client setting notification architecture body Trigger signal;
Step 403: design and simulation major cycle module;
It emulates major cycle module and operation is triggered by the beginning collaborative simulation button of interactive interface, emulation major cycle module will be continuous The single step between collaborative simulation event in circular flow emulation in MATLAB time shaft, to promote in MATLAB/Simulink In addition the simulation process of control system emulates major cycle module for progress bar is created to constantly update the entire collaborative simulation of display Progress;Emulation major cycle module time driving is only in that with event driven difference: when module brings into operation, being driven using the time Dynamic module calls the client source Program Generating client component of mex compiler compilation time driving by will use, in the case where connecing The component will be used to complete the interaction with NS3 always in the entire simulation process come, and uses event driven emulation major cycle The step is not carried out in module;
Step 404: design single step Simulation drive module;
Pass through the single step between the collaborative simulation event in MATLAB time shaft in the operation emulation of single step Simulation drive module, single step Simulation drive module will differ widely in the process of two kinds of driving methods, be followed using will directly run emulation master when time driving When compiling the time driving client component of generation in ring moulds block, and being synchronized every time with NS3 under event-driven, client Modification is set in the trigger signal of transmission data packet in notification architecture body, in order to ensure modified values are correctly sent, transports every time An event-driven client source file will be all compiled before row single step Simulation drive module;Later, single step Simulation drive module will It is separately operable respective notice parsing and single step planning module and Simulink emulation start-up and shut-down control module, is also needed under event-driven It runs controller respond module and possible controller response is completed;Finally, solving the minimum and maximum of step-length for will be deleted Value and external input variable, eliminate each run single step when by these variable dimensions it is inconsistent caused by abnormal simulation;
Step 405: the parsing of design notice and single step planning module;
The text file that client is generated using the notification architecture body received, notice parsing read these with single step planning module Text file simultaneously parses, and notice parsing later is planned in a following single step from single step planning module according to different modes Simulation parameter and process;The core concept that notice parsing is realized with single step planning module is: Control System Imitation has reappeared together In sample single step in network simulation control system operating condition, in addition notice parsing with single step planning module defines two kinds of applications The data packet processing mode of layer, a kind of mode are the threshold values of setting received data packet delay, prevent from receiving the excessive data of delay Packet, it is another then be by the current package number for receiving event and reception event post-simulation uses before package number into Row compares, if the number for being currently received data packet be greater than before received data packet number, using the data packet Otherwise interior data then abandon the packet data;Notice parsing is thought with design of the single step planning module under two kinds of driving methods Want it is also quite different with operational process, under time driving, single step be one synchronizing cycle step-length, if in synchronizing cycle step-length Be not received by data packet, in the single step by the packet delay be approximately one synchronizing cycle step-length, existed by obtaining node Each reception event time delay across synchronizing cycle step-length number and the time span in current step, this is synchronized into week A series of combination that step-length index value range is divided into bounds is solved in phase step-length, these combinations will be used in determination and connect down It is segmented the index for the solutions step-length for executing step-length synchronizing cycle emulation, is collected simultaneously the phase of the reception event of data packet each time Information preservation is closed to structural body, and structural body is carried out by bubble sort according to the precedence of the event of reception, the structure after sequence Body will successively reappear received data packet event after being used for, and under event-driven, single step is imitative between adjacent two subsynchronous The true time, therefore only the single step need to can be performed by the corresponding bound for solving step-length index of the simulation time;In addition not It is same as the lower limit that time driving determines the solution step-length index of certain section of emulation using truthful data packet delay, event-driven uses The lower limit for the solution step-length index that " reckoning " postpones to determine the single step;
Step 406: design Simulink emulates start-up and shut-down control module;
Emulation start-up and shut-down control module directly controls Control System Imitation model in Simulink to complete the emulation of a single step, imitates True start-up and shut-down control module by each solution step-length using set_param function call Simulink emulation command start, Pause, step and stop are realized to be emulated in each solution step-length start and stop Simulink, is updated with reaching in a certain precise time point The purpose of exterior input;It is successively executed under time driving each in single step obtained in notice parsing and single step planning module Received data packet sequence of events, the bound indexed when received data packet event occurs using new solution step-length, and update The external input of model, circulating start and outage execute each solution step-length until next case point, when sequence of events is without remaining thing The single step executes completion when part, and the bound operation adjacent two only indexed by the solution step-length of certain single step under event-driven Emulation between subsynchronous, the outside for updating the model of the external input variable to receive in alternative events next time later are defeated Enter;The node location to control system is collected with velocity information after the completion of the single step run and redundant node hair is set The trigger signal sent;
Step 407: design Simulink suspends callback module;
Call back function Stopfcn is set in Simulink simulation model, and call back function Stopfcn will be temporary in each solution step-length Stopping time adjusts back Simulink and suspends callback module, and Simulink suspends callback module and selects to transport according to two kinds of driving methods of emulation The internal state of control system and output in solution step-length each in emulation are saved in relevant variable by two kinds of readjustment subprograms of row In, and be written in text file;
Step 408: design controller respond module;
Under event-driven mode, controller respond module executes after each controller receives data packet and calculates appointing for control amount Business, and save each node data packet of the control system under the event and send mark for client reading;Similar Simulink is emulated Start stop mode in start-up and shut-down control module, controller respond module determine that controller receives data packet and controller should not abandon Data packet then runs one and solves step-length to obtain the control amount of controller, and having executed the solution step-length post-simulation will return back to State before executing the solution step-length, because executing the purpose of controller respond module just for the sake of obtaining the control of controller Amount, the purpose of rollback be in order to prevent collaborative simulation Time Inconsistency the problem of;
Step 409: design simulation model closedown module;
Step 410: design Simulink control system model;
By in a certain control system sensor and actuator regard as to rely on the same node of controlled device, and controller is regarded as It is another node;Therefore two subsystems module is created in the control system file of Simulink to represent two nodes;
Step 411: design MATLAB client component;
MATLAB client component is also divided into two kinds according to the difference of driving method, and client is from MATLAB working space and text Obtained in this document Simulink emulate single step as a result, and NS3 circulating server will be sent to after its customized encapsulation, Enter data packet comprising new round simulation result of the blocking model until receiving NS3 transmission later, after the completion of resolve packet Client will close;
Step 412: design MATLAB user interface;
According to demand analysis, by user according to different simulating scenes need the settable simulation parameter of user to be divided into global parameter, Control system parameter, node network interface card parameter, NS3 parameter and redundant node send setting parameter, and furthermore user can be used imitative Interface is exited in the loading of true mode, the control of collaborative simulation process, the drafting of simulation result, simulating scenes flash demo and resetting 5 functions.
CN201910596703.8A 2019-07-02 2019-07-02 NS3 and MATLAB-based networked control system collaborative simulation method Active CN110457747B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910596703.8A CN110457747B (en) 2019-07-02 2019-07-02 NS3 and MATLAB-based networked control system collaborative simulation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910596703.8A CN110457747B (en) 2019-07-02 2019-07-02 NS3 and MATLAB-based networked control system collaborative simulation method

Publications (2)

Publication Number Publication Date
CN110457747A true CN110457747A (en) 2019-11-15
CN110457747B CN110457747B (en) 2023-04-07

Family

ID=68481942

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910596703.8A Active CN110457747B (en) 2019-07-02 2019-07-02 NS3 and MATLAB-based networked control system collaborative simulation method

Country Status (1)

Country Link
CN (1) CN110457747B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111835554A (en) * 2020-05-23 2020-10-27 北京工业大学 Internet of vehicles routing simulation platform based on event-driven kernel
CN112615941A (en) * 2021-01-14 2021-04-06 哈尔滨工业大学 Network control laboratory system based on Android operating system
CN112699515A (en) * 2021-01-06 2021-04-23 浙江工业大学 SCILLAB and NS3 collaborative simulation interface method based on TCP socket
CN112737815A (en) * 2020-12-15 2021-04-30 中国科学院信息工程研究所 Method and system for dynamically configuring event queue of network simulator
CN113139281A (en) * 2021-04-12 2021-07-20 浙江工业大学 Collaborative simulation time synchronization method based on XCOS and NS3
CN113158405A (en) * 2020-12-31 2021-07-23 山东大学 Coupling method, visual platform and simulation method of electric heating system
CN113204335A (en) * 2021-04-20 2021-08-03 南京航空航天大学 UML model merging and consistency detection method and system for collaborative modeling
CN113378364A (en) * 2021-05-31 2021-09-10 上海大学 Joint simulation method and system for wireless network control system
CN113468713A (en) * 2020-03-31 2021-10-01 顺丰科技有限公司 Service simulation method and device, computer equipment and storage medium
CN113467272A (en) * 2021-06-01 2021-10-01 中国航空工业集团公司沈阳飞机设计研究所 Simulink-based joint simulation method and system
CN115562892A (en) * 2022-12-02 2023-01-03 北京卓翼智能科技有限公司 Redis-based simulation system time management method, system, device and equipment
CN115664846A (en) * 2022-12-08 2023-01-31 深圳市永达电子信息股份有限公司 Network security management and control system and method
CN117518869A (en) * 2023-11-14 2024-02-06 浙江华电器材检测研究院有限公司 Power distribution network hardware-in-loop simulation method and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106529056A (en) * 2016-11-17 2017-03-22 东南大学 Master-slave power communication integrated simulation platform and simulation method
CN109379233A (en) * 2018-11-30 2019-02-22 北京仿真中心 A kind of cloud emulation platform model safety safeguards system, method, server and terminal
CN109586963A (en) * 2018-11-30 2019-04-05 北京仿真中心 A kind of cloud emulation platform safe-guard system, server, terminal and method
CN109598040A (en) * 2018-11-22 2019-04-09 浙江工业大学 The associative simulation interface method that NS3 and MATLAB based on Transmission Control Protocol are integrated

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106529056A (en) * 2016-11-17 2017-03-22 东南大学 Master-slave power communication integrated simulation platform and simulation method
CN109598040A (en) * 2018-11-22 2019-04-09 浙江工业大学 The associative simulation interface method that NS3 and MATLAB based on Transmission Control Protocol are integrated
CN109379233A (en) * 2018-11-30 2019-02-22 北京仿真中心 A kind of cloud emulation platform model safety safeguards system, method, server and terminal
CN109586963A (en) * 2018-11-30 2019-04-05 北京仿真中心 A kind of cloud emulation platform safe-guard system, server, terminal and method

Cited By (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113468713A (en) * 2020-03-31 2021-10-01 顺丰科技有限公司 Service simulation method and device, computer equipment and storage medium
CN111835554A (en) * 2020-05-23 2020-10-27 北京工业大学 Internet of vehicles routing simulation platform based on event-driven kernel
CN111835554B (en) * 2020-05-23 2022-07-22 北京工业大学 Internet of vehicles routing simulation platform based on event-driven kernel
CN112737815A (en) * 2020-12-15 2021-04-30 中国科学院信息工程研究所 Method and system for dynamically configuring event queue of network simulator
CN112737815B (en) * 2020-12-15 2022-05-20 中国科学院信息工程研究所 Method and system for dynamically configuring event queue of network simulator
CN113158405B (en) * 2020-12-31 2023-04-11 山东大学 Coupling method, visual platform and simulation method of electric heating system
CN113158405A (en) * 2020-12-31 2021-07-23 山东大学 Coupling method, visual platform and simulation method of electric heating system
CN112699515B (en) * 2021-01-06 2024-05-03 浙江工业大学 SCILAB and NS3 collaborative simulation interface method based on TCP socket
CN112699515A (en) * 2021-01-06 2021-04-23 浙江工业大学 SCILLAB and NS3 collaborative simulation interface method based on TCP socket
CN112615941B (en) * 2021-01-14 2022-04-15 哈尔滨工业大学 Network control laboratory system based on Android operating system
CN112615941A (en) * 2021-01-14 2021-04-06 哈尔滨工业大学 Network control laboratory system based on Android operating system
CN113139281A (en) * 2021-04-12 2021-07-20 浙江工业大学 Collaborative simulation time synchronization method based on XCOS and NS3
CN113204335A (en) * 2021-04-20 2021-08-03 南京航空航天大学 UML model merging and consistency detection method and system for collaborative modeling
CN113204335B (en) * 2021-04-20 2024-05-17 南京航空航天大学 UML model merging and consistency detection method and system oriented to collaborative modeling
CN113378364A (en) * 2021-05-31 2021-09-10 上海大学 Joint simulation method and system for wireless network control system
CN113467272A (en) * 2021-06-01 2021-10-01 中国航空工业集团公司沈阳飞机设计研究所 Simulink-based joint simulation method and system
CN115562892A (en) * 2022-12-02 2023-01-03 北京卓翼智能科技有限公司 Redis-based simulation system time management method, system, device and equipment
CN115562892B (en) * 2022-12-02 2023-03-24 北京卓翼智能科技有限公司 Redis-based simulation system time management method, system, device and equipment
CN115664846A (en) * 2022-12-08 2023-01-31 深圳市永达电子信息股份有限公司 Network security management and control system and method
CN115664846B (en) * 2022-12-08 2023-07-04 深圳市永达电子信息股份有限公司 Network security management and control system and method
CN117518869A (en) * 2023-11-14 2024-02-06 浙江华电器材检测研究院有限公司 Power distribution network hardware-in-loop simulation method and related equipment

Also Published As

Publication number Publication date
CN110457747B (en) 2023-04-07

Similar Documents

Publication Publication Date Title
CN110457747A (en) A kind of network control system synergy emulation method based on NS3 and MATLAB
Onat et al. Control over imperfect networks: Model-based predictive networked control systems
Wang et al. Hybridsim: A modeling and co-simulation toolchain for cyber-physical systems
CN106529056B (en) A kind of power communication joint simulation method based on master-slave mode
Aminian et al. GISOO: A virtual testbed for wireless cyber-physical systems
CN111897300A (en) OPC-UA (OLE for process control-user agent) -based software/hardware combined simulation system and self-adaptive cooperation method thereof
CN105468817B (en) A kind of multi-model real-time emulation system
Baumann et al. Fast feedback control over multi-hop wireless networks with mode changes and stability guarantees
Kohtamaki et al. Piccsim toolchain-design, simulation and automatic implementation of wireless networked control systems
Bouloukakis et al. Performance modeling of the middleware overlay infrastructure of mobile things
De Vita et al. Using deep reinforcement learning for application relocation in multi-access edge computing
CN103763142B (en) Multimode isomery DTN simulation verification system and method
CN105468431B (en) Multi-model real-time emulation system
CN103634290B (en) Network (WSN) emulation system
Jigorea et al. Modelling of real-time embedded systems in an object-oriented design environment with UML
CN114925607B (en) Industrial network management system for information physical synchronization and pre-planning method thereof
Schiller et al. Emulating vehicular ad hoc networks for evaluation and testing of automotive embedded systems
Xinyu et al. Verification of Hybrid Chi model for cyber-physical systems using PHAVer
CN101969442A (en) Process running environment perception and migration based network analog framework implementation method
CN114063468A (en) Data interaction method suitable for wireless ad hoc network semi-physical simulation system
Böhm et al. Looking into hardware-in-the-loop coupling of omnet++ and rosenet
Babu et al. Emulation/simulation of PLC networks with the S3F network simulator
CN106773790A (en) Based on the synchronous many iteration electric power of clobal axle and communication joint simulation method
CN105487407B (en) The method of control Exata node motions track in real time
Ebers et al. Poster: Adapter framework for VANET simulators

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