A multi-flowmeter communication control system and method
Patent Information
- Application Number
- CN202611067377.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-17
- Publication Date
- 2026-10-09
AI Technical Summary
[0004]但是,传统并联架构中每个流量计入网前需人工逐个配置地址,批量拓展效率较低,新增10个流量计耗时通常超过2小时,运维过程中更换流量计需重新设置地址,易出错且耗时
Smart Images

Figure CN122891392A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of flow meter technology, and in particular to a multi-flow meter communication control system and method. Background Technology
[0002] In industrial production and municipal operations, flow meters are widely deployed in the measurement and monitoring of various fluid media.
[0003] Currently, flow meters are typically connected in parallel to the communication bus via independent interfaces, but the device address of each flow meter needs to be manually configured. For example, the address code is set via a DIP switch.
[0004] However, in the traditional parallel architecture, each flow meter needs to be manually configured before it is connected to the network. The efficiency of batch expansion is low. Adding 10 flow meters usually takes more than 2 hours. When replacing a flow meter during operation and maintenance, the address needs to be reset, which is prone to errors and time-consuming. Summary of the Invention
[0005] This application is made in view of at least one of the above-mentioned technical problems existing in the prior art, and the present application can improve communication efficiency.
[0006] In a first aspect, embodiments of this application provide a multi-flowmeter communication control system, including: a communication bus, an address allocation module, and a control module; Multiple flow meters are connected in parallel to the communication bus through their respective bus interfaces; The address allocation module is connected to the communication bus and is used to allocate a device address to each flow meter in response to the address request sent by each flow meter after it is connected to the communication bus. The control module is connected to the communication bus and is used to obtain the device address of each flow meter through the communication bus, generate a polling queue based on the device address of each flow meter, and communicate with each flow meter based on the number of flow meters connected to the communication bus and the polling queue.
[0007] Secondly, embodiments of this application provide a multi-flowmeter communication control method, applied to the system described above, the method comprising: In response to the address requests sent by each flow meter after it has connected to the communication bus, a device address is assigned to each of the flow meters; The device address of each flow meter is obtained through the communication bus; A polling queue is generated based on the device address of each flow meter; Based on the number of flow meters connected to the communication bus and the polling queue, communication is performed with each flow meter. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0009] Figure 1 This is a schematic diagram of a multi-flowmeter communication control system provided in one embodiment of this application; Figure 2 This is a schematic diagram of a multi-flowmeter communication control system provided in another embodiment of this application; Figure 3 This is a flowchart of a multi-flowmeter communication control method provided in one embodiment of this application. Detailed Implementation
[0010] To enable those skilled in the art to better understand the technical solutions of the embodiments of this application, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0011] like Figure 1 As shown in the figure, this application provides a multi-flowmeter communication control system, including: a communication bus 101, an address allocation module 102, and a control module 103.
[0012] Multiple flow meters are connected in parallel to the communication bus through their respective bus interfaces; The address allocation module is connected to the communication bus and is used to allocate device addresses to each flow meter in response to the address requests sent after each flow meter is connected to the communication bus. The control module, connected to the communication bus, is used to obtain the device address of each flow meter through the communication bus, generate a polling queue based on the device address of each flow meter, and communicate with each flow meter based on the number of flow meters connected to the communication bus and the polling queue.
[0013] A communication bus is a common transmission channel for data exchange between devices in a system. Multiple flow meters are connected in parallel to this communication bus through their respective bus interfaces, meaning all flow meters are connected to the same communication bus and share it as the communication medium. Typical implementations include RS-485 bus, Ethernet, and CAN bus. In an RS-485 bus, multiple devices can be connected to a single bus, each connected to the bus through its own communication interface.
[0014] Parallel connection differs from cascading. In a parallel topology, each device is independently connected to the bus, and the failure of any device does not affect the connection of other devices to the bus. In a cascading topology, however, devices are connected in series, and the failure of a preceding device will cause communication interruption of subsequent devices.
[0015] The address allocation module is the functional module responsible for automatic address allocation in the system. Its core function is to eliminate the manual address configuration required in traditional solutions. This module connects to the communication bus and can receive data frames transmitted on the communication bus. When a new flow meter is physically connected to the communication bus, the flow meter automatically sends an address request message, such as a broadcast frame containing its own hardware ID, like a MAC address or chip serial number. After the address allocation module listens for this address request through the communication bus, it responds by assigning a globally unique device address to the flow meter.
[0016] The address allocation module can employ several strategies to ensure the uniqueness of allocated addresses. One approach is to maintain a list of allocated addresses and assign the smallest currently unused available address to a new device. Another approach is to generate addresses based on the flow meter's hardware ID. Since the hardware ID is unique, the generated device address is also unique. Alternatively, a combination of random numbers and collision detection can be used to allocate addresses.
[0017] The address allocation module can be implemented as a standalone hardware device, such as a dedicated address allocator, connected separately to the communication bus, and independently perform address allocation functions. Alternatively, the address allocation module can be integrated within the control module as a functional submodule, allowing the control module to simultaneously handle both address allocation and communication scheduling.
[0018] The control module is the core control and scheduling unit of the system, responsible for managing the communication order of each flow meter. It is also connected to the communication bus, enabling data exchange with each flow meter via the bus.
[0019] The control module needs to know the device addresses of the flow meters already connected to the communication bus in order to perform subsequent queue generation and communication scheduling. The obtained device addresses constitute the basic data for the control module to perform communication scheduling.
[0020] The control module can be implemented using various hardware platforms. In industrial control environments, it can be based on a programmable logic controller (PLC); in scenarios requiring strong computing power, an industrial control computer (IPC) can be used; for cost-sensitive or space-constrained scenarios, an embedded platform based on a microprocessor (MPU), microcontroller (MCU), or digital signal processor (DSP) can be used; in flow meter-specific scenarios, a dedicated flow computer can be used; and in remote monitoring scenarios, some or all of the control module's functions can be deployed on a cloud server.
[0021] The polling queue is an ordered list of device addresses maintained internally by the control module. This list determines the order in which the control module communicates with each flow meter. After obtaining information about all flow meters with assigned addresses on the communication bus, the control module generates an initial polling queue based on these device addresses.
[0022] The polling queue is generated by sorting the devices in ascending order by their addresses, forming an ordered list of all acquired device addresses. After the polling queue is generated, the control module will communicate with each flow meter sequentially according to the order of the polling queue. Besides ascending order by address, it can also be sorted in descending order by device address, by device priority, or by device type. The polling queue can be implemented in software using various data structures such as arrays, linked lists, or circular buffers.
[0023] The communication behavior of the control module is not fixed, but dynamically adapts based on the total number of connected devices. When the number of connected devices is small, the control module can adopt a simpler communication strategy, such as sequential polling; when the number of connected devices increases, the control module can adjust the communication strategy to ensure that all devices can be accessed in a timely manner.
[0024] In this embodiment, address allocation is automatically triggered after the flowmeter is connected to the bus, eliminating the need for manual dialing or pre-configuration. This achieves plug-and-play functionality and solves the problems of low efficiency and error-proneness in manual address configuration in existing technologies. The control module automatically discovers all connected flowmeters on the bus and organizes them into a polling queue, achieving automatic discovery and orderly management of device addresses. The communication behavior of the control module is related to the number of connected devices, enabling the system to communicate in a way that adapts to the current scale under different device sizes, avoiding the problem of communication efficiency dropping sharply as the number of devices increases under a fixed polling method. The topology of flowmeters connected in parallel to the bus avoids the problem of a single point of failure affecting the whole system in a cascaded architecture, improving the system's scalability and reliability.
[0025] In one embodiment of this application, the control module is configured to, in response to the number of flow meters connected to the communication bus not being greater than a preset number threshold, communicate with each flow meter sequentially based on the order of the polling queue; and in response to the number of flow meters connected to the communication bus being greater than the number threshold, divide multiple flow plans into multiple partitions based on the device address of each flow meter, and communicate with each flow meter sequentially based on the partition to which the flow meter belongs.
[0026] The preset quantity threshold is a configurable parameter. The system pre-sets a value as a judgment benchmark to distinguish between two scenarios: a small number of devices and a large number of devices.
[0027] The control module communicates with each flow meter one by one according to the order of the devices in the polling queue: it first communicates with the first device in the queue, then with the second device, and so on, until the end of the queue, and then starts a new round of polling from the beginning.
[0028] Sequential polling is more efficient when the number of devices is small because the queue is short and the waiting time for each flow meter to be polled is short. For example, with 50 flow meters and a single interaction time of 10ms, the complete polling cycle is 500ms, which can meet the real-time requirements of most industrial monitoring scenarios.
[0029] The threshold can be flexibly configured according to specific application scenarios, and is not limited to a fixed value. For example, when the bus bandwidth is high and the device response speed is fast, the threshold can be set higher; in scenarios with extremely high real-time requirements, the threshold can be set lower.
[0030] In sequential polling, the polling interval can be fixed or dynamically adjusted. For example, the interval can be extended when device data changes slowly to save bus resources.
[0031] When the number of connected devices exceeds a preset threshold, simple sequential polling will cause the waiting time for each device to be too long. Therefore, the system automatically switches to a partitioned polling strategy.
[0032] Partitioning refers to dividing all connected flow meters on the bus into multiple subgroups based on their device addresses; each subgroup constitutes a partition. The purpose of partitioning is to break down a large set of flow meters into multiple smaller subsets, thereby maintaining a shorter polling cycle within each partition. After partitioning, the control module polls by partition, completing communication with all flow meters within one partition before moving on to the next, and so on. Communication within each partition can proceed sequentially according to the polling queue order, similar to sequential polling, but because the number of flow meters in each partition is smaller, the waiting time for each flow meter to be polled is significantly shortened.
[0033] In addition to partitioning by device address, partitioning can also be done by device type, geographical location, priority, or random partitioning. Polling of each partition can also be performed in parallel.
[0034] Sequential polling is low-cost and simple to implement when the number of flow meters is small, and can efficiently complete communication tasks, avoiding the unnecessary complexity introduced by partitioned polling when the number of flow meters is small. Partitioned polling significantly reduces the waiting time of individual flow meters when the number of flow meters is large, avoiding the problem of polling latency increasing linearly with the number of flow meters in sequential polling. The automatic switching mechanism between the two strategies allows the system to adapt to changes in the flow meter scale without manual intervention, achieving dynamic adaptation between communication strategy and flow meter scale.
[0035] In one embodiment of this application, the address allocation module is configured to, in response to an address request sent after the flow meter accesses the communication bus, obtain the hardware identifier of the flow meter contained in the address request; verify whether the hardware identifier of the flow meter is the same as the hardware identifier of the flow meter that has been allocated a device address; if not, generate an access timing code based on the time when the flow meter accesses the communication bus; generate a device address of the flow meter based on the access timing code and the hardware identifier of the flow meter; and send the allocated device address to the flow meter.
[0036] When a new flow meter is connected to the communication bus, it automatically sends an address request message to the communication bus. This message is in the form of a broadcast frame and contains the flow meter's hardware identifier. The hardware identifier is a unique identifier that is fixed at the factory and is unaffected by power outages, restarts, or network changes. The hardware identifier can be a MAC address, chip serial number, or device serial number, etc.
[0037] The address allocation module internally maintains an allocated device record table, which records information about all flow meters that have been successfully assigned addresses, including at least the hardware identifier and corresponding device address for each allocated device. When a new address request is received, the address allocation module extracts the hardware identifier carried within and compares it one by one with the hardware identifiers of all allocated devices in the record table.
[0038] If the comparison results show that the same hardware identifier already exists in the record table, it means that the flow meter has been previously assigned an address and may have sent an address request again for some reason. In this case, the verification will fail, triggering a fault alarm or reassigning an existing address. If the comparison results do not show the same hardware identifier, it means that the flow meter is a new device, the verification will pass, and the subsequent address allocation process can continue.
[0039] The access sequence code is a dynamic code generated based on the flow meter's access time. It identifies the order in which the flow meters join the network, and its generation is based on the moment the flow meter connects to the communication bus. Specifically, when the address allocation module receives an address request, it records the current system time and generates a sequence code based on this time. Because the sequence code is generated based on the access time, flow meters that connect at different times will receive different sequence codes; for example, those that connect earlier will receive a smaller code value, and those that connect later will receive a larger code value. Since hardware identifiers are unique at the factory and access timing codes are generated based on access time, combining the two ensures that the final generated device address is unique. For example, a portion of the hardware identifier can be concatenated with the access timing code.
[0040] A dual encoding mechanism, employing both hardware identification and access timing, ensures the uniqueness of device addresses, preventing address conflicts that may arise from manual address configuration. A uniqueness verification mechanism prevents the same device from repeatedly accessing the network and occupying multiple addresses, and also avoids address allocation errors caused by hardware identification conflicts. The entire allocation process is automatically triggered by the flow meter's access behavior, requiring no manual intervention and achieving plug-and-play functionality.
[0041] like Figure 2 As shown, the system also includes: a fault isolation module 104; The fault isolation module is used to remove the flow meter from the polling queue in response to the detection that the flow meter meets the preset communication abnormality conditions.
[0042] The fault isolation module is a functional module in the system responsible for detecting, judging and handling communication abnormalities of equipment. Its core function is to prevent the communication abnormality of a single flow meter from spreading to the entire system, thereby ensuring the overall reliability of the system.
[0043] The fault isolation module can be a hardware device independent of the control module, connected to the control module and each flow meter via a communication bus. The fault isolation module also functions as a functional submodule within the control module, managed and scheduled by the control module. Alternatively, the functions of the fault isolation module can be distributed across the communication interfaces of each flow meter, allowing each flow meter to independently detect its communication status and proactively isolate communication.
[0044] The fault isolation module monitors the communication status of each flow meter in real time via the communication bus. Monitoring methods can include various approaches. For example, the fault isolation module can listen to the communication interactions between the control module and each flow meter, recording the response of each flow meter; or the control module can report the communication status of each flow meter to the fault isolation module in real time during polling; or the fault isolation module itself can periodically send probe messages to each flow meter via the communication bus to check whether it can respond normally.
[0045] Preset communication anomaly conditions refer to pre-defined conditions or standards used to determine whether device communication is normal. These conditions can be pre-set and stored in the system before system deployment based on actual operating conditions, or they can be set and adjusted by users through the configuration interface, allowing maintenance personnel to flexibly adjust the sensitivity of anomaly detection according to different scenarios.
[0046] Communication anomaly refers to a state where the control module and the flow meter cannot complete data exchange normally. Communication anomaly conditions may include, but are not limited to, the following: the flow meter fails to respond multiple times consecutively, the flow meter response times out, the flow meter returns a message with an incorrect format, or verification fails. Removal refers to deleting the device address of the abnormal flow meter from the polling queue.
[0047] Once a flow meter is removed from the polling queue, the control module will no longer poll with that flow meter. This prevents communication anomalies in that flow meter from affecting the communication of other normal flow meters. The control module no longer wastes polling time waiting for responses from abnormal flow meters, and the abnormal flow meter will no longer send abnormal messages to the bus, interfering with the normal communication of other flow meters.
[0048] When a flow meter fails to communicate normally due to hardware failure, communication link interruption, or program abnormality, the system can automatically isolate it. This prevents the control module from wasting communication time waiting for the flow meter's response during each polling, thus ensuring the communication efficiency of other normal flow meters. After the abnormal flow meter is isolated, its abnormal messages sent to the communication bus will no longer be received and processed by the control module, avoiding the problem of abnormal messages blocking the bus or interfering with the communication of other flow meters.
[0049] In one embodiment of this application, each flow meter's bus interface has a built-in optocoupler. In response to a short circuit or overcurrent fault in the first flow meter, the optocoupler disconnects the electrical connection between the first flow meter and the communication bus.
[0050] The optocoupler is located at the bus interface of the flowmeter. Its input side connects to the flowmeter's internal communication circuit, and its output side connects to the communication bus. During normal operation, the optocoupler transmits communication signals between the flowmeter and the bus using light as a medium, enabling the flowmeter to interact with other devices on the bus. When the flowmeter experiences a short circuit or overcurrent fault, the optocoupler automatically cuts off the signal transmission path between the input and output sides, achieving electrical isolation between the faulty device and the bus.
[0051] In addition to optocouplers, magnetic couplers, capacitive couplers, and other similar devices can also be used.
[0052] The first flowmeter refers to any one of multiple flowmeters as the fault object. A short-circuit fault refers to a fault state in which an unexpected low-impedance path is formed between two points at different potentials in a circuit due to insulation failure, device breakdown, or physical contact, leading to a sharp increase in current. An overcurrent fault refers to a state in which the current flowing through a circuit or device exceeds its design rating or safety threshold. The severity of overcurrent faults is usually less than that of short-circuit faults.
[0053] Optocouplers have a fast response speed and can isolate the communication bus and system before the short-circuit high current causes greater damage, thus ensuring the safety of the bus and other devices.
[0054] In one embodiment of this application, the control module is configured to stop communicating with the second flow meter in response to detecting that a message sent by the second flow meter during communication meets a preset message abnormality condition, and to communicate with the next flow meter based on a polling queue.
[0055] During the communication process, the control module communicates with each flow meter according to the polling queue. Specifically, when a flow meter is polled, the control module sends a request message to that flow meter, and the flow meter returns a response message upon receiving it. The control module receives and parses the response message, checking whether the message meets preset message exception conditions during this process.
[0056] Preset message anomaly conditions refer to pre-defined detection standards used to determine whether a message is abnormal. These conditions are pre-set and stored in the control module according to the communication protocol used before system deployment. Message anomalies may include, but are not limited to, the following: incorrect message format, failed message verification, and abnormal message content.
[0057] Upon receiving an abnormal message, the control module immediately terminates the current communication process and ceases sending retry commands or other subsequent commands to the flow meter. The next flow meter refers to the flow meter immediately following the currently abnormal flow meter in the polling queue. After ceasing communication with the abnormal flow meter, the control module immediately begins normal communication with the next flow meter in the order of the polling queue.
[0058] This embodiment avoids the polling cycle being prolonged or halted due to an abnormal message sent by a single flow meter, ensuring that the communication of other normal flow meters is not affected and improving the overall communication efficiency of the system. The control module immediately stops communication and continues to the next flow meter after detecting an anomaly, with a fast response speed, capable of processing abnormal messages instantly and preventing abnormal messages from continuously occupying bus resources.
[0059] In one embodiment of this application, the control module is used to divide the communication period corresponding to the polling queue into time slots corresponding to each flow meter, and to communicate with the corresponding flow meter within the time slot corresponding to each flow meter.
[0060] The communication cycle corresponding to the polling queue refers to the total time required for the control module to complete one full round of polling, i.e., to communicate with each device in the polling queue once. A time slot refers to multiple consecutive and non-overlapping time segments obtained after dividing the communication cycle. Each time slot corresponds to one flow meter. Within a time slot, the bus resources are exclusively used by that flow meter, and the control module only communicates with that flow meter. The division of time slots is dynamic; as the number of devices in the polling queue changes, the total duration of the communication cycle and the duration of each time slot can be adjusted accordingly. After a time slot ends, regardless of whether communication is complete, the control module releases the bus and waits for the start of the next time slot to communicate with the next flow meter.
[0061] This application embodiment avoids data collisions caused by multiple devices communicating simultaneously by dividing the communication cycle into multiple time slots and allocating a dedicated time slot for each flow meter, thus solving the problem of devices competing for bus resources in traditional bus communication.
[0062] In one embodiment of this application, the control module is configured to insert the third flow meter into the polling queue based on the device address of the third flow meter after detecting that the third flow meter has accessed the communication bus and obtained the device address.
[0063] Accessing the communication bus refers to the physical connection of the new flow meter to the communication bus, completing the electrical connection with the bus. Obtaining the device address means that the flow meter has completed the address allocation process and has the foundation to be identified and addressed in the system. The insertion operation does not interrupt the existing polling process. The control module can perform the insertion after the current polling cycle ends, or it can dynamically insert within the current polling cycle. In addition to determining the insertion position by ascending or descending order of device address, the insertion position can also be determined by grouping by device type.
[0064] After physical access and address allocation are completed, the new device can automatically join the polling queue and participate in subsequent communications without manual intervention, achieving plug-and-play functionality and simplifying system expansion and maintenance. The insertion process does not interrupt the existing polling process, and the system can maintain normal communication services during dynamic expansion, ensuring the continuous operation of the system.
[0065] In one embodiment of this application, terminating matching resistors are provided at both ends of the communication bus.
[0066] Termination matching resistors are resistive elements placed at both ends of a communication bus, and their resistance values are usually equal to or close to the characteristic impedance of the transmission line.
[0067] In an RS-485 bus, the transmission line typically uses twisted-pair shielded cable with a characteristic impedance of 120Ω. Therefore, a 120Ω resistor is connected to each end of the bus, with one end connected to the farthest end and the other end connected to the nearest end. The resistor is connected between the two signal lines of the bus.
[0068] By setting terminating resistors at both ends of the communication bus, the impedance at the end of the transmission line is matched with the characteristic impedance of the transmission line, thereby eliminating impedance discontinuities. The signal is absorbed at the end without reflection, ensuring the quality of signal transmission on the bus.
[0069] like Figure 3 As shown, this application provides a multi-flowmeter communication control method, applied to the system of any of the above embodiments. The method includes: Step 301: In response to the address requests sent by each flow meter after it connects to the communication bus, the address allocation module assigns a device address to each flow meter.
[0070] Step 302: The control module obtains the device address of each flow meter through the communication bus.
[0071] Step 303: The control module generates a polling queue based on the device address of each flow meter.
[0072] Step 304: The control module communicates with each flow meter based on the number of flow meters connected to the communication bus and the polling queue.
[0073] Automatic address allocation enables plug-and-play network access for flow meters, eliminating the need for manual address configuration. Device address acquisition and polling queue generation enable automatic discovery and orderly management of all devices on the bus. Communication based on the number of connected devices allows for dynamic adaptation of communication strategies to the device scale, ensuring high-efficiency communication performance regardless of the number of devices.
[0074] In one embodiment of this application, the control module communicates with each flow meter based on the number of flow meters connected to the communication bus and the polling queue, including: In response to the fact that the number of flow meters connected to the communication bus is no greater than a preset threshold, the control module communicates with each flow meter sequentially based on the order of the polling queue. When the number of flow meters connected to the communication bus exceeds the threshold, the control module divides multiple flow plans into multiple partitions based on the device address of each flow meter, and communicates with each flow meter sequentially based on the partition to which the flow meter belongs.
[0075] In one embodiment of this application, in response to an address request sent after the flow meter connects to the communication bus, the address allocation module allocates a device address to the flow meter, including: In response to the address request sent after the flow meter connects to the communication bus, the address allocation module obtains the hardware identifier of the flow meter contained in the address request, verifies whether the hardware identifier of the flow meter is the same as the hardware identifier of the flow meter that has been allocated a device address, and if not, generates an access timing code based on the time when the flow meter connects to the communication bus, generates a device address of the flow meter based on the access timing code and the hardware identifier of the flow meter, and sends the allocated device address to the flow meter.
[0076] In one embodiment of this application, the method further includes: in response to detecting that the flow meter meets a preset communication anomaly condition, the fault isolation module removes the flow meter from the polling queue.
[0077] In one embodiment of this application, the method further includes: in response to a short-circuit fault or overcurrent fault in the first flow meter, the optocoupler disconnects the electrical connection between the first flow meter and the communication bus.
[0078] In one embodiment of this application, the method further includes: in response to detecting that a message sent by the second flow meter during communication meets a preset message abnormality condition, the control module stops communicating with the second flow meter and communicates with the next flow meter based on a polling queue.
[0079] In one embodiment of this application, the control module communicates with each flow meter based on the number of flow meters connected to the communication bus and the polling queue, including: dividing the communication period corresponding to the polling queue into time slots corresponding to each flow meter, and communicating with the corresponding flow meter within the time slots corresponding to each flow meter.
[0080] In one embodiment of this application, the method further includes: after the control module detects that the third flow meter has accessed the communication bus and obtains the device address, it inserts the third flow meter into the polling queue based on the device address of the third flow meter.
[0081] This application provides an electronic device, including a memory and a processor. The memory stores an executable program, and the processor executes the executable program to perform the steps of the methods described in any of the above embodiments.
[0082] This application provides a computer program product that, when executed by a processor, implements the methods of any of the above embodiments.
[0083] It should be understood that in the embodiments of this application, the processor may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0084] It should also be understood that the memory mentioned in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Specifically, non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0085] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA, or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, the memory (storage module) is integrated into the processor.
[0086] It should be noted that the memories described herein are intended to include, but are not limited to, these and any other suitable types of memories.
[0087] In addition to the data bus, this bus may also include a power bus, a control bus, and a status signal bus. However, for clarity, all buses are labeled "bus" in the diagram.
[0088] It should also be understood that the first, second, third, fourth and various numerical designations used herein are merely for descriptive convenience and are not intended to limit the scope of this application.
[0089] It should be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0090] In implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0091] In the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0092] Those skilled in the art will recognize that the various illustrative logical blocks (ILBs) and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0093] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and 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 through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0094] 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.
[0095] In addition, the functional units in the various embodiments of this application 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.
[0096] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.
[0097] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A multi-flowmeter communication control system, characterized in that, include: Communication bus, address allocation module, and control module; Multiple flow meters are connected in parallel to the communication bus through their respective bus interfaces; The address allocation module is connected to the communication bus and is used to allocate a device address to each flow meter in response to the address request sent by each flow meter after it is connected to the communication bus. The control module is connected to the communication bus and is used to obtain the device address of each flow meter through the communication bus, generate a polling queue based on the device address of each flow meter, and communicate with each flow meter based on the number of flow meters connected to the communication bus and the polling queue.
2. The system as described in claim 1, characterized in that, The control module is configured to communicate with each flow meter sequentially based on the order of the polling queue, in response to the fact that the number of flow meters connected to the communication bus is not greater than a preset number threshold. In response to the number of flow meters connected to the communication bus exceeding the number threshold, the multiple flow plans are divided into multiple partitions based on the device address of each flow meter, and communication is performed sequentially with each flow meter based on the partition to which the flow meter belongs.
3. The system as described in claim 1, characterized in that, The address allocation module is used to respond to an address request sent after the flow meter accesses the communication bus, obtain the hardware identifier of the flow meter contained in the address request; verify whether the hardware identifier of the flow meter is the same as the hardware identifier of the flow meter that has been assigned a device address; if not, generate an access timing code based on the time when the flow meter accesses the communication bus. Based on the access timing code and the hardware identifier of the flow meter, generate the device address of the flow meter; send the assigned device address to the flow meter.
4. The system as described in claim 1, characterized in that, Also includes: Fault isolation module; The fault isolation module is used to remove the flow meter from the polling queue in response to detecting that the flow meter meets a preset communication abnormality condition.
5. The system as described in claim 1, characterized in that, in, Each of the flow meters has a built-in optocoupler in its bus interface. In response to a short circuit or overcurrent fault in the first flow meter, the optocoupler disconnects the electrical connection between the first flow meter and the communication bus.
6. The system as described in claim 1, characterized in that, The control module is configured to, in response to detecting that a message sent by the second flow meter during communication meets a preset message abnormality condition, stop communicating with the second flow meter and, based on the polling queue, communicate with the next flow meter.
7. The system as described in claim 1, characterized in that, The control module is used to divide the communication period corresponding to the polling queue into time slots corresponding to each of the flow meters, and to communicate with the corresponding flow meter within the time slots corresponding to each flow meter.
8. The system as described in claim 1, characterized in that, The control module is configured to insert the third flow meter into the polling queue based on the device address of the third flow meter after detecting that the third flow meter has accessed the communication bus and obtained the device address.
9. The system as described in claim 1, characterized in that, The communication bus is equipped with terminating resistors at both ends.
10. A multi-flowmeter communication control method, characterized in that, Applied to the system according to any one of claims 1-9, the method comprises: In response to the address requests sent by each flow meter after it has connected to the communication bus, the address allocation module assigns a device address to each flow meter. The control module obtains the device address of each flow meter through the communication bus; The control module generates a polling queue based on the device address of each flow meter; The control module communicates with each flow meter based on the number of flow meters connected to the communication bus and the polling queue.