CN115835268B - Protocol stack simulation method of Wi-Fi distributed coordination function DCF - Google Patents

Protocol stack simulation method of Wi-Fi distributed coordination function DCF Download PDF

Info

Publication number
CN115835268B
CN115835268B CN202310088803.6A CN202310088803A CN115835268B CN 115835268 B CN115835268 B CN 115835268B CN 202310088803 A CN202310088803 A CN 202310088803A CN 115835268 B CN115835268 B CN 115835268B
Authority
CN
China
Prior art keywords
network element
read
channel
data
shared memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310088803.6A
Other languages
Chinese (zh)
Other versions
CN115835268A (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.)
Nanjing Langli Micro Integrated Circuit Co ltd
Original Assignee
Nanjing Langli Micro Integrated Circuit Co ltd
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 Nanjing Langli Micro Integrated Circuit Co ltd filed Critical Nanjing Langli Micro Integrated Circuit Co ltd
Priority to CN202310088803.6A priority Critical patent/CN115835268B/en
Publication of CN115835268A publication Critical patent/CN115835268A/en
Application granted granted Critical
Publication of CN115835268B publication Critical patent/CN115835268B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention discloses a protocol stack simulation method of a Wi-Fi distributed coordination function DCF, wherein the distributed coordination function DCF is a Wi-Fi channel random access method, and based on shared memory and signal quantity, channel competition is simulated through a software lock; the inter-process shared memory of the Linux platform is used as the data bearing of the wireless channel, the data transmission process on the channel is converted into the writing operation of the shared memory, the data receiving process on the channel is converted into the reading operation of the shared memory, and further the DCF channel preemption and the data transmission process between network elements are simulated, so that the simulation of the basic mode and the request transmission/permission transmission mode of the DCF is realized. The method decouples the software running environment from the chip hardware, reduces the purchase quantity of the hardware simulation platform, and saves the research and development cost of the chip; the debugging and optimizing work of the software is greatly advanced, and the aim of shortening the research and development period of the chip product is finally realized.

Description

