CN113746827A - Real-time data link byte stream error-proofing method based on multi-band turing machine - Google Patents

Real-time data link byte stream error-proofing method based on multi-band turing machine Download PDF

Info

Publication number
CN113746827A
CN113746827A CN202111013281.0A CN202111013281A CN113746827A CN 113746827 A CN113746827 A CN 113746827A CN 202111013281 A CN202111013281 A CN 202111013281A CN 113746827 A CN113746827 A CN 113746827A
Authority
CN
China
Prior art keywords
data
length
band
controller
stack
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
CN202111013281.0A
Other languages
Chinese (zh)
Other versions
CN113746827B (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.)
China Academy of Railway Sciences Corp Ltd CARS
Signal and Communication Research Institute of CARS
Beijing Ruichi Guotie Intelligent Transport Systems Engineering Technology Co Ltd
Beijing Huatie Information Technology Co Ltd
Original Assignee
China Academy of Railway Sciences Corp Ltd CARS
Signal and Communication Research Institute of CARS
Beijing Ruichi Guotie Intelligent Transport Systems Engineering Technology Co Ltd
Beijing Huatie Information Technology 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 China Academy of Railway Sciences Corp Ltd CARS, Signal and Communication Research Institute of CARS, Beijing Ruichi Guotie Intelligent Transport Systems Engineering Technology Co Ltd, Beijing Huatie Information Technology Co Ltd filed Critical China Academy of Railway Sciences Corp Ltd CARS
Priority to CN202111013281.0A priority Critical patent/CN113746827B/en
Publication of CN113746827A publication Critical patent/CN113746827A/en
Application granted granted Critical
Publication of CN113746827B publication Critical patent/CN113746827B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/18Protocol analysers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/03Protocol definition or specification 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/322Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions
    • H04L69/329Intralayer communication protocols among peer entities or protocol data unit [PDU] definitions in the application layer [OSI layer 7]

Abstract

The invention discloses a real-time data link byte stream error-proofing method based on a multi-band turing machine, the whole scheme not only has the traditional communication buffer data reading and writing functions, but also can detect invalid byte stream from the receiving end and make failure-operable guidance, thereby avoiding the interference of illegal data, abnormal data and length error data to the data exchange of application layers and protecting the program.

Description

Real-time data link byte stream error-proofing method based on multi-band turing machine
Technical Field
The invention relates to the technical field of communication, in particular to a real-time data link byte stream error prevention method based on a multi-band turing machine.
Background
The TCP/IP protocol is a networking format commonly used between computers, and includes a link layer, a network layer, a transport layer and an application layer. The four layers correspond to hardware devices, data frame routing, packet grouping, communication details of applications, and control functions in the computer network, respectively. On computers of different models and different operating systems, an application program uses a TCP/IP protocol to establish a reliable real-time data link in a transmission layer, and then completes data exchange through byte streams, thereby realizing service requests and responses in a computer network. The specific content and read-write method of the byte stream are specified by the specific scenario or communication protocol of the TCP/IP application layer.
The existing TCP/IP application layer byte stream data exchange method can be summarized as two flows of reading and writing as shown in fig. 1. The reading process firstly stores the byte stream transmitted by the data link into the communication cache of the program, and then processes effective data according to an application layer communication protocol; the writing process converts the effective data into byte streams according to an application layer communication protocol, and then writes the byte streams into a communication cache to be transmitted by a data link.
According to the protocol, all valid data occupy a fixed byte length in the communication buffer and have a unique data number. The application layer communication protocol also specifies the ordering of different types of valid data in the communication cache, so that the TCP/IP application program can control the read-write behavior of the network data according to a fixed sequence and an information format.
The effective data types and read-write modes in the communication cache can be summarized as table 1, and table 1 is a specific method for controlling the communication cache by a TCP/IP application program, and a software developer usually directly encodes and writes a program according to the specification of an application layer protocol.
Figure BDA0003239585200000011
TABLE 1 description of the read/write modes of different types of data
The TCP/IP protocol is a transport layer service oriented towards data links, and the reading and writing of the byte stream in the communication cache is controlled by the application layer. In the prior art, when the computer network connection is unstable or the communication software fails, an invalid byte stream will appear in the communication cache. Because a TCP/IP application program designed in the prior art cannot perform data validity determination and error-proofing process while reading and writing a byte stream, an invalid byte stream may generate severe interference on data exchange of an application layer, resulting in an unexpected behavior of the application program and even a breakdown.
Disclosure of Invention
The invention aims to provide a real-time data link byte stream error-proofing method based on a multi-band turing machine, which can detect invalid byte streams and conduct failure-operable guidance from the perspective of a receiving end.
The purpose of the invention is realized by the following technical scheme:
a real-time data link byte stream error-proofing method based on a multi-band turing machine comprises the following steps:
constructing a multi-band smart machine, performing read-write operation of communication cache through a state transfer function of the multi-band smart machine, detecting an invalid byte stream in the read-write operation or before the read-write operation, and returning to a read operation initial state or skipping related bytes when the invalid byte stream is detected; the state transition function is divided into five subroutines according to functions: main, Mark, PullSym, ReadLen and ReadRan; wherein:
main subprogram for processing the initial and end states of the reading and writing operation of the multi-band smart machine, and switching to PullSym subprogram after the initial state of the reading and writing operation is processed;
a PullSym subroutine for pulling data symbols from the data symbol stack of the multi-band smart machine during a read operation, and entering a ReadLen subroutine, a ReadRan subroutine, or a Mark subroutine according to a data type identifier, or returning to a Main subroutine; the system is also used for pulling data symbols from the data symbol stack of the multi-band turing machine in the write operation and entering a Mark subprogram;
the Mark subprogram is used for marking data symbols on a communication cache belt according to the data type identification in the reading operation and detecting invalid byte streams through validity judgment, if the valid data passes the validity judgment, the valid data is read into the data symbols of the application program and then returned to the PullSym subprogram, or the data symbols are marked and the data reading is completed and then returned to the Main subprogram, and the terminal state is entered; the communication cache is also used for marking data symbols on the communication cache according to the data type identification in the write operation, obtaining the value of effective data through an operator and returning the value to the PullSym subprogram, or writing corresponding data after marking the data symbols and returning the corresponding data to the PullSym subprogram;
the ReadLen subprogram is a reading program of word length data, protocol marks and length data, after the word length data, the protocol marks or the length data are marked, invalid byte streams are detected through validity judgment, if the validity judgment is passed, valid data are read into a data symbol of an application program, and then the valid data are returned to the PullSym subprogram;
the ReadRan subprogram is a reading program of the cyclic data, after the marking of the cyclic data is completed, the invalid byte stream is detected through validity judgment, if the invalid byte stream passes the validity judgment, the valid data is read into a data symbol of an application program, and after the cyclic data is read, the PullSym subprogram is returned.
The technical scheme provided by the invention can be seen that the whole scheme not only has the traditional communication cache data reading and writing functions, but also can detect invalid byte streams from the angle of a receiving end and conduct invalidation-operable guidance, thereby avoiding the interference of illegal data, abnormal data and length error data on the data exchange of the application layer and protecting the program.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a schematic diagram of a method for exchanging byte stream data of a TCP/IP application layer according to the background art of the present invention;
fig. 2 is a flowchart of a real-time data link byte stream error protection method based on a multi-band turing machine according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a data group relationship of application layer communication protocol valid data according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a multi-band turing machine model of a communication cache read-write flow according to an embodiment of the present invention;
fig. 5 is a flow chart of state transition of the multi-band turing machine according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
The terms that may be used herein are first described as follows:
the term "and/or" means that either or both can be achieved, for example, X and/or Y means that both cases include "X" or "Y" as well as three cases including "X and Y".
The terms "comprising," "including," "containing," "having," or other similar terms of meaning should be construed as non-exclusive inclusions. For example: including a feature (e.g., material, component, ingredient, carrier, formulation, material, dimension, part, component, mechanism, device, process, procedure, method, reaction condition, processing condition, parameter, algorithm, signal, data, product, or article of manufacture), is to be construed as including not only the particular feature explicitly listed but also other features not explicitly listed as such which are known in the art.
The error-proofing method for the byte stream of the real-time data link based on the multi-band turing machine provided by the invention is described in detail below. Details which are not described in detail in the embodiments of the invention belong to the prior art which is known to the person skilled in the art. Those not specifically mentioned in the examples of the present invention were carried out according to the conventional conditions in the art or conditions suggested by the manufacturer.
As shown in fig. 2, a real-time data link byte stream error-proofing method based on a multi-band turing machine includes the following steps:
1. and constructing a multi-band turing machine.
2. And performing read-write operation of communication buffer memory through the state transfer function of the multi-band smart machine, and detecting invalid byte streams in the read-write operation or before the read-write operation.
3. When an invalid byte stream is detected, a read operation start state is returned or the relevant bytes are skipped.
In the embodiment of the invention, the state transfer function is divided into five subprograms according to functions: main, Mark, PullSym, ReadLen and ReadRan; wherein:
main subprogram for processing the initial and end states of the reading and writing operation of the multi-band smart machine, and switching to PullSym subprogram after the initial state of the reading and writing operation is processed;
a PullSym subroutine for pulling data symbols from the data symbol stack of the multi-band smart machine during a read operation, and entering a ReadLen subroutine, a ReadRan subroutine, or a Mark subroutine according to a data type identifier, or returning to a Main subroutine; the system is also used for pulling data symbols from the data symbol stack of the multi-band turing machine in the write operation and entering a Mark subprogram;
the Mark subprogram is used for marking data symbols on a communication cache belt according to the data type identification in the reading operation and detecting invalid byte streams through validity judgment, if the valid data passes the validity judgment, the valid data is read into the data symbols of the application program and then returned to the PullSym subprogram, or the data symbols are marked and the data reading is completed and then returned to the Main subprogram, and the terminal state is entered; the communication cache is also used for marking data symbols on the communication cache according to the data type identification in the write operation, obtaining the value of effective data through an operator and returning the value to the PullSym subprogram, or writing corresponding data after marking the data symbols and returning the corresponding data to the PullSym subprogram;
the ReadLen subprogram is a reading program of word length data, protocol marks and length data, after the word length data, the protocol marks or the length data are marked, invalid byte streams are detected through validity judgment, if the validity judgment is passed, valid data are read into a data symbol of an application program, and then the valid data are returned to the PullSym subprogram;
the ReadRan subprogram is a reading program of the cyclic data, after the marking of the cyclic data is completed, the invalid byte stream is detected through validity judgment, if the invalid byte stream passes the validity judgment, the valid data is read into a data symbol of an application program, and after the cyclic data is read, the PullSym subprogram is returned.
In an embodiment of the present invention, the invalid byte stream includes: illegal data, abnormal data, and length error data.
Wherein the illegal data comprises: data in the byte stream that is not within the valid range specified by the communication protocol; the exception data includes: data within the byte stream that can cause the operating system to force the application to close; the length error data includes: data with inconsistent data length and actual length recorded by the byte stream;
the illegal data and the abnormal data are detected by validity judgment in the read-write operation (a specific mode will be described later); the length error data is detected before the read-write operation, the execution flow during the detection is consistent with the read operation flow, if the length calculation band B6If the storage content is 0 before the completion of all the flags of the byte stream or if the storage content is not 0 after all the flags of the byte stream are completed, it indicates that the length error data is detected (a specific mode will be described later).
The above-mentioned scheme of the embodiment of the invention not only has the traditional communication cache data reading and writing functions, but also can detect invalid byte streams and make invalidation-operable guidance from the receiving end, thereby avoiding the interference of illegal data, abnormal data and length error data on the data exchange of the application layer and protecting the program.
In order to show the technical scheme and the technical effects provided by the invention more clearly, the invention is described in detail in the following aspects of communication cache read-write flow analysis, a mathematical model of the communication cache read-write flow and a principle.
Firstly, communication cache read-write flow analysis.
At present, the valid data defined by the application layer communication protocol is generally divided into different data groups according to type codes, the data groups are ordered sequences formed by a plurality of valid data, and the ordering is based on data numbers specified by the application layer communication protocol. The relationship between different data sets can be represented as a tree structure as shown in fig. 3, which is called a protocol tree.
The position of each data group in the tree in fig. 3 may be determined by a sequence of type codes, and the data numbers in all groups in a single path satisfy the sequential relationship. The data group at the root node typically contains a byte stream length field. Valid data read from and written to the communication cache may be abstractly expressed as data symbols operable within the application. The data symbols can store data and automatically record the storage time, the effective data type is specified by a communication protocol, and attribute information can be acquired through operators. Table 2 is a description of the operators and functions of the data symbols, which are available in the byte stream algorithm because the data symbols can be directly manipulated by the application.
Figure BDA0003239585200000061
TABLE 2 data symbol function and operator description
And secondly, a mathematical model of a communication cache read-write process.
The communication cache read-write flow of the application program provided by the embodiment of the invention is shown in table 3.
Figure BDA0003239585200000062
Table 3 communication buffer read-write flow of application program
In the reading and writing processes, the loading, emptying and data copying of the communication cache are easy to realize in an application program, and how to mark the communication cache as a data symbol under the known conditions is a difficult point of a byte stream error-proofing algorithm. The mathematical model of the communication cache read-write flow can be formally expressed as a multi-band turing machine M meeting specific specifications, as shown in fig. 4, which mainly comprises: the device comprises a controller, a data symbol stack, a data buffer stack, a protocol position stack, a word length buffer zone, a loop calculation zone and a length calculation zone. The multi-band smart phone marks the communication buffer as a data symbol through a state transfer function.
1) The controller is used for storing state variables of the state transfer functions of the multi-band turing machine and controlling the conversion among the subprograms, and each subprogram outputs the corresponding state variable and the corresponding input variable after executing each process; wherein the state variables include: the system comprises a main state, a data type identifier, a data symbol stack state, a data buffer stack state and a protocol position stack state (the last four are extension states), wherein the main state comprises a ready state, a reading state and a writing state of the multi-band turing machine; the input variables include: the controller is currently pointing to the communication buffer zone position, the word size buffer zone value and the loop calculation zone value.
2) Character length buffer belt B2And a loop calculation band B4And length calculating band B6For temporarily storing local variables used in the read and write processes, each bin within a band represents a single byte of storage space. The content specifically contained by the local variables can be summarized as
Table 4.
Figure BDA0003239585200000071
TABLE 4 local variables used in the read-write procedure
3) Data symbol stack E1Each cell of (a) represents a single data symbol, a data structure for storing valid data inside the application, a data buffer stack E3And protocol location stack E5For temporarily storing a byte stream, each cell represents a single byte.
In addition, communication buffer zone B in fig. 40Corresponding to the communication cache, each bin represents a single byte in the cache.
In the embodiment of the invention, the multi-band smart machine is defined by using a seven-tuple form and is expressed as follows:
M=(Q,Σ,Γ,δ,Q0,C,F)
wherein:
m represents a multi-band turing machine.
Q is a set of multi-band turing machine states
Figure BDA0003239585200000072
Is an ordered pair of five state components. q. q.s0、q1、q2Sequentially represents ready state, read state, write state, t0、t1
Figure BDA0003239585200000081
t3、t4、t5、tBIs data type identification respectively representing ready, fixed length data, word length data, variable length data, cycle data, protocol mark, length data and null data, the last three components respectively corresponding to data symbol stack E1Data buffer stack E3And protocol location stack E5I, e, epsilon are the state labels of the linear stack, respectively representing stack-in, stack-out and no-operation, considering that if the state labels of the linear stack are distinguished by the angle labels, the state function will not completely express the states of the plurality of linear stacks, and therefore, the text brackets [,,,,, etc.)]The different linear stack states in (A) are distinguished by the difference of filling positions, i.e. corresponding to the data symbol stack E in turn1Data buffer stack E3And protocol location stack E5
Sigma is a finite set of input data symbols
Figure BDA0003239585200000082
Is an ordered pair of four input variables; beta is aBIndicating a blank symbol in a communication buffer zone B0The upper part shows that the grid is not loaded with the byte stream, and the communication buffer after the byte stream is loaded is signed by beta0Represents; character length buffer belt B2And a loop calculation band B4And length calculating band B6All the bytes can be equivalently converted into integers, and the input contents of the three are respectively recorded as
Figure BDA0003239585200000083
References to content are all non-negative integers.
Γ is a signed complete set
Figure BDA0003239585200000084
Alpha represents a data symbol and represents that the byte on the communication cache band forms a matching relation with effective data stored in the application program; beta is aBIn the word length buffer zone B2And a loop calculation band B4And length calculating band B6Upper indicates the initialization state.
And delta is a state transfer function of the multi-band turing machine and is used for defining the normal state of reading and writing of the communication cache.
Q0Is the initial state set of the multi-band turing machine { ([ q ]0,t0,ε,ε,ε],βBBBB),([q0,t0,i,ε,ε],βBBBB) And (c) both represent the states of the turing machine before the communication buffer starts data reading and writing, respectively, the initial state being automatically set by the application, similar to the state of the linear stack, the bracket ([ 2 ]]The states of each cache band and the computation band in (v) are distinguished by the difference of the filling positions of the symbols, and the beta of the four positionsBSequentially corresponding to communication buffer zone B0Word length buffer belt B2And a loop calculation band B4And length calculating band B6Beta in gammaBThus; it is noted that the specific position sequence can be adjusted by those skilled in the art according to actual situations or experience, and a practical example is provided here.
C is communication buffer band B0Word length buffer belt B2And a loop calculation band B4And length calculating band B6Blank symbol set [ beta ] used inB}。
F is the termination state set of the multi-band turing machine { ([ q ]0,tB,ε,ε,ε],βBBBB) And the state is the final state of the turing machine after the turing machine finishes reading or writing the communication cache data.
And thirdly, working principle.
As described above, in the embodiment of the present invention, the state transition function of the multi-band turing machine may be divided into five subroutines: main, Mark, PullSym, ReadLen and ReadRan, wherein the Main subprogram processes the initial and termination states of the reading and writing operation of the turing machine; the Mark subprogram is used for marking the data symbols on the communication buffer tape; the purpose of the PullSym subroutine is to pull data symbols from the data symbol stack; the ReadLen subprogram is a reading program of word length data and a protocol mark; the ReadRan subroutine is the process for cycling data. The interaction relationship between the five sub-programs and the interaction relationship between the sub-programs can be represented as a flow chart shown in fig. 5.
The flowchart shown in fig. 5 includes read and write flows of the communication buffer as a whole, where the read flow starts from (1) and ends from (6), and the write flow starts from (7) and ends from (8). When the states of the multi-band turing machine do not correspond to the numbers, it can be determined that the controller points to an invalid byte stream. After the invalid byte stream is detected from the receiving end, the application program performs invalidation-operable guidance with the purpose of keeping the operation state, and the method is to force the application program to return to the initial state (1) of the reading process, or skip the current byte and record the error log. The data at the transmitting end is not checked for invalid byte streams.
The numbers in fig. 5 are the flow numbers of the state transition functions. The state transfer function is composed of state variables and input variables, wherein the state variables comprise a main state, a data type identifier, a data symbol stack state, a data buffer stack state and a protocol position stack state, and the input variables comprise a communication buffer zone position, a word length buffer zone numerical value and a cycle calculation zone numerical value pointed by the controller at present. And after each step is executed, the output content is a multi-element group formed by the state variables and the input variables. The controller can be in communication buffer zone B0Up-shift, the direction of shift is labeled by the last variable of the tuple, S denotes no shift, and R denotes right shift. Communication buffer zone B0Each cell is blank symbol beta before loadingB. In the description of the procedure, l2、l4And l6Respectively representing character length buffer zone B2And a loop calculation band B4And length calculating band B6Non-zero data in (1), satisfies the relation l2>0、l4> 0 and l6>0。
The flow of steps of each subroutine will be described below with reference to fig. 5.
1. Main subprogram.
The Main sub-program comprises: a step of reading operation and a step of writing operation; wherein:
1) the step of the read operation includes:
step 1, δ ([ q ]0,t0,ε,ε,ε],βBBBB)=([q0,t0,ε,ε,i], β 00,0,0, S), enters the initial state of the read operation, communication buffer band B0Loading byte stream, word length buffer zone B2And a loop calculation band B4Is preset to 0 and the controller does not move.
Step 1 corresponds to flow (1) in fig. 5, and the numbers of the subsequent steps correspond one-to-one to the numbers of the flows in fig. 5.
In the above equation, the five state components in parentheses on the left side correspond to the multi-band turing machine state set Q in the aforementioned seven-tuple, and sequentially represent turing machine ready, data type identifier ready, and data symbol stack E1No-operation, data buffer stack E3No operation, protocol location stack E5Not operating;
the first four input variables outside the included numbers in the left side correspond to a complete set gamma of the multi-band turing machine with symbols in the seven tuples, and represent that the multi-band turing machine is in a communication cache band B0Pointing to blank symbols, word length buffer zone B2Pointing to blank symbols, calculating band B cyclically4Pointing to blank symbols, length calculation band B6Pointing to the blank symbol.
Five state components in brackets on the right side correspond to the multi-band turing machine state set Q in the seven tuples, and sequentially represent turing machine ready, data type identification ready and data symbol stack E1No-operation, data buffer stack E3No operation, protocol location stack E5Stacking;
the first four input variables outside the middle part of the right side and including the number correspond to a complete set gamma of the multi-band turing machine with symbols in the seven tuples, and represent that the multi-band turing machine is in a communication cache band B0Pointing to blank symbols, word length buffer zone B2The content of the pointer byte is 0, and the band B is circularly calculated4The content of the pointer byte is 0, and the length calculation band B6The content of the pointer byte is 0.
The last variable outside the middle part of the right side and corresponding to the multi-band turing machine controller is in the communication cache band B0Upward movement direction means that the controller is not moving.
The symbols appearing in the subsequent steps have similar meanings and are not described in detail one by one.
Step 2, δ ([ q ]0,t0,ε,ε,i],β0,0,0,0)=([q1,tB,ε,ε,e],β0,LE5,0,plS), protocol location stack E5Loading type code of root node of protocol tree and word length position p of byte stream length field in data group of root nodelProtocol location stack E5Content L ofE5Move to the word length buffer zone B2Data type identification changed to null data tB(ii) a As described above, the protocol tree is a tree structure formed by different data groups, the data groups are obtained by dividing valid data according to type codes, and the data groups in the protocol tree are used as nodes.
Step 3, δ ([ q ]1,tB,ε,ε,e],β0,l2,0,l6)=([q1,tB,i,ε,ε],β0,0,0,l6S), the application executes a function Tree (-), the argument of which is the word size buffer zone B2Content l of2At this time,/2Is the type code of the protocol tree node, and the acquired data group is loaded to the data symbol stack E in the form of data symbol sequence1Length calculation band B6The content of (a) is not changed; the function Tree () is used for obtaining the data group from the protocol Tree according to the type code and recording the current position of the protocol Tree.
Step 4, δ ([ q ]1,tB,i,ε,ε],β0,0,0,l6)=([q0,t0,e,ε,ε],β0,0,0,l6S), data set loading into data symbol stack E1Data class of controllerType identification changed to ready t0Enter PullSym subroutine, Length calculation band B6Is unchanged.
Step 5, δ ([ q ]1,tB,ε,ε,ε],β0,0,0,l6)=([q1,tB,ε,ε,e],β0,LE5,0,l6S), the step is jumped into by the PullSym subprogram, specifically, the type of the loaded data symbol in the step 9 of the PullSym subprogram is null data tBThe protocol position stack E is shifted to the present step5Content L ofE5Move to the word length buffer zone B2Length calculation band B6After that, the process proceeds to step 3.
Step 6, δ ([ q ]1,tB,ε,ε,ε],βB,0,0,0)=([q0,tB,ε,ε,ε],βBBBBS), the step is jumped into by the Mark subprogram, enters the termination state of the reading operation, completes the reading operation, and the word length buffer zone B2And a loop calculation band B4And resetting.
2) The step of writing comprises:
step 7, δ ([ q ]0,t0,i,ε,ε],βBBBB)=([q2,t0,e,ε,ε], β B0,0,0, S), entering an initial state of write operation, executing a function Load (-) by the application program, wherein an argument of the function Load (-) is given by the application program, and the obtained valid data is loaded to a data symbol stack E in the form of a data symbol sequence1And then the method is transferred into a PullSym subprogram (specifically, step 11 in the PullSym subprogram), wherein the function Load () is used for loading all the pre-sent valid data, and the ordering of all the valid data conforms to the specification of the application layer communication protocol.
Step 8, δ ([ q ]2,tB,ε,ε,ε],βB,0,0,0)=([q0,tB,ε,ε,ε],βBBBBS), the step skips to enter from PullSym subprogram, enters the termination state of write operation, completes read operation, word lengthBuffer zone B2And a loop calculation band B4And resetting.
2. PullSym subroutine.
In the embodiment of the invention, the PullSym subprogram respectively executes different steps for read operation and write operation; wherein:
1) the performing step for the read operation includes:
step 9, δ ([ q ]0,t0,e,ε,ε],β0,0,0,l6)=([q1,t(α),ε,ε,ε],β0,l(α),0,l6S), when the data type of the controller is marked as ready t0Time, data symbol stack E1Popping up a data symbol alpha, a data type identifier and a word length buffer zone B2Type and word length of data symbol and length calculation band B are loaded by operators t (-) and l (-) respectively6Is unchanged. The subsequent steps differ according to the type of the loaded data symbol of the operator t (-) as described in table 5.
Figure BDA0003239585200000111
TABLE 5 description of the subsequent steps of step 9
Step 10,
Figure BDA0003239585200000112
This step is carried over from step 33 in the ReadLen subroutine when the data type of the controller is identified as word size data
Figure BDA0003239585200000124
Time, data symbol stack E1Popping up a data symbol alpha, identifying the type of the data symbol loaded by the operator t (-), and buffering the data stack E3Content L ofE3Move to the word length buffer zone B2Length calculation band B6And (4) the content is not changed, and the Mark subprogram is entered according to the read data type identification.
2) The step of performing for the write operation comprises:
step 11, delta ([ delta ])q2,t0,e,ε,ε],βB,0,0,0)=([q2,t(α),ε,ε,ε],βBL (α),0,0, S) when the data type of the controller is identified as ready t0Time, data symbol stack E1Popping up a data symbol alpha, a data type identifier and a word length buffer zone B2And loading the type and the word length of the data symbol through operators t (-) and l (-) respectively, and entering a Mark subprogram according to the data type identification. When the type and word length of the loaded data symbol are tBAnd 0, the flow proceeds to step (8) to end the write flow.
Step 12,
Figure BDA0003239585200000121
This step is carried over by step 22 in the Mark subroutine when the data type of the controller is identified as word size data
Figure BDA0003239585200000122
Time, data symbol stack E1Popping up a data symbol alpha, loading the data symbol type by the data type identification through an operator t (·), and buffering a word length B2Is stored in2And if not, marking to enter a Mark subprogram according to the data type.
3. Mark subprogram.
In the embodiment of the invention, the Mark subprogram respectively executes different steps for read operation and write operation; wherein:
1) the performing step for the read operation includes:
step 13, δ ([ q ]1,t1,ε,ε,ε],β0,l2,0,l6)=([q1,t1,ε,ε,ε],α,l2-1,0,l 61, R), this step is entered by a read jump of the PullSym subroutine (in particular step 9 described above), when the data type of the controller is identified as fixed-length data t1And the character length buffer belt B2When the memory content of (2) is not 0, the communication buffer pointed to by the controller is signed by beta0Marking the data symbol alpha as the current one, and marking the word length buffer band B after the marking is finished2Of (1) storage content l2Minus 1, length meterCalculating belt B6Non-zero data l in6 Minus 1, the controller moves to the right.
Step 14, δ ([ q ]1,t1,ε,ε,ε],β0,0,0,l6)=([q0,t0,e,ε,ε],β0,0,0,E(α)*l6S), after step 13 is executed, buffer zone B is formed when word length is longer2Is stored in2When the value is 0, the controller finishes marking the fixed-length data, executes validity judgment E (alpha), reads the valid data after the judgment is passed into the data symbol of the application program, and returns to the PullSym subprogram to read the next data symbol.
Step 15,
Figure BDA0003239585200000125
This step is entered by a read jump of the PullSym subroutine (specifically, the aforementioned step 10), when the data type identifier of the controller is variable length data
Figure BDA0003239585200000131
And the character length buffer belt B2Is stored in2When not 0, the controller points to the communication buffer with a symbol beta0Will be marked as the current data symbol alpha, after marking is completed l2Decrease by 1, l6Minus 1, the controller moves to the right.
Step 16,
Figure BDA0003239585200000132
After step 15, buffer zone B is written to2Is stored in2When the value is 0, the controller finishes marking the variable-length data, executes validity judgment E (alpha), reads the valid data after the judgment is passed into the data symbol of the application program, and returns to the PullSym subprogram to read the next data symbol.
Step 17, δ ([ q ]1,t1,ε,ε,ε],βB,0,0,0)=([q1,tB,ε,ε,ε], β B0,0,0, S), after step 13 is executed, when the data symbol of the pointing position of the controller is βBHour and word length buffer zone B2Is stored in2Is a non-volatile organic compound (I) with a value of 0,data type identification will be changed to null data tBThe program returns to the Main subroutine (specifically, returns to the step 6) to end the reading process.
Step 18,
Figure BDA0003239585200000133
After step 15, when the data symbol of the pointing position of the controller is βBHour and word length buffer zone B2Is stored in2To 0, the data type identification will be changed to null data tBThe program returns to the Main subroutine (specifically, returns to the step 6) to end the reading process.
2) The step of performing for the write operation comprises:
step 19, δ ([ q ]2,t1,ε,ε,ε],βB,l2,0,0)=([q2,t1,ε,ε,ε],α,l2-1,0,0, R) when the data type of the controller is identified as fixed-length data t1And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Minus 1, the controller moves to the right.
Step 20, δ ([ q ]2,t1,ε,ε,ε],βB,0,0,0)=([q2,t0,e,ε,ε], β B0,0,0, S), after step 19 is performed, the word length buffer zone B is filled2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarking as a data symbol alpha, returning to the PullSym subprogram (specifically, the step 11) to write the next data symbol; at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 21,
Figure BDA0003239585200000135
When the data type of the controller is marked as word length data
Figure BDA0003239585200000136
And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 22,
Figure BDA0003239585200000134
After step 21, buffer B is written2Is stored in2When 0, the character length buffer zone B2Loading valid data stored by the current data symbol alpha through an operator v (·), and returning to the PullSym subprogram (specifically, the step 12) to write the next data symbol; the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 23,
Figure BDA0003239585200000141
When the data type of the controller is identified as variable-length data
Figure BDA0003239585200000142
And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Minus 1, the controller moves to the right.
Step 24,
Figure BDA0003239585200000143
After step 23, buffer B is written to the word length2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarked as data symbol a, the return PullSym subroutine (specifically step 11 described above) writes the next data symbol, and at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 25, δ ([ q ]2,t3,ε,ε,ε],βB,l2,0,0)=([q2,t3,ε,ε,ε],α,l2-1,0,0, R) when the data type of the controller is identified as cycle data t3And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Minus 1, the controller moves to the right.
Step 26, δ ([ q ]2,t3,ε,ε,ε],βB,0,0,0)=([q2,t0,e,ε,ε], β B0,0,0, S), after step 25 is performed, the word length buffer zone B is filled2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarked as data symbol a, the return PullSym subroutine (specifically step 11 described above) writes the next data symbol, and at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
Step 27, δ ([ q ]2,t4,ε,ε,ε],βB,l2,0,0)=([q2,t4,ε,ε,ε],α,l2-1,0,0, R) when the data type of the controller is identified as protocol flag t4And the character length buffer belt B2Is stored in2When not 0, the controller points to the blank symbol beta of the communication buffer zoneBWill be marked as the current data symbol alpha, after marking is completed l2Minus 1, the controller moves to the right.
Step 28, δ ([ q ]2,t4,ε,ε,ε],βB,0,0,0)=([q2,t0,e,ε,ε], β B0,0,0, S), after step 27 is performed, the word length buffer zone B is filled2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarking as a data symbol alpha, returning to a PullSym subprogram (specifically, the step 11) to write the next data symbol, and simultaneously, writing the marked byte into data and sending the data to the network through a TCPIP protocol;
step 29, δ ([ q ]2,t5,ε,ε,ε],βB,l2,0,0)=([q2,t5,ε,ε,ε],α,l2-1,0,0, R) when the data type of the controller is identified as length data t5And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Symbol betaBWill be marked as the current data symbol alpha, after marking is completed l2Minus 1, the controller moves to the right.
Step 30, δ ([ q ]2,t5,ε,ε,ε],βB,0,0,0)=([q2,t0,e,ε,ε], β B0,0,0, S), after step 29 is performed, the word length buffer B is taken as2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarked as data symbol a, the return PullSym subroutine (specifically step 11 described above) writes the next data symbol, and at the same time, the marked bytes will be written to data and sent to the network via the TCPIP protocol.
4. ReadLen subroutine.
In the embodiment of the present invention, the step of executing the ReadLen subroutine includes:
step 31,
Figure BDA0003239585200000151
When the data type is identified as word length data
Figure BDA0003239585200000152
And the character length buffer belt B2Is stored in2When not 0, the controller sets the data buffer stack E3Is in the stack state and proceeds to step 32.
Step 32,
Figure BDA0003239585200000153
Controller directed communication buffer signed beta0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E3After marking,/2 Minus 1, length calculating the non-zero data l in the band6Minus 1, the controller moves to the right.
Step 33,
Figure BDA0003239585200000154
After step 32, the long buffer zone B is formed2Is stored in2When the data length is 0, the controller finishes marking the word length data, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol, and stores the valid data of the data symbol alpha into a data buffer stack E3And then returns to the PullSym subroutine (specifically, step 10) to read the next data symbol.
Step 34, δ ([ q ]1,t4,ε,ε,ε],β0,l2,0,l6)=([q1,t4,ε,ε,i],β0,l2,0,l6S), when the data type is marked as a protocol tag t4And the character length buffer belt B2Is stored in2When not 0, the controller sets the protocol position stack E5Is in the stack state and proceeds to step 35.
Step 35, δ ([ q ]1,t4,ε,ε,i],β0,l2,0,l6)=([q1,t4,ε,ε,i],α,l2-1,0,l6-1, R), controller directed communication buffer signed β0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the protocol location stack E5After marking,/2Decrease by 1, l6Minus 1, the controller moves to the right.
Step 36, δ ([ q ]1,t4,ε,ε,i],β0,0,0,l6)=([q1,t0,e,ε,ε],β0,0,0,E(α)*l6S), after step 35 is executed, buffer zone B is written to word length2Is stored in2When the number is 0, the controller finishes marking the protocol mark, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol of the application program, and stores the valid data of the data symbol alpha into a protocol position stack E5And then returns to the PullSym subroutine (specifically, step 9) to read the next data symbol.
Step 37, δ ([ q ]1,t5,ε,ε,ε],β0,l2,0,l6)=([q1,t5,ε,i,ε],β0,l2,0,l6S), when the data type is identified as length data t5And the character length buffer belt B2Is stored in2When not 0, the controller sets the protocol position stack E5Is in the stack state and proceeds to step 38.
Step 38, δ ([ q ]1,t5,ε,i,ε],β0,l2,0,l6)=([q1,t5,ε,i,ε],α,l2-1,0,l6R), controller directed communication buffer signed beta0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E3After marking,/2Decrease by 1, l6Without change, the controller moves to the right.
Step 39, δ ([ q ]1,t5,ε,i,ε],β0,0,0,l6)=([q1,t0,e,ε,ε],β0,0,0,E(α)*LE3S), after step 38 is executed, buffer zone B is written to word length2Is stored in2When the data is 0, the controller finishes marking the length data, executes validity judgment E (alpha), and reads valid data after the judgment is passed into a data symbol of the application program; storing the valid data of the data symbol alpha to the data buffer stack E3And the storage content is marked as lE3Then moved to the length calculation band B6And then returns to the PullSym subroutine (specifically, step 9) to read the next data symbol.
5. ReadRan subroutine.
In the embodiment of the present invention, the steps executed by the ReadRan subroutine sequentially include:
step 40, δ ([ q ]1,t3,ε,ε,ε],β0,l2,0,l6)=([q1,t3,ε,i,ε],β0,l2,0,l6S), when the data type is identified as cycle data t3And the character length buffer belt B2Is stored in2When not 0, controlSystem setup data buffer Stack E3Is in the stacked state.
Step 41, δ ([ q ]1,t3,ε,i,ε],β0,l2,0,l6)=([q1,t3,ε,i,ε],α,l2-1,0,l6-1, R), controller directed communication buffer signed β0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E3After marking,/2 Minus 1, length calculating the non-zero data l in the band6Minus 1, the controller moves to the right.
Step 42, δ ([ q ]1,t3,ε,i,ε],β0,0,0,l6)=([q1,t3,i,ε,ε],β0,lE3,r(α),E(α)*l6S), the controller has completed marking of the cycle data, performs validity determination E (α), and determines that valid data after passing is read into the data symbol; buffer data on stack E3Data storage content l ofE3Move to the word length buffer zone B2The end point r (alpha) of the number of the current cycle data is loaded into the cycle calculation band B4Data symbol stack E1Set to a stacked state if lE3If the content of (1) is 0, the read cyclic data content is 0, go to step 45, if l isE3If not 0, the process proceeds to step 43.
Step 43, δ ([ q ]1,t3,i,ε,ε],β0,l2,l4,l6)=([q1,t3,i,ε,ε],β0,l2,l4-1,l6S), when the data type is identified as cycle data t3And the character length buffer belt B2And a loop calculation band B4When the storage content of (2) is not 0, the band B is cyclically calculated4Is stored in4Is a data number of a communication protocol and can uniquely correspond to a data symbol alpha operable in a program. Adding alpha to the data symbol stack E1After, l4Decrease by 1 if l4Equals the number starting point s (α) of the current cycle data, and proceeds to step 44, otherwise step 43 is executed again.
Step 44, delta ([ delta ]q1,t3,i,ε,ε],β0,l2,s(α),l6)=([q1,t3,i,ε,ε],β0,l2-1,r(α),l6S), when calculating band B in cycles4Is stored in4A word length buffer zone B for numbering the start s (alpha) of the current cycle data2Is stored in2 Subtracting 1, loading the numbering end point r (alpha) of the current cycle data into a cycle calculation band B4If l is20, go to step 45, if l2If it is greater than 0, the process proceeds to step 43.
Step 45, δ ([ q ]1,t3,i,ε,ε],β0,0,l4,l6)=([q1,t3,e,ε,ε],β0,0,l4,l6S), buffer zone B when word length2When the memory content of (2) is 0, the data symbol stack E1And adjusting the stack pushing state into the stack popping state.
Step 46, δ ([ q ]1,t3,e,ε,ε],β0,0,l4,l6)=([q1,t3,e,ε,ε],β0,0,l4-1,l6S) buffer zone B with equal word length2When the memory content of (2) is 0, the data symbol stack E1And executing the pop operation. The purpose of the pop operation is to empty the preloaded data symbols so that the number of repetitions of the data symbols in the loop is equal to the memory content l of the data buffer stack loaded in step 39E3And (5) the consistency is achieved. Because the step (3) loads the data symbol stack E1In time, the data symbols within the specified range of the cycle data are preloaded once, and if the preloaded data is popped without executing the pop operation, the data symbols are stacked E1The accumulated number of data symbols in the buffer stack can not be equal to the storage content l of the data buffer stack loaded in step 39E3A matching relationship is formed, resulting in a failure of the read flow.
Step 47, δ ([ q ]1,t3,e,ε,ε],β0,0,s(α),l6)=([q0,t0,e,ε,ε],β0,0,0,l6And S), after the pop operation is finished, returning to the PullSym subprogram (specifically, the step 9) to read the next data symbol.
The above is the interaction relationship between the interior of the five subprograms and the subprograms, and for convenience of understanding, four application cases of normal data reception, normal data transmission, data content error and data length error are introduced below by combining the interaction relationship between the interior of the five subprograms and the subprograms.
Since the data link itself may also generate disturbance to cause invalid data to appear in the byte stream, only the receiving end detects illegal data, abnormal data and length error data and performs failure-operable direction, and the transmitting end does not perform detection operation of invalid byte stream. The content of the data received and sent by the communication buffer in each case conforms to the data set specifications set forth in tables 6, 7, and 8. The definition of data group 0, data groups 0-1, and data groups 0-1-3 comes from the application layer proprietary communication protocol actually used in some large-scale distributed hard real-time system.
Data numbering Data type Description of the invention
1 t5 Data length
2 t4 Type code
3 t1 Version number
4 t1 Time
TABLE 6 definition of data set 0
Figure BDA0003239585200000171
TABLE 7 definition of data sets 0-1
Figure BDA0003239585200000181
TABLE 8 definition of data sets 0-1-3
1. The data received the case normally.
The byte stream received by the communication cache conforms to the specifications of the application layer private communication protocol. When data is normally received, illegal data, abnormal data, and length error data are not present in the byte stream. An example of the implementation is as follows:
1) executing step 1 and step 2, finishing the initialization of the reading process and loading the type code of the root node of the protocol tree to a protocol position stack E5
2) Step 3 and step 4 are executed, and the data symbols of the data group 0 are loaded to the data symbol stack E1Protocol location stack E5And (4) emptying.
3) Step 9, step 37, step 38, step 39 are executed, and the slave data symbol stack E1The pull number is 1 and the type is length data t5The data symbol of (2). Communication buffer marked bytes are stored in data symbols, length calculation band B6The load is marked byte by the total length of the byte stream.
4) Executing the steps 9, 34, 35 and 36, and stacking the data symbols E1The pull number is 2 and the type is the protocol label t4The data symbol of (2). Communication buffer marked bytes into data symbols, protocol location stackE5The type code marked byte as the next data group is loaded.
5) Executing step 9, step 13 and step 14, and stacking E from the data symbols1The drawing number is 3 and the type is fixed length data t1The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols. The data symbol processing flow of number 4 corresponds to 3.
6) Executing step 9, step 5, step 3 and step 4 to obtain a protocol position stack E5After the contents of (1), load the data symbols of data groups 0-1 into a data symbol stack E1Protocol location stack E5And (4) emptying.
7) Executing step 9, step 13 and step 14, and stacking E from the data symbols1The pull number is 5 and the type is fixed length data t1The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols.
8) Executing step 9, step 34, step 35 and step 36, and stacking E from the data symbols1The pull number is 6 and the type is the protocol label t4The data symbol of (2). Communication buffer marked bytes into data symbols, protocol location stack E5The type code marked byte as the next data group is loaded.
9) Executing the steps 9, 31, 32, 33, 10, 15 and 16 to obtain the data symbol stack E1Sequentially pulling data with number of 7 and type of word length
Figure BDA0003239585200000193
And data symbols of type 8 and variable length data
Figure BDA0003239585200000194
The data symbol of (2). Communication buffer marked bytes are stored in data symbols, word length buffer band B2And a data buffer stack E3Emptied after use is complete.
10) Executing step 9, step 5, step 3 and step 4 to obtain a protocol position stack E5After the contents of (3), load the data symbols of data groups 0-1-3 into a data symbol stack E1Protocol location stack E5And (4) emptying.
11) Executing step 9, step 13 and step 14, and stacking E from the data symbols1The pull number is 9 and the type is fixed-length data t1The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols. The data symbol processing flow of number 10 corresponds to 9.
12) Step 9, step 40, step 41, step 42, step 43, step 44, step 45, step 46, step 47 are executed to slave data symbol stack E1Pull number 11 and type cycle data t3The data symbol of (2). Loop calculation band B4Loading the marked bytes as a number of cycles, and then inserting the data symbols into the data symbol stack E in reverse order1Each time the inserted data symbols are numbered 19, 18, 17, 16, 15, 14, 13 and 12 in sequence. If the number of cycles is 0, step 46 can ensure that the number of insertions is consistent with the number of cycles read in the byte stream.
13) Executing step 9, step 13 and step 14, and stacking E from the data symbols1The drawing number is 12 and the type is fixed length data t1The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols.
14) Executing the steps 9, 31, 32, 33, 10, 15 and 16 to obtain the data symbol stack E1Sequentially pulling data with serial number of 13 and type of word length
Figure BDA0003239585200000191
And 14 and the type is variable length data
Figure BDA0003239585200000192
The data symbol of (2). Communication buffer marked bytes are stored in data symbols, word length buffer band B2And a data buffer stack E3Emptied after use is complete.
15) Executing step 9, step 13 and step 14, and stacking E from the data symbols1The drawing number is 15 and the type is fixed length data t1The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols.
16) Step 9, step 40 and stepStep 41, step 42, step 43, step 44, step 45, step 46, step 47, from the data symbol stack E1Pull number 16 and type cycle data t3The data symbol of (2). Loop calculation band B4Loading the marked bytes as a number of cycles, and then inserting the data symbols into the data symbol stack E in reverse order1Each inserted data symbol is numbered 19, 18 and 17 in that order. If the number of cycles is 0, step 46 can ensure that the number of insertions is consistent with the number of cycles read in the byte stream.
17) Executing step 9, step 13 and step 14, and stacking E from the data symbols1The drawing number is 17 and the type is fixed length data t1The data symbol of (2). The marked bytes of the communication buffer are stored in data symbols.
18) Executing the steps 9, 31, 32, 33, 10, 15 and 16 to obtain the data symbol stack E1Sequentially pulling data with 18 serial numbers and word length types
Figure BDA0003239585200000201
And data symbols of type 19 and variable length data
Figure BDA0003239585200000202
The data symbol of (2). Communication buffer marked bytes are stored in data symbols, word length buffer band B2And a data buffer stack E3Emptied after use is complete.
19) Slave data symbol stack E1And continuously pulling data symbols, marking the communication buffer according to the data type and storing the data until all the byte streams are marked.
20) And (6) executing the step (18) and the step (6), resetting the multi-band turing machine, stopping the machine in the receiving state, and finishing the reading process.
2. The data is sent to the case normally.
The effective data ordering pre-sent by the application program conforms to the specification of the communication protocol of the application layer. When the values of data numbers 11 and 16 in Table 8 are 2 and 1, respectively, the loaded sequence is α1α2α3α4α5α6α7α8α9α10α11α12α13α14α15α16α17α18α19α12α13α14α15α16α17α18α19When data is normally transmitted, each data symbol αi,i∈[1,19]The pre-stored data are all in the effective range, and the execution example is as follows:
1) executing step 7, completing the initialization of the writing process and loading the pre-sent content to the data symbol stack E in the form of data symbols1. All symbols are arranged according to data numbering and storage time sequence.
2) Executing step 11, step 29 and step 30, and stacking E from the data symbols1The pull number is 1 and the type is length data t5The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
3) Executing step 11, step 27 and step 28, and stacking E from the data symbols1The pull number is 2 and the type is the protocol label t4The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
4) Executing step 11, step 19 and step 20, and stacking E from the data symbols1The drawing number is 3 and the type is fixed length data t1The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer. The data symbol processing flow of numbers 4 and 5 is identical to 3.
5) Executing step 11, step 27 and step 28, and stacking E from the data symbols1The pull number is 6 and the type is the protocol label t4The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
6) Executing the steps 11, 21, 22, 12, 23 and 24, and stacking the data symbols E1Sequentially pulling data with number of 7 and type of word length
Figure BDA0003239585200000211
And data symbols of type 8 and variable length data
Figure BDA0003239585200000212
The data symbol of (2). Storing the data symbol content with number 7 into word length buffer zone B2And then writing into the communication buffer. Buffer zone B of data symbols numbered 8 according to word length2Writing the stored word length data into a communication buffer, word length buffer band B2Emptied after use is complete.
7) Executing step 11, step 19 and step 20, and stacking E from the data symbols1The pull number is 9 and the type is fixed-length data t1The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer. The data symbol processing flow of number 10 corresponds to 9.
8) Executing step 11, step 25 and step 26, and stacking E from the data symbols1Pull number 11 and type cycle data t3The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer. Since the value stored in the data number 11 is 2, the contents of the data numbers 12 to 19 appear 2 times in the loaded contents.
9) Executing step 11, step 19 and step 20, and stacking E from the data symbols1The drawing number is 12 and the type is fixed length data t1The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
10) Executing the steps 11, 21, 22, 12, 23 and 24, and stacking the data symbols E1Sequentially pulling data with serial number of 13 and type of word length
Figure BDA0003239585200000213
And 14 and the type is variable length data
Figure BDA0003239585200000214
The data symbol of (2). The data symbol content numbered 13 is stored in the word length buffer zone B2And then writing into the communication buffer. Buffer zone B of data symbols numbered 14 according to word length2Writing the stored word length data into a communication buffer, word length buffer band B2Emptied after use is complete.
11) Executing step 11, step 19 and step 20, and stacking E from the data symbols1The drawing number is 15 and the type is fixed length data t1The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
12) Executing step 11, step 25 and step 26, and stacking E from the data symbols1Pull number 16 and type cycle data t3The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer. Since the value stored in the data number 16 is 1, the contents of the data numbers 17 to 19 appear 1 time in the loaded contents. If the value stored in the data number 16 is 0, the contents of the data numbers 17 to 19 do not appear.
13) Executing step 11, step 19 and step 20, and stacking E from the data symbols1The drawing number is 17 and the type is fixed length data t1The data symbol of (2). And writing the valid data stored in the data symbol into a communication buffer.
14) Executing the steps 11, 21, 22, 12, 23 and 24, and stacking the data symbols E1Sequentially pulling data with 18 serial numbers and word length types
Figure BDA0003239585200000215
And data symbols of type 19 and variable length data
Figure BDA0003239585200000216
The data symbol of (2). The data symbol content numbered 18 is stored in a word length buffer zone B2And then writing into the communication buffer. Buffer zone B of 19-numbered data symbols according to word length2Writing the stored word length data into a communication buffer, word length buffer band B2Emptied after use is complete.
15) Slave data symbol stack E1Pulling the rest data symbols in sequence, writing the data into the cache according to the data type mark until the data symbol stack E1Is empty.
16) And (6) executing the step (11) and the step (8), resetting the multi-band turing machine, stopping the machine in a receiving state, and ending the writing process.
3. Data content error case.
Invalid data in the byte stream can be detected and a fail-actionable guided flow can be executed in the receiving flow. When illegal data or abnormal data exists in the byte stream, the execution example is as follows:
1) data symbols numbered 3, 4, 5, 9, 10, 12, 15, 17: the step 13 of reading is executed to read the type of fixed-length data t1Then, the process proceeds to step 14, and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 14 in the length calculation band B6The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guiding flow, the concrete method is to force to return to the initial state or skip the current byte, and then record the error log.
2) Data symbols numbered 7, 13, 18: the step 32 of reading data of type word length is executed
Figure BDA0003239585200000221
After the data symbol of (2), the process proceeds to step 33, and validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 33 in the length calculation band B6The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guiding flow, the concrete method is to force to return to the initial state or skip the current byte, and then record the error log.
3) Data symbols numbered 8, 14, 19: step 15 of reading data t of variable length type is executed2After the data symbol of 1, the flow proceeds to step 16 and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 16 in the length calculation band B6The number of the particles is 0. Since there is no connection rule in the state transfer function, the multi-band turing machine will be shut down in the non-accepting state, will execute the failure-operable oriented flow, the specific methodTo force a return to the initial state or skip the current byte, the error log is recorded again.
4) Data symbols numbered 11, 16: step 41 is executed to read the type of cycle data t3Then, the process proceeds to step 42, and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, operator E (α) will return 0, resulting in step 42 in the length calculation band B6The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guide logic, the specific method is to force to return to the initial state or skip the current byte, and then record the error log.
5) Data symbols numbered 2, 6: the execution step 35 reads the type of protocol flag t4Then, the process proceeds to step 35, and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 36 in the length calculation band B6The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guide logic, the specific method is to force to return to the initial state or skip the current byte, and then record the error log.
6) Data symbol numbered 1: step 38 is performed to read the type as length data t5Then, the process proceeds to step 39, and a validity determination E (α) is performed. If there is data or an outlier in the marked byte stream that is outside the valid range, the operator E (α) will return 0, resulting in step 39 in the length calculation band B6The number of the particles is 0. Because the state transfer function has no connection rule, the multi-band turing machine will stop in the non-acceptance state, and will execute the failure-operable guide logic, the specific method is to force to return to the initial state or skip the current byte, and then record the error log.
4. Data length error case.
When detecting data with a length error, the steps executed are the same as those when the data is normally read. The application program firstly detects data with error length once, and executes the byte stream reading process if no error exists.
Since the purpose of executing the reading process is changed into length check, the multi-band turing machine can only mark and read word length data
Figure BDA0003239585200000231
Cycle data t3Protocol label t4And length data t5Only mark unread fixed-length data t1Variable length data
Figure BDA0003239585200000232
The content of (1). If the length calculation band B6If the storage content is 0 before all the marks of the byte stream are finished or the storage content is not 0 after all the marks of the byte stream are finished, the algorithm detects the data with the wrong length, the multi-belt turing machine is stopped in a non-receiving state, the algorithm executes failure-operable guide logic, and the specific method is to force the multi-belt turing machine to return to an initial state or skip the current byte and then record an error log.
The four application cases of normal data receiving, normal data sending, data content error and data length error show that the method provided by the invention has the function of reading and writing the real-time data link byte stream by the traditional method, and realizes the detection and invalidation of invalid byte stream and the operable guide process on the basis. The method provided by the invention is manufactured according to the application layer private communication protocol actually used in a large-scale distributed hard real-time system, and the beneficial effects brought by the method can be summarized as follows:
1) allowing TCP/IP applications to perform invalidity detection and invalidation of illegal data-an operational guided flow. The process is carried out simultaneously with the reading process of the real-time data link byte stream, so that the situation that invalid data further causes unexpected behaviors of the application program can be prevented.
2) Allowing the TCP/IP application to perform the detection of invalidity and invalidation of anomalous data-an operational guided flow. The process and the reading process of the real-time data link byte stream are carried out simultaneously, so that invalid data can be prevented from further causing application program crash.
3) The TCP/IP application program is allowed to judge whether the whole real-time data link byte stream is error data in length in advance before the data reading process begins.
Through the above description of the embodiments, it is clear to those skilled in the art that the above embodiments can be implemented by software, and can also be implemented by software plus a necessary general hardware platform. With this understanding, the technical solutions of the embodiments can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.), and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods according to the embodiments of the present invention.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to perform all or part of the above described functions.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (9)

1. A real-time data link byte stream error-proofing method based on a multi-band turing machine is characterized by comprising the following steps:
constructing a multi-band smart machine, performing read-write operation of communication cache through a state transfer function of the multi-band smart machine, detecting an invalid byte stream in the read-write operation or before the read-write operation, and returning to a read operation initial state or skipping related bytes when the invalid byte stream is detected; the state transition function is divided into five subroutines according to functions: main, Mark, PullSym, ReadLen and ReadRan; wherein:
main subprogram for processing the initial and end states of the reading and writing operation of the multi-band smart machine, and switching to PullSym subprogram after the initial state of the reading and writing operation is processed;
a PullSym subroutine for pulling data symbols from the data symbol stack of the multi-band smart machine during a read operation, and entering a ReadLen subroutine, a ReadRan subroutine, or a Mark subroutine according to a data type identifier, or returning to a Main subroutine; the system is also used for pulling data symbols from the data symbol stack of the multi-band turing machine in the write operation and entering a Mark subprogram;
the Mark subprogram is used for marking data symbols on a communication cache belt according to the data type identification in the reading operation and detecting invalid byte streams through validity judgment, if the valid data passes the validity judgment, the valid data is read into the data symbols of the application program and then returned to the PullSym subprogram, or the data symbols are marked and the data reading is completed and then returned to the Main subprogram, and the terminal state is entered; the communication cache is also used for marking data symbols on the communication cache according to the data type identification in the write operation, obtaining the value of effective data through an operator and returning the value to the PullSym subprogram, or writing corresponding data after marking the data symbols and returning the corresponding data to the PullSym subprogram;
the ReadLen subprogram is a reading program of word length data, protocol marks and length data, after the word length data, the protocol marks or the length data are marked, invalid byte streams are detected through validity judgment, if the validity judgment is passed, valid data are read into a data symbol of an application program, and then the valid data are returned to the PullSym subprogram;
the ReadRan subprogram is a reading program of the cyclic data, after the marking of the cyclic data is completed, the invalid byte stream is detected through validity judgment, if the invalid byte stream passes the validity judgment, the valid data is read into a data symbol of an application program, and after the cyclic data is read, the PullSym subprogram is returned.
2. The method of claim 1, wherein the multi-band smart machine comprises: the device comprises a controller, a data symbol stack, a data buffer stack, a protocol position stack, a word length buffer zone, a cycle calculation zone and a length calculation zone;
the controller is used for storing state variables of the state transfer functions of the multi-band turing machine and controlling the conversion among the subprograms, and each subprogram outputs the corresponding state variable and the corresponding input variable after executing each process; wherein the state variables include: the system comprises a main state, a data type identifier, a data symbol stack state, a data buffer stack state and a protocol position stack state, wherein the main state comprises a ready state, a reading state and a writing state of the multi-band turing machine; the input variables include: the position of a communication buffer zone, the numerical value of a word length buffer zone and the numerical value of a cyclic calculation zone which are pointed by the controller at present;
character length buffer belt B2And a loop calculation band B4And length calculating band B6The local variables are used for temporarily storing the local variables used in the reading and writing process;
data symbol stack E1Each cell of (a) represents a single data symbol, a data structure for storing valid data inside the application, a data buffer stack E3And protocol location stack E5For temporarily storing the byte stream.
3. The method of claim 2, wherein the invalid byte stream comprises: illegal data, abnormal data, and length error data;
wherein the illegal data comprises: data in the byte stream that is not within the valid range specified by the communication protocol; the exception data includes: data within the byte stream that can cause the operating system to force the application to close; the length error data includes: data with inconsistent data length and actual length recorded by the byte stream;
the illegal data and the abnormal data are detected through validity judgment in read-write operation; said length errorDetecting data before read-write operation, the execution flow in detection is identical to that of read operation, if length calculation band B is used6If the storage content is 0 before the byte stream is completely marked, or if the storage content is not 0 after the byte stream is completely marked, it indicates that the length error data is detected.
4. The method of claim 2, wherein the real-time data link byte stream error proofing is defined using a seven-tuple form, expressed as:
M=(Q,Σ,Γ,δ,Q0,C,F)
wherein:
m represents a multi-band turing machine;
q is a set of multi-band turing machine states
Figure FDA0003239585190000023
q0、q1、q2Sequentially represents ready state, read state, write state, t0、t1
Figure FDA0003239585190000021
t3、t4、t5、tBIs data type identification respectively representing ready, fixed length data, word length data, variable length data, cycle data, protocol mark, length data and null data, the last three components respectively corresponding to data symbol stack E1Data buffer stack E3And protocol location stack E5I, e and epsilon are state identifiers of the linear stack and respectively represent stack entering, stack exiting and no operation;
sigma is a finite set of input data symbols
Figure FDA0003239585190000022
Is an ordered pair of four input variables; beta is aBIndicating a blank symbol in a communication buffer zone B0The upper part shows that the grid is not loaded with the byte stream, and the communication buffer after the byte stream is loaded is signed by beta0Represents; character length buffer belt B2And a loop calculation band B4And length calculating band B6All the bytes can be equivalently converted into integers, and the input contents of the three are respectively recorded as
Figure FDA0003239585190000031
Refers to content as all non-negative integers;
Γ is a signed complete set
Figure FDA0003239585190000032
Alpha represents a data symbol and represents that the byte on the communication cache band forms a matching relation with effective data stored in the application program; beta is aBIn the word length buffer zone B2And a loop calculation band B4And length calculating band B6Up represents the initialization state;
δ is the state transfer function of the multi-band turing machine;
Q0is the initial state set of the multi-band turing machine { ([ q ]0,t0,ε,ε,ε],βBBBB),([q0,t0,i,ε,ε],βBBBB) And the two states respectively represent the states of the Turing machine before the communication buffer starts to read and write data, and beta at four positionsBSequentially corresponding to communication buffer zone B0Word length buffer belt B2And a loop calculation band B4And length calculating band B6
C is communication buffer band B0Word length buffer belt B2And a loop calculation band B4And length calculating band B6Blank symbol set [ beta ] used inB};
F is the termination state set of the multi-band turing machine { ([ q ]0,tB,ε,ε,ε],βBBBB) And the state is the final state of the turing machine after the turing machine finishes reading or writing the communication cache data.
5. The method for preventing errors of the real-time data link byte stream based on the multi-band turing machine according to the claim 2, 3 or 4, characterized in that the Main sub-program comprises: a step of reading operation and a step of writing operation; wherein:
the step of the read operation includes:
step 1, entering an initial state of read operation, and communicating a cache band B0Loading byte stream, word length buffer zone B2And a loop calculation band B4The memory content of (2) is preset to be 0, and the controller does not move;
step 2, protocol position stack E5Loading type code of root node of protocol tree and word length position p of byte stream length field in data group of root nodelProtocol location stack E5Content L ofE5Move to the word length buffer zone B2Data type identification changed to null data tB(ii) a The protocol tree is a tree structure formed by different data groups, the data groups are obtained by dividing effective data according to type codes, and the data groups in the protocol tree are used as nodes;
step 3, the application program executes a function Tree (DEG), and the argument of the function Tree (DEG) is a word length buffer zone B2Content l of2The acquired data group is loaded to a data symbol stack E in the form of a data symbol sequence1Length calculation band B6The content of (a) is not changed; the function Tree (-) is used for acquiring a data group from the protocol Tree according to the type code and recording the current position of the protocol Tree;
step 4, loading the data group to a data symbol stack E1Thereafter, the data type identification of the controller is changed to ready t0Enter PullSym subroutine, Length calculation band B6The content of (a) is not changed;
and 5, jumping into the step by the PullSym subprogram, wherein the type of the loaded data symbol in the PullSym subprogram is null data tBThe protocol position stack E is shifted to the present step5Content L ofE5Move to the word length buffer zone B2Length calculation band B6After the content is not changed, the step 3 is carried out;
6, jumping into the step by the Mark subprogram, entering the termination state of the read operation, completing the read operation, and buffering the word length buffer zone B2And a loop calculation band B4Resetting;
the step of writing comprises:
and 7, entering an initial state of write operation, executing a function Load (-) by the application program, giving an argument of the function Load (-) by the application program, and loading the obtained effective data to a data symbol stack E in a data symbol sequence mode1The function Load (-) is used for loading all the effective data which are sent in advance, and the sequence of all the effective data accords with the specification of an application layer communication protocol;
step 8, the PullSym subprogram jumps into the step, enters the termination state of the write operation, completes the read operation, and the word length buffer zone B2And a loop calculation band B4And resetting.
6. The real-time datalink byte stream error-proofing method based on multi-zone turing machine according to claim 2, 3 or 4, characterized in that the PullSym subroutine performs different steps for each of the read and write operations; wherein:
the performing step for the read operation includes:
step 9, when the data type of the controller is marked as ready t0Time, data symbol stack E1Popping up a data symbol alpha, a data type identifier and a word length buffer zone B2Type and word length of data symbol and length calculation band B are loaded by operators t (-) and l (-) respectively6The content of (2) is not changed, and the subsequent steps are transferred into different subprograms according to different types of loading data symbols of an operator t (·);
step 10, the step is transferred by the ReadLen subprogram, when the data type of the controller is marked as word length data
Figure FDA0003239585190000042
Time, data symbol stack E1Popping up a data symbol alpha, identifying the type of the data symbol loaded by the operator t (-), and buffering the data stack E3Content L ofE3Move to the word length buffer zone B2Length calculation band B6The content is not changed, and a Mark subprogram is entered according to the read data type identification;
the step of performing for the write operation comprises:
step 11, when the data type of the controller is marked as ready t0Time, data symbol stack E1Popping up a data symbol alpha, a data type identifier and a word length buffer zone B2Loading the type and the word length of the data symbol through an operator t (-) and l (-) respectively, and entering a Mark subprogram according to the data type identification; when the type and word length of the loaded data symbol are null data tBWhen the sum is 0, the Main subprogram is switched into, and the ending state of the writing operation is entered;
step 12, when the data type of the controller is marked as word length data
Figure FDA0003239585190000041
Time, data symbol stack E1Popping up a data symbol alpha, loading the data symbol type by the data type identification through an operator t (·), and buffering a word length B2Is stored in2And if not, marking to enter a Mark subprogram according to the data type.
7. The error protection method for the byte stream of the real-time data link based on the multi-band turing machine according to the claim 2, 3 or 4, characterized in that the Mark subprogram executes different steps for each of the read operation and the write operation; wherein:
the performing step for the read operation includes:
step 13, the step is jumped in by the read operation of the PullSym subprogram, when the data type of the controller is marked as the fixed-length data t1And the character length buffer belt B2When the memory content of (2) is not 0, the communication buffer pointed to by the controller is signed by beta0Marking the data symbol alpha as the current one, and marking the word length buffer band B after the marking is finished2Of (1) storage content l2Minus 1, length calculation band B6Non-zero data l in6Subtracting 1, the controller moves to the right;
step 14, after step 13, buffer zone B with word length2Is stored in2When the data is 0, the controller finishes marking the fixed-length data, executes validity judgment E (alpha), reads the valid data after the judgment is passed into the data symbol of the application program, and returns to the PullSym subprogram; wherein, an operator E (-) during the validity judgment represents whether the judgment data exceeds the valid range or has an abnormal value;
step 15, the step is jumped in by the read operation of the PullSym subprogram, when the data type of the controller is marked as variable-length data
Figure FDA0003239585190000051
And the character length buffer belt B2Is stored in2When not 0, the controller points to the communication buffer with a symbol beta0Will be marked as the current data symbol alpha, after marking is completed l2Decrease by 1, l6Subtracting 1, the controller moves to the right;
step 16, after step 15, buffer zone B with word length is formed2Is stored in2When the number is 0, the controller finishes marking the variable length data, executes validity judgment E (alpha), reads the valid data after the judgment is passed into the data symbol of the application program, and returns to the PullSym subprogram;
step 17, after step 13, when the controller points to the communication buffer zone B0The data symbol of the position is a blank symbol betaBHour and word length buffer zone B2Is stored in2To 0, the data type identification will be changed to null data tBThe program returns to the Main subprogram to finish the reading process; step 18, after step 15, when the data symbol of the communication buffer zone pointed by the controller is a blank symbol βBHour and word length buffer zone B2Is stored in2To 0, the data type identification will be changed to null data tBThe program returns to the Main subprogram to finish the reading process;
the step of performing for the write operation comprises:
step 19, when the data type of the controller is marked as fixed-length data t1And the character length buffer belt B2Is stored in2When not 0, the controller points toMessage buffer zone B0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 20, after step 19, buffer zone B with word length is formed2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing marked bytes into data and sending the data to a network through a TCPIP protocol;
step 21, when the data type of the controller is marked as word length data
Figure FDA0003239585190000061
And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 22, after step 21, buffer zone B with word length is formed2Is stored in2When 0, the character length buffer zone B2Loading valid data stored by the current data symbol alpha through an operator v (·), returning to a PullSym subprogram, and simultaneously writing the marked bytes into data and sending the data to a network through a TCPIP protocol;
step 23, when the data type of the controller is marked as variable-length data
Figure FDA0003239585190000062
And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 24, after step 23, buffer zone B with word length is formed2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BTagging as data symbolsNumber α, returns the PullSym subroutine, while the marked bytes will be written to data and sent to the network via TCPIP protocol;
step 25, when the data type of the controller is marked as cycle data t3And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 26, after step 25, buffer zone B with word length2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing marked bytes into data and sending the data to a network through a TCPIP protocol;
step 27, when the data type of the controller is marked as the protocol label t4And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 28, after step 27, buffer B with word length is taken2Is stored in2When 0, the controller has buffered the communication with the band B0Blank symbol of (2)BMarking as a data symbol alpha, returning to a PullSym subprogram, and simultaneously writing marked bytes into data and sending the data to a network through a TCPIP protocol;
step 29, when the data type of the controller is marked as length data t5And the character length buffer belt B2Is stored in2When not 0, the communication buffer zone B pointed by the controller0Blank symbol beta ofBWill be marked as the current data symbol alpha, after marking is completed l2Subtracting 1, the controller moves to the right;
step 30, after step 29, buffer zone B with word length is formed2Is stored in2When 0, the controller has buffered the communicationBelt B0Blank symbol of (2)BMarked as data symbol a, the PullSym subroutine is returned, while the marked bytes will be written to data and sent to the network via the TCPIP protocol.
8. The method for preventing errors of the real-time data link byte stream based on the multi-band turing machine according to the claim 2, 3 or 4, characterized in that the ReadLen sub-program executes the steps of:
step 31, when the data type is marked as word length data
Figure FDA0003239585190000071
And the character length buffer belt B2Is stored in2When not 0, the controller sets the data buffer stack E3Is in the stack state and proceeds to step 32;
step 32, the controller directed communication buffer is signed beta0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E3After marking,/2Minus 1, length calculating the non-zero data l in the band6Subtracting 1, the controller moves to the right;
after step 33, step 32 is executed, the long buffer zone B is formed2Is stored in2When the data length is 0, the controller finishes marking the word length data, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol, and stores the valid data of the data symbol alpha into a data buffer stack E3Then returning to the PullSym subprogram; wherein, an operator E (-) during the validity judgment represents whether the judgment data exceeds the valid range or has an abnormal value;
step 34, when the data type is identified as the protocol mark t4And the character length buffer belt B2Is stored in2When not 0, the controller sets the protocol position stack E5Is in the stack state and proceeds to step 35;
step 35, the controller directed communication buffer is signed beta0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the protocol location stack E5After marking,/2Decrease by 1, l6Subtracting 1, the controller moves to the right;
step 36, after step 35, buffer B with word length is taken2Is stored in2When the number is 0, the controller finishes marking the protocol mark, executes validity judgment E (alpha), reads valid data after the judgment is passed into a data symbol of the application program, and stores the valid data of the data symbol alpha into a protocol position stack E5Then returning to the PullSym subprogram;
step 37, when the data type is marked as length data t5And the character length buffer belt B2Is stored in2When not 0, the controller sets the protocol position stack E5Is in the stack state and proceeds to step 38;
step 38, the controller directs the communication buffer to be signed beta0The data symbol alpha to be marked as current, the byte pointed to by the controller is stored in the data buffer stack E3After marking,/2Decrease by 1, l6The controller moves to the right without changing;
step 39, after step 38, buffer zone B with word length is formed2Is stored in2When the data is 0, the controller finishes marking the length data, executes validity judgment E (alpha), and reads valid data after the judgment is passed into a data symbol of the application program; storing the valid data of the data symbol alpha to the data buffer stack E3Then moved to the length calculation band B6And then returns to the PullSym subroutine.
9. The method for error proofing of a real-time data link byte stream based on a multi-band turing machine according to claim 2, 3 or 4, characterized in that the ReadRan subroutine performs steps including:
step 40, when the data type is marked as cycle data t3And the character length buffer belt B2Is stored in2When not 0, the controller sets the data buffer stack E3Is in a stack entering state;
step 41, the controller directed communication buffer is signed beta0The data symbol a to be marked as current,the byte pointed to by the controller will be stored in the data buffer stack E3After marking,/2Minus 1, length calculating the non-zero data l in the band6Subtracting 1, the controller moves to the right;
step 42, the controller finishes marking the cycle data, executes validity judgment E (alpha), and reads the valid data after the judgment is passed into the data symbol; buffer data on stack E3Data storage content l ofE3Move to the word length buffer zone B2The end point r (alpha) of the number of the current cycle data is loaded into the cycle calculation band B4Data symbol stack E1Setting to a stack entering state; if the data storage content lE3If the content of (1) is 0, the read cyclic data content is 0, go to step 45, if the data storage content lE3If not, go to step 43; wherein, an operator E (-) during the validity judgment represents whether the judgment data exceeds the valid range or has an abnormal value;
step 43, when the data type is identified as cycle data t3And the character length buffer belt B2And a loop calculation band B4When the storage content of (2) is not 0, the band B is cyclically calculated4Is stored in4Is a data number of a communication protocol, can uniquely correspond to a data symbol alpha operable in a program, and adds the data symbol alpha into a data symbol stack E1Then, the content l is stored4Minus 1 if the content l is stored4Equals to the number starting point s (alpha) of the current cycle data, the process proceeds to step 44, otherwise, step 43 is executed again;
step 44, calculating the band B in a loop4Is stored in4A word length buffer zone B for numbering the start s (alpha) of the current cycle data2Is stored in2Subtracting 1, loading the numbering end point r (alpha) of the current cycle data into a cycle calculation band B4(ii) a If the content l is stored20, go to step 45, if the content l is stored2If the value is more than 0, the step 43 is carried out;
step 45, buffer zone B when word length2When the memory content of (2) is 0, the data symbol stack E1The stack pushing state is adjusted to be a stack pulling state;
step 46, word lengthBuffer zone B2When the memory content of (2) is 0, the data symbol stack E1Executing pop operation, emptying the pre-loaded data symbols, and enabling the repetition times of the data symbols in the circulation and the storage content l loaded to the data buffer stack in the ReadLen subprogramE3The consistency is achieved;
and step 47, returning to the PullSym subprogram after the pop operation is finished.
CN202111013281.0A 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine Active CN113746827B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111013281.0A CN113746827B (en) 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111013281.0A CN113746827B (en) 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine

Publications (2)

Publication Number Publication Date
CN113746827A true CN113746827A (en) 2021-12-03
CN113746827B CN113746827B (en) 2023-02-10

Family

ID=78734393

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111013281.0A Active CN113746827B (en) 2021-08-31 2021-08-31 Real-time data link byte stream error-proofing method based on multi-band turing machine

Country Status (1)

Country Link
CN (1) CN113746827B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005151492A (en) * 2003-11-20 2005-06-09 Nippon Telegr & Teleph Corp <Ntt> Method and apparatus for generating rule to deal with unauthorized access, method and apparatus for dealing with unauthorized access, and system for taking measure to stack-smashing attack
US20150261541A1 (en) * 2009-09-14 2015-09-17 Aemea, Inc. Dynamic register machine
US20170250869A1 (en) * 2014-09-12 2017-08-31 Andreas Richard Voellmy Managing network forwarding configurations using algorithmic policies
CN111061434A (en) * 2019-12-17 2020-04-24 人和未来生物科技(长沙)有限公司 Gene compression multi-stream data parallel writing and reading method, system and medium
WO2020125839A1 (en) * 2018-12-18 2020-06-25 GRID INVENT gGmbH Electronic element and electrically controlled display element

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005151492A (en) * 2003-11-20 2005-06-09 Nippon Telegr & Teleph Corp <Ntt> Method and apparatus for generating rule to deal with unauthorized access, method and apparatus for dealing with unauthorized access, and system for taking measure to stack-smashing attack
US20150261541A1 (en) * 2009-09-14 2015-09-17 Aemea, Inc. Dynamic register machine
US20170250869A1 (en) * 2014-09-12 2017-08-31 Andreas Richard Voellmy Managing network forwarding configurations using algorithmic policies
WO2020125839A1 (en) * 2018-12-18 2020-06-25 GRID INVENT gGmbH Electronic element and electrically controlled display element
CN111061434A (en) * 2019-12-17 2020-04-24 人和未来生物科技(长沙)有限公司 Gene compression multi-stream data parallel writing and reading method, system and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JACOB I. TORREY: "《Verification State-Space Reduction through Restricted Parsing Environments》", 《2015 IEEE CS SECURITY AND PRIVACY WORKSHOPS》 *

Also Published As

Publication number Publication date
CN113746827B (en) 2023-02-10

Similar Documents

Publication Publication Date Title
CN108769109B (en) Unified processing method and system for data of Internet of things heterogeneous equipment
US20200001471A1 (en) System and method for real-time robotic control
US10732608B2 (en) Translation module, processing module and control system
JPH0736123B2 (en) Equipment group control method
CN101395576B (en) A method for comparing, an automation system and a controller
CN107391366B (en) Test case generation method, test case execution method and test case execution device
CN101651679A (en) Data frame analyzing and processing system and method based on tree structure
CN109981599A (en) A kind of the general-purpose data parsing platform and method of communication data stream
EP0297248B1 (en) Look-ahead inference-type rule-based system
CN113746827B (en) Real-time data link byte stream error-proofing method based on multi-band turing machine
US20140052710A1 (en) Device and method of mass data storage based on tree structure
CN101986282A (en) Topological adaptation method and device
CN105393176B (en) Programmable controller and arithmetic processing system
CN108900396B (en) Intelligent gateway external equipment management method
JP3657315B2 (en) Portable information recording medium and access method thereof
KR101762953B1 (en) Xml post-processing hardware acceleration
CN107612919B (en) Protocol configuration method and device
CN108885612A (en) For handling the device and method through binary-coded structured documents
CN110968738A (en) Method and system for detecting nesting ring of data type template of intelligent station description file
CN107247678B (en) Programming method of CAN-LonWorks protocol conversion logic
CN109932997A (en) A kind of programmable logic controller (PLC) core system
CN111431737B (en) Predictive method for detecting data competition in software defined network
CN114968417A (en) Function calling method, device and equipment
CN114021659A (en) Circuit board material coding packaging method, device, equipment and medium
Dragayev Control algorithms of the operating mobile robot

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