A high-frequency process data acquisition method, system, device and medium for a petroleum pipe threader
Patent Information
- Application Number
- CN202611044173.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-10-20
AI Technical Summary
受工业以太网通讯协议交互机制、上位机系统资源调度限制,上位机最短数据轮询间隔仅能达到 50ms,单秒最大有效采集次数仅 20 次
[0041]通过将多路浮点型工艺参数压缩编码至单一长整型数据,降低后续传输所需的数据包数量;利用环形缓存区固定存储最近若干组编码数据,保证上位机每次读取时能够获得连续采集周期的数据而不丢失中间环节;在低于采集频率的读取周期下一次性获取多组编码数据,避免过高通讯频率导致的链路拥堵,并结合采集计数值比较去重剔除已被处理的数据,保证每笔数据仅被使用一次;通过开始画图标志和记录保存标志两个标志位协同界定有效数据的起始边界和终止触发点,使保存的数据区间精准覆盖单次拧接作业的实际工艺阶段,排除非拧接阶段的无效数据。本发明在保障高频数据采集完整性的前提下,通过编码压缩、环形缓存、分频读取和标志位边界控制的联合作用,实现了通讯负载与数据采样密度的解耦,使上位机在较低读取频率下仍能获得连续无间断的高频工艺数据序列,同时确保归档数据与实际拧接过程在时空上严格对齐,提高工业数据存储质量。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial data storage, specifically to a method, system, equipment, and medium for high-frequency process data acquisition of an oil pipe screwing machine. Background Technology
[0002] The quality of the screwing of male threads on the pipe body and female threads on the couplings of oil pipes and casings in the petroleum industry directly determines the sealing performance, structural strength, and operational safety of oil and gas pipelines, making it a core quality control aspect of pipe manufacturing. Dynamic process parameters such as torque, speed, and number of turns during thread screwing are crucial for determining thread fit accuracy, assembly quality, and the presence of defects such as mis-threading, under-tightening, and over-tightening. Therefore, the accuracy, real-time nature, and communication stability of process data acquisition are essential for pipe quality traceability and process optimization.
[0003] Currently, the control systems of traditional oil pipe threading machines on the market generally adopt a data acquisition architecture of a host computer actively polling a programmable logic controller (PLC). Due to the limitations of the industrial Ethernet communication protocol and the resource scheduling of the host computer system, the shortest data polling interval of the host computer can only reach 50ms, and the maximum number of effective acquisitions per second is only 20. The sampling density is too low to capture the instantaneous state of thread tightening. Summary of the Invention
[0004] The purpose of this invention is to provide a method, system, equipment and medium for high-frequency process data acquisition of oil pipe screwing machines, which solves the problems in the prior art.
[0005] This invention is achieved through the following technical solution:
[0006] In a first aspect, embodiments of the present invention provide a method for high-frequency process data acquisition of an oil pipe threading machine, comprising:
[0007] The PLC collects high-frequency process data of the oil pipe screwing machine at a first frequency, and encodes it into long integer data. The long integer data includes a start symbol, a start drawing flag, a record saving flag, a collection count value, and a screwing code value. The start symbol is used to mark the starting position of the long integer data. The start drawing flag is used to indicate whether drawing has started according to the high-frequency process data. The record saving flag is used to indicate whether the screwing code value has been saved. The collection count value is used to identify the sequence of the long integer data. The screwing code value is used to store the encoded high-frequency process data.
[0008] Each time a long integer data is collected, it is written to the DB1 end variable in the PLC to obtain the DB1 circular buffer data block;
[0009] The host computer acquires the DB1 circular buffer data block at a second frequency, and performs bitwise decoding based on the start character in the DB1 circular buffer data block to obtain multiple long integer data, wherein the first frequency is higher than the second frequency;
[0010] The collected high-frequency process data is saved based on the start drawing flag and record saving flag in the multiple long integer data.
[0011] Preferably, the step of acquiring high-frequency process data of the oil pipe tightening machine at a first frequency using a PLC and encoding it to obtain long integer data includes:
[0012] The PLC collects high-frequency process data of the oil pipe screwing machine at the first frequency.
[0013] The high-frequency process data is encoded to obtain screwing code values;
[0014] The starting point for drawing is determined based on the screwing torque in the high-frequency process data.
[0015] The record preservation flag is determined based on whether a manual preservation instruction has been received.
[0016] The collected count value is determined based on the first frequency;
[0017] The start symbol, the record saving flag, the start drawing flag, the acquisition count value, and the screwing code value are encoded as long integer data.
[0018] Preferably, the step of acquiring high-frequency process data of the oil pipe tightening machine at a first frequency using a PLC includes:
[0019] Based on the real-time acquisition of the 1-meter fixed lever arm and real-time tension and pressure data of the back clamp of the oil pipe screwing machine by PLC, the real-time torque of the thread screwing is calculated.
[0020] The encoder pulses of the oil pipe tightening machine are analyzed to obtain the cycle number and rotation speed.
[0021] Preferably, the storage capacity of the DB1 ring cache data block is greater than or equal to the ratio of the second frequency to the first frequency.
[0022] Preferably, when the storage size of the DB1 circular cache data block is greater than the ratio of the second frequency to the first frequency, the collected high-frequency process data is saved according to the start drawing flag and record saving flag in the plurality of long integer data, including:
[0023] The collected count values in the multiple long integer data are compared with the collected count values of existing long integer data in the host computer to remove duplicates, resulting in multiple filtered long integer data.
[0024] The collected high-frequency process data is saved based on the start drawing flag and record saving flag in the multiple filtered long integer data.
[0025] Preferably, the high-frequency process data is saved according to the start plotting flag and record saving flag in the plurality of filtered long integer data, including:
[0026] If the start plotting flag in any of the multiple filtered long integer data is valid, then plotting begins based on the filtered long integer data with the valid start plotting flag, resulting in a process curve and a structured data array with acquisition count values.
[0027] If the record saving flag is valid in any of the multiple filtered long integer data, then the structured data array prior to the filtered long integer data with the valid record saving flag is stored.
[0028] Preferably, if the record saving flag in any of the filtered long integer data is valid, then the structured data array storing the filtered long integer data before the record saving flag is valid includes:
[0029] The host computer iterates through the long integer data that has been decoded and filtered in each round, and checks the record saving flag of each data.
[0030] If any record with a long integer data filter is found to be valid during the traversal, it is determined that the screwing is completed and the operator has confirmed that it is qualified, and the data archiving process begins.
[0031] The host computer binds the structured data array with the static process parameters of the current operation to obtain associated data;
[0032] The host computer writes the associated data line by line into a data table to complete persistent storage.
[0033] Secondly, embodiments of the present invention provide a high-frequency process data acquisition system for an oil pipe threading machine, comprising:
[0034] The encoding module is used to collect high-frequency process data of the oil pipe screwing machine from the PLC at a first frequency, and encode it into long integer data. The long integer data includes a start symbol, a start drawing flag, a record saving flag, a collection count value, and a screwing code value. The start symbol is used to mark the starting position of the long integer data. The start drawing flag is used to indicate whether drawing has started according to the high-frequency process data. The record saving flag is used to indicate whether the screwing code value has been saved. The collection count value is used to identify the sequence of the long integer data. The screwing code value is used to store the encoded high-frequency process data.
[0035] The write module is used to write the long integer data collected each time into the DB1 end variable in the PLC to obtain the DB1 circular buffer data block;
[0036] The decoding module is used to obtain the DB1 circular buffer data block from the host computer at a second frequency, and to perform bitwise decoding based on the start character in the DB1 circular buffer data block to obtain multiple long integer data, wherein the first frequency is higher than the second frequency;
[0037] The storage module is used to save the acquired high-frequency process data according to the start drawing flag and record saving flag in the plurality of long integer data.
[0038] Thirdly, embodiments of the present invention provide an electronic device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method of the first aspect described above.
[0039] Fourthly, embodiments of the present invention provide a storage medium storing computer program instructions, which, when executed by a processor, implement the method of the first aspect described above.
[0040] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0041] By compressing and encoding multiple floating-point process parameters into a single long integer, the number of data packets required for subsequent transmission is reduced. A circular buffer is used to store the most recent sets of encoded data, ensuring that the host computer can obtain data from the continuous acquisition cycle without losing intermediate data each time it reads. Multiple sets of encoded data are acquired at once during reading cycles lower than the acquisition frequency, avoiding link congestion caused by excessively high communication frequencies. Deduplication and removal of processed data are combined with comparison of acquisition counts, ensuring that each piece of data is used only once. Two flags, a start drawing flag and a record saving flag, collaboratively define the start boundary and end trigger point of valid data, ensuring that the saved data range accurately covers the actual process stage of a single screwing operation, excluding invalid data from non-screwing stages. This invention, while ensuring the integrity of high-frequency data acquisition, achieves decoupling of communication load and data sampling density through the combined effects of encoding compression, circular buffering, frequency division reading, and flag boundary control. This allows the host computer to obtain continuous and uninterrupted high-frequency process data sequences even at lower reading frequencies, while ensuring strict temporal and spatial alignment between archived data and the actual screwing process, thus improving the quality of industrial data storage. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be considered as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:
[0043] Figure 1 A flowchart illustrating the high-frequency process data acquisition method for oil pipe screwing machines provided by this invention;
[0044] Figure 2 Hardware structure diagram of the high-frequency process data acquisition system for oil pipe screwing machine provided by the present invention;
[0045] Figure 3 This is a schematic diagram illustrating an example of high-frequency process data acquisition for an oil pipe screwing machine provided by the present invention.
[0046] Figure 4 A schematic diagram of the high-frequency process data acquisition system for oil pipe screwing machine provided by the present invention;
[0047] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0049] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0050] It should be noted that all actions involving the acquisition of signals, information, or data in this invention are carried out in compliance with the relevant data protection laws and regulations of the locality and with authorization from the owner of the relevant device.
[0051] Example 1
[0052] Please see Figure 1 This invention provides a method for high-frequency process data acquisition for oil pipe screwing machines, including:
[0053] S1. The PLC collects high-frequency process data of the oil pipe screwing machine at a first frequency, and encodes it into long integer data. The long integer data includes a start symbol, a start drawing symbol, a record saving symbol, a collection count value, and a screwing code value. The start symbol is used to mark the starting position of the long integer data. The start drawing symbol is used to indicate whether drawing has started according to the high-frequency process data. The record saving symbol is used to indicate whether the screwing code value has been saved. The collection count value is used to identify the sequence of the long integer data. The screwing code value is used to store the encoded high-frequency process data.
[0054] The first frequency refers to the time interval at which the PLC periodically collects the process parameters generated during the operation of the oil pipe tightening machine. For example, it is set to trigger a collection once every 10 milliseconds with a timer interrupt. This frequency is higher than the data reading frequency of the host computer, so as to ensure that the rapid changes in parameters such as torque, number of revolutions, and speed during the tightening process can be completely captured without losing details.
[0055] High-frequency process data refers to the set of real-time process parameters acquired by the PLC through analog input modules, high-speed counting modules, and other acquisition channels during the screwing operation. These parameters include, but are not limited to, screwing torque value, main clamp rotation cycle value, and main clamp speed value. These parameters change rapidly over time during the screwing process and are interrelated.
[0056] Long integer data is an integer variable stored internally by the PLC in the form of a binary bit sequence. Its bit width is at least 20 bits. It is used to encode multiple fields with different meanings into a single data entity according to a fixed bit field division rule, so as to reduce the number of data packets during communication transmission.
[0057] The start character is a preset value stored in a fixed bit field in long integer data. For example, the first bit is always set to the number 1. When decoding, the host computer determines whether the current 20 bits of data are valid encoded data based on the value of this bit, and excludes invalid data caused by communication interference or data alignment errors.
[0058] The start-drawing flag is a Boolean value stored in a specific flag field of long integer data, such as the 3rd bit. When the real-time torque reaches the starting torque threshold, the PLC sets this bit to 1, indicating that the high-frequency process data starting from the current acquisition cycle needs to participate in the real-time curve drawing of the host computer.
[0059] The record saving flag is a Boolean value stored in a specific flag field of long integer data, such as the 2nd bit. After the PLC completes the screwing of a single pipe and the operator confirms that the process quality is qualified, the PLC sets this bit to 1, and the host computer determines that the data of the current operation cycle needs to be persistently saved.
[0060] The acquisition count value is the sequence number stored in a specific integer bit field in long integer data. For example, the 4th to 8th bits, a total of 5 bits, store integers in the range of 0 to 99999. The PLC increments this value by 1 every time it acquires and encodes data, and resets it to zero after overflow. This is used by the host computer to distinguish the order of data at different acquisition times and to remove duplicate data.
[0061] The screwing code value is a collection of encoded process data stored in multiple integer bit fields in long integer data, including torque code value, revolution code value, and speed code value. The revolution number is a floating-point number magnified by 10,000 times and then stored in the corresponding bit field, the speed is a floating-point number magnified by 10 times and then stored in the corresponding bit field, and the torque value is directly stored in the corresponding bit field, thereby converting the floating-point physical quantity into an integer bit field to facilitate bit splicing operation.
[0062] Specifically, after the PLC triggers the acquisition interrupt at the first frequency, it simultaneously locks the original physical quantity values of each acquisition channel within the current scanning cycle. Based on pre-set bit field allocation rules, it performs dimensional conversion on the torque, cycle number, and rotational speed to obtain corresponding integer encoded values. These values are then combined with the start symbol, start drawing flag, record saving flag, and maintained acquisition count value determined for the current process stage, and concatenated into a 20-bit long integer data through shifting and logical OR operations. This data serves as the complete encoded output for a single acquisition, used in subsequent buffering steps. In this process, the floating-point process parameters that originally required multiple data packets to be transmitted are compressed into a single long integer variable, reducing the amount of data transmitted in subsequent communication and ensuring that the data generated by high-frequency acquisition can be encoded in a timely manner without becoming a system bottleneck.
[0063] In some implementations, high-frequency process data of the oil pipe tightening machine is collected by the PLC at a first frequency and encoded into long integer data, including:
[0064] The PLC collects high-frequency process data of the oil pipe screwing machine at the first frequency.
[0065] The high-frequency process data is encoded to obtain screwing code values;
[0066] The starting point for drawing is determined based on the screwing torque in the high-frequency process data.
[0067] The record preservation flag is determined based on whether a manual preservation instruction has been received.
[0068] The collected count value is determined based on the first frequency;
[0069] The start symbol, the record saving flag, the start drawing flag, the acquisition count value, and the screwing code value are encoded as long integer data.
[0070] The process of determining the start drawing marker based on the screwing torque in the high-frequency process data includes:
[0071] When the tightening torque is greater than the initial torque threshold, the start drawing flag is set to 1; when the tightening torque is greater than the optimal torque threshold, the start drawing flag is set to 0.
[0072] For example, the structure of long integer data is shown in the table below:
[0073]
[0074] The first bit is the start sign of the number, which is fixed to 1 and is used to define the boundary of the number of bits in the long integer data.
[0075] The second bit: record save flag, which can be 0 or 1. When it is 1, the action of writing the data of a single pipe into Excel is triggered.
[0076] The third bit: Start drawing flag, which can be 0 or 1. When it is 1, the host computer starts drawing the process curve.
[0077] 4th to 8th digits: Collected count value, original engineering range 0~99999;
[0078] 9th to 13th digits: Torque value, original engineering range 0~99999;
[0079] Bits 14 to 18: Week number encoding value, the original week number range is 0~9.9999, during encoding, the floating-point number is magnified by 10000 times and converted into an integer for storage;
[0080] Bits 19 and 20: Rotational speed encoding value. The original rotational speed range is 0 to 9.9. During encoding, the floating-point number is multiplied by 10 and converted to an integer for storage.
[0081] In some embodiments, the step of acquiring high-frequency process data of the oil pipe tightening machine at a first frequency using a PLC includes:
[0082] Based on the real-time acquisition of the 1-meter fixed lever arm and real-time tension and pressure data of the back clamp of the oil pipe screwing machine by PLC, the real-time torque of the thread screwing is calculated.
[0083] The encoder pulses of the oil pipe tightening machine are analyzed to obtain the cycle number and rotation speed.
[0084] Specifically, within each acquisition cycle triggered at the first frequency, the PLC simultaneously reads the current signal value from the tension / compression sensor channel in the analog input module and converts it into a real-time force value. This force value is multiplied by a preset 1-meter fixed lever arm constant to obtain the real-time torque physical quantity for thread tightening. Simultaneously, it reads the current cumulative count value of the encoder pulses in the high-speed counting module and divides it by the pulse base per revolution to obtain the number of revolutions. It also calculates the pulse increment within a unit time window and converts it into instantaneous rotational speed. These three physical quantities serve as the raw input for the high-frequency process data within that acquisition cycle. This acquisition method directly utilizes the fixed physical characteristics of the back clamp lever arm in the screw fastener's mechanical structure for torque conversion, avoiding the signal transmission and mechanical installation difficulties associated with installing a torque sensor on the rotating spindle. Furthermore, by simultaneously obtaining the number of revolutions and rotational speed through the cumulative count and increment calculation of the encoder pulses, it provides a synchronous horizontal and vertical axis data source for the subsequent plotting of torque-revolution curves and rotational speed-revolution curves.
[0085] S2. Write the long integer data collected each time into the DB1 end variable in the PLC to obtain the DB1 circular buffer data block;
[0086] Among them, the DB1 last variable refers to the last long integer variable in the preset DB1 data block inside the PLC, arranged in the order of variable declaration. For example, if 10 long integer variables, value1 to value10, are declared in DB1, then value10 is the last variable, which serves as the write entry point for the circular buffer.
[0087] DB1 circular cache data blocks refer to a circular storage structure composed of a fixed number of long integer variables in DB1. Each time new data is written to the last variable, the original last variable data is moved to the previous variable, and each variable is moved forward in sequence. The data of the first variable is discarded, thus always retaining a fixed number of recently written encoded data.
[0088] Specifically, after the PLC completes the encoding of each long integer data, it assigns the data to the last variable in DB1. Then, it triggers a circular shift operation, moving all data stored in DB1 one position in the direction of decreasing variable index. During this shift, the original data in the variable with the smallest index is lost, while the variable with the largest index is overwritten by the new data. This creates a buffer structure where data is continuously updated as the acquisition process progresses. Because the circular buffer stores a fixed number of the most recent sets of encoded data, the host computer can acquire data from multiple consecutive acquisition cycles at once during batch reading, reducing the risk of data discontinuity during decoding calculations.
[0089] In some embodiments, the storage capacity of the DB1 ring cache data block is greater than or equal to the ratio of the second frequency to the first frequency.
[0090] Specifically, the ratio of the second frequency to the first frequency refers to the multiple of the host computer reading cycle (e.g., 50ms) to the PLC acquisition cycle (e.g., 10ms), i.e., 5 times. This ratio reflects the number of high-frequency acquisitions actually completed by the PLC between two host computer reads. According to system design requirements, the storage capacity of the DB1 ring buffer data block is configured to be no less than this ratio, for example, a storage capacity of 10 and a ratio of 5, to ensure that during any host computer read operation, the ring buffer has accumulated all the new encoded data generated within at least one complete read cycle, preventing situations where the buffer is empty or insufficient data.
[0091] S3. The host computer obtains the DB1 circular buffer data block at a second frequency, and performs bitwise decoding based on the start character in the DB1 circular buffer data block to obtain multiple long integer data, wherein the first frequency is higher than the second frequency;
[0092] The second frequency refers to the time interval at which the host computer periodically reads the DB1 ring buffer data block. This frequency is lower than the first frequency of the PLC, for example, once every 50 milliseconds, to ensure that the amount of data transmitted in a single read operation is within the allowable range of the communication bandwidth and does not cause communication timeout or delay.
[0093] Bitwise decoding refers to the process by which the host computer, after reading the original long integer value from the DB1 circular buffer data block, extracts the independent values of each field through bitwise operations according to the same bit field division rules as when encoding the PLC. This includes extracting the start character and verifying its validity, as well as extracting the start drawing flag, record saving flag, acquisition count value, torque code value, cycle number code value, and speed code value.
[0094] Specifically, when the host computer triggers the read operation according to the second frequency, it reads the values of all variables in the DB1 circular buffer data block at once. For each read long integer data, the start sign bit field is first extracted and compared with a preset value. If they match, the data is determined to be valid encoded data. Then, its acquisition count value is extracted and compared with the count value retained in the previous round of reading to remove processed data and filter out newly acquired encoded data in the current cycle for use in subsequent steps. The strategy of batch storing multiple sets of encoded data in the circular buffer, combined with the host computer's batch reading, allows multiple acquisition cycles of data to be transmitted in each communication, reducing the number of communication interactions per unit time and ensuring stable operation of the communication link without data backlog at the second frequency.
[0095] S4. Save the collected high-frequency process data according to the start drawing flag and record saving flag in the plurality of long integer data.
[0096] In each round of decoding, the host computer checks the start-drawing flag field of each long integer data. When the start-drawing flag is set to 1, it organizes the data and the subsequently acquired coded data into a structured data array according to the acquisition count value. This array is used to draw the process curve with the number of screwing turns as the horizontal axis. When the host computer detects coded data with the record-saving flag set to 1 in subsequent rounds of decoding, it identifies all data in the currently organized structured data array preceding the data with the record-saving flag as valid process data to be persistently stored. This data is then associated with operational parameters such as pipe specifications, coupling models, materials, and execution standards, and written line by line into an Excel document for archiving.
[0097] The host computer controls the start and end boundaries of data saving by determining the validity and invalidity of the start drawing flag. That is, when the start drawing flag is valid, the start point of valid data recording is defined, and when the start drawing flag is invalid, the end trigger point of valid data recording is defined. This avoids including invalid data or sensor standby noise data from non-tightening stages in the archiving scope. At the same time, the record saving flag is set by the PLC after the operator confirms the process quality, ensuring that the tightening process corresponding to the archived data has passed quality verification.
[0098] In some implementations, when the storage size of the DB1 ring cache data block is greater than the ratio of the second frequency to the first frequency, the collected high-frequency process data is saved according to the start drawing flag and record saving flag in the plurality of long integer data, including:
[0099] The collected count values in the multiple long integer data are compared with the collected count values of existing long integer data in the host computer to remove duplicates, resulting in multiple filtered long integer data.
[0100] The collected high-frequency process data is saved based on the start drawing flag and record saving flag in the multiple filtered long integer data.
[0101] Specifically, when the storage capacity of the ring buffer is greater than the ratio of the second frequency to the first frequency, the amount of new data actually generated by the PLC between two upper computer read operations is less than the total capacity of the ring buffer. This means that in the current reading round, some of the collected count values will overlap with the existing count values of the upper computer. After comparing the collected count values one by one to eliminate these duplicate data, the selected long integer data set is all the newly generated coded data after the previous reading round. The data in this set is arranged in ascending order of the collected count values. Then, the start and end boundaries of the data records are located according to the start drawing marker in the filtering results. Finally, the recorded data is archived according to the record saving marker. Thus, in the data saving operation, only the newly generated high-frequency process data that is within the effective boundary interval is extracted for archiving, avoiding multiple saving of the same data due to repeated reading and incomplete data intervals due to boundary misalignment, and ensuring the consistency between the archived data and the actual acquisition time.
[0102] In some implementations, the collected high-frequency process data is saved based on the start-drawing flag and record-saving flag in the plurality of filtered long integer data, including:
[0103] If the start plotting flag in any of the multiple filtered long integer data is valid, then plotting begins based on the filtered long integer data with the valid start plotting flag, resulting in a process curve and a structured data array with acquisition count values.
[0104] If the record saving flag is valid in any of the multiple filtered long integer data, then the structured data array prior to the filtered long integer data with the valid record saving flag is stored.
[0105] Wherein, if the record saving flag in any of the filtered long integer data is valid, then the structured data array prior to storing the filtered long integer data with valid record saving flags includes:
[0106] The host computer iterates through the long integer data that has been decoded and filtered in each round, and checks the record saving flag of each data.
[0107] If any record with a long integer data filter is found to be valid during the traversal, it is determined that the screwing is completed and the operator has confirmed that it is qualified, and the data archiving process begins.
[0108] The host computer binds the structured data array with the static process parameters of the current operation to obtain associated data;
[0109] The host computer writes the associated data line by line into a data table to complete persistent storage.
[0110] Specifically, after the host computer obtains the filtered long integer data through comparison and deduplication in each round, it sequentially traverses the start drawing flag field of each filtered data. When the first data with the start drawing flag set to 1 is identified, the host computer appends this data and all subsequent filtered data to the structured data format one by one according to the collection count value. The data points corresponding to the start drawing flag set to 1 are mapped to a coordinate system with the number of revolutions as the horizontal axis to draw torque-number of revolutions curves and speed-number of revolutions curves. This allows for real-time updates of the dynamic graphical representation of the screwing process on the display interface. At the same time, the structured data array continues to accumulate until the start drawing flag is identified as set to 0, at which point the drawing and updating of the structured data array stops. When the host computer detects that the record save flag of any filtered data is set to 1 during subsequent traversal, it determines the structured data array corresponding to the period when the start drawing flag is 1 in the current structured data array as the collection to be archived, and writes it to an Excel document to complete persistent storage. The data containing the record save flag itself is not included in the storage scope, because this data only serves as a trigger signal and does not carry the process data during the screwing process. This ensures that the archived process curve data all come from the actual screwing stage and are not redundant data containing the flag trigger time.
[0111] The present invention will be further described in detail below with reference to specific embodiments.
[0112] This embodiment discloses a high-frequency process data acquisition method and system for oil pipe screwing machines, such as... Figure 2 As shown, the hardware platform uses an IPC-5120 industrial control computer and a Siemens S7-1513 PLC control system. The PLC's supporting expansion modules are, in order: 6ES7521-1BL00-0AB0 digital input module, 6ES7521-1BH00-0AB0 digital input module, 6ES7522-1BL01-0AB0 digital output module, 6ES7534-7QE00-0AB0 analog input / output module, and 6ES7550-1AA01-0AB0 high-speed counting module. The entire system is applied to the fully automated screwing production scenario of oil tubing and casing.
[0113] After the system is powered on and initialized, the IPC-5120 industrial computer and the Siemens S7-1513 PLC establish a stable communication link via industrial Ethernet and the S7TCP / IP protocol. The PLC acquires switch signals from the main clamp, back clamp, conveying mechanism, photoelectric detection switches, etc., through two digital input modules; and outputs control commands through digital output modules to realize the action control of main clamp clamping and loosening, back clamp clamping and loosening, steel pipe turning, feeding and discharging, V-shaped roller conveyor lifting and conveying, etc.
[0114] like Figure 3As shown, the PLC acquires two 4~20mA analog signals through the 6ES7534-7QE00-0AB0 analog input / output module: one is the hydraulic pressure signal, corresponding to an engineering range of 0~40MPa; the other is the tension / compression sensor signal at the back clamp, corresponding to an engineering range of -5~+5 tons. The PLC, combined with the 1-meter fixed installation lever arm of the back clamp, calculates the thread tightening torque in real time, with the original torque range being 0~99999. The PLC acquires the incremental encoder pulse signal of the main clamp through the 6ES7550-1AA01-0AB0 high-speed counting module, and analyzes it to obtain the number of tightening revolutions and the rotational speed; the original data for the number of revolutions is 0~9.9999 (1 integer + 4 decimal floating-point numbers), and the original data for the rotational speed is 0~9.9 (1 integer + 1 decimal floating-point number).
[0115] After the equipment switches to the automatic screwing process, the steel pipe is conveyed by the conveying mechanism, positioned by the photoelectric switch, and the clamping body completes the clamping action. The main clamp then begins to rotate and screw. When the real-time torque reaches the preset starting torque threshold of the host computer, the PLC sets the starting plotting mark position 1 in the long integer data and simultaneously starts the high-frequency timed acquisition task; in this embodiment, the default acquisition period is set to 10ms.
[0116] The PLC internally uses a pre-defined DB1 data block as a circular buffer. DB1 contains 10 long integer variables, value1 to value10, each with 20 bits. Multiple parameters are encoded bit-by-bit according to a pre-defined rule: the first bit is fixed as the start sign 1; the second bit is the record saving flag; the third bit is the start drawing flag; bits 4-8 store the acquisition count value (0-99999); bits 9-13 store the torque value (0-99999); the cycle number is amplified 10000 times and stored as an integer in bits 14-18; the speed is amplified 10 times and stored as an integer in bits 19-20.
[0117] Data storage adopts a last-in-first-out circular shift mechanism: after each encoding is completed, the latest 20-bit long integer data is written to the last variable value10 of DB1; the original value10 data is shifted to value9, and all variable data are shifted forward in sequence. The old data in the frontmost value1 is automatically overflowed and discarded. DB1 always saves the latest 10 sets of encoded data.
[0118] The host computer reads all 10 long integer variables in the DB1 data block in batches at a fixed 50ms cycle. Compared with the traditional multi-variable distributed transmission scheme, this scheme only transmits long integer data, which greatly reduces the amount of communication data and can stably maintain a 50ms reading cycle, without communication delays caused by excessive data volume.
[0119] After receiving the long integer data, the host computer performs a bit-by-bit decoding operation: splitting the data into 20 bits, extracting the acquisition count value, torque code value, cycle number code value, and speed code value respectively; dividing the cycle number code value by 10000 to restore the original floating-point number, and dividing the speed code value by 10 to restore the original floating-point number. The host computer then compares the acquired count value, removing duplicate data from the previous round and selecting entirely new and valid acquired data.
[0120] The host computer uses the valid data to plot real-time process curves of torque-number of rotations and speed-number of rotations, respectively, with the number of screwing turns as the X-axis, to fully reproduce the dynamic changes of the entire screwing process; at the same time, it generates a structured data array based on the collected count values.
[0121] After a single pipe is screwed together, the operator verifies the quality of the process curve. Once the quality is confirmed to be acceptable, a save command is triggered, and the PLC records the save flag as 1. When the host computer detects that the flag is 1, it associates the pipe specifications, coupling model, material, and execution standards of this operation with the structured data array and writes them line by line into an Excel document to complete persistent archiving, generating a production record that can be queried and traced for a long time.
[0122] Example 2
[0123] Please see Figure 4 This invention provides a high-frequency process data acquisition system for an oil pipe screwing machine, comprising:
[0124] The encoding module 201 is used to collect high-frequency process data of the oil pipe screwing machine from the PLC at a first frequency, and encode it into long integer data. The long integer data includes a start symbol, a start drawing flag, a record saving flag, a collection count value, and a screwing code value. The start symbol is used to mark the starting position of the long integer data. The start drawing flag is used to indicate whether drawing has started according to the high-frequency process data. The record saving flag is used to indicate whether the screwing code value has been saved. The collection count value is used to identify the sequence of the long integer data. The screwing code value is used to store the encoded high-frequency process data.
[0125] The writing module 202 is used to write the long integer data collected each time into the DB1 end variable in the PLC to obtain the DB1 circular buffer data block;
[0126] The decoding module 203 is used to obtain the DB1 circular buffer data block from the host computer at a second frequency, and to perform bitwise decoding based on the start character in the DB1 circular buffer data block to obtain multiple long integer data, wherein the first frequency is higher than the second frequency;
[0127] The storage module 204 is used to save the collected high-frequency process data according to the start drawing flag and record saving flag in the plurality of long integer data.
[0128] It should be noted that each module and unit in the high-frequency process data acquisition system of the oil pipe screwing machine in this embodiment corresponds one-to-one with each step in the high-frequency process data acquisition method of the oil pipe screwing machine in the aforementioned embodiment. Therefore, the specific implementation of this embodiment can refer to the implementation of the aforementioned high-frequency process data acquisition method of the oil pipe screwing machine, and will not be repeated here.
[0129] Example 3
[0130] Please see Figure 5 This embodiment provides an electronic device, including at least one processor 301 and a memory 302. Optionally, the device further includes a communication component 303. The processor 301, memory 302, and communication component 303 are connected via a bus 304.
[0131] In a specific implementation, at least one processor 301 executes computer execution instructions stored in memory 302, causing at least one processor 301 to perform the above-described method.
[0132] The specific implementation process of processor 301 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0133] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0134] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0135] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0136] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0137] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0138] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0139] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0140] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0141] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0142] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0143] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0144] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0145] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for high-frequency process data acquisition of an oil pipe screwing machine, characterized in that, include: The PLC collects high-frequency process data of the oil pipe screwing machine at a first frequency, and encodes it into long integer data. The long integer data includes a start symbol, a start drawing flag, a record saving flag, a collection count value, and a screwing code value. The start symbol is used to mark the starting position of the long integer data. The start drawing flag is used to indicate whether drawing has started according to the high-frequency process data. The record saving flag is used to indicate whether the screwing code value has been saved. The collection count value is used to identify the sequence of the long integer data. The screwing code value is used to store the encoded high-frequency process data. Each time a long integer data is collected, it is written to the DB1 end variable in the PLC to obtain the DB1 circular buffer data block; The host computer acquires the DB1 circular buffer data block at a second frequency, and performs bitwise decoding based on the start character in the DB1 circular buffer data block to obtain multiple long integer data, wherein the first frequency is higher than the second frequency; The collected high-frequency process data is saved based on the start drawing flag and record saving flag in the multiple long integer data.
2. The method according to claim 1, characterized in that, The process involves acquiring high-frequency process data from the oil pipe tightening machine via PLC at a first frequency, and encoding this data to obtain long integer data, including: The PLC collects high-frequency process data of the oil pipe screwing machine at the first frequency. The high-frequency process data is encoded to obtain screwing code values; The starting point for drawing is determined based on the screwing torque in the high-frequency process data. The record preservation flag is determined based on whether a manual preservation instruction has been received. The collected count value is determined based on the first frequency; The start symbol, the record saving flag, the start drawing flag, the acquisition count value, and the screwing code value are encoded as long integer data.
3. The method according to claim 2, characterized in that, The process of acquiring high-frequency process data of the oil pipe tightening machine according to the PLC at a first frequency includes: Based on the real-time acquisition of the 1-meter fixed lever arm and real-time tension and pressure data of the back clamp of the oil pipe screwing machine by PLC, the real-time torque of the thread screwing is calculated. The encoder pulses of the oil pipe tightening machine are analyzed to obtain the cycle number and rotation speed.
4. The method according to claim 1, characterized in that, The storage capacity of the DB1 ring cache data block is greater than or equal to the ratio of the second frequency to the first frequency.
5. The method according to claim 4, characterized in that, When the storage size of the DB1 circular cache data block is greater than the ratio of the second frequency to the first frequency, the collected high-frequency process data is saved according to the start plotting flag and record saving flag in the plurality of long integer data, including: The collected count values in the multiple long integer data are compared with the collected count values of existing long integer data in the host computer to remove duplicates, resulting in multiple filtered long integer data. The collected high-frequency process data is saved based on the start drawing flag and record saving flag in the multiple filtered long integer data.
6. The method according to claim 5, characterized in that, The collected high-frequency process data is saved based on the start plotting flag and record saving flag in the multiple filtered long integer data, including: If the start plotting flag in any of the multiple filtered long integer data is valid, then plotting begins based on the filtered long integer data with the valid start plotting flag, resulting in a process curve and a structured data array with acquisition count values. If the record saving flag is valid in any of the multiple filtered long integer data, then the structured data array prior to the filtered long integer data with the valid record saving flag is stored.
7. The method according to claim 6, characterized in that, If the record saving flag is valid in any of the filtered long integer data, then the structured data array prior to storing the filtered long integer data with valid record saving flags includes: The host computer iterates through the long integer data that has been decoded and filtered in each round, and checks the record saving flag of each data. If any record with a long integer data filter is found to be valid during the traversal, it is determined that the screwing is completed and the operator has confirmed that it is qualified, and the data archiving process begins. The host computer binds the structured data array with the static process parameters of the current operation to obtain associated data; The host computer writes the associated data line by line into a data table to complete persistent storage.
8. A high-frequency process data acquisition system for an oil pipe screwing machine, characterized in that, include: The encoding module is used to collect high-frequency process data of the oil pipe screwing machine from the PLC at a first frequency, and encode it into long integer data. The long integer data includes a start symbol, a start drawing flag, a record saving flag, a collection count value, and a screwing code value. The start symbol is used to mark the starting position of the long integer data. The start drawing flag is used to indicate whether drawing has started according to the high-frequency process data. The record saving flag is used to indicate whether the screwing code value has been saved. The collection count value is used to identify the sequence of the long integer data. The screwing code value is used to store the encoded high-frequency process data. The write module is used to write the long integer data collected each time into the DB1 end variable in the PLC to obtain the DB1 circular buffer data block; The decoding module is used to obtain the DB1 circular buffer data block from the host computer at a second frequency, and to perform bitwise decoding based on the start character in the DB1 circular buffer data block to obtain multiple long integer data, wherein the first frequency is higher than the second frequency; The storage module is used to save the acquired high-frequency process data according to the start drawing flag and record saving flag in the plurality of long integer data.
9. An electronic device, characterized in that, include: At least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, The method as described in any one of claims 1-7 is implemented when the computer program instructions are executed by the processor.