Protocol stack simulation method of Wi-Fi distributed coordination function DCF
Technical Field
The invention relates to a simulation method of a Wi-Fi distributed coordination function DCF, in particular to a method for simulating combination of a Wi-Fi wireless protocol stack and a wireless random access mechanism by using a software mode, and belongs to the technical field of communication.
Background
The current analog simulation of Wi-Fi distributed coordination function DCF generally comprises two modes. One is a simple simulation software protocol stack, which must be combined with hardware to work, and the other is a random access mechanism which can only simulate DCF, such as open source software NS3, etc., and cannot be comprehensively simulated with the protocol stack. NS3 is a discrete event random simulator, which can be used to simulate random events in various scenarios in a network, such as random access of channels, random roaming of multiple users, etc., and can simulate network protocols such as Wi-Fi, wi-Max, LTE, etc., and has been adopted by a great deal of research and teaching scenarios.
The simulation of NS3 aims to evaluate network performance, rather than synthesize a wireless protocol stack, simulating the feasibility of the verification procedure. In NS3 simulation, all network elements are running in a virtual network environment. When using the NS3 emulation network protocol, the user defines various basic events in the Wi-Fi network, such as DIFS event, random reciprocal event, send event, ACK event, etc., according to the event template of the NS3, and defines the transition relationship of these events through the state machine. After setting the initial random number seed, the random event engine runs the events and counts the events, and records the simulated running process. After the simulation is finished, a user can perform data analysis on the record file of the simulation process, so that the running performance of the corresponding simulation protocol is obtained, and the evaluation of the performance of the wireless protocol is assisted.
However, the simulation of NS3 can only run in a virtual network environment, i.e. cannot interoperate with a real network environment, and cannot interface with a software protocol stack. The invention provides a novel simulation mechanism based on shared content and a software lock, wherein the bottom layer is directly carried on a protocol stack of a Wi-Fi distributed coordination function DCF, and a novel wireless network simulation mode is constructed by utilizing the function which can be developed by the protocol stack, so that the simulation mechanism can be directly connected with a real wireless network environment, and the reality and the use scene of wireless simulation are greatly expanded.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a method for simulating the preemption, timing and transmission of Wi-Fi wireless channels by simply using a software mode under the condition of no participation of Wi-Fi hardware. The method can provide a method which has no hardware participation, is convenient for debugging and tracking and is convenient for quickly constructing a software prototype for the protocol layer and the application layer software development of Wi-Fi.
In order to solve the technical problems, the invention adopts the following technical scheme:
the method for simulating Wi-Fi wireless channel competition based on the shared memory and the signal quantity simulates channel competition through a software lock, takes inter-process shared memory based on a Linux platform as data bearing of a wireless channel, converts a data transmission process on the channel into a writing operation for the shared memory, converts a data receiving process on the channel into a reading operation for the shared memory, simulates DCF channel preemption and data transmission processes among network elements, and realizes simulation of a DCF basic mode and a request transmission/permission transmission mode.
Further, a finite state machine is adopted to trigger the state migration of each node according to the random event occurring on the time axis, so that simulation of a DCF random competition mechanism of a Wi-Fi wireless channel is realized.
Further, during simulation, network elements participating in Wi-Fi wireless channel competition are abstracted into one node, and changes generated by random events of each node along with the time are abstracted into transitions between IDLE, backoff, SEND, RECEIVE states.
Further, the migration correspondence between the four states includes the following seven network element state transitions:
11 Network element state transition 1), corresponding state IDLE transition to Backoff: the channel lock is idle, the read-write lock is idle, random back-off is started, and data to be transmitted is indicated that the network element has data to be transmitted in the channel space state;
12 Network element state transition 2), corresponding state Backoff transition to IDLE: the channel is locked up, random back-off is not started, and data to be transmitted is represented that the channel is occupied by other network elements;
13 Network element state transition 3, corresponding state Backoff transition to SEND: the channel lock is changed from idle to occupied, the read-write lock is changed from idle to occupied, random back-off is not started, data to be transmitted is still to be transmitted, the random back-off timer is overtime, the channel is idle, and data transmission is started;
14 Network element state transition 4), corresponding state IDLE to RECEIVE transition: the read-write lock is changed from idle to occupied, random back-off is not started, and no data to be sent exists, so that a receiver receives the data;
15 Network element state transition 5, corresponding to state RECEIVE transition to IDLE: when an ACK frame is received, the channel lock is changed from occupied to idle, the read-write lock is changed from occupied to idle, random back-off is not started, data to be sent is not needed, the data is received completely, the destination address of the received frame is not the current network element or the received frame is the ACK frame, and response is not needed to be sent immediately;
16 Network element state transition 6, corresponding state RECEIVE to SEND transition: the read-write lock is changed from occupied to idle to occupied, random back-off is not started, data to be sent is not needed, the destination address of the received frame is represented as the current network element, and response data is needed to be transmitted immediately after the data is received;
17 Network element state transition 7, corresponding state SEND transition to IDLE: and when the random back-off is not started, the read-write lock is changed from occupied to idle, which means that the current data transmission is completed and no other data to be transmitted exists.
Further, during simulation, the change generated by the Wi-Fi wireless channel along with the time and the occurrence of random events is abstracted into two states of IDLE and BUSY.
Further, the migration correspondence between the two states includes the following two channel state transitions:
21 Channel state transition 1), corresponding state BUSY to IDLE transition: the channel lock occupation indicates that the network element occupies a channel to prepare to send frame data;
22 Channel state transition 2), corresponding state IDLE transition to BUSY: the channel lock is idle, indicating that the network element releases the channel for the next contention.
Further, when the network element one and the network element two compete for the wireless channel at the same time and send data to the network element three in the Basic mode of the DCF, and finally the network element two competes successfully, a finite state machine is adopted to trigger the state migration of each node according to the random event occurring on the time axis, so as to realize the simulation process of the random competition mechanism of the DCf of the Wi-Fi wireless channel, and the simulation process comprises the following steps:
after waiting for a DIFS time slot, setting a corresponding random back-off timer duration as a first set value by the first network element, setting a corresponding random back-off timer duration as a second set value by the second network element, and setting the first set value to be greater than the second set value;
when the random back-off timer of the second network element is overtime, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, simultaneously acquiring a read-write lock, writing a data frame into the shared memory, wherein the destination address is the third network element, and then releasing the read-write lock; meanwhile, the network element acquires the read-write lock after passing through one unit time slot, finds that the channel lock is occupied and data exists in the shared memory, pauses the random back-off timer to acquire the read-write lock at the same time, and releases the read-write lock after reading the data frame in the shared memory; analyzing the data frame in the shared memory to find that the destination address is not self, analyzing the duration field and updating the NAV timer; meanwhile, the third network element obtains a read-write lock after passing through a unit time slot, and releases the read-write lock after reading the data frame in the shared memory;
the third network element analyzes the read data frame, finds that the destination address is self, and after waiting for a short inter-frame gap, the third network element acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock; meanwhile, the network element continuously acquires the read-write lock after waiting for one unit time slot, reads the ACK frame in the shared memory, and releases the read-write lock. Analyzing the ACK frame in the shared memory to find that the destination address is not the self, analyzing the duration field and updating the NAV timer; meanwhile, the second network element obtains the read-write lock after passing through a unit time slot, reads the ACK frame in the shared memory, and releases the read-write lock. The ACK frame in the shared memory is parsed to find that the destination address is itself. And releasing the channel lock if no other data needs to be transmitted.
And recovering the random back-off timer corresponding to the network element one after the NAV timer of the network element one is overtime and the DIFS time slot is waited for to be full again.
Further, when the request to send/allow to send mode is RTS/CTS mode, when the network element one and the network element two compete for wireless channels at the same time and send data to the network element three, and finally the network element two compete successfully, a finite state machine is adopted to trigger state migration of each node according to random events occurring on a time axis, so as to realize simulation process of the Wi-Fi wireless channel DCF random competition mechanism, which comprises the following steps:
after waiting for a DIFS time slot, setting a corresponding random back-off timer duration as a first set value by the first network element, setting a corresponding random back-off timer duration as a second set value by the second network element, and setting the first set value to be greater than the second set value;
when the random back-off timer of the second network element is overtime, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, simultaneously acquiring a read-write lock, writing RTS frame data into the shared memory, and releasing the read-write lock after the destination address is the third network element; meanwhile, the network element acquires a read-write lock after passing through a unit time slot, finds that the channel lock is occupied and that data exists in the shared memory, and pauses the random back-off timer; meanwhile, the network element III acquires a read-write lock after passing through a unit time slot, reads RTS frame data in the shared memory, and releases the read-write lock. And analyzing RTS frame data in the shared memory to find that the destination address is self.
After waiting for a unit time slot, the network element firstly acquires the read-write lock, reads RTS frame data in the shared memory, and releases the read-write lock. And analyzing RTS frame data in the shared memory, analyzing a duration field and updating the NAV timer, wherein the destination address is not self.
After waiting for a short frame gap, the network element III acquires a read-write lock, writes CTS frame data into the shared memory, and releases the read-write lock when the destination address is the network element II; meanwhile, the network element acquires the read-write lock after waiting for one unit time slot, reads CTS frame data in the shared memory, and releases the read-write lock. Resolving CTS frame data in a shared memory, resolving a duration field, updating a NAV timer, wherein a destination address is not self; meanwhile, the second network element obtains the read-write lock after passing through a unit time slot, reads CTS frame data in the shared memory, and releases the read-write lock. And analyzing CTS frame data in the shared memory, wherein the destination address is self, and releasing the read-write lock.
After waiting for a short frame gap, the second network element acquires a read-write lock, writes a data frame into the shared memory, and releases the read-write lock after the destination address is the third network element; meanwhile, the network element acquires the read-write lock after waiting for one unit time slot, reads the data frame in the shared memory, and releases the read-write lock. Analyzing the data frame in the shared memory, analyzing the duration field and updating the NAV timer when the destination address is not self; meanwhile, the network element III acquires a read-write lock after passing through a unit time slot, reads the data frame in the shared memory, releases the read-write lock, analyzes the data frame in the shared memory, and the destination address is self.
After waiting for a short frame gap, the third network element acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock after the destination address is the second network element; meanwhile, the network element waits for a unit time slot to acquire the read-write lock, reads the ACK frame in the shared memory, and releases the read-write lock. Analyzing the ACK frame in the shared memory, analyzing the duration field and updating the NAV timer if the destination address is not self; meanwhile, the second network element obtains the read-write lock after passing through a unit time slot, reads the ACK frame in the shared memory, and releases the read-write lock. And analyzing the ACK frame in the shared memory, wherein the destination address is self, and if no other data needs to be sent to release the channel lock.
And recovering the random back-off timer corresponding to the network element one after the NAV timer of the network element one is overtime and the DIFS time slot is waited for to be full again.
Further, the DCF channel preemption and data transmission process between network elements includes the following steps:
step 1, after each DIFS time slot expires, the network element checks whether a NAV timer is overtime or not, and a CCA is used for checking the channel state;
when the NAV timer does not time out, the NAV timer is decremented, and whether the NAV timer times out is checked again after waiting for a unit time slot;
when the channel state is busy, waiting for a unit time slot and checking the channel state again;
executing the next step only when the NAV timer times out and the channel state is idle;
step 2, selecting a random back-off value n, calculating back-off time length according to the random back-off value, and starting a random back-off timer;
step 3, judging whether the random back-off timer is overtime, if yes, acquiring a channel lock, then immediately acquiring a read-write lock, if acquiring successfully, starting to transmit data, if not, suspending the random back-off timer, acquiring the read-write lock, acquiring currently transmitted frame data, updating a NAV timer according to a duration field in the currently transmitted frame data, and returning to the step 1; if the read-write lock fails to be acquired, continuously waiting until the acquisition is successful; writing data after the read-write lock is successfully obtained; if the random back-off timer is not overtime, the step 4 is entered;
step 4, judging whether the NAV timer is overtime or not and judging the channel state;
when the NAV timer is not overtime or the channel state is busy, returning to execute the step 1;
when the NAV timer has timed out and the channel state is idle, the random back-off value is decremented, and the random back-off timer is updated according to the new random back-off value; meanwhile, step 3 is repeatedly performed every other unit slot.
Further, a Linux naming semaphore is adopted as a channel lock for protecting a current channel from being forced to be intruded by other network elements;
and another Linux naming semaphore is used as a read-write lock for protecting the shared memory from being written by other network elements simultaneously or read in the writing process.
The invention has the beneficial effects that:
the invention discloses a protocol stack simulation method of a Wi-Fi distributed coordination function DCF, which is a Wi-Fi channel random access method. In the present invention, 1) Basic mode (i.e., basic mode) simulation of DCF, 2) request to send/clear to send mode (i.e., RTS/CTS mode) simulation are implemented, respectively. The invention simulates channel competition through a software lock based on shared memory and signal quantity. The invention uses the inter-process shared memory of the Linux platform as the data bearing of the wireless channel, converts the data transmission process on the channel into the writing operation of the shared memory, and converts the data receiving process on the channel into the reading operation of the shared memory, thereby simulating the DCF channel preemption and the data transmission process between network elements.
The invention provides a method for simulating preemption, timing and transmission of Wi-Fi wireless channels by simply using software under the condition of no Wi-Fi hardware participation. The method can provide a method which has no hardware participation, is convenient for debugging and tracking and is convenient for quickly constructing a software prototype for the protocol layer and the application layer software development of Wi-Fi. The method can effectively solve the progress contradiction that the software can start debugging only after the chip prototype design and test are finished, which occurs in early stage of Wi-Fi chip product research and development engineering, and the software debugging and optimizing work can be greatly advanced, so that the aim of shortening the chip product research and development period is finally achieved.
By adopting the method of the invention, the software running environment and the chip hardware can be effectively decoupled, the purchase quantity of the hardware simulation platform can be reduced to a certain extent, and the purpose of saving the research and development cost of the chip can be realized.
The method simulates channel competition through the software lock, and simultaneously uses the shared memory to realize data transmission on the wireless channel, thereby relatively truly and accurately simulating the DCF channel preemption and the data transmission process between network elements.
Drawings
Fig. 1 is a schematic diagram of correct channel preemption according to NAV;
FIG. 2 is a flow chart of a DCF preemption process;
FIG. 3 is a schematic diagram of a state transition of each node triggered by a random event occurring on a time axis;
fig. 4 is a schematic diagram of migration between network element states participating in channel contention;
fig. 5 is a schematic diagram of a change migration of a wireless channel;
FIG. 6 is a schematic diagram of Basic mode scene channel preemption;
FIG. 7 is a specific flow chart of the method in a Basic mode scenario;
fig. 8 is a schematic diagram of RTS/CTS mode scene channel preemption;
fig. 9 is a specific flowchart of the method in the RTS/CTS mode scenario.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for more clearly illustrating the technical aspects of the present invention, and are not intended to limit the scope of the present invention.
The method simulates channel competition through the software lock, and simultaneously uses the shared memory to realize data transmission on the wireless channel, thereby relatively truly and accurately simulating the DCF channel preemption and the data transmission process between network elements. In connection with fig. 2, the dcf preemption procedure is as follows:
step 1, after each DIFS time slot expires, the network element checks whether the NAV timer is overtime, if not, the NAV timer is decremented by taking the length of one unit time slot as the amplitude, and after waiting for one unit time slot, the NAV timer is checked again whether the NAV timer is overtime. If the time is out, the result of the following step 2 is waited.
And 2, checking the channel state by using the channel lock, and if the channel is busy, waiting for one unit time slot and checking again. If the channel is idle and the status of the step 1 is determined to be "NAV timer timeout", the following step 3 is entered.
And 3, selecting a random back-off value n, calculating back-off time length according to the random back-off value, and starting a random back-off timer.
And 4, judging whether the random back-off timer is overtime, acquiring a channel lock if the random back-off timer is overtime, immediately acquiring a read-write lock, starting to transmit data if the channel lock is successfully acquired, suspending the random back-off timer if the channel lock is failed to acquire the read-write lock, acquiring the currently transmitted frame data, updating a NAV timer according to a duration field in the currently transmitted frame data, and returning to the step 1. If the read-write lock fails to be acquired, continuously waiting until the acquisition is successful; writing data after the read-write lock is successfully obtained; if the random back-off timer has not timed out, step 5 is entered.
And 5, judging the overtime state and the channel state of the NAV timer. If the NAV timer has timed out and the channel is idle, the random back-off value is decremented by one unit slot length as amplitude, and the random back-off timer is updated according to the new random back-off value, returning to step 4. If the NAV timer has not expired or the channel is busy, go back to step 1.
In step 3, the random backoff value n is an integer randomly selected between a contention window minimum value and a contention window maximum value defined according to the IEEE Std 802.11 ™ -2020 protocol.
In step 3, the back-off time length=n×unit time slot.
In other embodiments, the determination of whether the NAV timer in step 1 and step 2 times out and the determination of the channel state may be sequentially interchanged, or the two determination steps may be executed in parallel, and when the channel is idle and the NAV timer times out, the next step is still entered.
Based on the basic process of DCF channel preemption, the main design concept of the method of the invention relates to three main logic relations:
1. the inter-process shared memory based on the Linux platform is used as a data bearing means of a wireless channel, the data transmission behavior (namely the transmission in the step 4 of the DCF preemption process) on the channel is converted into a writing operation for the shared memory, and the data receiving behavior on the channel is converted into a reading operation for the shared memory. The shared memory adopts the structure shown in the table 1:
table 1 data structure in shared memory
Figure SMS_1
2. A Linux naming semaphore is used as a channel lock to protect the current channel from forced intrusion by other network elements to mimic CCA behavior.
3. And using a Linux naming semaphore as a read-write lock for protecting the shared memory from being written by other network elements simultaneously or read in the writing process.
By utilizing the three main logic relations, the method triggers the state migration of each node by adopting the finite state machine FSM (Finite State Machine) according to the random event occurring on the time axis, thereby realizing the simulation of the Wi-Fi channel DCF random competition mechanism.
As shown in fig. 3 and fig. 4, the network elements participating in channel contention are abstracted as a node, and each node is abstracted as a transition between IDLE, backoff, SEND, RECEIVE states along with the time and the change (such as data need to be sent, waiting for receiving ACK and periodically receiving data) caused by the random event. The migration process of the state machine is illustrated in table 2 below:
table 2 network element state transition specification
Figure SMS_2
As shown in fig. 5, changes generated by the wireless channel itself and random events (such as data transmission) occurring over time are abstracted into two states of IDLE2 and BUSY. The network element state transition is illustrated in table 3 below.
Table 3 channel state transition specification
Figure SMS_3
By using the simulation method for triggering the finite state machine migration by random events based on time variation, the DCF random competition mechanism of the wireless channel can be restored highly. The DCF random contention mechanism mainly has two kinds of scenes, namely a Basic mode scene and an RTS/CTS mode scene.
1) Basic mode scene
Suppose that at the same time two network elements (network element 1 and network element 2) compete for the radio channel and send data to the third network element (network element 3), and eventually network element 2 competes successfully, as shown in fig. 6. Specific implementation steps of the method are described in detail with reference to fig. 7 for the Basic mode scenario described above. In fig. 7, all the processes of reading each frame omit the process of "acquire read-write lock→read shared memory→release read-write lock".
When the network element 1 and the network element 2 compete for a wireless channel at the same moment and send data to the network element 3 in a Basic mode scene, and finally, when the network element 2 competes successfully, a finite state machine is adopted to trigger the state migration of each node according to a random event occurring on a time axis, so that a simulation process of a DCF random competition mechanism of a Wi-Fi wireless channel is realized, and the simulation process comprises the following steps:
after waiting for a DIFS time slot, the network element 1 sets the duration of the corresponding random back-off timer to a first set value (the duration is 7 in the embodiment), and the network element 2 sets the duration of the corresponding random back-off timer to a second set value (the duration is 4 in the embodiment), where the first set value is greater than the second set value;
when the random back-off timer of the network element 2 is overtime, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, simultaneously acquiring a read-write lock, writing a data frame into a shared memory, wherein the destination address is the network element 3, and then releasing the read-write lock; meanwhile, the network element 1 acquires the read-write lock after passing through a unit time slot, finds that the channel lock is occupied and data exists in the shared memory, pauses the random back-off timer, acquires the read-write lock at the same time, and releases the read-write lock after reading a data frame in the shared memory; analyzing the data frame in the shared memory to find that the destination address is not self, analyzing the duration field and updating the NAV timer; meanwhile, the network element 3 acquires a read-write lock after passing through a unit time slot, and releases the read-write lock after reading a data frame in the shared memory;
the network element three analyzes the read data frame, discovers that the destination address is self, and after waiting for a short frame gap, the network element 3 acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock after the destination address is the network element 2; meanwhile, the network element 1 continues to acquire the read-write lock after waiting for one unit time slot, reads the ACK frame in the shared memory, and releases the read-write lock. Analyzing the ACK frame in the shared memory to find that the destination address is not the self, analyzing the duration field and updating the NAV timer; meanwhile, the network element 2 acquires the read-write lock after passing through a unit gap, reads the ACK frame in the shared memory, and releases the read-write lock. The ACK frame in the shared memory is parsed to find that the destination address is itself. And releasing the channel lock if no other data needs to be transmitted.
And recovering the random back-off timer corresponding to the network element 1 after the NAV timer of the network element 1 is overtime and the DIFS time slot is waited for to be full again.
To clearly illustrate the steps in fig. 7, the state migration process of each network element, the shared memory, the channel lock, and the read-write lock in each step is specifically described in the following table 4 according to the time sequence, where each network element performs the actions of acquiring the read-write lock, reading the frame data, and releasing the read-write lock every other unit time slot, which corresponds to the details in the state migration description of the network element in table 2, which corresponds to the details in table 2, and the details in table 3, which are not described in table 4.
TABLE 4 Basic mode scene process state specification
Figure SMS_4
2) RTS/CTS mode scene
Suppose that at the same time two network elements (network element 1 and network element 2) compete for the radio channel and send data to the third network element (network element 3), and eventually network element 2 competes successfully as shown in fig. 8.
Specific implementation steps of the method are described in detail in connection with fig. 9 for RTS/CTS mode scenarios. In fig. 9, all the processes of reading each frame omit the process of "acquire read-write lock→read shared memory→release read-write lock".
When the network element 1 and the network element 2 compete for a wireless channel at the same moment and send data to the network element 3 in the RTS/CTS mode scene, and finally the network element 2 competes successfully, a finite state machine is adopted to trigger the state migration of each node according to a random event occurring on a time axis, so that the simulation process of a DCF random competition mechanism of a Wi-Fi wireless channel is realized, and the method comprises the following steps:
after waiting for a DIFS time slot, the network element 1 sets the corresponding random back-off timer time length to a first set value (in this embodiment, the time length is set to 7), and the network element 2 sets the corresponding random back-off timer time length to a second set value (in this embodiment, the time length is set to 4), where the first set value is greater than the second set value;
when the random back-off timer of the network element 2 is overtime, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, simultaneously acquiring a read-write lock, writing RTS frame data into a shared memory, wherein a destination address is the network element 3, and then releasing the read-write lock; meanwhile, the network element 1 acquires a read-write lock after passing through a unit time slot, finds that the channel lock is occupied and that data exists in the shared memory, and pauses the random back-off timer; meanwhile, the network element 3 obtains the read-write lock after passing through a unit time slot, reads RTS frame data in the shared memory, and releases the read-write lock. And analyzing RTS frame data in the shared memory to find that the destination address is self.
After waiting for a unit time slot, when the network element 1 acquires the read-write lock, the RTS frame data in the shared memory is read, and the read-write lock is released. And analyzing RTS frame data in the shared memory, wherein the destination address is not an analysis duration field per se, and updating the NAV timer.
After waiting for a short frame gap, the network element 3 acquires a read-write lock, writes CTS frame data into the shared memory, and releases the read-write lock when the destination address is the network element 2; meanwhile, the network element 1 waits for a unit time slot to acquire a read-write lock, reads CTS frame data in the shared memory, and releases the read-write lock. Resolving CTS frame data in a shared memory, resolving a duration field, updating a NAV timer, wherein a destination address is not self; meanwhile, the network element 2 acquires the read-write lock after passing through a unit time slot, reads CTS frame data in the shared memory, and releases the read-write lock. Resolving CTS frame data in the shared memory, wherein the destination address is self, and releasing a read-write lock and a channel lock;
after waiting for a short frame gap, the network element 2 acquires a read-write lock, writes a data frame into the shared memory, and releases the read-write lock after the destination address is the network element 3; meanwhile, the network element 1 waits for a unit time slot to acquire the read-write lock, reads the data frame in the shared memory, and releases the read-write lock. Analyzing the data frame in the shared memory, analyzing the duration field and updating the NAV timer when the destination address is not self; meanwhile, the network element 3 acquires the read-write lock after passing through a unit time slot, reads the data frame in the shared memory, and releases the read-write lock. And analyzing the data frame in the shared memory, wherein the destination address is self.
After waiting for a short frame gap, the network element 3 acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock after the destination address is the network element 2; meanwhile, the network element 1 waits for a unit time slot to acquire the read-write lock, reads the ACK frame in the shared memory, and releases the read-write lock. Analyzing the ACK frame in the shared memory, analyzing the duration field and updating the NAV timer if the destination address is not self; meanwhile, the network element 2 acquires the read-write lock after passing through a unit time slot, reads the ACK frame in the shared memory, and releases the read-write lock. And analyzing the ACK frame in the shared memory, wherein the destination address is self, and if no other data needs to be sent to release the channel lock.
And recovering the random back-off timer corresponding to the network element 1 after the NAV timer of the network element 1 is overtime and the DIFS time slot is waited for to be full again.
For clarity of explanation of the steps in fig. 9, the state migration process of each network element, the shared memory, the channel lock, and the read-write lock in each step is specifically described in the following table 5 according to the time sequence, where each network element performs the actions of acquiring the read-write lock, reading the frame data, and releasing the read-write lock every other unit time slot, and the specific meaning of the corresponding network element state migration number is described in detail in table 2, the specific meaning of the channel state migration number is described in detail in table 3, and the details of the channel state migration number are not described in table 5.
For the above steps, the following table 5 is specifically described in time series.
TABLE 5RTS/CTS mode scene procedure State Specification
Figure SMS_5
Compared with the traditional simulator, the invention has the innovation of utilizing the mode of sharing the memory and the signal quantity. Whereas conventional simulators typically employ a random trigger mechanism + state machine to construct a discrete event simulator, the implementation mechanism, implementation scheme of the present invention is quite different from conventional simulators.
The foregoing is merely a preferred embodiment of the present invention, and it should be noted that modifications and variations could be made by those skilled in the art without departing from the technical principles of the present invention, and such modifications and variations should also be regarded as being within the scope of the invention.

Claims (5)

1. A protocol stack simulation method of a DCF (distributed coordination function) with Wi-Fi is characterized in that channel competition is simulated through a software lock, an inter-process shared memory based on a Linux platform is used as a data carrier of a wireless channel, a data transmission process on the channel is converted into a write operation for the shared memory, a data receiving process on the channel is converted into a read operation for the shared memory, a DCF channel preemption and a data transmission process between network elements are simulated, and simulation of a DCF basic mode and a request transmission/permission transmission mode is realized;
triggering state migration of each node by adopting a finite state machine according to random events occurring on a time axis, and realizing simulation of a DCF random competition mechanism of a Wi-Fi wireless channel;
during simulation, abstracting network elements participating in Wi-Fi wireless channel competition into one node, and abstracting changes generated by random events of each node along with the time as migration between IDLE, backoff, SEND, RECEIVE states;
the migration correspondence between the four states includes the following seven network element state transitions:
11 Network element state transition 1), corresponding state IDLE transition to Backoff: the channel lock is idle, the read-write lock is idle, random back-off is started, and data to be transmitted is indicated that the network element has data to be transmitted in the channel space state;
12 Network element state transition 2), corresponding state Backoff transition to IDLE: the channel is locked up, random back-off is not started, and data to be transmitted is represented that the channel is occupied by other network elements;
13 Network element state transition 3, corresponding state Backoff transition to SEND: the channel lock is changed from idle to occupied, the read-write lock is changed from idle to occupied, random back-off is not started, data to be transmitted is still to be transmitted, the random back-off timer is overtime, the channel is idle, and data transmission is started;
14 Network element state transition 4), corresponding state IDLE to RECEIVE transition: the read-write lock is changed from idle to occupied, random back-off is not started, and no data to be sent exists, so that a receiver receives the data;
15 Network element state transition 5, corresponding to state RECEIVE transition to IDLE: when an ACK frame is received, the channel lock is changed from occupied to idle, the read-write lock is changed from occupied to idle, random back-off is not started, data to be sent is not needed, the data is received completely, the destination address of the received frame is not the current network element or the received frame is the ACK frame, and response is not needed to be sent immediately;
16 Network element state transition 6, corresponding state RECEIVE to SEND transition: the read-write lock is changed from occupied to idle to occupied, random back-off is not started, data to be sent is not needed, the destination address of the received frame is represented as the current network element, and response data is needed to be transmitted immediately after the data is received;
17 Network element state transition 7, corresponding state SEND transition to IDLE: the random back-off is not started, and the read-write lock is changed from occupied to idle, so that the current data transmission is completed and no other data to be transmitted exists;
during simulation, abstracting the change generated by the Wi-Fi wireless channel along with the time and the random event into an IDLE state and a BUSY state;
the transition correspondence between the two states includes the following two channel state transitions:
21 Channel state transition 1), corresponding state BUSY to IDLE transition: the channel lock occupation indicates that the network element occupies a channel to prepare to send frame data;
22 Channel state transition 2), corresponding state IDLE transition to BUSY: the channel lock is idle, indicating that the network element releases the channel for the next contention.
2. The protocol stack simulation method of the DCF according to claim 1, wherein when the network element I and the network element II compete for wireless channels and send data to the network element III at the same time in a basic mode of the DCF, and finally the network element II competes successfully, a finite state machine is adopted to trigger state migration of each node according to random events occurring on a time axis, so as to realize a simulation process of a DCF random competition mechanism of the Wi-Fi wireless channels, and the method comprises the following steps:
after waiting for a DIFS time slot, setting a corresponding random back-off timer duration as a first set value by the first network element, setting a corresponding random back-off timer duration as a second set value by the second network element, and setting the first set value to be greater than the second set value;
when the random back-off timer of the second network element is overtime, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, simultaneously acquiring a read-write lock, writing a data frame into the shared memory, wherein the destination address is the third network element, and then releasing the read-write lock; meanwhile, the network element acquires the read-write lock after passing through one unit time slot, finds that the channel lock is occupied and data exists in the shared memory, pauses the random back-off timer, acquires the read-write lock at the same time, and releases the read-write lock after reading the data frame in the shared memory; analyzing the data frame in the shared memory to find that the destination address is not self, analyzing the duration field and updating the NAV timer; meanwhile, the third network element obtains a read-write lock after passing through a unit time slot, and releases the read-write lock after reading the data frame in the shared memory; the third network element analyzes the read data frame, discovers that the destination address is self, and after waiting for a short frame gap, the third network element acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock again when the destination address is the second network element; meanwhile, the network element continuously acquires the read-write lock after waiting for one unit time slot, reads the ACK frame in the shared memory, and releases the read-write lock; analyzing the ACK frame in the shared memory to find that the destination address is not the self, analyzing the duration field and updating the NAV timer; meanwhile, the second network element acquires a read-write lock after passing through a unit time slot, reads an ACK frame in the shared memory, and releases the read-write lock; resolving the ACK frame in the shared memory to find that the destination address is self; releasing the channel lock if no other data needs to be sent;
and recovering the random back-off timer corresponding to the network element one after the NAV timer of the network element one is overtime and the DIFS time slot is waited for to be full again.
3. The protocol stack simulation method of a Wi-Fi distributed coordination function DCF according to claim 1, wherein when a transmission/permission transmission mode is requested, when a network element one and a network element two compete for a wireless channel and transmit data to a network element three at the same time, and finally the network element two competes successfully, a finite state machine is adopted to trigger state migration of each node according to a random event occurring on a time axis, so as to realize a simulation process of a Wi-Fi wireless channel DCF random competition mechanism, and the method comprises the following steps:
after waiting for a DIFS time slot, setting a corresponding random back-off timer duration as a first set value by the first network element, setting a corresponding random back-off timer duration as a second set value by the second network element, and setting the first set value to be greater than the second set value;
when the random back-off timer of the second network element is overtime, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, simultaneously acquiring a read-write lock, writing RTS frame data into the shared memory, and releasing the read-write lock after the destination address is the third network element; meanwhile, the network element acquires a read-write lock after passing through a unit time slot, finds that the channel lock is occupied and that data exists in the shared memory, and pauses the random back-off timer; meanwhile, the network element III acquires a read-write lock after passing through a unit time slot, reads RTS frame data in the shared memory, and releases the read-write lock; resolving RTS frame data in a shared memory, and finding that a destination address is self;
after waiting for a unit time slot, the network element firstly acquires a read-write lock, reads RTS frame data in the shared memory, and releases the read-write lock; resolving RTS frame data in the shared memory, resolving a duration field, updating a NAV timer, wherein the destination address is not self;
after waiting for a short frame gap, the network element III acquires a read-write lock, writes CTS frame data into the shared memory, and releases the read-write lock when the destination address is the network element II; meanwhile, the network element firstly waits for a unit time slot and then acquires a read-write lock, reads CTS frame data in the shared memory, and releases the read-write lock; resolving CTS frame data in a shared memory, resolving a duration field, updating a NAV timer, wherein a destination address is not self; meanwhile, the second network element obtains a read-write lock after passing through a unit time slot, reads CTS frame data in the shared memory, and releases the read-write lock; resolving CTS frame data in the shared memory, wherein the destination address is self, and releasing the read-write lock;
after waiting for a short frame gap, the second network element acquires a read-write lock, writes a data frame into the shared memory, and releases the read-write lock after the destination address is the third network element; meanwhile, the network element acquires a read-write lock after waiting for one unit time slot, reads a data frame in the shared memory, and releases the read-write lock; analyzing the data frame in the shared memory, analyzing the duration field and updating the NAV timer when the destination address is not self; meanwhile, the third network element obtains a read-write lock after passing through a unit time slot, reads the data frame in the shared memory, and releases the read-write lock; analyzing a data frame in the shared memory, wherein the destination address is self; after waiting for a short frame gap, the third network element acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock after the destination address is the second network element; meanwhile, the network element waits for a unit time slot to acquire a read-write lock, reads an ACK frame in the shared memory, and releases the read-write lock; analyzing the ACK frame in the shared memory, analyzing the duration field and updating the NAV timer if the destination address is not self; meanwhile, the second network element acquires a read-write lock after passing through a unit time slot, reads an ACK frame in the shared memory, and releases the read-write lock; analyzing the ACK frame in the shared memory, wherein the destination address is self, if no other data needs to be sent to release the channel lock;
and recovering the random back-off timer corresponding to the network element one after the NAV timer of the network element one is overtime and the DIFS time slot is waited for to be full again.
4. The protocol stack simulation method of the Wi-Fi distributed coordination function DCF according to claim 1, wherein the DCF channel preemption and data transmission process between network elements comprises the following steps:
step 1, after each distributed inter-frame gap (DIFS) time slot expires, a network element checks whether a network allocation vector timer (NAV timer) is overtime or not, and simulates Clear Channel Assessment (CCA) through a channel lock, so that the channel lock is used for checking the channel state;
when the NAV timer is not in a overtime state, gradually decrementing the NAV timer by taking the length of one unit time slot as the amplitude according to the timing time, and checking whether the NAV timer is overtime again after waiting for one unit time slot;
when the channel state is busy, waiting for a unit time slot and checking the channel state again;
executing the next step only when the NAV timer times out and the channel state is idle;
step 2, selecting a random back-off value n, calculating back-off time length according to the random back-off value, and starting a random back-off timer;
step 3, judging whether the random back-off timer is overtime, if yes, acquiring a channel lock, then immediately acquiring a read-write lock, if acquiring successfully, starting to transmit data, if not, suspending the random back-off timer, acquiring the read-write lock, acquiring currently transmitted frame data, updating a NAV timer according to a duration field in the currently transmitted frame data, and returning to the step 1; if the read-write lock fails to be acquired, continuously waiting until the acquisition is successful; writing data after the read-write lock is successfully obtained; if the random back-off timer does not time out, entering step 4;
step 4, judging whether the NAV timer is overtime or not and judging the channel state;
when the NAV timer is not overtime or the channel lock state is busy, returning to execute the step 1;
when the NAV timer is overtime and the channel lock state is idle, the random back-off value is decremented by taking a unit time slot length as the amplitude, and the random back-off timer is updated according to the new random back-off value; meanwhile, step 3 is repeatedly performed every other unit slot.
5. The protocol stack simulation method of the Wi-Fi distributed coordination function DCF according to claim 1, wherein a Linux naming semaphore is adopted as a channel lock for protecting a current channel from being forced to be intruded by other network elements;
and another Linux naming semaphore is used as a read-write lock for protecting the shared memory from being written by other network elements simultaneously or read in the writing process.
CN202310088803.6A 2023-02-09 2023-02-09 Protocol stack simulation method of Wi-Fi distributed coordination function DCF Active CN115835268B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310088803.6A CN115835268B (en) 2023-02-09 2023-02-09 Protocol stack simulation method of Wi-Fi distributed coordination function DCF

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310088803.6A CN115835268B (en) 2023-02-09 2023-02-09 Protocol stack simulation method of Wi-Fi distributed coordination function DCF

Publications (2)

Publication Number Publication Date
CN115835268A CN115835268A (en) 2023-03-21
CN115835268B true CN115835268B (en) 2023-05-09

Family

ID=85520941

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310088803.6A Active CN115835268B (en) 2023-02-09 2023-02-09 Protocol stack simulation method of Wi-Fi distributed coordination function DCF

Country Status (1)

Country Link
CN (1) CN115835268B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101951612B (en) * 2010-09-01 2012-12-19 南京航空航天大学 DCF protocol fairness guarantee method suitable for multi-hop ad hoc network
CN109714807B (en) * 2019-01-16 2021-03-23 南京航空航天大学 Cognitive radio network access method based on common control channel
CN114003351A (en) * 2020-07-28 2022-02-01 中移(苏州)软件技术有限公司 Data processing method and device and storage medium
CN112579550B (en) * 2020-12-21 2022-09-30 国电南瑞科技股份有限公司 Metadata information synchronization method and system of distributed file system

Also Published As

Publication number Publication date
CN115835268A (en) 2023-03-21

Similar Documents

Publication Publication Date Title
US20020059052A1 (en) Co-simulation of network components
CN108984389B (en) Application program testing method and terminal equipment
CN111200837B (en) Wi-Fi software testing system and method
CN113076227A (en) MCU verification method, system and terminal equipment
CN108647176B (en) Data transmission method for Internet of vehicles equipment and Internet of vehicles equipment
WO2022213538A1 (en) Method and apparatus for establishing simulation test platform, and electronic device
CN115841089A (en) System-on-chip verification platform and verification method based on UVM
CN113377596A (en) Method for storing and reading waveform data and related device
CN111352778B (en) Network simulation processing method and device, electronic equipment and storage medium
CN115835268B (en) Protocol stack simulation method of Wi-Fi distributed coordination function DCF
CN112100014B (en) Passive wireless communication chip verification platform, construction method and chip verification method
CN114253823A (en) Distributed test method and related equipment
CN115659885B (en) System and method for simulation test
TWI362002B (en) Method and computer program product for automated generation of message exchange pattern simulation code
CN115685785A (en) Universal bus model and simulation test method
CN111897582B (en) All-in-one machine Ethernet refreshing method and device, storage medium and all-in-one machine equipment
CN114546823A (en) Method for reproducing debugging scene of logic system design and related equipment
CN117131821B (en) Chip verification method, device, electronic equipment and storage medium
CN116233907B (en) AP performance detection method and detection system based on simulation multi-concurrent STA
US20230014477A1 (en) Method and device for testing memory, and readable storage medium
JP2003177937A (en) Apparatus and method for improvement of communication between emulator unit and host device
CN116842902B (en) System-level simulation modeling method for black box model
BELLOTTI et al. An interactive VHDL simulator for IEEE 802.11 networks
JP2926561B1 (en) Software testing method
CN117971579A (en) Fault injection testing method, testing equipment and testing system

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