Interface data processing method and device, electronic equipment and medium

By constructing a state dictionary and calculating device states hierarchically, the problem of instability in the interface conversion program was solved, the efficiency of interface data processing and the accuracy of device state calculation were improved, and the compilation of device state rules was simplified.

CN116902041BActive Publication Date: 2026-01-16CRSC URBAN RAIL TRANSIT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310721086.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-16
Publication Date
2026-01-16
Estimated Expiration
2043-06-16

AI Technical Summary

Technical Problem

In existing technologies, the interface conversion program is unstable, which affects the efficiency of interface data processing and makes it impossible to respond quickly to changes in user needs.

Method used

By determining the target parameters of the target device, constructing a state dictionary, and calculating the device state hierarchically based on the serialized interface data, the current state information of the virtual device is used to quickly obtain and update the device state, thereby realizing hierarchical calculation of the device state.

Benefits of technology

It improves the efficiency of interface data processing, simplifies the compilation of device status calculation rules, ensures the timeliness and accuracy of device status information, and reduces the possibility of duplicate calculations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116902041B_ABST
    Figure CN116902041B_ABST
Patent Text Reader

Abstract

The application provides an interface data processing method and device, electronic equipment and medium. The method comprises the following steps: determining all target parameters of a target device, wherein the target parameters are used to indicate parameters related to state calculation of the target device; in the case that at least part of the target parameters exist in a state dictionary corresponding to the target device, determining current state information of a first virtual device corresponding to the target device based on the at least part of the target parameters, wherein the state dictionary is constructed based on serialized interface data; and determining current state information of the target device based on the current state information of the first virtual device. The interface data processing method and device, electronic equipment and medium provided by the application can improve the processing efficiency of interface data.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of rail transit technology, and in particular to an interface data processing method and device, electronic equipment and a medium. BACKGROUND

[0002] An intelligent operation and maintenance system is an important device for signal system device state monitoring and full life cycle management. The intelligent operation and maintenance system uses cloud platforms, big data processing and communication technologies to complete centralized monitoring, fault disposal, analysis and prediction and production management of all devices of the signal system. The interface program of the intelligent operation and maintenance system needs to process a large amount of input data in real time and calculate device state information that users are concerned about. Since the state of the device is related to multiple interface data, and the conversion rule can change, it needs to be specified by the user.

[0003] The conventional interface conversion program needs to write a corresponding conversion module for the conversion rule, and the format of the input data is very strict. The development process of the conventional interface conversion program is long, and due to the reasons such as many devices to be converted, uncertain conversion rules, etc., the interface conversion program needs to be frequently modified and adapted, which cannot quickly respond to changes in user requirements, resulting in that the interface data processing efficiency is affected. SUMMARY

[0004] The present application provides an interface data processing method, device, electronic equipment and medium to solve the technical problem that the interface conversion program is unstable in the prior art, resulting in that the interface data processing efficiency is affected.

[0005] The present application provides an interface data processing method, comprising:

[0006] determining all target parameters of a target device, the target parameters being used to indicate parameters related to state calculation of the target device;

[0007] in a case where at least part of the target parameters exist in a state dictionary corresponding to the target device, determining current state information of a first virtual device corresponding to the target device based on the at least part of the target parameters, the state dictionary being constructed based on serialized interface data;

[0008] determining current state information of the target device based on the current state information of the first virtual device.

[0009] In some embodiments, after the current state information of the first virtual device corresponding to the target device is determined based on the at least part of the target parameters, the method further comprises:

[0010] In a case where a time length between a first time and a second time is not more than a first time length, the current state information of the first virtual device is determined as valid information, the second time is earlier than the first time, the first time is an update time of the current state information of the first virtual device, and the second time is an update time of previous state information of the first virtual device.

[0011] The previous state information of the first virtual device is updated as the current state information of the virtual device.

[0012] In some embodiments, the current state information of the target device is determined based on the current state information of the first virtual device, including:

[0013] Intermediate state information of the target device is determined based on the current state information of the first virtual device.

[0014] Current state information of a second virtual device corresponding to the target device is determined based on parameters other than the at least part of the target parameters in the all target parameters.

[0015] The current state information of the target device is determined based on the intermediate state information and the current state information of the second virtual device.

[0016] In some embodiments, after the current state information of the target device is determined based on the current state information of the first virtual device, the method further includes:

[0017] In a case where a time length between a third time and a fourth time is not more than a second time length, the current state information of the target device is determined as valid information, the fourth time is earlier than the third time, the third time is an update time of the current state information of the target device, and the fourth time is an update time of previous state information of the target device.

[0018] The previous state information of the target device is updated as the current state information of the target device.

[0019] In some embodiments, after the current state information of the target device is determined based on the current state information of the first virtual device, the method further includes:

[0020] The state dictionary is updated based on the current state information of the target device.

[0021] In some embodiments, after the current state information of the target device is determined based on the current state information of the first virtual device, the method further includes:

[0022] determine whether the state information of the target device changes based on the current state information of the target device and the last state information of the target device;

[0023] determine one or more of device change information and alarm information in a case where the state information of the target device changes.

[0024] The application further provides an interface data processing apparatus, comprising:

[0025] a first determining module configured to determine all target parameters of a target device, the target parameters being used to indicate parameters related to state calculation of the target device;

[0026] a second determining module configured to determine current state information of a first virtual device corresponding to the target device based on at least part of the target parameters in a case where the at least part of the target parameters exist in a state dictionary corresponding to the target device, the state dictionary being constructed based on serialized interface data;

[0027] a third determining module configured to determine current state information of the target device based on the current state information of the first virtual device.

[0028] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the interface data processing method as described above when executing the program.

[0029] The application further provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program being executable on a processor to implement the interface data processing method as described above.

[0030] The application further provides a computer program product comprising a computer program, the computer program being executable on a processor to implement the interface data processing method as described above.

[0031] The interface data processing method, apparatus, electronic device, and medium provided by the application can quickly obtain at least part of parameters related to state calculation of a target device by converting interface data into a state dictionary, greatly improving the efficiency of interface data processing, and then determining state information of a corresponding first virtual device based on the at least part of target parameters, and calculating the state information of the target device, implementing hierarchical calculation of device state, effectively processing data of a change type big data interface with a small memory overhead; hierarchical calculation of device state also greatly simplifies the difficulty of device state calculation rule compilation. BRIEF DESCRIPTION OF DRAWINGS

[0032] In order to more clearly illustrate the technical solutions in the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the accompanying drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort on the basis of these drawings.

[0033] Figure 1 is one of the flowcharts of the interface data processing method provided by the present application.

[0034] Figure 2 is another flowchart of the interface data processing method provided by the present application.

[0035] Figure 3 is a structural schematic diagram of the interface data processing device provided by the present application.

[0036] Figure 4 is a structural schematic diagram of the electronic device provided by the present application. DETAILED DESCRIPTION

[0037] In order to make the objectives, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below with reference to the accompanying drawings in the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort belong to the protection scope of the present application.

[0038] The interface data processing method, device, electronic device and medium of the present application will be described below with reference to the accompanying drawings.

[0039] In the related art, the interface conversion program in the intelligent operation and maintenance system needs to analyze a large amount of interface data received by the Automatic Train Supervision (ATS) interface in real time, and calculate the state information of a large number of devices in real time according to user demand, and send the state information and alarm information of the devices to the front-end program to display to the user. At the same time, it is necessary to record the received data and sent data in real time to facilitate the analysis of interface faults in the later stage. The interface conversion program has requirements for real-time performance and stability of operation, and the speed of data processing of the interface conversion program must be very fast and error protection must be done well.

[0040] Figure 1 is one of the flowcharts of the interface data processing method provided by the present application. With reference to Figure 1 the interface data processing method provided by the present application includes steps 110, 120 and 130.

[0041] Step 110, all target parameters of the target device are determined, and the target parameters are used to indicate parameters related to state calculation of the target device;

[0042] Step 120, in the case that at least part of the target parameters exist in the state dictionary corresponding to the target device, the current state information of the first virtual device corresponding to the target device is determined based on the at least part of the target parameters, and the state dictionary is constructed based on the interface data after serialization processing;

[0043] Step 130, the current state information of the target device is determined based on the current state information of the first virtual device.

[0044] It should be noted that the execution subject of the interface data processing method provided by the present application can be an electronic device, a component in the electronic device, an integrated circuit, or a chip. The electronic device can be a mobile electronic device or a non-mobile electronic device. Illustratively, the mobile electronic device can be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., and the present application is not limited in this regard.

[0045] The technical solutions of the present application will be described in detail below with the computer capable of running the interface conversion program as an example.

[0046] In actual execution, the communication between the data acquisition module and the collected device adopts a Client / Server mode based on the Transmission Control Protocol (TCP), the collected device is the Server end, and the data acquisition module is the Client end. The collected device sends state information to the data acquisition module in real time according to the state change of itself, and sends heartbeat information to the data acquisition module at regular intervals.

[0047] The interface data processing method provided by the present application will be described below with the data acquisition module as an intelligent operation and maintenance system and the collected device as an ATS system as an example.

[0048] According to the given communication protocol, the Ethernet interface of the intelligent operation and maintenance system can receive the data stream sent by the ATS system at a fixed frequency, convert the data stream into a character stream, and store it according to the JS object mark (JavaScript Object Notation, JSON) data format. The data stream can be ATS system maintenance information, which can include ATS system information data, application data, alarm data, etc. The specific process is as follows:

[0049] In actual execution, the communication between the ATS system and the intelligent operation and maintenance system adopts the C / S mode based on TCP, and adopts a unified information frame format. The information frame format usually includes frame header, frame content length, frame content, and frame tail identification.

