Disclosure of Invention
The invention provides a dynamic analysis method of locomotive event data, which comprises the following steps,
s1: the ground equipment reads the locomotive description file, extracts description information including a communication bus type, a communication port number, a data frame identification code group, a variable name, a variable position, a data processing formula and a disposal condition, compiles the description information to generate a description code stream, and transmits the description code stream to the vehicle-mounted equipment in an Ethernet mode;
s2: the vehicle-mounted equipment creates a data frame management class, a data variable management class, an event management class and a global management data dictionary according to the description code stream;
s3: the method comprises the steps that a vehicle-mounted device starts a thread group comprising a plurality of threads, each thread monitors a bus for transmitting locomotive test data and reads a test data stream on the bus, detects data frame identification code groups in the test data stream, judges whether data between two data frame identification code groups in the test data stream are complete data frames or not, stores the complete data frames, and discards incomplete data frames;
s4: analyzing the message content of the data frame according to the created data frame management class, the created data variable management class and the created event management class, extracting associated data and filling a global management data dictionary; then, in the global management data dictionary range, executing dynamic interpretation description scripts of a data variable management class and an event management class to realize dynamic operation triggered by data variables or events;
s5: and performing engineering range conversion on the dynamic operation result and storing the dynamic operation result into a data variable management class for further processing by a subsequent program.
Further, the locomotive description file is an excel file, each sheet page of the locomotive description file comprises all bus communication data description information of one locomotive type, the description information comprises a locomotive data effective judgment condition, a data frame structure, a data variable name and an event trigger signal, and the information of each entry comprises a communication bus type, a communication port index, a data frame identification code group, a variable name, a position of a variable in a data frame, an engineering transformation formula and an execution software script when the variable needs to perform linkage action.
Furthermore, the attribute members of the data frame management class include an identification code group sequence of the data frame, a data frame number, a data frame length, a data frame content, a data frame code group mask, a detection parameter index included in the data frame, a detection event index included in the data frame, and a data frame change indication; the method member of the data frame management class comprises the steps of updating the data content of the instance object of the data frame management class, acquiring the included detection parameter index, acquiring the included detection event index and producing the data frame mask.
The attribute members of the data variable management class comprise a global number, a bus type, a bus interface index number, a variable name character string, an identification code sequence of a data frame, a data type, a start byte of an example object of the data variable management class in a data frame message, a start bit in the start byte, a bit length of the example object of the data variable management class, a byte order, a bus maximum value, a bus minimum value, an engineering quantity maximum value, an engineering quantity minimum value, a change filtering threshold value, a valid judgment function script, a conversion expression function script, a default return value, a current latest value, a change indication mark and a needed conversion mark; the method members of the data variable management class comprise a class object assignment reloading method and a class printing output reloading method.
The attribute members of the trigger event management class comprise a global event number, a bus type, a bus interface index number, an event mode, a data frame identification code sequence to which the trigger event management class belongs, a data type, a starting byte of an instance object of the trigger event management class in a data frame message, a starting bit in the starting byte, a bit length, a byte order, an event judgment function script, an event name, an event ID code value and a current event state; the method members of the trigger event management class comprise a class object assignment reloading method and a class printing output reloading method.
The global management data dictionary comprises a global detection variable parameter dictionary and a global event dictionary, wherein the global detection variable parameter dictionary is used for linking multi-bus and multi-port data variables, the index (Key) of the global detection variable parameter dictionary is the name of the variable, the content (body) of the global detection variable parameter dictionary is the class object of the variable, the index (Key) of the global event dictionary is the name of the event, and the content (body) of the global event dictionary is the class object of the event.
The invention provides a locomotive event data dynamic analysis method, which is suitable for a locomotive event data recording and processing system, wherein a locomotive description file is used for storing description information such as a communication bus type, a communication port number, a data frame identification code group, a variable name, a variable position, a data processing formula, a handling condition and the like, each description information corresponds to various buses and data transmission protocols of the buses, information in the locomotive description file is read by ground equipment and transmitted to vehicle-mounted equipment, and the vehicle-mounted equipment creates a data frame management class, a data variable management class, an event management class and a global management data dictionary according to the description information and then extracts, processes and stores the locomotive event information. When the data acquisition system on the locomotive is adjusted, the data analysis requirement can be met only by modifying the description file of the locomotive without modifying the software of the vehicle-mounted equipment and the ground equipment, the test requirement of the data recording and processing system is reduced, the cost is saved, the service boundary between a locomotive integration unit and a data recording and processing system supply unit is clearer, and the risk of disclosure of the locomotive integration unit is reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be 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 some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As shown in fig. 1, the present invention provides a method for dynamically analyzing locomotive event data, comprising the following steps,
s1: the ground equipment reads the locomotive description file, extracts description information including a communication bus type, a communication port number, a data frame identification code group, a variable name, a variable position, a data processing formula and a disposal condition, compiles the description information to generate a description code stream, and transmits the description code stream to the vehicle-mounted equipment in an Ethernet mode;
s2: the vehicle-mounted equipment creates a data frame management class, a data variable management class, an event management class and a global management data dictionary according to the description code stream;
s3: the method comprises the steps that a vehicle-mounted device starts a thread group comprising a plurality of threads, each thread monitors a bus for transmitting locomotive test data and reads a test data stream on the bus, detects data frame identification code groups in the test data stream, judges whether data between two data frame identification code groups in the test data stream are complete data frames or not, stores the complete data frames, and discards incomplete data frames;
s4: analyzing the message content of the data frame according to the created data frame management class, the created data variable management class and the created event management class, extracting associated data and filling a global management data dictionary; then, in the global management data dictionary range, executing dynamic interpretation description scripts of a data variable management class and an event management class to realize dynamic operation triggered by data variables or events;
s5: and performing engineering range conversion on the dynamic operation result and storing the dynamic operation result into a data variable management class for further processing by a subsequent program.
The invention provides a locomotive event data dynamic analysis method, which is suitable for a locomotive event data recording and processing system, wherein a locomotive description file is used for storing description information such as a communication bus type, a communication port number, a data frame identification code group, a variable name, a variable position, a data processing formula, a handling condition and the like, each description information corresponds to various buses and data transmission protocols of the buses, information in the locomotive description file is read by ground equipment and transmitted to vehicle-mounted equipment, and the vehicle-mounted equipment creates a data frame management class, a data variable management class, an event management class and a global management data dictionary according to the description information and then extracts, processes and stores the locomotive event information. When the data acquisition system on the locomotive is adjusted, the data analysis requirement can be met only by modifying the description file of the locomotive without modifying the software of the vehicle-mounted equipment and the ground equipment, the test requirement of the data recording and processing system is reduced, the cost is saved, the service boundary between a locomotive integration unit and a data recording and processing system supply unit is clearer, and the risk of disclosure of the locomotive integration unit is reduced.
Further, the locomotive description file is an excel file, each sheet page of the locomotive description file comprises all bus communication data description information of one locomotive type, the description information comprises a locomotive data effective judgment condition, a data frame structure, a data variable name and an event trigger signal, and the information of each entry comprises a communication bus type, a communication port index, a data frame identification code group, a variable name, a position of a variable in a data frame, an engineering transformation formula and an execution software script when the variable needs to perform linkage action.
As shown in table 1, when the type is device, the in-vehicle apparatus itself is described, and when the line valid condition expression is established, that is, alm [ "alm 1" ] ═ 1, that is, an event named alm1 occurs, the in-vehicle apparatus starts recording. When the type is msg, a data frame on a bus is described, the port type of the row describes the bus type of the data frame, and the port type CAN be a CAN bus, an Ethernet bus, an RS485 bus or an MVB bus; the data frame identification code group describes the identification information of the frame, for example, the CAN data frame is a CAN frame ID, the ethernet data packet is a comID of the TRDP protocol, or an identification word of other protocols; the MVB bus is source port information of the MVB, etc. The mode information describes the data part byte length of the frame. When the type is status, each row describes a locomotive parameter variable, the port type describes which bus the parameter variable comes from, the data frame identification code group describes the data frame the parameter variable comes from, the mode is used for describing the byte order (big end order or small end order) for acquiring the parameter variable, and the variable name is used for describing the engineering use name of the parameter variable, so that the identification of people is facilitated; the data type describes the type of the parameter variable; the starting byte describes the starting byte position of the parameter variable in the data frame; the start bit describes the start bit sequence of the parameter variable in the start byte; the bit length describes the data bit length of the parameter variable; a valid conditional expression describes a decision expression that the parameter variable is valid, for example, a conditional decision expression status [ "status1" ] ═ 1 for a parameter variable named status3 describes that status3 is valid when the value of the parameter variable named status1 is 1, and is invalid otherwise. The numerical value linkage expression describes a script function of linkage or mathematical conversion of the parameter variable and other parameter variables, for example, the numerical value linkage expression status [ "status1" ] × 2+ status [ "status 2" ] corresponding to the name status3 indicates that the status3 is the sum of twice of the status1 and the status2, common calculations can be compiled in a description file, and the script function can be adapted only by modifying the description file when the data relation on the locomotive changes or the data converter is updated. When the type is alm, a trigger event is described, the description content is basically similar to that of a status type, and the difference is that the mode field description is divided into three types of RT, FT and EQ, which respectively represent a rising edge trigger, a falling edge trigger of a bit variable, and an expression decision condition of an arbitrary variable. The user can realize the analysis of any port, any variable and any event only by filling the description file according to the design document, and can realize the linkage operation between the variable and the event through the convenient script function.
Table 1 partial information of a sheet page of a locomotive description file
Furthermore, the attribute members of the data frame management class include an identification code group sequence of the data frame, a data frame number, a data frame length, a data frame content, a data frame code group mask, a detection parameter index included in the data frame, a detection event index included in the data frame, and a data frame change indication; the method member of the data frame management class comprises the steps of updating data content contained in an instance object of the data frame management class, obtaining a detection parameter index contained in the instance object, obtaining a detection event index contained in the instance object and producing a data frame mask.
The attribute members of the data variable management class comprise a global number, a bus type, a bus interface index number, a variable name character string, an identification code sequence of a data frame, a data type, a start byte of an example object of the data variable management class in a data frame message, a start bit in the start byte, a bit length of the example object of the data variable management class, a byte order, a bus maximum value, a bus minimum value, an engineering quantity maximum value, an engineering quantity minimum value, a change filtering threshold value, a valid judgment function script, a conversion expression function script, a default return value, a current latest value, a change indication mark and a needed conversion mark; the method members of the data variable management class comprise a class object assignment reloading method and a class printing output reloading method.
The attribute members of the trigger event management class comprise a global event number, a bus type, a bus interface index number, an event mode, a data frame identification code sequence to which the trigger event management class belongs, a data type, a starting byte of an instance object of the trigger event management class in a data frame message, a starting bit in the starting byte, a bit length, a byte order, an event judgment function script, an event name, an event ID code value and a current event state; the method members of the trigger event management class comprise a class object assignment reloading method and a class printing output reloading method.
The global management data dictionary comprises a global detection variable parameter dictionary and a global event dictionary, wherein the global detection variable parameter dictionary is used for linking multi-bus and multi-port data variables, the index (Key) of the global detection variable parameter dictionary is the name of the variable, the content (body) of the global detection variable parameter dictionary is the class object of the variable, the index (Key) of the global event dictionary is the name of the event, and the content (body) of the global event dictionary is the class object of the event.
The structural attribute design of the class is consistent with the communication parameter design definition of a locomotive network engineering designer to the maximum extent, the use names are consistent, and the learning complexity of the engineering designer to the description file can be reduced. Data frames, variable parameters (signals) and events are subjected to class-level abstraction, any plurality of objects can be instantiated from the abstraction, and therefore the processing of the same class is unified. Because the memory structures of the same object are consistent, some memory carrying processing can be faster and more efficient. After the class is uniformly defined, if communication parameters are required to be adjusted in the future, the attribute or the modification method only needs to be modified in the class, so that various changes can be corresponded, and the program modification amount is minimum.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.