CN115835268A - 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
CN115835268A
CN115835268A CN202310088803.6A CN202310088803A CN115835268A CN 115835268 A CN115835268 A CN 115835268A CN 202310088803 A CN202310088803 A CN 202310088803A CN 115835268 A CN115835268 A CN 115835268A
Authority
CN
China
Prior art keywords
network element
read
channel
data
write lock
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
CN202310088803.6A
Other languages
Chinese (zh)
Other versions
CN115835268B (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

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a protocol stack simulation method of a Wi-Fi distributed coordination function DCF, wherein the DCF is a method for randomly accessing a Wi-Fi channel, and simulates channel competition through a software lock based on shared memory and semaphore; the inter-process shared memory of the Linux platform is used as the data bearer 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 the DCF channel preemption and data transmission process between network elements are simulated, so that the simulation of the DCF basic mode and the request sending/permission sending mode is realized. The method decouples the software operating environment and the chip hardware, reduces the purchase quantity of hardware simulation platforms, and saves the research and development cost of the chip; the debugging and optimizing work of the software is greatly carried out in advance, and the aim of shortening the research and development period of the chip product is finally achieved.

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 the combination of a Wi-Fi wireless protocol stack and a wireless random access mechanism in a software mode, and belongs to the technical field of communication.
Background
The current analog simulation of the Wi-Fi distributed coordination function DCF generally comprises two modes. One is to simulate a software protocol stack only, which needs to be combined with hardware to work, and the other is to simulate only a random access mechanism of an emulated DCF, such as open source software NS3, which cannot be simulated with the protocol stack comprehensively. The NS3 is a discrete event random simulator, and may be used to simulate random events in various scenarios in a network, such as random access of a channel, random roaming of multiple users, and the like, and may simulate network protocols such as Wi-Fi, wi-Max, and LTE, and has been adopted in a large number of research and teaching scenarios.
The simulation goal of NS3 is to evaluate network performance, rather than synthesize the radio protocol stack, to simulate the feasibility of a validation procedure. In the NS3 simulation, all network elements operate in a virtual network environment. When a user uses the NS3 simulation network protocol, various basic events in the Wi-Fi network, such as DIFS events, random reciprocal events, sending events, ACK events and the like, are defined according to the event template of the NS3, and the transition relation of the events is defined through a state machine. And then, after setting the seed of the initial random number, running the events through a random event engine, counting the events, and recording the running process of the simulation. After the simulation is finished, a user can analyze data of the recording file of the simulation process, and then the running performance of the corresponding simulation protocol is obtained, so that the evaluation of the performance of the wireless protocol is assisted.
However, the simulation of the NS3 can only run in a virtual network environment, i.e. cannot run in interworking with a real network environment, and even 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 of the simulation mechanism 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 butted with a real wireless network environment, and the reality and the use scene of wireless simulation are greatly expanded.
Disclosure of Invention
The technical problem to be solved by the invention is to overcome the defects of the prior art and provide a method for simulating the preemption, the timing and the transmission of a Wi-Fi wireless channel by only using a software mode under the condition of not participating in Wi-Fi hardware. The method can provide a method which has no hardware participation, is convenient for debugging and tracing and is convenient for quickly constructing a software prototype for the software development of a protocol layer and an application layer of Wi-Fi.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
a Wi-Fi wireless channel competition simulation method based on a shared memory and semaphore simulates channel competition through software mode, inter-process shared memory based on a Linux platform is used as data bearing of a wireless channel, a data transmission process on the channel is converted into writing operation on the shared memory, a data receiving process on the channel is converted into reading operation on the shared memory, a DCF channel preemption and data transmission process between network elements is simulated, and simulation of a DCF basic mode and a request sending/permission sending mode is achieved.
Further, a finite state machine is adopted to trigger the state transition of each node according to random events occurring on a time axis, and the simulation of the DCF random competition mechanism of the 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 of each node along with the time and the occurrence of random events are abstracted into transitions among four states of IDLE, backoff, SEND and RECEIVE.
Further, the migration correspondence between the four states includes the following seven network element state transitions:
11 Network element state migration 1, corresponding state IDLE migration to backkoff: the channel lock is idle, the read-write lock is idle, random backoff is started, data to be transmitted is to be transmitted, and the network element in the channel space state has data to be transmitted;
12 Network element state migration 2, corresponding state Backoff migrating to IDLE: the channel lock is busy, the random backoff is not started, and data to be sent is to be sent, which indicates that the channel is occupied by other network elements;
13 Network element state migration 3, corresponding state backkoff to SEND migration: the channel lock is changed from idle to occupied, the read-write lock is changed from idle to occupied, the random backoff is not started, data to be sent represents that the random backoff timer is overtime and the channel is idle, and data transmission is started;
14 Network element state migration 4, corresponding state IDLE migrates to RECEIVE: the read-write lock is changed from idle to occupied, random backoff is not started, no data to be sent exists, and the receiver receives the data;
15 Network element state migration 5, the corresponding state RECEIVE migrates to IDLE: when the ACK frame is received, the channel lock is changed from occupied to idle, the read-write lock is changed from occupied to idle, random backoff is not started, no data to be sent exists, the data is received completely, the destination address of the received frame is not the current network element or the received ACK frame is the ACK frame, and response does not need to be sent immediately;
16 Network element state migration 6, the corresponding state RECEIVE migrates to SEND: the read-write lock is changed from occupied to idle and then changed into occupied, random backoff is not started, data to be sent indicates that the destination address of the received frame is the current network element, and response data needs to be transmitted immediately after the data is received;
17 Network element state migration 7, corresponding state SEND to IDLE migration: and if the random back-off is not started, the read-write lock is changed from occupied to idle, which indicates that the current data is sent completely and no other data to be sent exists.
Further, during simulation, changes of the Wi-Fi wireless channel over time and changes of random events are abstracted into an IDLE state and a BUSY state.
Further, the transition correspondence between the two states includes the following two channel state transitions:
21 Channel state transition 1, corresponding state BUSY to IDLE: channel lock occupation, which means that a network element occupies a channel to prepare for sending frame data;
22 Channel state transition 2, corresponding state IDLE to BUSY transition: the channel lock is idle, which means the network element releases the channel for the next contention.
Further, in a Basic mode of the DCF, when the first network element and the second network element compete for the wireless channel and send data to the third network element at the same time, and finally when the second network element competes successfully, a finite state machine is used to trigger state transition 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, which includes the following steps:
after waiting for a DIFS time slot, the first network element sets the time length of a corresponding random backoff timer to be a first set value, the second network element sets the time length of the corresponding random backoff timer to be a second set value, and the first set value is greater than the second set value;
when the random backoff timer of the network element two times out, 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 three, and then releasing the read-write lock; meanwhile, once the network element passes a unit time slot, the network element acquires a read-write lock, finds that the channel lock is occupied and data exists in the shared memory, suspends the random backoff timer to simultaneously acquire the read-write lock, 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 a NAV timer; meanwhile, the network element III acquires the read-write lock after one 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 obtains a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock when the destination address is the second network element; meanwhile, the network element 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 self, analyzing the duration field, and updating a NAV timer; and meanwhile, the network element two acquires the read-write lock after one unit time slot, reads the ACK frame in the shared memory and releases the read-write lock. And resolving the ACK frame in the shared memory to find that the destination address is the address of the ACK frame. And releasing the channel lock if no other data needs to be sent.
And recovering the random backoff timer corresponding to the network element I after waiting for the DIFS time slot to be full again until the NAV timer of the network element I is overtime.
Further, when the request-to-send/permission-to-send mode is the RTS/CTS mode, when the first network element and the second network element compete for the wireless channel and send data to the third network element at the same time, and finally when the second network element competes successfully, the finite state machine is used to trigger the state transition of each node according to a random event occurring on a time axis, so as to realize a simulation process of a DCF random competition mechanism for the Wi-Fi wireless channel, including the following steps:
after waiting for a DIFS time slot, the first network element sets the time length of a corresponding random backoff timer to be a first set value, the second network element sets the time length of the corresponding random backoff timer to be a second set value, and the first set value is greater than the second set value;
when the random backoff timer of the network element two times out, 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 the target address is the network element three, and then releasing the read-write lock; meanwhile, once the network element passes a unit time slot, the network element acquires a read-write lock, finds that a channel lock is occupied and data exists in a shared memory, and suspends a random back-off timer; and meanwhile, the network element III acquires the read-write lock after one 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, and finding that the destination address is the RTS frame data.
And after waiting for one unit time slot, the first network element 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 the duration field and 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; and 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. Analyzing CTS frame data in the shared memory, analyzing the duration field and updating a NAV timer, wherein the destination address is not self; and meanwhile, the network element II acquires the read-write lock after one unit time slot, reads CTS frame data in the shared memory and releases the read-write lock. And analyzing the 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 network element two acquires a read-write lock, writes a data frame into the shared memory, and releases the read-write lock when the destination address is the network element three; and 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, if the destination address is not self, analyzing the duration field, and updating the NAV timer; and meanwhile, the network element III acquires the read-write lock after one 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 network element III acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock when the destination address is the network element II; meanwhile, the network element waits for one 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, if the destination address is not self, analyzing the duration field, and updating the NAV timer; and meanwhile, the network element two acquires the read-write lock after one 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 backoff timer corresponding to the network element I after waiting for the DIFS time slot to be full again until the NAV timer of the network element I is overtime.
Further, the DCF channel preemption and data transmission process between network elements includes the following steps:
step 1, after each DIFS time slot expires, a network element checks whether a NAV timer is overtime, and a CCA is used for checking a channel state;
when the NAV timer is not overtime, the NAV timer is decreased, and whether the NAV timer is overtime is checked again after waiting for a unit time slot;
when the channel state is busy, the channel state is checked again after waiting for one unit time slot;
executing the next step only when the NAV timer is overtime and the channel state is idle;
step 2, selecting a random backoff value n, calculating the backoff time length according to the random backoff value, and starting a random backoff timer;
step 3, judging whether the random backoff timer is overtime, if so, acquiring a channel lock, then immediately acquiring a read-write lock, if successfully acquiring, starting to transmit data, if not, suspending the random backoff 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 acquired; if the random back-off timer is not overtime, entering step 4;
step 4, judging whether the NAV timer is overtime and 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 is overtime and the channel state is idle, the random backoff value is decreased progressively, and the random backoff timer is updated according to the new random backoff value; meanwhile, step 3 is repeatedly performed every other unit slot.
Furthermore, a Linux named semaphore is used as a channel lock for protecting the current channel from being forced to break into by other network elements;
and the other Linux naming semaphore is used as a read-write lock for protecting the shared memory from being written in by other network elements simultaneously or being read in the process of writing.
The invention achieves the following beneficial effects:
the invention discloses a protocol stack simulation method of a Wi-Fi distributed coordination function DCF, wherein the DCF is a method for randomly accessing a Wi-Fi channel. In the present invention, 1) simulation of a Basic mode (i.e., basic mode) of the DCF, 2) simulation of a request-to-send/clear-to-send mode (i.e., RTS/CTS mode) are implemented, respectively. The invention simulates channel competition through software mode based on shared memory and semaphore. The method utilizes the inter-process shared memory of the Linux platform as the data bearer of the wireless channel, converts the data transmission process on the channel into the writing operation of the shared memory, converts the data receiving process on the channel into the reading operation of the shared memory, and further simulates the DCF channel preemption and data transmission process between network elements.
The invention provides a method for simulating preemption, timing and transmission of a Wi-Fi wireless channel by only 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 tracing and is convenient for quickly constructing a software prototype for the software development of a protocol layer and an application layer of Wi-Fi. The progress contradiction that software can start debugging only after chip prototype design and test are completed, which appears in the early stage of Wi-Fi chip product research and development engineering, can be effectively solved, and the debugging and optimizing work of the software can be greatly carried out in advance, so that the aim of shortening the research and development period of the chip product is finally achieved.
By adopting the method of the invention, the software operation environment and the chip hardware can be effectively decoupled, and the purchase quantity of the hardware simulation platform is reduced to a certain extent, thereby realizing the purpose of saving the chip research and development cost.
The method simulates channel competition through software mode locking, and simultaneously realizes data transmission on a wireless channel by using a shared memory, thereby relatively truly and accurately simulating the DCF channel preemption and data transmission process between network elements.
Drawings
Fig. 1 is a schematic diagram of proper channel preemption according to NAV;
fig. 2 is a flow chart of a DCF preemption process;
FIG. 3 is a schematic diagram of state transition of each node triggered by a random event occurring on a time axis;
figure 4 is a schematic diagram of the transition between network element states participating in channel contention;
FIG. 5 is a schematic diagram of a transition of a change in a wireless channel;
FIG. 6 is a diagram illustrating channel preemption for a Basic mode scenario;
FIG. 7 is a detailed flowchart of the method in the Basic mode scenario;
fig. 8 is a diagram of RTS/CTS mode scenario 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 illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
The method simulates channel competition through software mode locking, and simultaneously realizes data transmission on a wireless channel by using a shared memory, thereby relatively truly and accurately simulating the DCF channel preemption and data transmission process between network elements. In connection with fig. 2, the dcf preemption process 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 decreased 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 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 state of step 1 is "NAV timer timeout", the following step 3 is entered.
And 3, selecting a random backoff value n, calculating the backoff time length according to the random backoff value, and starting a random backoff timer.
And 4, judging whether the random backoff timer is overtime, acquiring a channel lock if the random backoff timer is overtime, immediately acquiring a read-write lock, starting to transmit data if the acquisition is successful, suspending the random backoff timer if the acquisition of the channel lock is failed, acquiring the read-write lock, acquiring currently transmitted frame data, updating the 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 acquired; if the random back-off timer is not over time, go to step 5.
And 5, judging the overtime state and the channel state of the NAV timer. If the NAV timer is overtime and the channel is idle, the random back-off value is decreased by taking the length of one unit time slot as the amplitude, and the random back-off timer is updated according to the new random back-off value, and the step 4 is returned. If the NAV timer is not over time or the channel is busy, the procedure returns to step 1.
In step 3, the random backoff value n is an integer randomly selected between the minimum value and the maximum value of the contention window defined in 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 times out and the determination of the channel state in step 1 and step 2 may be performed in parallel, with the two determination steps being interchanged in sequence or not, and the next step is still performed when the channel is idle and the NAV timer times out.
Based on the basic process of the DCF channel preemption, the method of the invention mainly relates to three main logic relations:
1. the inter-process shared memory based on the Linux platform is used as a data carrying means of a wireless channel, a data transmission behavior on the channel (i.e., "transmission" in step 4 of the DCF preemption process) is converted into a write operation for the shared memory, and a data receiving behavior on the channel is converted into a read operation for the shared memory. The shared memory adopts the structure as shown in the table 1:
table 1 data structure in shared memory
Figure SMS_1
2. A Linux named semaphore is used as a channel lock to protect the current channel from being forced into by other network elements, thereby simulating CCA behavior.
3. And a Linux naming semaphore is used as a read-write lock for protecting the shared memory from being written in by other network elements simultaneously or being read in the process of writing.
By utilizing the three main logic relations, the method adopts a Finite State Machine (FSM) to trigger the State transition of each node according to random events occurring on a time axis, thereby realizing the simulation of the DCF random competition mechanism of the Wi-Fi channel.
As shown in fig. 3 and 4, network elements participating in channel competition are abstracted into one node, and changes (such as data transmission, waiting for receiving ACK, and periodic data reception) generated by random events occurring in the process of time of each node are abstracted into transitions among four states of IDLE, backoff, SEND, and RECEIVE. The migration process of the state machine is illustrated in table 2 below:
table 2 network element state migration description
Figure SMS_2
As shown in fig. 5, the changes of the wireless channel itself over time and the random events (such as data transmission) are abstracted into two states, IDLE2 and BUSY. The network element state transition specification is shown in table 3 below.
Table 3 channel state transition description
Figure SMS_3
By utilizing the simulation method for triggering the finite-state machine migration by random events based on the time variation, the DCF random competition mechanism of the wireless channel can be highly restored. The DCF random competition mechanism mainly has two scenes, namely a Basic mode scene and an RTS/CTS mode scene.
1) Basic mode scenarios
Suppose that 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) at the same time, and finally, the 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. In fig. 7, all the processes of reading frames omit the process of "acquiring a read/write lock → reading a shared memory → releasing a read/write lock".
In a Basic mode scene, when a network element 1 and a network element 2 compete for a wireless channel and send data to a network element 3 at the same time, and finally when the network element 2 competes successfully, a finite state machine is adopted to trigger the state transition 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 duration of the corresponding random back-off timer to be a first set value (the duration is 7 in this embodiment), the network element 2 sets the duration of the corresponding random back-off timer to be a second set value (the duration is 4 in this embodiment), and 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, acquiring a read-write lock, writing a data frame into a shared memory, wherein the target address is the network element 3, and then releasing the read-write lock; meanwhile, the network element 1 acquires a read-write lock after a unit time slot, finds that a channel lock is occupied and data exists in a shared memory, suspends a random backoff 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 a NAV timer; meanwhile, the network element 3 acquires the read-write lock after one unit time slot, and releases the read-write lock after reading the data frame in the shared memory;
the network element III analyzes the read data frame, finds that the destination address is self, and after waiting for a short frame interval, the network element 3 obtains a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock when 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. Resolving the ACK frame in the shared memory to find that the destination address is not self, resolving the duration field, and updating the NAV timer; meanwhile, the network element 2 acquires the read-write lock after a unit interval, reads the ACK frame in the shared memory, and releases the read-write lock. And resolving the ACK frame in the shared memory to find that the destination address is the address of the ACK frame. And releasing the channel lock if no other data needs to be sent.
And recovering the random backoff timer corresponding to the network element 1 after waiting for the DIFS time slot to be full again until the NAV timer of the network element 1 is overtime.
To clearly illustrate the steps in fig. 7, the state transition process of each network element, shared memory, channel lock, and read/write lock in each step according to the time sequence is specifically illustrated in table 4 below, where each network element performs the actions of acquiring the read/write lock, reading frame data, and releasing the read/write lock every other unit time slot, and the specific meaning of the corresponding network element state transition number is described in detail in table 2, the specific meaning of the channel state transition number is described in table 3, and is not described in detail in table 4.
TABLE 4 Basic mode scene Process State Specification
Figure SMS_4
2) RTS/CTS mode scenarios
Suppose that 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) at the same time, and finally, the network element 2 competes successfully, as shown in fig. 8.
For the RTS/CTS mode scenario, the specific implementation steps of the method will be described in detail with reference to fig. 9. In fig. 9, all the processes of reading frames omit the process of "acquiring read/write lock → reading shared memory → releasing read/write lock".
In an RTS/CTS mode scene, when a network element 1 and a network element 2 compete for a wireless channel at the same time and send data to a network element 3, and finally when the network element 2 competes successfully, a finite state machine is adopted to trigger the state transition 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 time length of the corresponding random backoff timer to be a first set value (in this embodiment, the time length is set to 7), the network element 2 sets the time length of the corresponding random backoff timer to be a second set value (in this embodiment, the time length is set to 4), and the first set value is greater than the second set value;
when the random backoff timer of the network element 2 times out, acquiring a channel lock state, if the channel lock is idle, occupying the channel lock, acquiring a read-write lock, writing RTS frame data into a shared memory, wherein the target address is the network element 3, and then releasing the read-write lock; meanwhile, the network element 1 acquires the read-write lock after a unit time slot, finds that the channel lock is occupied and data exists in the shared memory, and suspends the random back-off timer; meanwhile, the network element 3 acquires the read-write lock after one unit time slot, reads the RTS frame data in the shared memory, and releases the read-write lock. And analyzing RTS frame data in the shared memory, and finding that the destination address is the RTS frame data.
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 the self-analysis duration field, 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, wherein the destination address is the network element 2; meanwhile, the network element 1 waits for one unit time slot and then acquires the read-write lock, reads CTS frame data in the shared memory and releases the read-write lock. Analyzing CTS frame data in the shared memory, analyzing the duration field and updating a NAV timer, wherein the destination address is not self; meanwhile, the network element 2 acquires the read-write lock after one unit time slot, reads CTS frame data in the shared memory, and releases the read-write lock. Analyzing 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, wherein the destination address is the network element 3; meanwhile, the network element 1 waits for a unit time slot and then acquires 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, if the destination address is not self, analyzing the duration field, and updating the NAV timer; meanwhile, the network element 3 acquires the read-write lock after 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, wherein 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 an ACK frame in the shared memory, and releases the read-write lock. Analyzing the ACK frame in the shared memory, if the destination address is not self, analyzing the duration field, and updating the NAV timer; meanwhile, the network element 2 acquires the read-write lock after one 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 backoff timer corresponding to the network element 1 after waiting for the DIFS time slot to be full again until the NAV timer of the network element 1 is overtime.
To clearly illustrate the steps in fig. 9, the state transition process of each network element, shared memory, channel lock, and read/write lock in each step according to the time sequence is specifically illustrated in table 5 below, where each network element performs the actions of acquiring the read/write lock, reading frame data, and releasing the read/write lock every other unit time slot, and the specific meaning of the corresponding network element state transition number is described in detail in table 2, the specific meaning of the channel state transition number is described in table 3, and is not described in detail in table 5.
The following table 5 is specifically described in chronological order for the above steps.
TABLE 5RTS/CTS mode scene Process State Specification
Figure SMS_5
Compared with the realization scheme of the traditional simulator, the invention has the innovative characteristic of utilizing the mode of sharing the memory and the semaphore. The traditional simulator generally adopts a random trigger mechanism and a state machine to construct a discrete event simulator, so the realization mechanism and the realization scheme of the invention are completely different from the traditional simulator.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A protocol stack simulation method of a Wi-Fi distributed coordination function DCF is characterized in that a channel is simulated through software mode locking, an interprocess shared memory based on a Linux platform is used as data load of a wireless channel, a data transmission process on the channel is converted into writing operation on the shared memory, a data receiving process on the channel is converted into reading operation on the shared memory, a DCF channel preemption and data transmission process between network elements is simulated, and simulation of a DCF basic mode and a request sending/permission sending mode is achieved.
2. The method as claimed in claim 1, wherein a finite state machine is used to trigger state transition of each node according to a random event occurring on a time axis, so as to realize simulation of a Wi-Fi wireless channel DCF random contention mechanism.
3. The method as claimed in claim 2, wherein during simulation, the network elements participating in the Wi-Fi wireless channel competition are abstracted into one node, and changes of each node over time and generated by random events are abstracted into transitions among four states, IDLE, backoff, SEND, and RECEIVE.
4. The method according to claim 3, wherein the migration correspondence between the four states includes the following seven network element state transitions:
11 Network element state migration 1, corresponding state IDLE migration to backkoff: the channel lock is idle, the read-write lock is idle, random backoff is started, data to be transmitted is to be transmitted, and the network element in the channel space state has data to transmit;
12 Network element state migration 2, corresponding state Backoff migrating to IDLE: the channel lock is busy, the random backoff is not started, and data to be sent is to be sent, which indicates that the channel is occupied by other network elements;
13 Network element state migration 3, corresponding state backkoff to SEND migration: the channel lock is changed from idle to occupied, the read-write lock is changed from idle to occupied, the random backoff is not started, data to be sent represents that the random backoff timer is overtime and the channel is idle, and data transmission is started;
14 Network element state migration 4, corresponding state IDLE migrates to RECEIVE: the read-write lock is changed from idle to occupied, random backoff is not started, no data to be sent exists, and the receiver is indicated to receive the data;
15 Network element state migration 5, the corresponding state RECEIVE migrates to IDLE: when the ACK frame is received, the channel lock is changed from occupied to idle, the read-write lock is changed from occupied to idle, random backoff is not started, no data to be sent exists, the fact that the data are received completely is shown, the destination address of the received frame is not the current network element or the received ACK frame is received, and response does not need to be sent immediately;
16 Network element state transition 6, corresponding state RECEIVE to SEND: the read-write lock is changed from occupied to idle and then changed into occupied, random backoff is not started, data to be sent indicates that the destination address of the received frame is the current network element, and response data needs to be transmitted immediately after the data is received;
17 Network element state migration 7, the corresponding state SEND migrates to IDLE: and if the random back-off is not started, the read-write lock is changed from occupied to idle, which indicates that the current data is sent completely and no other data to be sent exists.
5. The method as claimed in claim 2 or 4, wherein the change of Wi-Fi wireless channel over time and the random event is abstracted to IDLE and BUSY states during simulation.
6. The method of claim 5, wherein the transition correspondence between the two states comprises transition between the following two channel states:
21 Channel state transition 1, corresponding state BUSY to IDLE: channel lock occupation, which means that a network element occupies a channel to prepare for sending frame data;
22 Channel state transition 2, corresponding state IDLE to BUSY transition: the channel lock is idle, which means the network element releases the channel for the next contention.
7. The protocol stack simulation method of the Wi-Fi distributed coordination function DCF according to claim 1, wherein in a basic mode of the DCF, when a first network element and a second network element compete for a wireless channel and send data to a third network element at the same time, and finally the second network element competes successfully, a finite state machine is used 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 DCF random competition mechanism of the Wi-Fi wireless channel, comprising the following steps:
after waiting for a DIFS time slot, the first network element sets the time length of a corresponding random backoff timer to be a first set value, the second network element sets the time length of the corresponding random backoff timer to be a second set value, and the first set value is greater than the second set value;
when the random backoff timer of the network element two times out, 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 three, and then releasing the read-write lock; meanwhile, once the network element passes a unit time slot, the network element acquires a read-write lock, finds that the channel lock is occupied and data exists in the shared memory, suspends the random backoff timer, simultaneously acquires the read-write lock, 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 a NAV timer; meanwhile, the network element III acquires the read-write lock after one 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, waits for a short frame interval, obtains a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock when the destination address is the second network element; meanwhile, the network element 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 self, analyzing the duration field, and updating a NAV timer; meanwhile, the network element two acquires a read-write lock after one 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 to find that the destination address is the address of the ACK frame; if no other data needs to be sent, releasing the channel lock;
and recovering the random backoff timer corresponding to the network element I after waiting for the DIFS time slot to be full again until the NAV timer of the network element I is overtime.
8. The protocol stack simulation method of the Wi-Fi distributed coordination function DCF according to claim 1, wherein when a transmission/transmission permission mode is requested, when a first network element and a second network element compete for a wireless channel and transmit data to a third network element at the same time, and finally the second network element competes successfully, a finite state machine is used to trigger state transition of each node according to a random event occurring on a time axis, so as to implement a simulation process of a Wi-Fi wireless channel DCF random competition mechanism, comprising the steps of:
after waiting for a DIFS time slot, the first network element sets the time length of the corresponding random backoff timer to be a first set value, the second network element sets the time length of the corresponding random backoff timer to be a second set value, and the first set value is larger than the second set value;
when the random backoff timer of the network element two times out, 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 the target address is the network element three, and then releasing the read-write lock; meanwhile, once the network element passes a unit time slot, the network element acquires a read-write lock, finds that a channel lock is occupied and data exists in a shared memory, and suspends a random back-off timer; meanwhile, the network element III acquires the read-write lock after one unit time slot, reads RTS frame data in the shared memory and releases the read-write lock; analyzing RTS frame data in the shared memory, and finding that the destination address is the RTS frame data per se;
after waiting for a unit time slot, the first network element acquires a read-write lock, reads RTS frame data in a shared memory, and releases the read-write lock; analyzing RTS frame data in the shared memory, analyzing the duration field and 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 acquires a read-write lock after waiting for one unit time slot, reads CTS frame data in the shared memory, and releases the read-write lock; analyzing CTS frame data in the shared memory, analyzing the duration field and updating a NAV timer, wherein the destination address is not self; meanwhile, the network element II acquires the read-write lock after one unit time slot, reads CTS frame data in the shared memory and releases the read-write lock; analyzing CTS frame data in the shared memory, wherein the destination address is self, and releasing a read-write lock;
after waiting for a short frame gap, the network element two acquires a read-write lock, writes a data frame into the shared memory, and releases the read-write lock when the destination address is the network element three; 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, if the destination address is not self, analyzing the duration field, and updating the NAV timer; meanwhile, the network element III acquires a read-write lock after 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, wherein the destination address is self; after waiting for a short frame gap, the network element III acquires a read-write lock, writes an ACK frame into the shared memory, and releases the read-write lock when the destination address is the network element II; 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; resolving the ACK frame in the shared memory, resolving the duration field and updating the NAV timer if the destination address is not self; meanwhile, the network element two acquires a read-write lock after one 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, and if no other data needs to be sent to release the channel lock;
and recovering the random backoff timer corresponding to the network element I after waiting for the DIFS time slot to be full again until the NAV timer of the network element I is overtime.
9. The method for protocol stack emulation of a Wi-Fi distributed coordination function, DCF, according to claim 1, wherein the DCF channel preemption and data transmission process between network elements comprises the steps of:
step 1, after each distributed interframe space, namely DIFS time slot expires, a network element checks whether a network allocation vector timer, namely a NAV timer, is overtime, simulates CCA (clear channel assessment) through channel lock, and then checks the channel state by using the channel lock;
when the NAV timer is not in an overtime state, the NAV timer is gradually decreased by taking the length of one unit time slot as the amplitude according to the timing time, and whether the NAV timer is overtime is checked again after waiting for one unit time slot;
when the channel state is busy, the channel state is checked again after waiting for one unit time slot;
executing the next step only when the NAV timer is overtime and the channel state is idle;
step 2, selecting a random backoff value n, calculating the backoff time length according to the random backoff value, and starting a random backoff timer;
step 3, judging whether the random backoff timer is overtime, if so, acquiring a channel lock, then immediately acquiring a read-write lock, if successfully acquiring, starting to transmit data, if not, suspending the random backoff 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 acquired; if the random back-off timer is not overtime, entering step 4;
step 4, judging whether the NAV timer is overtime and 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 backoff value is decreased by taking the length of one unit time slot as the amplitude, and the random backoff timer is updated according to the new random backoff value; meanwhile, step 3 is repeatedly performed every other unit slot.
10. The protocol stack simulation method of the Wi-Fi distributed coordination function DCF according to claim 1, wherein a Linux named semaphore is used as a channel lock to protect a current channel from being forced into by other network elements;
and the other Linux naming semaphore is used as a read-write lock for protecting the shared memory from being written in by other network elements simultaneously or being read in the process of writing.
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 true CN115835268A (en) 2023-03-21
CN115835268B 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)