[0050] When the ATS system and the intelligent operation and maintenance system perform interface data communication, due to the large length of the information frame (about 150KB), the Ethernet interface of the intelligent operation and maintenance system actually receives the interface data in the form of packet and sticky packet.

[0051] When the Ethernet interface of the intelligent operation and maintenance system parses the data according to the given communication protocol, it first needs to obtain the data frame according to the frame header, frame length, and frame tail, and then serializes the interface data in JSON data format, and then stores the serialized interface data in the Kafka interface.

[0052] Among them, Kafka is a partitionable message system, the interface for obtaining messages is the Kafka interface, and messages are summarized in units of topics. JSON data format is a lightweight data exchange format that uses a text format completely independent of programming language to store and represent data.

[0053] It can be understood that data parsing is based on the communication protocol and is parsed layer by layer into the corresponding data structure according to the encapsulation structure of the data. Each data frame includes multiple data packets, each data packet corresponds to the data of multiple devices, and each device data has multiple formats. In actual execution, the amount of parsed data is very large and chaotic, up to tens of thousands of lines, and it is very difficult and time-consuming to find the status information of the target device.

[0054] Because each type of signal corresponding to the interface data has a lot of information per frame, if the information is not directly translated and stored in JSON format, a dictionary nested array data structure will be obtained.

[0055] The following source program is an example of parsing ATS interface data without converting JSON data.

[0056]

[0057]

[0058] And the interface data corresponding information directly into the state dictionary, this is not conducive to the rapid reading of the corresponding data, will cause the interface conversion program conversion data time-consuming too much, so need to interface data serialization processing, extraction information as a key part of the content, and the information feature value extraction, as the key value, so that the information conversion dictionary, stored in the Kafka interface. If part of the information content contains a sequence of information, the key information also needs to be extracted and converted into a dictionary as a key value.

[0059] It should be noted that the state dictionary can be used as a key to the device name, and the state information corresponding to the device as a value, i.e. the state value. It can be understood that the device name can be set according to the actual situation, which is not specifically limited here; for example: it can be a certain site-uplink, a certain site-car terminal or a certain site-extension, etc. The state value can include the target parameter and the state information corresponding to the target parameter. The state dictionary is used to indicate the state-related information of a plurality of devices parsed from the received interface data, for example, it can be the state information of all devices related to the ATS system. The state dictionary can be dynamically updated in real time.

[0060] The target parameter can be set according to the device attribute and actual demand, for example: the target parameter can be: region number, station type, event name or device event time, server status, central processor status, etc.

[0061] The state information corresponding to the target parameter can be set according to the target parameter, which is not specifically limited here, for example: the state information corresponding to the server status can be "normal", "alarm" or "unknown state", etc. The state information corresponding to the region number is the actual number corresponding to the region.

[0062] The information in the state dictionary can also be flattened, and the target parameter participating in the calculation can be quickly obtained during conversion calculation, greatly improving the efficiency of interface data processing.

[0063] The following source program is an example of JSON data after the ATS interface data extracts the key information and converts the interface data sequence to a dictionary.

[0064]

[0065]

[0066] According to the actual needs of users, a device conversion data table can be input, which is used to represent the table data configured by users to convert the demand, and can include the devices concerned by users, the state calculation rules corresponding to the devices and the target parameters related to the state calculation.

[0067] The contents included in the device conversion data table can be as shown in Table 1 or Table 2.

[0068] Table 1

[0069]

[0070] Table 2

[0071]

[0072] Wherein, params is a parameter table; eval is a calculation formula of the device state (supporting all single-line program statements of PYTHON); dict is a conversion dictionary of the calculation result; name is an internal name of the virtual device, facilitating caching the state value of the virtual device; identify is a parameter screening formula, used to determine the value of the state calculation parameter actually participating in the calculation when there is only one parameter but actually multiple parameters.

[0073] In actual execution, the device conversion rule corresponding to the JSON file can be generated by identifying the file corresponding to the device conversion data table, and then the device conversion rule corresponding to the JSON file is further read to determine all target parameters corresponding to the target device and the state calculation rule related to the device state calculation. The device conversion rule can be determined according to user demand, for example: a parameter threshold exceeding 80% is considered as a device fault, or multiple parameters all meet the condition to consider that the device is normally running, which is not specifically limited here.

[0074] In this step, after the interface conversion program reads the information frame transmitted by the interface, it is stored in the form of dictionary nesting. Then the state dictionary corresponding to the information frame is flattened to facilitate reading of the target parameter. After obtaining the flattened state dictionary, based on the device conversion data table, the target device that needs to be calculated can be determined, and then the parameters related to the state calculation of the target device are obtained in the state dictionary.

[0075] Since the interface data of the ATS is large, the actual data received is change data, only part of the type information in a packet of data, and the other part of the information is empty, so the state of the device needs to cache the intermediate state data and perform hierarchical calculation.

[0076] It can be understood that there are many target parameters related to the state calculation of the target device, but they cannot be received all at once, may be received in batches, and it cannot be guaranteed that the state data of the target parameters corresponding to the target device are refreshed every cycle, so only part of the data received can be updated, and the data not received is not updated temporarily.

[0077] When only part of the target parameters exist in the interface data and only part of the target parameters exist in the state dictionary, the intermediate state of the target device can be calculated according to the at least part of the target parameters. The intermediate state can be used to indicate the state information of the virtual device corresponding to the target device. The target device can include a plurality of virtual devices, and the specific number is not limited (the maximum number in the current engineering application is 24).

[0078] In actual execution, the interface conversion program first calculates the device state of the first virtual device corresponding to the target parameters according to the at least part of the target parameters obtained from the state dictionary. It is required that the target parameters participating in the state calculation belong to the same information type.

[0079] If the parameters related to the state calculation of the target device do not exist in the state dictionary, the last state information of the corresponding virtual device is kept unchanged.

[0080] In one cycle, after obtaining the current state information of all virtual devices, the current state information of the aggregation device, that is, the target device, can be calculated.

[0081] If the target parameters participating in the calculation are empty in this calculation, that is, only part of the target parameters are unknown or all the target parameters are unknown, the last state information of the aggregation device is kept unchanged.

[0082] The interface data processing method provided by the application can quickly obtain at least part of the parameters for calculating the state of the target device by converting the interface data into the state dictionary, greatly improving the efficiency of interface data processing, and then determining the state information of the corresponding first virtual device according to at least part of the target parameters, and calculating the state information of the target device, realizing the hierarchical calculation of the device state, effectively processing the data of the large data interface with changes in a small memory overhead; the hierarchical calculation of the device state also greatly simplifies the difficulty of compiling the device state calculation rules.

[0083] In some embodiments, after determining the current state information of the first virtual device corresponding to the target device based on at least part of the target parameters, the interface data processing method further comprises:

[0084] In the case where the time length between the first time and the second time is not more than the first time length, the current state information of the first virtual device is determined to be valid information, the second time is earlier than the first time, the first time is the update time of the current state information of the first virtual device, and the second time is the update time of the last state information of the first virtual device.

[0085] The last state information of the first virtual device is updated to the current state information of the virtual device.

[0086] In actual implementation, the update time of the current state information of the first virtual device can be represented by a time stamp, and the update time of the previous state information of the first virtual device is also represented by a time stamp.

[0087] After obtaining the current state information of the first virtual device, the update time of the current state information of the first virtual device can be determined, that is, the time stamp corresponding to the first time is obtained.

[0088] Then, it is detected whether the duration or time difference between the time stamp corresponding to the first time and the time stamp corresponding to the second time exceeds a first duration. The first duration can be determined according to actual requirements, for example, can be 1 minute or 30 seconds, and is not limited here.

[0089] If the first duration is exceeded, it indicates that the current state information of the first virtual device is invalid information, and then the previous state information of the first virtual device is updated to an unknown state; if the first duration is not exceeded, it indicates that the current state information of the first virtual device is valid information, and then the previous state information of the first virtual device is updated to the current state information of the first virtual device.

[0090] The interface data processing method provided by the application verifies the update time of the current state information of the first virtual device and the update time of the previous state information of the first virtual device, and only in the case that the duration between the first time and the second time does not exceed the first duration, the previous state information of the first virtual device is updated, which can ensure the timeliness of the device state information, thereby avoiding the use of expired device state information to participate in state calculation to derive an incorrect result.

[0091] In some embodiments, based on the current state information of the first virtual device, the current state information of the target device is determined, including:

[0092] Based on the current state information of the first virtual device, intermediate state information of the target device is determined;

[0093] Based on parameters other than at least part of the target parameters in all target parameters, the current state information of a second virtual device corresponding to the target device is determined;

[0094] Based on the intermediate state information and the current state information of the second virtual device, the current state information of the target device is determined.

[0095] It can be understood that after the current state information of the first virtual device is determined, the intermediate state information of the target device based on the current state information of the first virtual device can be determined. The intermediate state information is the state information that is not completed for all state calculations.

[0096] The state information of the target device can need up to 24 virtual devices to participate in state calculation, the state information of one virtual device can need several target parameters to participate in calculation, and the state information of the target device can also need other device cascade calculation derivation, so part of the target parameters can only calculate the intermediate state information of the target device. Because the time of different target parameters reaching the interface can be different, that is, all target parameters can not be received at the same time, therefore, only part of the target parameters can be calculated, and other target parameters need to be received in full before the aggregate calculation can be performed to obtain the aggregate state of the target device, that is, the final state information.

[0097] In actual execution, the current state information of the corresponding second virtual device is determined only when all parameters except at least part of the target parameters are acquired. The second virtual device and the second virtual device are all virtual devices corresponding to the target device.

[0098] In the case of acquiring the current state information of all virtual devices, the current state information of the target device can be determined according to the intermediate state information of the target device and the current state information of the second virtual device.

