CN117914779A - Data acquisition method and device based on communication terminal and electronic device - Google Patents

Data acquisition method and device based on communication terminal and electronic device Download PDF

Info

Publication number
CN117914779A
CN117914779A CN202410077953.1A CN202410077953A CN117914779A CN 117914779 A CN117914779 A CN 117914779A CN 202410077953 A CN202410077953 A CN 202410077953A CN 117914779 A CN117914779 A CN 117914779A
Authority
CN
China
Prior art keywords
address
sub
segments
variable
communication terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410077953.1A
Other languages
Chinese (zh)
Inventor
顾昕岑
廉德旭
杨友胜
刘洋
苗萍萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Weichai Power Co Ltd
Weifang Weichai Power Technology Co Ltd
Original Assignee
Weichai Power Co Ltd
Weifang Weichai Power Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Weichai Power Co Ltd, Weifang Weichai Power Technology Co Ltd filed Critical Weichai Power Co Ltd
Priority to CN202410077953.1A priority Critical patent/CN117914779A/en
Publication of CN117914779A publication Critical patent/CN117914779A/en
Pending legal-status Critical Current

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application provides a data acquisition method and device based on a communication terminal and an electronic device. The method comprises the following steps: under the condition that the received variable address segment is a discontinuous address segment, determining whether to combine the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments; under the condition that the corresponding two sub-address segments are determined to be combined, the corresponding two sub-address segments are combined to obtain a combined address segment, a request message is generated at least based on the combined address segment, and under the condition that the corresponding two sub-address segments are determined to be not combined, the corresponding request message is generated at least based on each sub-address segment; the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal, and the problems of relatively wasting the storage space of the communication terminal and causing data loss and communication disorder caused by configuring the discontinuous address field as the whole continuous variable address field are solved.

Description