Citations (4)

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

Patent Citations (4)

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

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
王文鼐: "Sub-1G 受限接入窗的离散事件网络仿真设计" *
陈睿等: "基于变量访问序模式的中断数据竞争检测方法" *

Also Published As

Publication number Publication date
CN115835268B (en) 2023-05-09

Similar Documents

Publication Publication Date Title
CN111200837B (en) Wi-Fi software testing system and method
CN109921915B (en) Method and device for testing wake-up function of real-time clock module and electronic equipment
CN111352778B (en) Network simulation processing method and device, electronic equipment and storage medium
CN113377596A (en) Method for storing and reading waveform data and related device
CN115685785A (en) Universal bus model and simulation test method
WO2004092928A2 (en) System and method for real time simulation
CN116627877A (en) On-chip bus state recording system and method
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
WO2021027801A1 (en) Application program generation method and apparatus, and cloud server and readable storage medium
CN105142159A (en) Test system for L2 (Layer 2) in LTE (Long Term Evolution) base station
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
CN109960646B (en) Application testing method and terminal
CN112654075A (en) Method and system for rapidly connecting AP (access point) by WLAN (wireless local area network) cold start
CN116233907B (en) AP performance detection method and detection system based on simulation multi-concurrent STA
CN117131821B (en) Chip verification method, device, electronic equipment and storage medium
Ma et al. Probability of coexistence of LTE-LAA and WLAN systems based on delay constraints
CN117528602A (en) Protocol stack simulation method of Wi-Fi centralized coordination function PCF
Nguyen et al. Integration of Atheros ath5k device driver in wireless ad-hoc router
CN113572652B (en) Wired Mesh network testing method
JP2003177937A (en) Apparatus and method for improvement of communication between emulator unit and host device
BELLOTTI et al. An interactive VHDL simulator for IEEE 802.11 networks
JP2926561B1 (en) Software testing method
CN116321253A (en) Ad hoc network simulation test method and device, terminal equipment and readable storage medium

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