[0099] The interface data processing method provided by the application determines the intermediate state information of the target device through the current state information of the first virtual device, then determines the current state information of the second virtual device corresponding to the target device, realizes layered calculation of the state information of the virtual device, and then determines the state information of the target device according to the intermediate state information of the target device and the current state information of the second virtual device, so as to effectively process the interface data of the change type large data with small memory overhead, and greatly simplify the difficulty of device calculation rule compilation in layered calculation of device state.

[0100] In some embodiments, after determining the current state information of the target device based on the current state information of the first virtual device, the interface data processing method further comprises:

[0101] In the case that the time length between the third time and the fourth time is not more than the second time length, the current state information of the target device is determined as valid information, the fourth time is earlier than the third time, the third time is the update time of the current state information of the target device, and the fourth time is the update time of the last state information of the target device;

[0102] The last state information of the target device is updated to the current state information of the target device.

[0103] After obtaining the current state information of the target device, the update time of the current state information of the target device can be determined, that is, the time stamp corresponding to the third time is acquired.

[0104] Then, whether the duration or time difference between the time stamp corresponding to the third moment and the time stamp corresponding to the fourth moment exceeds a second duration is detected. The second duration can be determined according to actual needs, for example, can be 1 minute or 30 seconds, etc., which is not specifically limited here.

[0105] If the second duration is exceeded, it means that the current state information of the target device is invalid information, and then the last state information of the target device is updated to an unknown state; if the first duration is not exceeded, it means that the current state information of the target device is valid information, and then the last state information of the target device is updated to the current state information of the target device.

[0106] The interface data processing method provided by the application can guarantee the timeliness of the state dictionary and improve the accuracy of interface data processing.

[0107] In some embodiments, after determining the current state information of the target device based on the current state information of the first virtual device, the interface data processing method further comprises:

[0108] Updating the state dictionary based on the current state information of the target device.

[0109] It can be understood that after obtaining the current state information of the target device, the current state information of the target device can be taken as the latest state information, and the state values of all target parameters in the state dictionary are updated.

[0110] The interface data processing method provided by the application can guarantee the timeliness of the state dictionary and improve the accuracy of interface data processing.

[0111] In some embodiments, after determining the current state information of the target device based on the current state information of the first virtual device, the interface data processing method further comprises:

[0112] Based on the current state information of the target device and the last state information of the target device, whether the state information of the target device changes is determined.

[0113] In the case that the state information of the target device changes, one or more of the device change information and the alarm information is determined.

[0114] It can be understood that the current state information of the target device and the last state information of the target device can be compared to determine the change of the state information of the target device.

[0115] If the state information of the target device changes, one or more of the device change information and alarm information can be determined.

[0116] In actual execution, the interface conversion program determines that the state value of the aggregation device (target device) has changed, generates device change information, and stores it in the cache queue.

[0117] Subsequently, the device change information in the cache queue is generated in the agreed format to send JSON information to the front-end Kafka interface, and alarm information is generated according to user configuration requirements and sent to the front-end Kafka interface. The interface program calculates the state value of the aggregation device in the order of data, so the target parameters participating in the calculation of the state of the aggregation device and the state information corresponding to the target parameters can be the state value of the aggregation device. In this way, the calculation process of the complex device state can be simplified, and the efficiency of the interface calculation can be improved.

[0118] The interface conversion program can read the cached device list, and store the device KEY value and the serialized value of the device (internal attribute value __dict__ of the device class) in the REDIS cache database.

[0119] The device class corresponds to the individual element that the user needs to display, and contains the related data of the device: the device ID number, SN value, KEY value, local code, station code, device name, device type, device subtype, device state value, device type value, and device state latest timestamp. Among them, the device state value is usually a dictionary containing the state values of all related virtual devices and the target device. The device ID number is a 16-bit digital code of the device (different devices have different codes), and the KEY value is the interface program mark "state: org: ats:" + the ID number of the device.

[0120] Due to the change of user configuration conversion requirements, the interface conversion program restarts to load related configurations, first reads the device state information from the REDIS cache database, and deserializes it to the corresponding device class. When restoring the device state information, the timestamp needs to be checked to determine whether the device state exceeds the specified time. If it is overdue, the corresponding device state will be set to an unknown state.

[0121] In this way, errors in generating device state information and alarm information caused by interface program upgrades or configuration modifications can be effectively avoided. The calculation of device state information requires the participation of previous state information, and as long as the time of updating the device state information does not exceed the specified time, the device state information is reliable. For example, since the ATS data interface can ensure that all information is updated within 1 minute, the timeout time value is temporarily set to 3 minutes.

[0122] The interface conversion program reads the cached list of changed devices, generates JSON data with the device information in a defined format, and sends it to the Kafka interface for front-end device display. The device information required for generating the interface is temporarily stored in members of the device class. When converting information, it checks if the device's status is unknown. If it is unknown, the device's timestamp needs to be modified to the current time of the interface conversion program; otherwise, the timestamp temporarily stored when the device status information is updated can be used directly.

[0123] Alarm information generation and recovery are tied to device status and generated according to user-configured conversion requirements. Typically, an alarm is generated when the device status changes and the current status is faulty or alarm-prone. If the device status changes and the current status is normal, and the alarm is found in the cached alarm list, the alarm is recovered and removed from the cached alarm list. Both alarm information generation and recovery processes generate corresponding JSON data according to a pre-defined protocol and send it to the Kafka API for display in the front-end application.

[0124] The following is an example of a device converting a JSON configuration file.

[0125]

[0126]

[0127] The following is an example of JSON data for device status information:

[0128]

[0129]

[0130] The following is an example of JSON data for device alarm information:

[0131] {

[0132] "id":"f4227abace0d11ed9bbd4889e79c57b0",

[0133] "line_code":5,

[0134] "line_name":"Line 5",

[0135] "area_type":0,

[0136] "area_code":98",

[0137] "area_name":"XXXX Station",

[0138] "dev_id":"0xffff05000203000b",

[0139] "dev_name":"YGBLZ-app-server-wireA",

[0140] "dev_type":"ATS",

[0141] "module_name":"Communication between the interface unit and non-security network A is interrupted"

[0142] "alarm_type":1,

[0143] "alarm_subtype":1,

[0144] "summary_info":"Communication failure",

[0145] "detail_contentr":"Communication between the interface unit and the insecure network A is interrupted",

[0146] "sugg_operation":"Check the non-secure network switch and its corresponding network cable connections, interface unit hardware, and process status",

[0147] "forward_id":0,

[0148] "backward_id":0,

[0149] "alarm_state":1,

[0150] "alarm_time":"2023-03-29 16:42:14.353",

[0151] "gmt_create":"2023-03-29 16:44:44.415",

[0152] "recover_mode":0,

[0153] "alarm_rate":0,

[0154] "nrecover_time":nul1,

[0155] "alarm_level": "Level 2 alarm"

[0156] }

[0157] The interface data processing method provided by this invention will be described below in conjunction with a practical application scenario.

[0158] The interface conversion program has been successfully applied to the intelligent operation and maintenance system of a certain subway line 5, and runs stably and reliably, and converts data flexibly and conveniently.

[0159] The interface data of the intelligent operation and maintenance and ATS maintenance of a certain subway line 5 is about three frames of data within 6 seconds, about 150-180kb, and the parsed data is about 23000-26000 rows. Since this part of data is change data, the interface data can be updated for about 60 seconds, so the input data is estimated to be about 230,000-260,000 rows.

[0160] Currently, the interface needs to calculate the state of about 90 devices, and the state value of some devices needs to be calculated by up to 24 virtual devices, and the state of a virtual device may need several parameters to participate in the calculation, and some devices need to be cascaded with other devices for calculation and derivation, so the number of real-time calculations of the interface is relatively large.

[0161] The interface conversion program uses PYTHON coding and runs on a LINUX dedicated server, and has been running stably for half a year. Through analysis of the log file, the data processing time after the interface program takes the data is all within 10ms, and the data processing time after the conversion interface program reads the data is also about 10ms, so the interface program has a lot of performance margin. When the interface program does not take data, it will wait for a short period of time, which can be configured. The CPU occupancy rate and memory occupancy rate of the interface program process on the LINUX server are both 0.0%, and the resource occupancy of the interface program is also very good.

[0162] The interface conversion program will be used in the intelligent operation and maintenance systems of multiple lines in the future, and lays a solid foundation for the intelligent operation and maintenance of urban rail transit.

[0163] The interface data processing method provided by the application has high efficiency in processing interface data, can process a large amount of interface data in real time, can support processing of change type interface input, and meets the requirements of big data processing; the device state is processed in layers, which greatly simplifies the requirement of device state rule writing, and also greatly reduces the possibility of repeated calculation; the device state has time effectiveness management, which effectively avoids the use of expired device state to participate in calculation and derivation to obtain incorrect results; the device state is cached in the REDIS cache database in real time when the device state is updated, so that the existing state value of the device can be synchronized when the interface program and the configuration are upgraded.

[0164] Figure 2 is a second flowchart of the interface data processing method provided by the application. Referring to Figure 2 , the interface data processing method provided by the application comprises:

[0165] Step 1: reading the Kafka interface to obtain interface data;

[0166] Step 2: flattening the interface data to obtain processed interface data;

[0167] Step 3: traversing all conversion rule data

[0168] Step 4: using the device ID of the current conversion rule to find the corresponding target device;

[0169] Step 5: using the current conversion rule to calculate the current state dictionary of the target device;

[0170] Step 6: judging whether the current state dictionary of the target device is empty, if the current state dictionary is empty, using the aggregation rule to calculate the aggregation state of the current device, if the aggregation state is not empty, storing the aggregation state in the device state dictionary; if the current state dictionary is not empty, judging whether the device state information is overdue;

[0171] Step 7: if not overdue, assigning the time corresponding to the device state information to the device time;

[0172] Step 8: in the case of device state change, assigning the new device state to the target device and storing the device in the updated device list.

[0173] The key point of the interface data processing method provided by the application is:

[0174] I. After parsing the interface data, the information is stored in the form of dictionary nesting, part of the content of the extracted information is used as the key value, and the elements in the queue are stored in the dictionary; after the dictionary nested information is flattened, the parameters participating in the calculation can be quickly obtained during the conversion calculation, which greatly improves the efficiency of interface data processing;

[0175] II. The device state is calculated and cached in layers, and the interface program can effectively process large data interfaces with small memory overhead; the layered calculation of the device state also greatly simplifies the difficulty of device calculation rule compilation;

[0176] III. The device state update has a time stamp record, and the timeliness of the device state is checked every period, if it is overdue, the device state is modified to unknown, so as to avoid using expired device state to participate in calculation and deduce wrong results;

[0177] IV. When the related state information of the device changes, it is stored in the cache REDIS, and the changed device state information and alarm information generated due to the lack of existing device state can be read when the interface program and configuration are upgraded (the interface program is restarted for a short time).

[0178] The interface data processing device provided by the application is described below, and the interface data processing device described below can be correspondingly referred to the interface data processing method described above.

[0179] Figure 3 A structure diagram of the interface data processing apparatus provided by the present application is shown in the figure. Figure 3 The interface data processing apparatus provided by the present application comprises:

[0180] A first determining module 310 is configured to determine all target parameters of a target device, wherein the target parameters are used to indicate parameters related to state calculation of the target device.

[0181] A second determining module 320 is configured to, in a case where at least part of the target parameters exist in a state dictionary corresponding to the target device, determine current state information of a first virtual device corresponding to the target device based on the at least part of the target parameters, wherein the state dictionary is constructed based on serialized interface data.

[0182] A third determining module 330 is configured to determine current state information of the target device based on the current state information of the first virtual device.

[0183] The interface data processing apparatus provided by the present application can quickly acquire at least part of parameters related to state calculation of a target device by converting interface data into a state dictionary, greatly improves the efficiency of interface data processing, and then can determine state information of a corresponding first virtual device according to the at least part of target parameters, and further calculate state information of the target device, realizes layered calculation of device state, can effectively process data of a change type large data interface with a small memory overhead, and greatly simplifies the difficulty of compiling device state calculation rules.

[0184] In some embodiments, the apparatus further comprises:

[0185] A first state updating module is configured to, after the determination of the current state information of the first virtual device corresponding to the target device based on the at least part of the target parameters, in a case where a time length between a first time and a second time is not more than a first time length, determine that the current state information of the first virtual device is valid information, wherein the second time is earlier than the first time, the first time is an update time of the current state information of the first virtual device, and the second time is an update time of previous state information of the first virtual device.

[0186] The previous state information of the first virtual device is updated as the current state information of the virtual device.

[0187] In some embodiments, the third determining module 330 is specifically configured to:

[0188] Determine intermediate state information of the target device based on the current state information of the first virtual device.

[0189] determine, based on the parameters other than the at least part of the target parameters, current state information of a second virtual device corresponding to the target device;

[0190] determine, based on the intermediate state information and the current state information of the second virtual device, the current state information of the target device.

[0191] In some embodiments, the apparatus further comprises:

[0192] a second state updating module configured to, after determining the current state information of the target device based on the current state information of the first virtual device, determine that the current state information of the target device is valid information in a case that a time duration between a third time and a fourth time is not more than a second time duration, the fourth time being earlier than the third time, the third time being an updating time of the current state information of the target device, and the fourth time being an updating time of previous state information of the target device.

[0193] update the previous state information of the target device as the current state information of the target device.

[0194] In some embodiments, the apparatus further comprises:

[0195] a dictionary updating module configured to, after determining the current state information of the target device based on the current state information of the first virtual device, update the state dictionary based on the current state information of the target device.

[0196] In some embodiments, the apparatus further comprises:

[0197] a fourth determining module configured to, after determining the current state information of the target device based on the current state information of the first virtual device, judge whether the state information of the target device changes based on the current state information of the target device and the previous state information of the target device.

[0198] determine one or more of device change information and alarm information in a case that the state information of the target device changes.

[0199] Figure 4 An example of an entity structure diagram of an electronic device is shown as Figure 4As shown, the electronic device can include a processor 410, a communications interface 420, a memory 430, and a communications bus 440, wherein the processor 410, the communications interface 420, and the memory 430 complete mutual communication through the communications bus 440. The processor 410 can invoke a logical instruction in the memory 430 to execute an interface data processing method, which includes:

[0200] determining all target parameters of the target device, the target parameters being used to indicate parameters related to state calculation of the target device;

[0201] in a case where at least part of the target parameters exist in the state dictionary corresponding to the target device, determining current state information of a first virtual device corresponding to the target device based on the at least part of the target parameters, the state dictionary being constructed based on the serialized interface data;

[0202] determining the current state information of the target device based on the current state information of the first virtual device.

[0203] In addition, the logical instruction in the memory 430 described above can be implemented in the form of a software functional unit and sold or used as an independent product, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, includes several instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0204] On the other hand, the present application also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, when the computer program is executed by a processor, the computer can execute the interface data processing method provided by the above-mentioned method, the method includes:

[0205] determining all target parameters of the target device, the target parameters being used to indicate parameters related to state calculation of the target device;

[0206] In a case where at least part of the target parameters exist in the state dictionary corresponding to the target device, current state information of a first virtual device corresponding to the target device is determined based on the at least part of the target parameters, the state dictionary being constructed based on the serialized interface data;

[0207] Current state information of the target device is determined based on the current state information of the first virtual device.

[0208] In another aspect, the present application also provides a non-transitory computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the interface data processing method provided by the above method, the method comprising:

[0209] All target parameters of a target device are determined, the target parameters being used to indicate parameters related to state calculation of the target device;

[0210] In a case where at least part of the target parameters exist in the state dictionary corresponding to the target device, current state information of a first virtual device corresponding to the target device is determined based on the at least part of the target parameters, the state dictionary being constructed based on the serialized interface data;

[0211] Current state information of the target device is determined based on the current state information of the first virtual device.

[0212] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.

[0213] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software plus necessary general hardware platforms, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of software products, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and include a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0214] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit the same; and although the present application has been described in detail with reference to the foregoing embodiments, it should be appreciated by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features thereof can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. An interface data processing method, characterized by, The method comprises the following steps: determining all target parameters of a target device, the target parameters being used to indicate parameters related to state calculation of the target device; in the case that at least part of the target parameters exist in a state dictionary corresponding to the target device, determining current state information of a first virtual device corresponding to the target device based on the at least part of the target parameters, the state dictionary being constructed based on serialized interface data; determining current state information of the target device based on the current state information of the first virtual device; wherein the step of determining the current state information of the target device based on the current state information of the first virtual device comprises: determining intermediate state information of the target device based on the current state information of the first virtual device; determining current state information of a second virtual device corresponding to the target device based on parameters other than the at least part of the target parameters in the all target parameters; determining the current state information of the target device based on the intermediate state information and the current state information of the second virtual device; wherein the intermediate state information is state information that is not completed with all state calculation; the first virtual device and the second virtual device are all virtual devices corresponding to the target device.

2. The interface data processing method of claim 1, wherein, After the step of determining the current state information of the first virtual device corresponding to the target device based on the at least part of the target parameters, the method further comprises: in the case that a time length between a first time and a second time is not more than a first time length, determining that the current state information of the first virtual device is valid information, the second time being earlier than the first time, the first time being an update time of the current state information of the first virtual device, and the second time being an update time of previous state information of the first virtual device; updating the previous state information of the first virtual device as the current state information of the first virtual device.

3. The interface data processing method according to any one of claims 1-2, characterized in that, After the step of determining the current state information of the target device based on the current state information of the first virtual device, the method further comprises: in the case that a time length between a third time and a fourth time is not more than a second time length, determining that the current state information of the target device is valid information, the fourth time being earlier than the third time, the third time being an update time of the current state information of the target device, and the fourth time being an update time of previous state information of the target device; updating the previous state information of the target device as the current state information of the target device.

4. The interface data processing method according to any one of claims 1-2, characterized in that, After the step of determining the current state information of the target device based on the current state information of the first virtual device, the method further comprises: updating the state dictionary based on the current state information of the target device.

5. The interface data processing method according to any one of claims 1-2, characterized in that, After the step of determining the current state information of the target device based on the current state information of the first virtual device, the method further comprises: judging whether the state information of the target device changes based on the current state information of the target device and the previous state information of the target device; In a case where the state information of the target device changes, one or more of device change information and alarm information is determined.

6. An interface data processing apparatus, characterized by, Comprise: A first determining module configured to determine all target parameters of a target device, the target parameters being used to indicate parameters related to state calculation of the target device; A second determining module configured to, in a case where at least part of the target parameters exist in a state dictionary corresponding to the target device, determine current state information of a first virtual device corresponding to the target device based on the at least part of the target parameters, the state dictionary being constructed based on serialized interface data; A third determining module configured to determine current state information of the target device based on the current state information of the first virtual device; The third determining module is configured to: Determine intermediate state information of the target device based on the current state information of the first virtual device; Determine current state information of a second virtual device corresponding to the target device based on parameters other than the at least part of the target parameters among all the target parameters; Determine current state information of the target device based on the intermediate state information and the current state information of the second virtual device; The intermediate state information is state information that is not completed with all state calculations; the first virtual device and the second virtual device are all virtual devices corresponding to the target device.

7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the program to implement the interface data processing method of any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the interface data processing method of any one of claims 1 to 5.

9. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the interface data processing method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Web server system, dictionary system, dictionary call method, screen control display method, and demonstration application generation method

    CN104798067A

  • Data replication method and apparatus, computer device, and storage medium

    US20210279254A1