Background technology
RFID (Radio Frequency Identification) technology is the emerging technology that promotes present information service development, it has a large capacity and a wide range, it is the technology that new growth engines and tool are changed power, can be widely used in fields such as production, logistics, traffic, manufacturing, medical treatment, public information service, can significantly improve management and operational paradigm, reduce cost, promote modern service industry, new high-tech industry and advanced manufacturing industry fusion development.
When carrying out the rfid system design, no matter be design read write line or label card, all needing has thorough assurance to whole protocol interaction flow process.In order to hold the correctness of design, except by related consensus standard is carried out deep and careful studying carefully, can also use the method for modeling and simulating, come more clearly to reproduce the communication process of " order-response " of consensus standard defined.
Yet, at present generally when carrying out the research and development of rfid system exploitation or RFID chip, be mostly earlier to carry out software emulation at the difference in functionality module again, as software emulation checking at anti-collision algorithms to totally carrying out function modoularization; Again each module and total system are carried out hardware design and testing authentication.Such design process has two aspect deficiencies, and the one, do not carry out low-cost and total system software emulation checking fast, the 2nd, the hardware simulation proving period of total system is oversize, can't carry out simple and effective software verification in early stage.Based on above problem, be badly in need of a kind of novel rfid system software emulation checking of invention modeling method, realize assessment checking in early stage fast and effectively to the RFID total system.
Summary of the invention
The problem that exists when the objective of the invention is at the above rfid system exploitation or the research and development of RFID chip, providing needs a kind of mapping, modeling and simulating method of radio frequency identification system of realizing the assessment checking in early stage fast and effectively of RFID total system based on server/customer end model and multithreading of invention.
The present invention is achieved in that mapping, modeling and simulating method of radio frequency identification system, with read write line as server end, label card is set up server/customer end (Server/Client) model as client, sets up being connected of Transmission Control Protocol between server end and the client;
Server end is opened a sub-thread of management, the work of Treatment Analysis order, initialization command; And open one again for each client that has connected and manage sub-thread accordingly, realize the transmission of read write line order and the reception that label card is responded;
Client is carried out analysis order, data processing repeatedly, the circulation of three steps responding, and until obtaining end signal, promptly the label card in the reality leaves the electromagnetic field effective coverage.Native system promptly is to simulate the information transmission of being undertaken by the electromagnetism place between read write line and label card with this.
Described server end mainly is the work of being simulated whole read write line end by read write line management thread and label card management thread.The method of synchronization that activates by incident between read write line management thread and label card management thread communicates, thereby realizes the synchronized broadcast of order, and the synchronous acquisition of response is handled.
Described at server end, defined the global variable s_send[10 of two unsigned char array types] and s_recv[20] [10], s_send[10] the service device waits the command frame sent out, shares for all sub-threads that connected, realizes the transmission of " order "; S_recv[20] response frame of the connexon thread of controlling oneself that receives of [10] service device, and distinguish different clients with the one dimension subscript of two-dimensional array.This structure helps server and carries out anti-collision round-robin data processing.
In order on same PC, to carry out rfid system emulation, can make client when foundation is connected with the TCP of server, consistent with the IP of server binding this machine IP is called out.
The present invention mainly adopts the mapping, modeling of realizing rfid system based on the mode of Server/Client network architecture model and system's multithreading application technology.Can simulate single read write line and many situations that label card is mutual based on Server/Client network architecture model, server is suitable read write line, client promptly is equivalent to label card, tangible network promptly is equivalent to invisible read write line magnetic field, carry out each other coordination by multithreading, thereby realize the function of simulation, can realize assessment checking in early stage fast and effectively the RFID total system.
Embodiment
Below in conjunction with accompanying drawing mapping, modeling and simulating method of radio frequency identification system of the present invention is further set forth.
Mapping, modeling and simulating method of radio frequency identification system, as server end, label card is set up as shown in Figure 1 server/customer end (Server/Client) model as client with read write line, sets up being connected of Transmission Control Protocol between server end and the client; Server end is opened a sub-thread of management, the work of Treatment Analysis order, initialization command; And open one again for each client that has connected and manage sub-thread accordingly, realize the transmission of read write line order and the reception that label card is responded; Client is carried out analysis order, data processing repeatedly, the circulation of three steps responding, and until obtaining end signal, promptly the label card in the reality leaves the electromagnetic field effective coverage.Native system promptly is to simulate the information transmission of being undertaken by the electromagnetism place between read write line and label card with this.
Typical R FID system for example can be that single read write line is corresponding to many label cards, and by read write line broadcasting command or data, responded respectively or the pattern of data feedback by label card.So when carrying out system modelling emulation, the crucial independence that just is how to embody a plurality of main bodys such as read write line and many label cards more is how to embody the process of carrying out command response and data interaction between read write line and label card.
In order to simulate single read write line, many situations that label card is mutual, the present invention has utilized the server/customer end in the network technology (Server/Client) model.The server/customer end model is to be used for realizing on the main frame of many different spatial multiple functions such as resource sharing, resource management and unified control in network application.Its transmission medium is the network that is made of electric wire optical fiber.When a station server and a plurality of client were carried out data interaction, the single read write line in the quite similar rfid system and many label cards carried out mutual situation.Server is suitable read write line, and client promptly is equivalent to label card, and tangible network promptly is equivalent to invisible read write line magnetic field.Certainly, we can allow same PC play the part of the role of server and client simultaneously when emulation, carry out each other coordination by multithreading, thereby realize the function of simulation.
The native system platform is at first set up being connected of Transmission Control Protocol between server and client when specific implementation.For server end, can open a sub-thread of management, the work of Treatment Analysis order, initialization command; And open one again for each client that has connected and manage sub-thread accordingly, realize the transmission of read write line order and the reception that label card is responded.For client then is to carry out analysis order, data processing repeatedly, the circulation of three steps responding, and until obtaining end signal, promptly the label card in the reality leaves the electromagnetic field effective coverage.Native system promptly is to simulate the information transmission of being undertaken by the electromagnetism place between read write line and label card with this.
Server end mainly is the work of being simulated whole read write line end by read write line management thread and label card management thread.Cross-thread communicates by the method for synchronization that incident activates, thereby realizes the synchronized broadcast of order, and the synchronous acquisition of response is handled.
In order on same PC, to carry out rfid system emulation, can make client when foundation is connected with the TCP of server, consistent with the IP of server binding this machine IP is called out.
When simulation command frame and response frame, native system adopts the variable of unsigned char type to represent a byte, and constitutes a frame structure with the array of unsigned char type.
In addition, on simulation synchronism problem, the native system platform solves by the simultaneous techniques of thread.Here adopted the processing mode of critical section to guarantee of the read and write of each thread to global variable; When having adopted the thread synchronization mode of event object (Event) to guarantee that thread is advanced simultaneously synchronously, thereby the synchronism when realizing that rfid system sends order and receives response.
Mapping, modeling and simulating method of radio frequency identification system of the present invention is as follows in concrete enforcement, mainly comprises the design and the client design of server end.
(1) server end design
At server end, defined the global variable s_send[10 of two unsigned char array types] and s_recv[20] [10], s_send[10] the service device waits the command frame sent out, shares for all sub-threads that connected, realizes the transmission of " order "; S_recv[20] response frame of the next own connexon thread that receives of [10] service device, and distinguish different clients with the one dimension subscript of two-dimensional array.This structure helps server and carries out anti-collision round-robin data processing.
At first, carry out data processing, comprise and analyze current response condition, finish the order to be sent of next bar, carry out work such as state exchange by the read write line management thread.Then the read write line management thread can activate incident hEvent_s, is equivalent to send an indicator signal, and the indication next command has initially been finished and has been ready for sending.The read write line management thread will enter the stage of waiting for label card management thread indicator signal automatically then, wait for that all label cards finish the synchronization point of response.
And in the label card management thread, be to be blocked in the state of waiting for indicator signal at the beginning, when obtaining the indication that initially finishes from the order that the read write line management thread is sent, promptly begun to the reading and sending process of command frame with to the reception and the ablation process of response frame.Activate incident hEvent_c[num after finishing again], the label card response of the current num of being numbered of indication finishes.
Therefore, mainly be the work of simulating whole read write line end by read write line management thread and label card management thread at server end.Cross-thread communicates by the method for synchronization that incident activates, thereby realizes the synchronized broadcast of order, and the synchronous acquisition of response is handled.This point is of crucial importance in the rfid system of reality.
On the basis of server-side system platform, can realize the read write line function of compatible different agreement by the data processing function in the read write line management thread is carried out concrete description.
Server end specific procedure flow process as shown in Figure 2.
(2) client design
Defined the global variable reply[10 of a unsigned char array type in client], be used to store current response frame to be sent, make data handling procedure seem clear and convenience.
In order on same PC, to carry out rfid system emulation, can make client when foundation is connected with the TCP of server, consistent with the IP of server binding this machine IP is called out.
The modeling of client is simple relatively, and main platform feature can realize by a circulation.At first be that the order that receives from server end is waited on obstructive ground, then carry out order analysis and data processing, frame and sending meets with a response; Carry out at last the judgement of done state again,, then quit work automatically as leaving read write line electromagnetic field inducing scope as if label card in the reality.
Client end specific procedure flow process as shown in Figure 3.
If will develop on this system platform, it is specific only to need that then order analysis in the circulation and data processing link are carried out suitable function performance, can realize the compatibility to different rfid systems.