Background technology
Information-technology age in today, network technology is maked rapid progress, network application is extensive day by day, disparate networks technology such as cable network, wireless network, satellite communication network, cable TV network, public phone network develop rapidly and move towards gradually to merge, cause network configuration and scale increasingly sophisticated huge, class of business constantly increases, and offered load is heavy day by day.
No matter be to make up new network, or upgrading existing network, perhaps test New Deal, all need the reliability and the validity of network are assessed objectively, thereby reduce the investment risk of networking, make the network of design that very high performance be arranged, perhaps make test result can reflect the performance of New Deal more exactly.Legacy network design and planing method are mainly by experience.Along with network is increasingly sophisticated, scale is huge day by day, and conventional method can not satisfy the needs of the network planning and design.The network simulation technology is arisen at the historic moment in this case, and the planning and designing that it is a network with its exclusive method provide objective, reliable quantitative basis, shortens the networking cycle, improves the science of making a strategic decision in the networking.The network simulation technology becomes the mainstream technology in the network planning, design and the exploitation at present gradually, becomes indispensable link in the network planning and the design.
The network simulation technology is a kind of by setting up the network equipment, link and protocol model, and the transmission of analog network flow, thereby obtains network design or optimize the emulation technology of needed network performance data.Network (WSN) emulation system adopts the simulation mechanism that discrete event drives more at present.The simulated core core module is the event scheduler that discrete event drives, and it safeguards an event queue, and incident is by the triggered time sequence arrangement in the formation, and more early the incident of Chu Faing is in more preceding position more in formation.Each event loop is all taken out first incident from formation, and gives corresponding module and handle.Also may produce new incident in the resume module process, these incidents all will be inserted in the event queue and adjust the position of incident in the formation according to the trigger event of incident.This circulation continues always, and up to simulated events that reaches appointment and event queue sky, then emulation finishes.
Network simulation utilizes analogue technique according to analysis of simulation result evaluating network performance, so that simulation result should be tried one's best is accurately credible.Yet each performance evaluation index all is a stochastic variable, and this desired value in simulation result is to once realization that should stochastic variable.Because each simulation result has randomness, so if only pass judgment on according to the result of an emulation and can cause very big deviation, even draw full of prunes conclusion.Be to improve the credibility of network simulation, move repeatedly emulation automatically and average and confidential interval is the necessary link of trustable network emulation.In addition, in the network simulation except estimating the absolute performance of certain scheme or agreement by simulation analysis, more susceptible condition is to compare simulation analysis at several different schemes or optional agreement simultaneously, sees clearly the relative performance characteristics and the superior point of each scheme or agreement, and then chooses optimal case.So network (WSN) emulation system should have following functional characteristics:
1. network (WSN) emulation system should be able to carry out many emulation automatically and moves in batches;
2. network (WSN) emulation system should be able to calculate the mean value of each achievement data automatically and have the confidential interval of certain confidence level;
3. network (WSN) emulation system should be able to carry out the contrast of multiple-schemes emulation experiment automatically.
Yet most network (WSN) emulation systems such as NS-2, GloMoSim can only be finished an emulation in running of simulated program at present.The OPNET network (WSN) emulation system is strong slightly, it provides and has once moved the mechanism of finishing a plurality of emulation fragments, some data processing functions also are provided, but do not provide the repeatedly function of simulation result averaged and confidential interval of automatic basis, and these data processing functions that it provided need the user to participate in and can not realize automatically.In addition, the existing network analogue system can not be carried out the contrast of multiple-schemes l-G simulation test automatically.Can be referring to people's such as Niu Wei patent of invention " Network Artificial Measuring System And Method " (application number: 200510012183.X).
Summary of the invention
Move repeatedly emulation in a simulation run process based on to network simulation the time, carry out the contrast of multiple-schemes simulation study, and the understanding of the necessity of automatic averaged and confidential interval, and, the present invention proposes a kind of network (WSN) emulation system at existing network analogue system deficiency in this respect.The functional characteristics of this network (WSN) emulation system comprises:
1. can in a running, finish a plurality of emulation fragments automatically;
2. can be automatically in time according to the data result of having finished l-G simulation test at the mean value of each tested computation schemes achievement data and have the monolateral length of the confidential interval of certain confidence level;
3. can realize multivariant contrast simulation experiment automatically.
The formation (see figure 1) of the network (WSN) emulation system that the present invention proposes comprises five modules: global control module (2), configuration information input module (1), simulation run module (3), achievement data trusted processing module (4), credible indexes data outputting module (5).The annexation of each module is: this configuration information input module (1) is communicated by letter with global control module (2), this global control module (2) respectively with configuration information input module (1), simulation run module (3), achievement data trusted processing module (4), credible indexes data outputting module (5) communication, this simulation run module (3) is communicated by letter with achievement data trusted processing module (4) with global control module (2), this achievement data trusted processing module (4) respectively with global control module (2), simulation run module (3), credible indexes data outputting module (5) communication, this credible indexes data outputting module (5) is communicated by letter with achievement data trusted processing module (4) with global control module (2) respectively.
Simulation run module (3) is responsible for the operation of emulation, and it comprises three submodules: core control submodule (6), node layer functions submodule (7), original index data collection submodule (8).Core control submodule (6) is the nucleus module of simulation run module (3), and node layer functions submodule (7) and original index data collection submodule (8) coordinate to finish the operation of emulation segment under the control of core control submodule (6).The annexation of each submodule is: core control submodule (6) is communicated by letter with node layer functions submodule (7), and node layer functions submodule (7) is communicated by letter with original index data collection submodule (8).
Core control submodule (6) is responsible for the formation of maintenance system simulated events, carries out the event handling circulation.It constantly takes out incident the earliest from event queue, and handles to the objective function layer of destination node event scheduling according to event content.
Node layer functions submodule (7) has been realized the nodal analysis method of layering by the ICP/IP protocol architecture, be followed successively by application layer, transport layer, network layer, MAC layer, physical layer from top to bottom, also increased the mobility model layer in the node layer functions submodule (7) to support simulation to removable node.
Original index data collection submodule (8) is called by node layer functions submodule (7), and to collect original performance index data in simulation process, these initial data will be given achievement data trusted processing module (4) and be handled after an emulation receives.
The beneficial effect of this network (WSN) emulation system is: the automatic mean value of calculation of performance indicators data and have the monolateral length of the confidential interval of certain confidence level, the application scenario of repeatedly emulation and the contrast simulation of many alternatives are specially adapted to rerun, can increase substantially the automaticity and the operating efficiency of user job, exempt the loaded down with trivial details emulated data of user and handle operation.
Embodiment
The main body operational process of network (WSN) emulation system proposed by the invention comprises two-layer circulation.Select a scheme to carry out emulation from scheme tabulation to be compared successively in the interior loop, the interior loop variable is that cyclic variable is SchemeIndex, and it represents the sequence number of current scheme in the scheme tabulation.The cyclic variable of outer circulation is the sequence number SimIndex of simulation sequence.SchemeIndex and SimIndex are since 0.An interior loop is called an emulation segment, and outer circulation is once become a simulation sequence, comprise a plurality of simulation sequence in the running that this analogue system is once complete like this.
The network (WSN) emulation system that the present invention proposes reaches embodiment in conjunction with the accompanying drawings and further specifies as follows:
The general structure block diagram of the network (WSN) emulation system that the present invention proposes as shown in Figure 1, it comprises five modules: global control module (2), configuration information input module (1), simulation run module (3), achievement data trusted processing module (4), credible indexes data outputting module (5).This global control module (2) is communicated by letter with configuration information input module (1), simulation run module (3), achievement data trusted processing module (4), credible indexes data outputting module (5) respectively, this simulation run module (3) is communicated by letter with achievement data trusted processing module (4) with global control module (2), and this achievement data trusted processing module (4) is communicated by letter with global control module (2), simulation run module (3), credible indexes data outputting module (5) respectively.
The workflow of network (WSN) emulation system proposed by the invention as shown in Figure 4.Comprise the steps:
1. configuration information input module (1) reads simulation configurations information from the simulation configurations message file of appointment.Simulation configurations information comprises emulation number of repetition SimMax, participate in the tabulation of each concrete agreement of comparative study, the length SchemeMax of this tabulation, the variable element tabulation, the parameter value tabulation of each variable element, simulating scenes zone, number of nodes, the concrete agreement that each layer function adopted reaches other parameter that emulation needs.
2. global control module (2) is provided with the numbering SimIndex=0 of pending emulation fragment place simulation sequence.
3. global control module (2) is provided with the pending numbering SchemeIndex=0 of emulation fragment in the simulation sequence of place.
4. global control module (2) is given simulation run module (3) with control.
5. simulation run module (3) is finished a network simulation fragment according to SchemeIndex and other configuration information as the simulation configurations parameter.The performance index data of obtaining in this time emulation are delivered to performance index data two-dimensional array RawMetricGroup[when emulation finishes] in [].Then control is returned global control module (2).
6. global control module (2) invocation performance index trusted processing module (4), the latter is according to two-dimensional array RawMetricGroup[] data in [] are calculated to the mean value of each performance index so far automatically in real time and have the monolateral length of the confidential interval of particular confidence level, and deposit result of calculation in one-dimension array CredibleMetric[] in.
7. global control module (2) is called credible performance index output module (5), the one-dimension array CredibleMetric[after the latter will handle] in the performance index data output in the resulting text file.
8.SchemeIndex=SchemeIndex+1。
9. judge whether SchemeIndex equals SchemeMax.If not, then forwarded for the 4th step to, otherwise forwarded for the 10th step to.
10.SimIndex=SimIndex+1。
Whether equal SimMax 11. judge SimIndex.If not, then forwarded for the 3rd step to, if then continued to forward to the 12nd step.
12. this end of run.
Configuration information input module (1)
Configuration information input module (1) is responsible for reading the required configuration parameter of operation emulation from configuration file.Configuration file is a text type file, available any text editor.
Every capable configuration information all adopts form " tabulation of parameter name parameter value ", and wherein parameter list can only comprise one, also can comprise multinomial.Preceding two parameters of configuration file are SIM_LIST_MAX and SCHEME_MAX, the scheme quantity in the quantity of the simulation sequence of the emulation of indicating respectively and each simulation sequence.These two parameters can only be got a value respectively.The parameter value tabulation of other parameter can comprise multinomial, and less than SCHEME_MAX, then this parameter is all got first value in all schemes as if the item number in the parameter list, otherwise each scheme is chosen the value of correspondence position successively.
Configuration file fragment shown in Figure 2 shows: operation this time needs 50 simulation sequence of emulation, and the scheme number is 3 in each simulation sequence, and the confidence level of the confidential interval that provide is 0.95.Only there are 2 in the parameter value tabulation after the NODE_NUMBER parameter, so node is counted NODE_NUMBER and all is taken as 100 in all schemes, and the tabulation of the parameter value after the ROUTE_POLICY parameter has 4, so ROUTE_POLICY selects DSR, ODMRP, AODV agreement respectively for use in these three schemes.
Simulation run module (3)
Simulation run module (3) is responsible for the operation of emulation fragment, and as shown in fig. 1, it comprises three submodules: core control submodule (6), node layer functions submodule (7), original index data collection submodule (8).The annexation of each submodule is: core control submodule (6) is communicated by letter with node layer functions submodule (7), and node layer functions submodule (7) is communicated by letter with original index data collection submodule (8).Core control submodule (6) is responsible for the formation of maintenance system simulated events, carries out the event handling circulation.It constantly takes out incident the earliest from event queue, and handles to the objective function layer of destination node event scheduling according to event content.Node layer functions submodule (7) has been realized the nodal analysis method of layering according to the ICP/IP protocol architecture, be followed successively by application layer, transport layer, network layer, MAC layer, physical layer from top to bottom, also increased the mobility model layer in the node layer functions submodule (7) to support simulation to removable node.Original index data collection submodule (8) is called by nodal analysis method, and to collect original performance index data in simulation process, these initial data will be given achievement data trusted processing module (4) and be handled after an emulation receives.Core control submodule (6) is the nucleus module of simulation run module (3), and node layer functions submodule (7) and original index data collection submodule (8) coordinate to finish the operation of emulation segment under the control of core control submodule (7).The operational process of an emulation as shown in Figure 5.
1. the initialization of emulation fragment.Comprise initialization artificial network topology, the initialization simulation parameter comprises from the contrast protocol list and selects required agreement, initializing universal simulation parameter value, and the required Data Structures of initialization emulation is according to configuration information initialization network traffics excitation information.
2. whether the decision event formation of core control submodule (6) is empty.If then forwarded for the 8th step to.Otherwise forwarded for the 3rd step to.
3. core control submodule (6) takes out the moment incident the earliest that triggers from event queue.Core control submodule (6) is adjusted into current emulation the triggering moment of this incident constantly.
4. core control submodule (6) is determined the destination node and the objective function layer of this incident according to the incident attached information, and incident is sent to the respective objects resume module.
5. the objective function layer of destination node is handled the incident that core control submodule (6) scheduling is come, and calls original index data collection submodule (8) as required.
6. original index data collection submodule (8) upgrades the respective performances achievement data.Forwarded for the 2nd step to.
7. the ending of emulation fragment is handled.Comprise the renewal of performance index data, and the performance index data that obtain in this emulation are sent to global control module (2).
8. this emulation fragment finishes.
Achievement data trusted processing module (4)
All to deposit the original performance achievement data that in this emulation fragment, obtains in two-dimensional array RawMetricGroup[after each emulation fragment is finished] in [].Two-dimensional array RawMetricGroup[] the corresponding different simulation sequence of first dimension of [], and the different schemes in the corresponding same simulation sequence of second dimension.Two-dimensional array RawMetricGroup[] basic element of [] is the variable of StructRawMetric structural type, each performance index to be measured is all corresponding field Metric in this StructRawMetric structure.Achievement data trusted processing module (4) is responsible for handling two-dimensional array RawMetricGroup[] [] middle performance index initial data of finishing the emulation fragment of storing, automatically in time at each scheme calculating mean value and have the monolateral length of the confidential interval of certain confidence level respectively, and deposit one-dimension array CredibleMetric[in] in, corresponding each scheme to be compared of the element of the diverse location of this array.One-dimension array CredibleMetric[] basic element be the variable of StructCredibleMetric structural type.Each performance index to be measured is corresponding two fields in the StructCredibleMetric structure: the monolateral length M etricError of mean value field MetricMean and confidential interval.
For a certain specific scheme to be measured, each performance index Metric to be measured is a stochastic variable x.The corresponding index value of being obtained in the emulation adopting this specified scheme to carry out is the once realization of this stochastic variable.Note x
iBe to array element RawMetricGroup[i that should specified scheme (supposing that this scheme is numbered j) in i the simulation sequence] value in [j] to Metric field that should performance index to be measured.
The desired value μ of stochastic variable x and variances sigma in the network simulation
2All be unknown.
The theoretical explanation of mathematical statistics distributes no matter what stochastic variable x is, the mean value of the performance index data of obtaining in n the repetition emulation
The nothing that is the desired value μ of x estimates partially, so in the StructCredibleMetric structure to what store in should the MetricMean field of index be
The calculating relative complex of confidential interval some.The theoretical explanation of mathematical statistics,
Be only the variances sigma of variable x
2Nothing estimate partially.Distribute no matter which kind of x obeys,
All obeying the degree of freedom is the t-distribution of n-1.For given confidence alpha,
For the confidence level of μ is the confidential interval of α.To MetricError field store that should index in the StructCredibleMetric structure be
Value, and t
1-α/2, n-1Value according to α and n in program is obtained by tabling look-up.
Credible indexes data outputting module (5)
Credible indexes data outputting module (5) is responsible for utilizing fprint () canonical function to output in the resulting text file data in the CredibleMetric variable.After obtaining repeatedly simulation result, for ease of distinguishing the used configuration information of each emulation, in the content that before destination file output performance achievement data, writes the simulation configurations file earlier.
The network simulation program generally need be moved a period of time and could finish, in order to follow the tracks of simulation result rapidly in time, check the confidential interval of existing simulation result, allow among the present invention after each emulation fragment has been moved, to recomputate the value of CredibleMetric immediately and export in the resulting text file.
Be figure for ease of the CredibleMetric simulation result is poured in Excel and the Matlab supervisor, in every row, add the tab key between each data with " t " with fpintf () when output.
Figure 3 shows that and utilize configuration file shown in Figure 2 to carry out the selected parts of the destination file that emulation obtained.Wherein preceding 5 row are represented the used configuration parameter tabulation of this emulation.And follow-up each behavior is by the simulation result data of credible indexes data outputting module (5) output.The meaning of each field in the every capable simulation result in the 1st line display back in follow-up each row, all the other are concrete emulated data.Represent that as " Scheme Sim PacketMeanPacketError EnergyMean EnergyError " among Fig. 3 the meaning of each field is from left to right:
Scheme: used scheme
Sim: the completed emulation number of fragments of every scheme
PacketMean: on average send message total
PacketError: on average send the monolateral length that message total has the confidential interval of given confidence level
EnergyMean: mean consumption energy
EnergyError: the monolateral length of the confidential interval with given confidence level of mean consumption energy
By its global control module (2), configuration information input module (1), simulation run module (3), achievement data trusted processing module (4), the cooperation of these five functional modules of credible indexes data outputting module (5), network (WSN) emulation system proposed by the invention has following functional characteristics: can automatically utilize different random number seeds to finish a plurality of emulation fragments in a running, can carry out the contrast of multiple-schemes simulation study automatically, can be automatically in the simulated program running mean value of calculation of performance indicators data and have the monolateral length of the confidential interval of certain confidence level in time.This invention is applicable to various universal network l-G simulation tests, and the application scenario of repeatedly emulation and the contrast simulation of many alternatives are specially adapted to rerun.Use this invention can increase substantially the automaticity and the operating efficiency of network simulation user job, exempt the loaded down with trivial details emulated data of user and handle operation.