Embodiment
In communication process, transmitting apparatus (data receiver) is to carry out take byte as unit to the transmission of data, in the time that the data that are transmitted exceed a byte, if not data cell composition certain format, the data that send will be difficult to received equipment (data receiver) and explain and analyze, and then cause confusion and the mistake of transfer of data.Therefore, be necessary that the form that data cell is assembled into several frames sends again.The data frame format of only guaranteeing definition is reasonable, can not only guarantee the correctness of transfer of data, and can also make to receive can be fast, effectively, safely Frame is resolved.Data receiver is split as Frame take byte as unit and sends, and data receiver receives frame data take byte as unit, but receives data side in the time resolving and analyze Frame, needs to consider following two problems:
First be to identify and receive complete Frame.For data receiver, frame data may be point some batches of arrivals, if the method not had can correctly identify frame head and postamble carries out frame synchronization, will cause the unreliable of the inefficiency of communication and communication.
Next is the fault-tolerant ability of transfer of data.In the time that transfer of data has occurred mistake during the course, system should have the error condition broken away from, return to the ability of normal condition.For example, in the time that frame data only transfer a part, because unknown failure, next frame data just start transmission, and system should be able to identify error of transmission, abandons previous Frame of makeing mistakes, and can correctly receive next Frame.It is larger that current correlation technique is processed this problem difficulty in the time of actual program, there is possibly the front portion of the front portion of first Frame and second Frame to be assembled into the situation of the data that a frame is new in result, this has just lost two frame data, the most serious the possibility of result is that system cannot be recovered from mistake, and this has just reduced the safety and reliability of system.
For solving this two problems, the present invention proposes a kind of communication means of realizing device-to-device in car body axle temperature detecting system based on state machine, this communication means is not only applicable to axle temperature detection technique field, after can or changing through simple replacement, is applicable to the technical field that needs equipment intercommunication that such as Industry Control, instrument and meter etc. are relevant yet.State machine, is often referred to finite state machine, is a kind of model with discrete input-output system, any moment it all in a specific state, the conversion of state depends on the event that system is accepted.In the time that under certain state, event occurs, system will be made reflection according to the event of input and current state, thereby determines how to process this event and whether be transformed into NextState.The trigger event of state is completed by external signal conventionally, in the time that effective trigger event occurs, just enters NextState (state transitions can certainly not occur), completes the specific tasks of this state simultaneously, until all states complete, returns initial condition.When a certain state occurs when abnormal, also returning to initial condition, wait for the appearance of next trigger event, so iterative cycles.When will increase new state and control logic in state machine, only need in state table, revise, and not relate to other module, thereby can guarantee the stability of system, so can well be expanded.
The communication means of the car body axle temperature detecting system of an embodiment of the present invention comprises receiving step and determining step.In receiving step, receiving equipment receives the axle temperature data from transmitting apparatus, wherein, axle temperature data assemble by tentation data frame format, comprise at least one in bearing temperature, ambient temperature, car type, vehicle, license number, bogie information, bearing information, compartment information, facility information and these information of state of charge, this tentation data frame format comprises several fields; In determining step, receiving equipment judges successively to these several fields, if all met the requirements, receives successfully, if the field stipulating in these several fields does not meet the requirements, returns to receiving step.Under another embodiment, in determining step, if the field stipulating in these several fields does not meet the requirements, before returning to receiving step, also next field of satisfactory field is not judged, until judged all fields.In each embodiment, receiving equipment judges field by state machine, is described as follows.
The present invention considers the feature that state machine possesses, and on the rational basis of data frame format, each field of frame format is divided into different states, referred to herein as the frame format of utilizing communication protocol between the reverse thinking define equipment of state machine.Formal definition to Frame in an embodiment of the present invention is as shown in table 1 below:
Frame head |
Destination address |
Source address |
Control domain |
Data length |
Data field |
Verification |
Postamble |
1 byte |
4 bytes |
4 bytes |
1 byte |
1 byte |
Indefinite |
1 byte |
1 byte |
The definition of table 1 data frame format
The field of the first behavior data frame format in upper table, second classifies the field length that each field allows as, and the listed field length of upper table, for for example, can also be defined as different bytes according to actual needs.In each field, first field is frame head, represents to start a new Frame; Second field is destination address, represents to receive the address of object; The 3rd field is source address, represents to send the address of object; The 4th field is control domain, is used for illustrating the purposes of packet; The 5th field is data length, is used for illustrating the length of data field; The 6th field is data field, and in the time that control domain is different, the content of data field is not identical yet; The 7th field is verification, is XOR and verification to data field; The 8th field is postamble, indicates the end of this Frame.
Due in the time defining data frame format,, according to the reverse thinking of state machine, each field of data frame format is defined as respectively to different states, so, consider that aforesaid data receiver will identify and receive complete Frame, and the fault-tolerant ability of transfer of data, here adopt the direct ideation of state machine to analyze the state of each field of data frame format, using the result that receives new data or data processing as external trigger conditions, thereby reach the object that state changes, finally complete reception and the verification of frame data.
The deterministic process that determining step relates to is: in received frame head status, judge whether to receive frame head, if so, preserve and received frame head status is changed into and receives destination address state, if not, keep received frame head status, return to receiving step; Judge whether to receive correct destination address, if so, preserving and will receive destination address state-transition is reception sources address state, if not, notifies transmitting apparatus retransmit axle temperature data and return to receiving step; Preserve complete source address, and reception sources address state is changed into and receives control domain state, proceed judgement; Preserve control domain, and will receive control domain state-transition for receiving data length state; Whether the data length that judgement receives is reasonable, if so, preserves and will receive data length state-transition for receiving data field state, if not, notifies transmitting apparatus retransmit axle temperature data and return to receiving step; Receive according to data length the data that data field is corresponding, receive data field state-transition for receiving verification state; Judge the correctness of verification, if verification is correct, receiving verification state-transition is that received frame shape of tail state continuation receive data, if check errors notifies transmitting apparatus retransmit axle temperature data and return to receiving step; Judge whether to receive correct postamble, if so, preserve and change received frame shape of tail state into reception success status for identifying correct reception data, if not, notify transmitting apparatus retransmit axle temperature data and return to receiving step.
Concrete state conversion process as shown in Figure 1, its embodied devices in system to the communication means of equipment the process to data receiver, comprise as follows:
Process 1. is not in the time starting receiving data frames or find that transfer of data is made mistakes, and system enters " received frame head status ";
Process 2., in the time receiving frame head mark, becomes " receiving destination address state ", if the data that receive are not frame head mark, continues to keep " received frame head status ";
Process 3. enters after " receiving destination address state ", if the data that receive are destination address, enters " reception sources address state ", otherwise returns to " received frame head status ";
Process 4. enters after " reception sources address state ", if receive complete source address data, enters " receiving control domain state ";
Process 5. enters after " receiving control domain state ", if receive control domain, enters " receiving data length state ";
Process 6. enters after " receiving data length state ", if the data length receiving is reasonable, enters " receiving data field state ", otherwise returns to " received frame head status ";
Process 7. enters after " receiving data field state ", receives data by the data length receiving, and receives after data, enters " receiving verification state ";
Process 8. enters after " receiving verification state ", if be verified as correctly, entered " received frame shape of tail state ", otherwise returns to " received frame head status ";
Process 9. enters after " received frame shape of tail state ", if receive correct postamble, enter " reception success status ", otherwise search and in reception buffer zone, have or not other frame head mark, if do not find frame head mark, system is returned to " received frame leader will ", otherwise should directly enter " receiving destination address state ", can improve like this Fault Tolerance, facilitate system to recover from mistake.
Communication means of the present invention adopts the reverse thinking definition communication data frame format of state machine, adopt the direct ideation of state machine to analyze the data frame format of definition, this reasonable design communication data frame format has guaranteed the correctness of transfer of data, by introducing the thought of state machine, simplify the realization of the communication protocol between equipment and analyzed difficulty, improve the reliability of communication, solve the problem of data-frame sync, improve system survivability, and because it adopts modular design, improve the portability of program, can be in different systems for example axle temperature detecting system, industrial control systems etc. are expanded.
For car body axle temperature detecting system, at it, in distribution or when maintenance phase, receiving equipment is axle temperature checkout equipment, and corresponding transmitting apparatus is portable equipment, or receiving equipment is portable equipment, and corresponding transmitting apparatus is axle temperature checkout equipment; At car body axle temperature detecting system, during in normal operational phase, receiving equipment is roadside unit, and corresponding transmitting apparatus is axle temperature checkout equipment, or receiving equipment is axle temperature checkout equipment, and corresponding transmitting apparatus is roadside unit.Further illustrate below the communication means of device-to-device in car body axle temperature detecting system of the present invention by concrete example.
Example 1:
As shown in Figure 2, car body axle temperature detecting system of the present invention comprises roadside unit 12 and axle temperature checkout equipment 11.Axle temperature checkout equipment 11 is arranged on vehicle to be detected conventionally, is for example arranged on the bogie of vehicle to be detected, or on the compartment of vehicle to be detected, or other position of vehicle to be detected.Because bearing is mounted on bogie, when axle temperature checkout equipment 11 being arranged on bogie or when other position of vehicle to be detected, in the time of vehicle operating, axle temperature checkout equipment 11 is relative with vehicle to be detected is static, is easy to detect the temperature of bearing.The axle temperature data that roadside unit 12 transmits for receiving axes temperature detector measurement equipment 11, and can be by the communication receiving to monitor network.Roadside unit 12 is connected with communication signal with axle temperature checkout equipment 11, is conventionally arranged at the lane side of vehicle operating to be detected.In a kind of realization, between roadside unit 12 and axle temperature checkout equipment 11, pass through 433MHz frequency for communication.
In the present embodiment, axle temperature checkout equipment 11 receives the axle temperature data from roadside unit 12 according to imposing a condition, these data can be the request data frame that roadside unit 12 sends, and the axle temperature data that this receives are the axle temperature data that assemble by tentation data frame format.Here, the definition of tentation data frame format is as shown in table 1, comprises several fields, the corresponding accepting state of each field, impose a condition and comprise the change according to the accepting state of last field in the front axle temperature data that once receive, determine whether to preserve current field.In a kind of specific implementation, in request data frame, the content of each field and implication are as shown in table 2 below:
Sequence number |
Field |
Byte number |
Content |
Remarks |
1 |
Frame head |
1 |
0x68 |
Fixed value |
2 |
Destination address |
4 |
0xFFFFFFFF |
Broadcast address |
3 |
Source address |
4 |
? |
The machine ID(is roadside unit ID) |
4 |
Control domain |
1 |
0x01 |
Fixed value |
5 |
Data length |
1 |
48 |
? |
6 |
Data field |
48 |
? |
To receiving the confirmation of data |
7 |
Verification |
1 |
? |
The XOR of data field and |
8 |
Postamble |
1 |
0x16 |
Fixed value |
The content of each field and implication in table 2 request data frame
In table 2, not filling out content sets according to actual needs voluntarily.As aforementioned, the respectively corresponding accepting state of each field in table 2, thereby axle temperature checkout equipment 11 is in the time receiving from the axle temperature data that send out by table 2 content of roadside unit 12, by the judgement of accepting state corresponding to field is determined to reception condition, the concrete similar aforesaid process 1-9 of receiving course, repeats no more.
Be appreciated that, in embodiment, the communication means of car body axle temperature detecting system also can comprise: roadside unit 12 receives the axle temperature data from axle temperature checkout equipment 11 according to imposing a condition, and these axle temperature data can be the reply data frames of axle temperature checkout equipment 11 request data frame that roadside equipment is sent.In a kind of specific implementation, in reply data frame, the content of each field and implication are as shown in table 3 below:
Content and the implication of each field in table 3 reply data frame
In table 3, not filling out content sets according to actual needs voluntarily.As aforementioned, the respectively corresponding accepting state of each field in table 3, thereby roadside unit 12 is in the time receiving from the axle temperature data that send out by table 3 content of axle temperature checkout equipment 11, by the judgement of accepting state corresponding to field is determined to reception condition, the concrete similar aforesaid process 1-9 of receiving course, repeats no more.
According to the present embodiment, communication between roadside unit 12 and axle temperature checkout equipment 11 is the data communication frame format based on appropriate design, thereby can guarantee the correctness of transfer of data, and by introducing the method for finite state machine, realization and the analysis of agreement are simplified, improve the reliability of the communication of each equipment in axle temperature detecting system, made communication process there is higher fault-tolerant ability simultaneously.In addition, as the content of the data field of table 3 remarks, axle temperature checkout equipment 11 not only can send roadside unit 12 to the axle temperature data that detect, also the relevant information of axle temperature checkout equipment 11 vehicles to be detected of living in is also sent to roadside unit 12, these relevant informations can prestore in advance and be stored in axle temperature checkout equipment 11, thereby, roadside unit 12 can by with the communicating by letter of axle temperature checkout equipment 11, automatically obtain the information of vehicle to be detected, without artificial manual by the Data Enter roadside unit 12 of vehicle to be detected.
Embodiment 2:
As shown in Figure 3, axle temperature detecting system of the present invention comprises axle temperature checkout equipment 11 and portable equipment 13.The functional meaning similar embodiment 1 of axle temperature checkout equipment 11, does not repeat.Portable equipment 13 is mainly used in the distribution of axle temperature detecting system and the maintenance to axle temperature checkout equipment 11.Portable equipment 13 can be the mobile devices such as such as PDA, between itself and axle temperature checkout equipment 11, is connected by communication signal.For example, portable equipment 13 is communicated by letter with axle temperature checkout equipment 11 by 125KHz frequency, and object is to wake axle temperature checkout equipment 11 up, and now, portable equipment 13 is for arranging the parameter of axle temperature checkout equipment 11; Again for example, between portable equipment and axle temperature checkout equipment 11, intercom mutually by 433MHz frequency, now, portable equipment 13 is for reading the axle temperature data of axle temperature checkout equipment 11.
For portable equipment 13 for the situation of parameter of axle temperature checkout equipment 11 is set, in the present embodiment,
This communication process is that portable equipment 13 sends request parameters Frame to axle temperature checkout equipment 11, axle temperature checkout equipment 11 receives the request parameters Frame from portable equipment 13 according to imposing a condition, and this request parameters Frame is the axle temperature data that assemble by tentation data frame format.In a kind of specific implementation, in request parameters Frame, content and the implication of each field are as shown in table 4 below:
Sequence number |
Field |
Byte number |
Content |
Remarks |
1 |
Frame head |
1 |
0x68 |
Fixed value |
2 |
Destination address |
4 |
0xFFFFFFFF |
Broadcast address |
3 |
Source address |
4 |
? |
The machine ID(is portable device id) |
4 |
Control domain |
1 |
0x08 |
Fixed value |
5 |
Data length |
1 |
48 |
? |
6 |
Data field |
48 |
(content of similar table 3) |
? |
7 |
Verification |
1 |
? |
The XOR of data field and |
8 |
Postamble |
1 |
0x16 |
Fixed value |
Table 4 is asked content and the implication of each field in parameters Frame
In table 4, not filling out content sets according to actual needs voluntarily.As aforementioned, the respectively corresponding accepting state of each field in table 4, thereby axle temperature checkout equipment 11 is in the time receiving from the axle temperature data that send out by table 4 content of portable equipment 13, by the judgement of accepting state corresponding to field is determined to reception condition, the concrete similar aforesaid process 1-9 of receiving course, repeats no more.
Correspondingly, portable equipment 13 is gone back the response parameters Frame of the request parameters Frame of receiving axes temperature detector measurement equipment 11 to its transmission, that is to say, axle temperature checkout equipment 11 sends response parameters Frame by tentation data frame format, and then portable equipment 13 receives response parameters Frame according to imposing a condition.In a kind of specific implementation, in this response parameters Frame, content and the implication of each field are as shown in table 5 below:
Table 5 responds content and the implication of each field in parameters Frame
In table 5, not filling out content sets according to actual needs voluntarily.As aforementioned, the respectively corresponding accepting state of each field in table 5, thereby portable equipment 13 is in the time receiving from the axle temperature data that send out by table 5 content of axle temperature checkout equipment 11, by the judgement of accepting state corresponding to field is determined to reception condition, the concrete similar aforesaid process 1-9 of receiving course, repeats no more.
For portable equipment 13 for reading the axle temperature data of axle temperature checkout equipment 11, in the present embodiment, this communication process is that portable equipment 13 sends request to axle temperature checkout equipment 11 Frame that gets parms, axle temperature checkout equipment 11 receives the acquisition request supplemental characteristic frame from portable equipment 13 according to imposing a condition, and this acquisition request supplemental characteristic frame is the axle temperature data that assemble by tentation data frame format.In a kind of specific implementation,
In acquisition request supplemental characteristic frame, content and the implication of each field are as shown in table 6 below:
Sequence number |
Field |
Byte number |
Content |
Remarks |
1 |
Frame head |
1 |
0x68 |
Fixed value |
2 |
Destination address |
4 |
0xFFFFFFFF |
Broadcast address |
3 |
Source address |
4 |
? |
The machine ID(is portable device id) |
4 |
Control domain |
1 |
0x09 |
Fixed value |
5 |
Data length |
1 |
? |
? |
6 |
Data field |
48 |
(content of similar table 3) |
? |
7 |
Verification |
1 |
? |
The XOR of data field and |
8 |
Postamble |
1 |
0x16 |
Fixed value |
Content and the implication of each field in table 6 acquisition request supplemental characteristic frame
In table 6, not filling out content sets according to actual needs voluntarily.As aforementioned, the respectively corresponding accepting state of each field in table 6, thereby axle temperature checkout equipment 11 is in the time receiving from the axle temperature data that send out by table 4 content of portable equipment 13, by the judgement of accepting state corresponding to field is determined to reception condition, the concrete similar aforesaid process 1-9 of receiving course, repeats no more.
Correspondingly, the response that portable equipment 13 is gone back the acquisition request supplemental characteristic frame of receiving axes temperature detector measurement equipment 11 to its transmission Frame that gets parms, that is to say, axle temperature checkout equipment 11 sends and responds the Frame that gets parms by tentation data frame format, and then portable equipment 13 receives and responds the Frame that gets parms according to imposing a condition.In a kind of specific implementation, this response content and implication of each field that get parms in Frame is as shown in table 7 below:
Table 7 responds content and the implication of each field in the Frame that gets parms
In table 7, not filling out content sets according to actual needs voluntarily.As aforementioned, the respectively corresponding accepting state of each field in table 5, thereby portable equipment 13 is in the time receiving from the axle temperature data that send out by table 5 content of axle temperature checkout equipment 11, by the judgement of accepting state corresponding to field is determined to reception condition, the concrete similar aforesaid process 1-9 of receiving course, repeats no more.
According to the present embodiment, communication between portable equipment 13 and axle temperature checkout equipment 11 is the data communication frame format based on appropriate design, thereby can guarantee the correctness of transfer of data, and by introducing the method for finite state machine, realization and the analysis of agreement are simplified, improve the reliability of the communication of each equipment in axle temperature detecting system, made communication process there is higher fault-tolerant ability simultaneously.In addition, as the content of the data field of table 3 remarks, portable equipment 13 can carry out relative parameters setting to axle temperature checkout equipment 11, axle temperature checkout equipment 11 also can send to portable equipment 13 by the relevant information of self pre-stored axle temperature checkout equipment 11 vehicle to be detected of living in, thereby, portable equipment 13 can by with the communicating by letter of axle temperature checkout equipment 11, automatically obtain the information of vehicle to be detected, without artificial manual by the Data Enter portable equipment 13 of vehicle to be detected.
Based on aforementioned exemplary, an embodiment of the present invention also provides a kind of car body axle temperature detecting system and the receiving equipment for this system.This receiving equipment comprises: receiver module, and for receiving the axle temperature data that send from transmitting apparatus, wherein, axle temperature data assemble by tentation data frame format, and tentation data frame format comprises several fields; The first judge module, for these several fields are judged successively, if all met the requirements, is judged as and receives successfully, if the field stipulating in these several fields does not meet the requirements, triggers receiver module and again receives.In another embodiment, receiving equipment also comprises the second judge module, when judging that at the first judge module field that these several fields stipulate does not meet the requirements, before triggering receiver module receives again, also next field of satisfactory field is not judged, until judged all fields.In embodiment, when car body axle temperature detecting system is in distribution or when maintenance phase, receiving equipment is axle temperature checkout equipment, and transmitting apparatus is portable equipment, or receiving equipment is portable equipment, and transmitting apparatus is axle temperature checkout equipment; When car body axle temperature detecting system is during in normal operational phase, receiving equipment is roadside unit, and transmitting apparatus is axle temperature checkout equipment, or receiving equipment is axle temperature checkout equipment, and transmitting apparatus is roadside unit.The specific implementation process of each module can, with reference to the corresponding steps in aforementioned communication embodiment of the method, not repeat at this.
It will be appreciated by those skilled in the art that, in above-mentioned execution mode, all or part of step of the whole bag of tricks can be carried out instruction related hardware by program and completes, this program can be stored in a computer-readable recording medium, and storage medium can comprise: read-only memory, random asccess memory, disk or CD etc.
Above content is in conjunction with concrete execution mode further description made for the present invention, can not assert that specific embodiment of the invention is confined to these explanations.For general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, can also make some simple deduction or replace.