Data acquisition method and device based on communication terminal and electronic device
Technical Field
The application relates to the technical field of data acquisition, in particular to a data acquisition method based on a communication terminal, a data acquisition device, a computer readable storage medium and an electronic device.
Background
In the actual application process, when data acquisition is performed through a T-BOX (TELEMATICS BOX, abbreviated as T-BOX) and an RS-485 protocol, a user is required to manually set a request message so as to acquire related data in an engine. However, only Byte (Byte) can be collected in the variable address field of the request message, and the accuracy and the setting time cost of the request message depend on the development experience of engineers. When the variable address segment in the request message is accurate to Bit, the data message needs to be manually analyzed to acquire the related data of the engine.
Meanwhile, under the condition that the variable address field is a discontinuous address field, if a request message comprising the whole continuous address field is configured and sent to the communication terminal, the storage space of the communication terminal is wasted; if the request message is configured based on each discontinuous address segment and sent to the communication terminal, the communication terminal repeatedly requests data, and the problems of data loss and communication disorder are easy to occur.
Disclosure of Invention
The application aims to provide a data acquisition method, a data acquisition device, a computer readable storage medium and an electronic device based on a communication terminal, which at least solve the problems of relatively wasting the storage space of the communication terminal and frequent segmentation caused by configuring discontinuous address segments into whole continuous variable address segments, so that the communication terminal repeatedly requests data, and the data loss and communication disorder occur.
In order to achieve the above object, according to one aspect of the present application, there is provided a data collection method based on a communication terminal, the data collection method being applied to a host computer, the communication terminal communicating with the host computer, the data collection method comprising: under the condition that the received variable address segment is a discontinuous address segment, determining whether to combine the two corresponding sub address segments based on the distance between the two adjacent sub address segments, wherein the variable address segment is used for representing the position of variable information of an engine to be acquired in a storage space, and the sub address segment is one address segment in the variable address segments; under the condition that the corresponding two sub-address segments are determined to be combined, the corresponding two sub-address segments are combined to obtain a combined address segment, a request message is generated at least based on the combined address segment, and under the condition that the corresponding two sub-address segments are determined to be not combined, the corresponding request message is generated at least based on each sub-address segment; and transmitting the request message to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
Optionally, determining whether to merge the two corresponding sub-address segments based on a distance between two adjacent sub-address segments includes: a first determining step, namely determining the distance between the ith sub-address segment and the (i+1) th sub-address segment to obtain a distance value, wherein the value of i starts from 1 until N, and N is the total number of the sub-address segments; a second determining step, determining to combine the ith sub-address segment with the (i+1) th address segment when the distance value is less than or equal to the distance average value; a third determining step of determining that the ith sub-address segment is not combined with the (i+1) th address segment when the distance value is greater than the distance average value; repeating the steps of the first determining step, the second determining step and the third determining step at least once in turn until all the sub address segments are determined, and when each repetition, i=i+1.
Optionally, determining a distance between the ith sub-address segment and the (i+1) th sub-address segment to obtain a distance value, including: and determining the difference value between the last address value of the ith sub address segment and the first address value of the (i+1) th sub address segment to obtain the distance value.
Optionally, the process of determining the distance average includes: using the formulaDetermining the distance average, wherein/(For the distance average value, x i+1 is the first address value of the (i+1) th sub-address segment, and x i is the last address value of the (i) th sub-address segment.
Optionally, generating the request message based at least on the combined address segment includes: generating the request message based on the combined address field and a configuration ID, wherein the configuration ID is generated based on the received type information of the engine, the variable address field and a corresponding RS485 analysis file, and the RS485 analysis file comprises an analysis rule formulated based on an RS485 communication protocol; generating the corresponding request message at least based on each sub-address segment, including: and generating the request message based on each sub-address segment and the configuration ID.
Optionally, the data acquisition method further includes: and under the condition that the variable address field is a continuous address field, generating the request message based on the variable address field and a configuration ID, wherein the configuration ID is generated based on the received type information of the engine, the variable address field and a corresponding RS485 analysis file, and the RS485 analysis file comprises analysis rules formulated based on an RS485 communication protocol.
Optionally, the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is obtained based on the communication terminal, including: the request message is issued to the communication terminal, and the request message is forwarded to an instrument based on the communication terminal, so that variable information of the engine corresponding to the variable address field in the request message is obtained through the instrument; receiving a data message uploaded by the instrument and forwarded by the communication terminal, wherein the data message corresponds to the request message one by one, and the data message comprises variable information of the engine corresponding to the variable address field in the request message and the corresponding configuration ID; and resolving the corresponding data message by adopting the RS485 resolving file corresponding to the configuration ID to obtain variable information of the engine corresponding to the variable address field.
According to another aspect of the present application, there is provided a data collection device based on a communication terminal, the data collection device being applied to an upper computer, the communication terminal being in communication with the upper computer, the data collection device comprising: the determining unit is used for determining whether to combine the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments when the received variable address segments are discontinuous address segments, wherein the variable address segments are used for representing the positions of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment in the variable address segments; the first generation unit is used for merging the two corresponding sub-address segments to obtain a combined address segment under the condition that the two corresponding sub-address segments are determined to be merged, generating a request message at least based on the combined address segment, and generating the corresponding request message at least based on each sub-address segment under the condition that the two corresponding sub-address segments are determined to be not merged; and the sending unit is used for sending the request message to the communication terminal so as to acquire the variable information of the engine corresponding to the variable address field based on the communication terminal.
According to still another aspect of the present application, there is provided a computer readable storage medium, the computer readable storage medium including a stored program, wherein when the program is executed, the device in which the computer readable storage medium is located is controlled to execute any one of the data acquisition methods based on the communication terminal.
According to a further aspect of the present application there is provided an electronic device comprising a memory and a processor, the memory having stored therein a computer program, the processor being arranged to perform any of the communication terminal based data acquisition methods by means of the computer program.
By applying the technical scheme of the application, under the condition that the received variable address segment comprises a plurality of discontinuous sub-address segments, whether the corresponding two sub-address segments are combined or not is determined based on the distance between the two adjacent sub-address segments. If the two corresponding sub-address segments meet the merging condition, namely, under the condition that the two sub-address segments are merged, merging the two corresponding sub-address segments to obtain a combined address segment, and generating a request message based on at least the combined address segment; if the two corresponding sub-address segments do not meet the merging condition, namely, the two sub-address segments are not merged, generating a corresponding request message at least based on each sub-address segment. And then the generated request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal. Compared with the prior art that a plurality of discontinuous sub-address segments are configured as continuous address segments, and at least the continuous address segments are based on the generation request message, the method and the device for merging the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments ensure that whether the two sub-address segments are merged or not is accurately determined. If the two sub address segments are determined to be combined, a request message is generated at least based on the combined address segments, so that the problems that too many segments are generated, more request messages are generated, frequent data request of a communication terminal is caused, and the problems of data loss and communication disorder are avoided. If the two sub-address segments are not combined, generating a corresponding request message at least based on each sub-address segment, so that the problem of wasting the storage space of the communication terminal caused by combining the sub-address segments can be avoided.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:
Fig. 1 is a block diagram showing a hardware configuration of a mobile terminal performing a data acquisition method based on a communication terminal according to an embodiment of the present application;
fig. 2 shows a flow chart of a data acquisition method based on a communication terminal according to an embodiment of the present application;
FIG. 3 illustrates a flow chart for determining whether two adjacent sub-address segments are merged, provided in accordance with an embodiment of the present application;
FIG. 4 illustrates a flow chart for obtaining variable information provided in accordance with an embodiment of the present application;
Fig. 5 shows a flow chart of a data acquisition method based on a communication terminal according to an embodiment of the present application;
Fig. 6 shows a schematic structural diagram of a data acquisition device based on a communication terminal according to an embodiment of the present application.
Wherein the above figures include the following reference numerals:
102. a processor; 104. a memory; 106. a transmission device; 108. and an input/output device.
Detailed Description
It should be noted that, without conflict, the embodiments of the present application and features of the embodiments may be combined with each other. The application will be described in detail below with reference to the drawings in connection with embodiments.
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe the embodiments of the application herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
As described in the background art, in the prior art, a discontinuous address field is configured as an entire continuous variable address field, which results in relatively wasting the storage space of the communication terminal and frequent segmentation, and the communication terminal repeatedly requests data, which results in data loss and communication disorder.
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of a mobile terminal according to a data acquisition method based on a communication terminal according to an embodiment of the present application. As shown in fig. 1, a mobile terminal may include one or more (only one is shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and not limiting of the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a data acquisition method based on a communication terminal in an embodiment of the present invention, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, to implement the above-mentioned method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as a NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In the present embodiment, a data acquisition method based on a communication terminal operating on a mobile terminal, a computer terminal or similar computing device is provided, it should be noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different from that herein.
Fig. 2 is a flowchart of a data acquisition method based on a communication terminal according to an embodiment of the present application. The data acquisition method is applied to an upper computer, the communication terminal communicates with the upper computer, as shown in fig. 2, and the data acquisition method comprises the following steps:
Step S201, determining whether to combine two corresponding sub-address segments based on the distance between two adjacent sub-address segments, where the variable address segments are used to represent the position of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment of the variable address segments;
Step S202, when the corresponding two sub-address segments are determined to be combined, combining the corresponding two sub-address segments to obtain a combined address segment, generating a request message at least based on the combined address segment, and when the corresponding two sub-address segments are determined to be not combined, generating the corresponding request message at least based on each sub-address segment;
Step S203, the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
In the data acquisition method based on the communication terminal, if the received variable address field includes a plurality of discontinuous sub-address fields, it is determined whether to combine the corresponding two sub-address fields based on the distance between the two adjacent sub-address fields. If the two corresponding sub-address segments meet the merging condition, namely, under the condition that the two sub-address segments are merged, merging the two corresponding sub-address segments to obtain a combined address segment, and generating a request message based on at least the combined address segment; if the two corresponding sub-address segments do not meet the merging condition, namely, the two sub-address segments are not merged, generating a corresponding request message at least based on each sub-address segment. And then the generated request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal. Compared with the prior art that a plurality of discontinuous sub-address segments are configured as continuous address segments, and at least the continuous address segments are based on the generation request message, the method and the device for merging the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments ensure that whether the two sub-address segments are merged or not is accurately determined. If the two sub address segments are determined to be combined, a request message is generated at least based on the combined address segments, so that the problems that too many segments are generated, more request messages are generated, frequent data request of a communication terminal is caused, and the problems of data loss and communication disorder are avoided. If the two sub-address segments are not combined, generating a corresponding request message at least based on each sub-address segment, so that the problem of wasting the storage space of the communication terminal caused by combining the sub-address segments can be avoided.
In a specific embodiment, the communication terminal may be a T-BOX. In an actual application process, the upper computer and the T-BOX may communicate based on a TCP/IP protocol (transmission control protocol/internet protocol, transmission Control Protocol/Internet Protocol, abbreviated as TCP/IP).
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
In the actual application process, as shown in fig. 3, in order to determine more accurately whether to merge adjacent sub-address segments, and further avoid merging sub-address segments that do not need to be merged, and not merging sub-address segments that need to be merged, in the specific implementation process, the step S201 may be implemented as follows:
step S2011, a first determining step, determining the distance between the ith sub-address segment and the (i+1) th sub-address segment to obtain a distance value, wherein the value of i starts from 1 until N, N is the total number of the sub-address segments;
Step S2012, a second determining step, determining to combine the ith sub-address segment with the (i+1) th address segment when the distance value is less than or equal to the distance average value;
step S2013, a third determining step, in which, when the distance value is greater than the distance average value, it is determined that the ith sub-address segment is not combined with the (i+1) th address segment;
Step S2014, repeating the steps, and repeating the first determining step, the second determining step, and the third determining step at least once in sequence until all the sub address segments are determined, and when each repetition, i=i+1.
In a specific embodiment, if there are three non-continuous sub-address segments, a first sub-address segment, a second sub-address segment, and a third sub-address segment are respectively provided. If the first sub-address segment and the second sub-address segment meet the merging condition, the first sub-address segment and the second sub-address segment are merged to obtain a combined address segment. For the third sub-address segment, then, a distance between the second sub-address segment and the third sub-address segment may be calculated. If the second sub-address segment and the third sub-address segment also meet the merging condition, the third sub-address segment may be merged into the combined address segment, i.e., the first sub-address segment, the second sub-address segment and the third sub-address segment are merged, thereby obtaining a final combined address segment. Finally, a request message is generated based at least on the final combined address field. That is, in the merging process, the merging of the two adjacent sub-address segments is not limited, and when a plurality of sub-address segments meet the merging condition, the sub-address segments can be merged, so that the problems of too many segments, generating more request messages, causing frequent data requests of the communication terminal and avoiding data loss and communication disorder can be further avoided.
Of course, in the actual application process, if the first sub-address segment and the second sub-address segment do not meet the merging condition, the first sub-address segment and the second sub-address segment may not be merged. Then, it is again determined whether the second sub-address segment and the third sub-address segment satisfy the merging condition. If the second sub-address segment and the third sub-address segment meet the merging condition, the second sub-address segment and the third sub-address segment can be merged to obtain a combined address segment, so that only two request messages are needed for three sub-address segments. If the second sub-address segment and the third sub-address segment do not meet the merging condition, three request messages are needed in this case, instead of merging the three sub-address segments. Thus, the problem of relatively wasting the storage space of the communication terminal caused by unreasonable merging of the sub-address segments can be avoided.
The step S2011 of the present application may be implemented by the following steps: and determining the difference value between the last address value of the ith sub address segment and the first address value of the (i+1) th sub address segment to obtain the distance value. In this embodiment, the difference between the last address value of the ith sub-address segment and the first address value of the (i+1) th sub-address segment is calculated, so that a distance value is obtained relatively simply, and further, it is ensured that whether the corresponding two sub-address segments are combined or not can be accurately determined based on the distance value and the distance average value in the following process.
In a specific embodiment, the process of determining the distance average value includes: using the formulaDetermining the distance average, wherein/(As the distance average value, x i+1 is the first address value of the (i+1) th sub-address segment, and x i is the last address value of the (i) th sub-address segment, the distance average value is simply determined, and whether the two adjacent sub-address segments are combined or not is accurately determined based on the distance value and the distance average value of the two adjacent sub-address segments.
In a specific embodiment, the distance average may also be a preset value.
In some embodiments, in order to facilitate the subsequent parsing of the received data message corresponding to the request message, the step S202 may be specifically implemented by: generating a request message based at least on the combined address field, including: generating the request message based on the combined address field and a configuration ID, wherein the configuration ID is generated based on the received type information of the engine, the variable address field and a corresponding RS485 analysis file, and the RS485 analysis file comprises analysis rules formulated based on an RS485 communication protocol; generating a corresponding request message at least based on each sub-address segment, including: and generating the request message based on each sub-address segment and the configuration ID. That is, in the scheme, the configuration ID is carried when the request message is generated, and the configuration ID is carried in the subsequently received data message, so that the engine information corresponding to the variable address field can be obtained more accurately and conveniently.
In the actual application process, the data acquisition method of the present application further includes step S204: and when the variable address field is a continuous address field, generating the request message based on the variable address field and a configuration ID, wherein the configuration ID is generated based on the received type information of the engine, the variable address field and a corresponding RS485 analysis file, and the RS485 analysis file comprises analysis rules formulated based on an RS485 communication protocol.
Specifically, under the condition that the upper computer and the communication terminal communicate through the TCP/IP protocol, the corresponding variable address segment (combined address segment or sub-address segment) and the configuration ID can be further encapsulated based on the TCP/IP protocol, so as to obtain the corresponding request message.
In a specific implementation process, as shown in fig. 4, the step S203 may be further implemented by step S2031, step S2032, and step S2033: step S2031, issuing the request message to the communication terminal, so as to forward the request message to a meter based on the communication terminal, thereby obtaining variable information of the engine corresponding to the variable address field in the request message through the meter; step S2032, receiving a data packet uploaded by the meter and forwarded by the communication terminal, where the data packet includes variable information of the engine corresponding to the variable address field in the request packet and the corresponding configuration ID; step S2033, resolving the corresponding data message by using the RS485 resolving file corresponding to the configuration ID, to obtain variable information of the engine corresponding to the variable address field. In this embodiment, since the received data packet also carries the configuration ID, the RS485 parsing file for parsing the data packet can be determined more simply by using the configuration ID. And then the RS485 analysis file is adopted to analyze the received data message, so that the analysis of the data message is simpler and automatic, and the variable information of the engine in the data message is further simpler. Meanwhile, the RS485 analysis file can be customized by a user, so that the scheme can be also suitable for various data acquisition scenes.
In the actual application process, a user can flexibly set the RS485 analysis file according to the actual application requirement. In one embodiment, the RS485 resolution file is as shown in table one. That is, the RS485 parsing file includes rules formulated based on the RS485 communication protocol and used for parsing the received data message.
List one
In the actual application process, the specific process of analyzing the data message by adopting the RS485 analysis file to obtain the variable information of the engine corresponding to the variable address field comprises the following steps: and based on the RS485 analysis file, carrying out variable splitting and analysis on the data message. Specifically, the byte variable may be acquired first, then the specified start bit and bit length may be acquired in a right-to-left manner, and so on. And finally, storing the analyzed data into a database. Of course, the analysis of the data message by the rule is not limited, and any feasible method in the prior art can be adopted to analyze the data message based on the RS485 analysis file to obtain the variable information of the engine corresponding to the variable address field. This is not limiting in the present application.
In a specific embodiment, the communication terminal and the instrument can be connected through an RS485 bus, so that the communication terminal and the instrument can communicate through an RS485 communication protocol.
In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the data acquisition method based on a communication terminal of the present application will be described in detail below with reference to specific embodiments.
The embodiment relates to a specific data acquisition method based on a communication terminal, as shown in fig. 5, including the following steps:
Step S1: the user can edit an RS485 analysis table (shown in table 1) on a visual interface of the cloud platform based on an RS485 communication protocol, namely, RS485 analysis files (one or more RS485 analysis files are configured) are configured on the visual interface of the cloud platform, and the obtained RS485 analysis files are respectively stored in a database of the cloud platform, so that the cloud platform can store the RS485 analysis files in a lasting mode, and detailed variable information of the RS485 analysis files can be displayed in a list mode.
Step S2: the user can select the type of the engine and the corresponding RS485 analysis file on the visual interface of the cloud platform, and can customize the variable address field, so that configuration information (namely, heartbeat configuration is carried out on the visual interface of the cloud platform) is obtained.
Step S3: when the configuration information (i.e. the heartbeat configuration is completed) is obtained, the configuration ID corresponding to the configuration information can be obtained through the configuration information (i.e. the heartbeat configuration), and the configuration ID is stored in the database. For a user, under the condition that variable information of a corresponding engine needs to be acquired, a configuration ID and a communication terminal can be selected on a visual interface of the cloud platform, and a request message is issued by clicking a down button.
Step S4: in the process of issuing the request message:
It is determined whether the variable address field is a continuous address field. When the variable address field is a continuous address field, the request message may be generated based on the variable address field and the configuration ID in ascending order of the address field. In the case where the variable address segment is a non-continuous address segment, then it is determined whether to merge the corresponding sub-address segments based on the distance between adjacent sub-address segments. The specific process is as follows:
Determining a difference value between a last address value of an i-th sub-address segment and a first address value of an i+1th sub-address segment to obtain a distance value, wherein the value of i starts from 1 until N, and N is the total number of the sub-address segments;
Using the formula Determining a distance average, wherein/(As a distance average value, x i+1 is the first address value of the (i+1) th sub-address segment, and x i is the last address value of the (i) th sub-address segment;
And determining to merge the ith sub-address segment with the (i+1) th address segment when the distance value is less than or equal to the distance average value, and determining to not merge the ith sub-address segment with the (i+1) th address segment (i.e., determining whether to merge) when the distance value is greater than the distance average value.
Under the condition that the ith sub-address segment and the (i+1) th address segment are determined to be combined, combining the corresponding two sub-address segments to obtain a combined address segment, and generating a request message based on the combined address segment and the configuration ID; and under the condition that the ith sub-address segment and the (i+1) th address segment are not combined, generating a corresponding request message based on each sub-address segment and the configuration ID.
Step S5: and the cloud platform issues the request message to the communication terminal, and the communication terminal feeds back the issuing state of the request message to the cloud platform. And if the request message is successfully issued to the communication terminal, the communication terminal requests the instrument according to the variable address segment in the request message so as to obtain variable information corresponding to the variable address segment in the request message.
Step S6: and the instrument generates a data message by using variable information corresponding to the acquired variable address field and the corresponding configuration ID, uploads the data message to the communication terminal, and forwards the data message to the cloud platform (namely the cloud platform receives the data message) by the communication terminal. And the cloud platform splits and analyzes the data message according to the RS485 analysis file corresponding to the configuration ID carried in the issued data message, thereby acquiring the initial bit, the bit length, the coefficient and the offset. For a single-variable data message, firstly acquiring a byte variable, and then acquiring information such as a designated start bit, a bit length and the like in a right-to-left mode. And storing the variable information obtained by analysis into a database for display on the cloud platform.
The embodiment of the application also provides a data acquisition device based on the communication terminal, and the data acquisition device based on the communication terminal can be used for executing the data acquisition method based on the communication terminal. The device is used for realizing the above embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
The following describes a data acquisition device based on a communication terminal provided by an embodiment of the present application.
Fig. 6 is a schematic structural diagram of a data acquisition device based on a communication terminal according to an embodiment of the present application. As shown in fig. 6, the data acquisition device includes:
A determining unit 10, configured to determine whether to combine two corresponding sub-address segments, where the variable address segment is used to represent a location of variable information of an engine to be acquired in a storage space, based on a distance between two adjacent sub-address segments, where the sub-address segment is one address segment of the variable address segments, where the variable address segment is received as a discontinuous address segment;
A first generating unit 20, configured to, when determining that the corresponding two sub-address segments are combined, combine the corresponding two sub-address segments to obtain a combined address segment, generate a request message based at least on the combined address segment, and, when determining that the corresponding two sub-address segments are not combined, generate the corresponding request message based at least on each sub-address segment;
And a sending unit 30 configured to send the request packet to the communication terminal, so as to obtain variable information of the engine corresponding to the variable address field based on the communication terminal.
In the data collection method based on the communication terminal, the determining unit is configured to determine whether to combine the two corresponding sub-address segments based on a distance between two adjacent sub-address segments when the received variable address segment includes a plurality of non-continuous sub-address segments. The first generating unit is used for merging the two corresponding sub-address segments to obtain a combined address segment and generating a request message at least based on the combined address segment if the two corresponding sub-address segments meet the merging condition, namely, if the two sub-address segments are merged; if the two corresponding sub-address segments do not meet the merging condition, namely, the two sub-address segments are not merged, generating a corresponding request message at least based on each sub-address segment. The sending unit is used for sending the generated request message to the communication terminal, so that variable information of the engine corresponding to the variable address field is obtained based on the communication terminal. Compared with the prior art that a plurality of discontinuous sub-address segments are configured as continuous address segments, and at least the continuous address segments are based on the generation request message, the method and the device for merging the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments ensure that whether the two sub-address segments are merged or not is accurately determined. If the two sub address segments are determined to be combined, a request message is generated at least based on the combined address segments, so that the problems that too many segments are generated, more request messages are generated, frequent data request of a communication terminal is caused, and the problems of data loss and communication disorder are avoided. If the two sub-address segments are not combined, generating a corresponding request message at least based on each sub-address segment, so that the problem of wasting the storage space of the communication terminal caused by combining the sub-address segments can be avoided.
In a specific embodiment, the communication terminal may be a T-BOX. In an actual application process, the upper computer and the T-BOX may communicate based on a TCP/IP protocol (transmission control protocol/internet protocol, transmission Control Protocol/Internet Protocol, abbreviated as TCP/IP).
In the actual application process, in order to accurately determine whether to combine adjacent sub-address segments and further avoid combining sub-address segments that do not need to be combined and not combining sub-address segments that need to be combined, in a specific implementation process, the determining unit includes a first determining module, a second determining module, a third determining module and a repeating module. The first determining module is configured to perform a first determining step, determine a distance between an ith sub-address segment and an (i+1) th sub-address segment, and obtain a distance value, where the value of i starts from 1 until N, where N is the total number of the sub-address segments; the second determining module is configured to perform a second determining step, and determine to combine the ith sub-address segment with the (i+1) th address segment when the distance value is less than or equal to the distance average value; the third determining module is configured to perform a third determining step, where it is determined that the ith sub-address segment is not combined with the (i+1) th address segment when the distance value is greater than the distance average value; the repeating module is configured to execute the repeating step, and sequentially repeat the first determining step, the second determining step, and the third determining step at least once until all the sub-address segments are determined, where i=i+1 when each repetition is completed.
In a specific embodiment, if there are three non-continuous sub-address segments, a first sub-address segment, a second sub-address segment, and a third sub-address segment are respectively provided. If the first sub-address segment and the second sub-address segment meet the merging condition, the first sub-address segment and the second sub-address segment are merged to obtain a combined address segment. For the third sub-address segment, then, a distance between the second sub-address segment and the third sub-address segment may be calculated. If the second sub-address segment and the third sub-address segment also meet the merging condition, the third sub-address segment may be merged into the combined address segment, i.e., the first sub-address segment, the second sub-address segment and the third sub-address segment are merged, thereby obtaining a final combined address segment. Finally, a request message is generated based at least on the final combined address field. That is, in the merging process, the merging of the two adjacent sub-address segments is not limited, and when a plurality of sub-address segments meet the merging condition, the sub-address segments can be merged, so that the problems of too many segments, generating more request messages, causing frequent data requests of the communication terminal and avoiding data loss and communication disorder can be further avoided.
Of course, in the actual application process, if the first sub-address segment and the second sub-address segment do not meet the merging condition, the first sub-address segment and the second sub-address segment may not be merged. Then, it is again determined whether the second sub-address segment and the third sub-address segment satisfy the merging condition. If the second sub-address segment and the third sub-address segment meet the merging condition, the second sub-address segment and the third sub-address segment can be merged to obtain a combined address segment, so that only two request messages are needed for three sub-address segments. If the second sub-address segment and the third sub-address segment do not meet the merging condition, three request messages are needed in this case, instead of merging the three sub-address segments. Thus, the problem of relatively wasting the storage space of the communication terminal caused by unreasonable merging of the sub-address segments can be avoided.
The first determining module of the present application further includes a first determining sub-module, configured to determine a difference between a last address value of the ith sub-address segment and a first address value of the (i+1) th sub-address segment, to obtain the distance value. In this embodiment, the difference between the last address value of the ith sub-address segment and the first address value of the (i+1) th sub-address segment is calculated, so that a distance value is obtained relatively simply, and further, it is ensured that whether the corresponding two sub-address segments are combined or not can be accurately determined based on the distance value and the distance average value in the following process.
In a specific embodiment, the second determining module further includes a second determining sub-module configured to apply a formulaDetermining the distance average, wherein/(As the distance average value, x i+1 is the first address value of the (i+1) th sub-address segment, and x i is the last address value of the (i) th sub-address segment, the distance average value is simply determined, and whether the two adjacent sub-address segments are combined or not is accurately determined based on the distance value and the distance average value of the two adjacent sub-address segments.
In a specific embodiment, the distance average may also be a preset value.
In some embodiments, in order to facilitate subsequent parsing of the received data packet corresponding to the request packet, the first generating unit includes a first generating module configured to generate the request packet based on the combined address field and a configuration ID, where the configuration ID is generated based on the received type information of the engine, the variable address field, and a corresponding RS485 parsing file, and the RS485 parsing file includes parsing rules formulated based on an RS485 communication protocol; the first generating unit further includes a second generating module, configured to generate the request packet based on each of the sub-address segments and the configuration ID. That is, in the scheme, the configuration ID is carried when the request message is generated, and the configuration ID is carried in the subsequently received data message, so that the engine information corresponding to the variable address field can be obtained more accurately and conveniently.
In an actual application process, the data acquisition device of the present application further includes a second generating unit, configured to generate the request packet based on the variable address field and a configuration ID when the variable address field is a continuous address field, where the configuration ID is generated based on the received type information of the engine, the variable address field, and a corresponding RS485 analysis file, and the RS485 analysis file includes an analysis rule formulated based on an RS485 communication protocol.
Specifically, under the condition that the upper computer and the communication terminal communicate through the TCP/IP protocol, the corresponding variable address segment (combined address segment or sub-address segment) and the configuration ID can be further encapsulated based on the TCP/IP protocol, so as to obtain the corresponding request message.
In a specific implementation process, the sending unit includes a sending module, a second receiving module and an analyzing module. The sending module is used for sending the request message to the communication terminal so as to forward the request message to the instrument based on the communication terminal, and accordingly variable information of the engine corresponding to the variable address field in the request message is obtained through the instrument; the second receiving module is configured to receive a data packet uploaded by the meter and forwarded by the communication terminal, where the data packet includes variable information of the engine corresponding to the variable address field in the request packet and the corresponding configuration ID; the analysis module is used for analyzing the corresponding data message by adopting the RS485 analysis file corresponding to the configuration ID to obtain the variable information of the engine corresponding to the variable address section. In this embodiment, since the received data packet also carries the configuration ID, the RS485 parsing file for parsing the data packet can be determined more simply by using the configuration ID. And then the RS485 analysis file is adopted to analyze the received data message, so that the analysis of the data message is simpler and automatic, and the variable information of the engine in the data message is further simpler. Meanwhile, the RS485 analysis file can be customized by a user, so that the scheme can be also suitable for various data acquisition scenes.
In the actual application process, a user can flexibly set the RS485 analysis file according to the actual application requirement. In one embodiment, the RS485 resolution file is as shown in table one. That is, the RS485 parsing file includes rules formulated based on the RS485 communication protocol and used for parsing the received data message.
In the actual application process, the specific process of analyzing the data message by adopting the RS485 analysis file to obtain the variable information of the engine corresponding to the variable address field comprises the following steps: and based on the RS485 analysis file, carrying out variable splitting and analysis on the data message. Specifically, the byte variable may be acquired first, then the specified start bit and bit length may be acquired in a right-to-left manner, and so on. And finally, storing the analyzed data into a database. Of course, the analysis of the data message by the rule is not limited, and any feasible method in the prior art can be adopted to analyze the data message based on the RS485 analysis file to obtain the variable information of the engine corresponding to the variable address field. This is not limiting in the present application.
In a specific embodiment, the communication terminal and the instrument can be connected through an RS485 bus, so that the communication terminal and the instrument can communicate through an RS485 communication protocol.
The data acquisition device based on the communication terminal comprises a processor and a memory, wherein the determining unit, the first generating unit, the sending unit and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions. The modules are all located in the same processor; or the above modules may be located in different processors in any combination.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be provided with one or more than one, and the problems of data loss and communication disorder caused by the fact that discontinuous address segments are configured into the whole continuous variable address segments, which are caused by wasting the storage space of the communication terminal and frequent segmentation, and the communication terminal repeatedly requests data are solved by adjusting kernel parameters.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip.
The embodiment of the invention provides a computer readable storage medium, which comprises a stored program, wherein the device where the computer readable storage medium is located is controlled to execute the data acquisition method based on a communication terminal when the program runs.
Specifically, the data acquisition method based on the communication terminal comprises the following steps:
Step S201, determining whether to combine two corresponding sub-address segments based on the distance between two adjacent sub-address segments, where the variable address segments are used to represent the position of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment of the variable address segments;
Step S202, when the corresponding two sub-address segments are determined to be combined, combining the corresponding two sub-address segments to obtain a combined address segment, generating a request message at least based on the combined address segment, and when the corresponding two sub-address segments are determined to be not combined, generating the corresponding request message at least based on each sub-address segment;
Step S203, the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
An embodiment of the present invention provides an electronic device including a memory and a processor, where the memory stores a computer program, and the processor is configured to execute the data acquisition method based on a communication terminal by using the computer program.
Specifically, the data acquisition method based on the communication terminal comprises the following steps:
Step S201, determining whether to combine two corresponding sub-address segments based on the distance between two adjacent sub-address segments, where the variable address segments are used to represent the position of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment of the variable address segments;
Step S202, when the corresponding two sub-address segments are determined to be combined, combining the corresponding two sub-address segments to obtain a combined address segment, generating a request message at least based on the combined address segment, and when the corresponding two sub-address segments are determined to be not combined, generating the corresponding request message at least based on each sub-address segment;
Step S203, the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program stored in the memory and capable of running on the processor, wherein the processor realizes at least the following steps when executing the program:
Step S201, determining whether to combine two corresponding sub-address segments based on the distance between two adjacent sub-address segments, where the variable address segments are used to represent the position of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment of the variable address segments;
Step S202, when the corresponding two sub-address segments are determined to be combined, combining the corresponding two sub-address segments to obtain a combined address segment, generating a request message at least based on the combined address segment, and when the corresponding two sub-address segments are determined to be not combined, generating the corresponding request message at least based on each sub-address segment;
Step S203, the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
The device herein may be a server, PC, PAD, cell phone, etc.
The application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with at least the following method steps:
Step S201, determining whether to combine two corresponding sub-address segments based on the distance between two adjacent sub-address segments, where the variable address segments are used to represent the position of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment of the variable address segments;
Step S202, when the corresponding two sub-address segments are determined to be combined, combining the corresponding two sub-address segments to obtain a combined address segment, generating a request message at least based on the combined address segment, and when the corresponding two sub-address segments are determined to be not combined, generating the corresponding request message at least based on each sub-address segment;
Step S203, the request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, etc., such as Read Only Memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
1) In the data acquisition method based on the communication terminal, if the received variable address segment comprises a plurality of discontinuous sub-address segments, whether the corresponding two sub-address segments are combined is determined based on the distance between the two adjacent sub-address segments. If the two corresponding sub-address segments meet the merging condition, namely, under the condition that the two sub-address segments are merged, merging the two corresponding sub-address segments to obtain a combined address segment, and generating a request message based on at least the combined address segment; if the two corresponding sub-address segments do not meet the merging condition, namely, the two sub-address segments are not merged, generating a corresponding request message at least based on each sub-address segment. And then the generated request message is issued to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal. Compared with the prior art that a plurality of discontinuous sub-address segments are configured as continuous address segments, and at least the continuous address segments are based on the generation request message, the method and the device for merging the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments ensure that whether the two sub-address segments are merged or not is accurately determined. If the two sub address segments are determined to be combined, a request message is generated at least based on the combined address segments, so that the problems that too many segments are generated, more request messages are generated, frequent data request of a communication terminal is caused, and the problems of data loss and communication disorder are avoided. If the two sub-address segments are not combined, generating a corresponding request message at least based on each sub-address segment, so that the problem of wasting the storage space of the communication terminal caused by combining the sub-address segments can be avoided.
2) In the data acquisition method based on the communication terminal, the determining unit is used for determining whether to combine the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments under the condition that the received variable address segments comprise a plurality of discontinuous sub-address segments. The first generating unit is used for merging the two corresponding sub-address segments to obtain a combined address segment and generating a request message at least based on the combined address segment if the two corresponding sub-address segments meet the merging condition, namely, if the two sub-address segments are merged; if the two corresponding sub-address segments do not meet the merging condition, namely, the two sub-address segments are not merged, generating a corresponding request message at least based on each sub-address segment. The sending unit is used for sending the generated request message to the communication terminal, so that variable information of the engine corresponding to the variable address field is obtained based on the communication terminal. Compared with the prior art that a plurality of discontinuous sub-address segments are configured as continuous address segments, and at least the continuous address segments are based on the generation request message, the method and the device for merging the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments ensure that whether the two sub-address segments are merged or not is accurately determined. If the two sub address segments are determined to be combined, a request message is generated at least based on the combined address segments, so that the problems that too many segments are generated, more request messages are generated, frequent data request of a communication terminal is caused, and the problems of data loss and communication disorder are avoided. If the two sub-address segments are not combined, generating a corresponding request message at least based on each sub-address segment, so that the problem of wasting the storage space of the communication terminal caused by combining the sub-address segments can be avoided.
The above description is only of the preferred embodiments of the present application and is not intended to limit the present application, but various modifications and variations can be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. The data acquisition method based on the communication terminal is applied to an upper computer, and the communication terminal is communicated with the upper computer, and is characterized by comprising the following steps of:
under the condition that the received variable address segment is a discontinuous address segment, determining whether to combine the two corresponding sub address segments based on the distance between the two adjacent sub address segments, wherein the variable address segment is used for representing the position of variable information of an engine to be acquired in a storage space, and the sub address segment is one address segment in the variable address segments;
Under the condition that the corresponding two sub-address segments are determined to be combined, the corresponding two sub-address segments are combined to obtain a combined address segment, a request message is generated at least based on the combined address segment, and under the condition that the corresponding two sub-address segments are determined to be not combined, the corresponding request message is generated at least based on each sub-address segment;
And transmitting the request message to the communication terminal, so that variable information of the engine corresponding to the variable address field is acquired based on the communication terminal.
2. The data acquisition method of claim 1, wherein determining whether to merge the corresponding two sub-address segments based on a distance between adjacent two sub-address segments comprises:
A first determining step, namely determining the distance between the ith sub-address segment and the (i+1) th sub-address segment to obtain a distance value, wherein the value of i starts from 1 until N, and N is the total number of the sub-address segments;
A second determining step, determining to combine the ith sub-address segment with the (i+1) th address segment when the distance value is less than or equal to the distance average value;
A third determining step of determining that the ith sub-address segment is not combined with the (i+1) th address segment when the distance value is greater than the distance average value;
Repeating the steps of the first determining step, the second determining step and the third determining step at least once in turn until all the sub address segments are determined, and when each repetition,
i=i+1。
3. The method of claim 2, wherein determining the distance between the ith sub-address segment and the (i+1) th sub-address segment to obtain a distance value comprises:
and determining the difference value between the last address value of the ith sub address segment and the first address value of the (i+1) th sub address segment to obtain the distance value.
4. The data acquisition method of claim 2, wherein determining the distance average comprises:
Using the formula Determining the distance average, wherein/(As the distance average value, xi +1 is the first address value of the i+1th sub-address segment, and xi is the last address value of the i-th sub-address segment.
5. The method of claim 1, wherein,
Generating a request message based at least on the combined address field, including: generating the request message based on the combined address field and a configuration ID, wherein the configuration ID is generated based on the received type information of the engine, the variable address field and a corresponding RS485 analysis file, and the RS485 analysis file comprises an analysis rule formulated based on an RS485 communication protocol;
generating the corresponding request message at least based on each sub-address segment, including: and generating the request message based on each sub-address segment and the configuration ID.
6. The data acquisition method of claim 1, wherein the data acquisition method further comprises:
And under the condition that the variable address field is a continuous address field, generating the request message based on the variable address field and a configuration ID, wherein the configuration ID is generated based on the received type information of the engine, the variable address field and a corresponding RS485 analysis file, and the RS485 analysis file comprises analysis rules formulated based on an RS485 communication protocol.
7. The data acquisition method according to claim 5 or 6, wherein the step of issuing the request message to the communication terminal so as to obtain variable information of the engine corresponding to the variable address field based on the communication terminal includes:
The request message is issued to the communication terminal, and the request message is forwarded to an instrument based on the communication terminal, so that variable information of the engine corresponding to the variable address field in the request message is obtained through the instrument;
Receiving a data message uploaded by the instrument and forwarded by the communication terminal, wherein the data message corresponds to the request message one by one, and the data message comprises variable information of the engine corresponding to the variable address field in the request message and the corresponding configuration ID;
and resolving the corresponding data message by adopting the RS485 resolving file corresponding to the configuration ID to obtain variable information of the engine corresponding to the variable address field.
8. The utility model provides a data acquisition device based on communication terminal, data acquisition device uses in the host computer, communication terminal with the host computer communicates, its characterized in that, data acquisition device includes:
The determining unit is used for determining whether to combine the two corresponding sub-address segments based on the distance between the two adjacent sub-address segments when the received variable address segments are discontinuous address segments, wherein the variable address segments are used for representing the positions of variable information of an engine to be acquired in a storage space, and the sub-address segments are one address segment in the variable address segments;
The first generation unit is used for merging the two corresponding sub-address segments to obtain a combined address segment under the condition that the two corresponding sub-address segments are determined to be merged, generating a request message at least based on the combined address segment, and generating the corresponding request message at least based on each sub-address segment under the condition that the two corresponding sub-address segments are determined to be not merged;
And the sending unit is used for sending the request message to the communication terminal so as to acquire the variable information of the engine corresponding to the variable address field based on the communication terminal.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium comprises a stored program, wherein the program, when run, controls a device in which the computer-readable storage medium is located to perform the communication terminal-based data acquisition method according to any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the communication terminal based data acquisition method according to any one of claims 1 to 7 by means of the computer program.
CN202410077953.1A 2024-01-18 2024-01-18 Data acquisition method and device based on communication terminal and electronic device Pending CN117914779A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410077953.1A CN117914779A (en) 2024-01-18 2024-01-18 Data acquisition method and device based on communication terminal and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410077953.1A CN117914779A (en) 2024-01-18 2024-01-18 Data acquisition method and device based on communication terminal and electronic device

Publications (1)

Publication Number Publication Date
CN117914779A true CN117914779A (en) 2024-04-19

Family

ID=90686577

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410077953.1A Pending CN117914779A (en) 2024-01-18 2024-01-18 Data acquisition method and device based on communication terminal and electronic device

Country Status (1)

Country Link
CN (1) CN117914779A (en)

Similar Documents

Publication Publication Date Title
US10754869B2 (en) Managing data format of data received from devices in an internet of things network
CN104836713A (en) Measurement and calibration method for vehicle electronic controller, device and system
CN109120477B (en) Dynamic analysis method, device, server and storage medium based on modbus protocol
CN107527186B (en) Electronic reading management method and device and terminal equipment
CN107689982A (en) Multi-data source method of data synchronization, application server and computer-readable recording medium
CN107146623B (en) Speech recognition method, device and system based on artificial intelligence
CN111966289A (en) Partition optimization method and system based on Kafka cluster
CN103713935A (en) Method and device for managing Hadoop cluster resources in online manner
CN110321283A (en) Interface testing case generation method, device, computer installation and storage medium
CN103905482A (en) Information push method, push server and system
CN109144846B (en) Test method and device for testing server
CN109089174A (en) A kind of processing method and processing device of multimedia data stream, computer storage medium
CN110472298B (en) Method, device, equipment and storage medium for constructing electric power market model
CN108427635A (en) Quickly method, server and the computer readable storage medium of test web page
CN111190625A (en) APP version upgrading method, server, client and computer readable storage medium
CN104636397B (en) Resource allocation methods, calculating accelerated method and device for Distributed Calculation
CN117914779A (en) Data acquisition method and device based on communication terminal and electronic device
CN111182006B (en) Method and device for mapping physical cluster into cloud computing resource
CN112231167A (en) Cloud resource monitoring method, device, equipment and storage medium
CN114422873B (en) Method, device and equipment for dynamically accessing industrial Internet identification analysis platform
CN106487855B (en) File uploading method, file accessing method, file uploading device, file accessing device and equipment
CN104598223B (en) A kind of network modelling language analysis method and device
CN111552715A (en) User query method and device
CN108337278A (en) A kind of method and apparatus for the amount of releasing news obtaining information flow
CN114928582B (en) Resource combination method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination