Pulse type water flowmeter monitoring circuit and method based on PLC and readable storage medium
By adopting a dedicated interrupt PIP isolated from the main program PIP in the PLC, combined with a timer module and a fault diagnosis mechanism, the problems of high hardware cost and excessive CPU load in high-speed pulse signal acquisition of PLC are solved. This achieves high-precision, low-cost water flow monitoring, has real-time fault early warning function, and improves the reliability and safety of the system.
Patent Information
- Application Number
- CN202511139821.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-11-07
AI Technical Summary
Existing PLCs suffer from problems such as high hardware costs, excessive CPU load, data loss, and data race conditions in high-speed pulse signal acquisition, and cannot meet the requirements for high precision and real-time performance.
The design adopts a dedicated interrupt PIP isolated from the main program PIP, combined with a timer module and a fault diagnosis mechanism. The dedicated interrupt PIP captures pulse signals in real time and calculates water flow, reducing hardware costs and improving acquisition accuracy and stability.
It achieves high-precision, low-cost water flow monitoring, has real-time fault early warning function, simplifies hardware structure, reduces equipment procurement and maintenance costs, and improves system reliability and security.
Smart Images

Figure CN120907628A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application provides a PLC-based pulse water flow meter monitoring circuit, method and readable storage medium, and belongs to the water flow monitoring field. BACKGROUND
[0002] In an industrial control system, a PLC executes a user program through a cyclic scanning mechanism, and a typical working cycle is divided into three stages: input sampling, program execution, and output refreshing. In this process, a process image area (PII / PIP) as a cache area of input / output signals reads the input state of a physical port in batches at the beginning of a scanning cycle and writes the output state in batches at the end of the scanning cycle through a hardware synchronization mechanism. This mechanism reduces the CPU load, but cannot meet the real-time capture requirement of a high-speed pulse signal, because the traditional PIP update frequency is limited by the PLC scanning cycle, and when the pulse signal frequency exceeds 1 / 2 of the scanning cycle, the pulse loss is caused due to insufficient sampling frequency.
[0003] The prior art usually adopts two schemes to improve the pulse capture accuracy: 1. Hardware dependence: an external high-speed pulse counting module is adopted to realize hardware-level counting through a dedicated ASIC chip, but the module cost is high and the channel expansion is limited. For example, a detection and judgment device and method for output pulses of a pulse vortex street pulse water flow meter are proposed in Chinese Invention Patent (CN102466500B), which needs to depend on an A / D sampling module, an abnormally wide pulse filtering module, a pulse quantity detection module and an output module, thereby increasing the system hardware cost and complexity.
[0004] 2. Software optimization type: high-frequency state polling code is inserted into a PLC main program, but the sampling interval is jittered due to the uncertainty of the main program execution time, and frequent polling significantly increases the CPU load and reduces the system real-time performance.
[0005] In addition, in the application of the interrupt mechanism, the traditional method has a timing sequence adaptation problem of the process image area and an interrupt service program (ISR): 1. When a normal I / O interrupt is used, the PLC needs to trigger an interrupt at each pulse edge, but is not synchronized with the process image area update, which may cause a phase difference between the input state read by the ISR and the actual physical signal, and when multiple pulses need to be collected, frequent edge interrupts will significantly increase the CPU load. 2. If the input register is directly accessed, the process image area delay can be bypassed, but the data race risk is caused due to non-atomic operation, and false actions are easily caused in an electromagnetic interference environment.
[0006] A Chinese invention patent (CN115963771A) discloses a PLC and a high-speed data acquisition and analysis processing method and system based thereon, which is oriented to general high-speed data acquisition and analysis, supports mixed processing of analog / digital signals, and is suitable for diversified scenes such as voltage and current waveform analysis. However, it has the following problems: 1. It relies on a general process image area, and the multi-channel data needs to be updated by peripheral instructions one by one, resulting in too long interruption execution time, data flow direction and processing efficiency as shown in Figure 1 When multi-channel data is read, the CPU resource occupancy rate rises significantly (the peripheral instruction execution time is long), affecting the main program running efficiency; 2. Array rotation storage is adopted: after the first array is full, it is transferred to the second array as a whole, and there is 1s-level lag in analyzing data, and the main program and the interruption program share the data block, which may cause data race risk; 3. It is a fixed sampling frequency (50Hz~2000Hz), which cannot be dynamically adjusted according to the signal characteristics; 4. It does not integrate fault diagnosis function, and relies on external system to realize protection logic. SUMMARY
[0007] To solve the above technical problems, the application provides a PLC-based pulse water flowmeter monitoring circuit, method and readable storage medium, which solves the technical problem of how to realize low-cost high-speed pulse signal acquisition based on PLC itself, while meeting the ordinary functional requirements of PLC and considering the high-speed acquisition function.
[0008] To solve the above technical problems, the application adopts the technical scheme that the PLC-based pulse water flowmeter monitoring circuit comprises a plurality of pulse water flowmeters, the output ends of the plurality of pulse water flowmeters are electrically connected to the input module of a PLC controller, the PLC controller further comprises an interruption dedicated PIP and a main program PIP, the interruption dedicated PIP is in communication connection with the input module, the interruption dedicated PIP and the main program PIP are arranged to be mutually isolated, and the interruption dedicated PIP is configured to store and update the pulse signals output by the input module in real time; The interruption dedicated PIP is in communication connection with an interruption program module, and the interruption program module is further in communication connection with a timer module and a DB block; The timer module and the DB block are also in communication connection with the main program module, and the main program module comprises a water flow signal processing module, which is configured to read the real-time pulse signals output by the interruption program module and the marked time stamp stored in the DB block, and calculate the real-time water flow value; The output end of the main program module is in communication connection with a fault judgment module, the fault judgment module is in communication connection with an alarm device and a protection device through the output module, and the protection device is electrically connected to a running device.
[0009] Further, the output end of the plurality of pulse water flow meters is electrically connected with the input module, and an RC filter circuit is further electrically connected between the output end of the plurality of pulse water flow meters and the input module.
[0010] Further, the PLC controller is a model of Siemens 1200 / 1500 series or Mitsubishi FX5U.
[0011] Further, the output module comprises a comparison and analysis module, and the fault judgment module, the protection device and the temperature collector of the running equipment are electrically connected to the comparison and analysis module.
[0012] A PLC-based pulse water flow meter monitoring method adopts the PLC-based pulse water flow meter monitoring circuit, and comprises the following steps: Step S1: completing hardware connection of the output end of the pulse water flow meter and the input module of the PLC controller, and converting the water flow signal collected by the pulse water flow meter into a pulse signal by the input module; Meanwhile, an independent interrupt dedicated PIP is allocated to the pulse signal input channel in the memory module of the PLC controller, and the interrupt dedicated PIP and the main program PIP are set to be isolated from each other; Step S2: the interrupt dedicated PIP reads the pulse signal output by the input module in real time, reads the level signal jump state of the pulse signal and marks the time stamp through the timer module and the interrupt program module of the PLC controller, identifies the rising edge / descending edge of the pulse signal, accumulates the number of pulse signals and records the time stamp by comparing the level signals at the interrupt moments of adjacent two times; Step S3: the main program module reads the latest pulse signal of the DB block, calculates the time difference between the pulse signal and the adjacent pulse signal generated thereby by using the time stamp, and converts the real-time water flow value in combination with the pulse water flow meter instrument coefficient.
[0013] Further, the priority of the scanning action of the timer module in step S2 is higher than that of the main program scanning action, so as to ensure that the interrupt response time deviation is less than or equal to 10 microseconds.
[0014] Further, a digital de-bouncing algorithm is embedded in the interrupt program module, and only when the interrupt program module accesses the interrupt dedicated PIP for a preset number of times in succession and the pulse signal stored in the interrupt dedicated PIP at the interrupt moment is collected to have the same level change, the pulse signal is determined to be a valid pulse event and is generated.
[0015] Further, the interrupt program module adopts a phase alignment algorithm to realize boundary synchronization of the interrupt trigger and the timing module, and eliminates sampling interval drift.
[0016] Further, a fault diagnosis mechanism is further established, and the fault diagnosis mechanism comprises low water flow protection and water cut-off protection. Low water flow protection: if the real-time water flow value read by the fault judgment module in a continuous period of time is lower than the water flow threshold value, an alarm signal is output; if the temperature of the corresponding operating device does not reach the over-temperature threshold value, the user can manually interrupt the alarm signal.
[0017] Water cut-off protection: if there is no pulse signal in a plurality of continuous interruption periods and the temperature of the corresponding operating device reaches the over-temperature threshold value, the power supply of the operating device is immediately cut off and an alarm device is triggered.
[0018] A readable storage medium, wherein a computer program is stored on the readable storage medium, and the computer program is executed by a processor to implement the method steps.
[0019] The pulse type water flow meter monitoring circuit, method and readable storage medium based on PLC provided by the application have the beneficial effects that, 1. High precision and stability: the pulse type water flow meter and the PLC controller cooperate with each other in the application, the pulse signal of the pulse type water flow meter is directly read by the interruption dedicated PIP of the PLC controller, and the real-time water flow value is calculated through the main program module, so that the measurement error caused by signal interference in the traditional water flow monitoring method is effectively avoided, the precision and stability of water flow monitoring are improved, and the requirement of accurately controlling the water flow of the high-temperature purification equipment can be better met; 2. Simplified hardware structure and reduced cost: compared with the prior art, the water flow monitoring method of the application configures the interruption dedicated PIP and the related circuit connection in the PLC controller, so that the expensive pulse counting device is saved, the hardware configuration of the monitoring system is simplified, the equipment procurement cost and maintenance difficulty are reduced, the hardware upgrade demand is reduced, the water flow monitoring system expansion and function optimization in the later period are facilitated, and good cost performance is achieved; 3. Real-time fault early warning and safety protection: the working state of the pulse type water flow meter is monitored in real time by the fault judgment module, an alarm signal can be sent in time when a fault occurs, the operator can quickly locate and solve the problem, the equipment damage and safety accidents caused by out-of-control water flow are effectively prevented, and the operation reliability and safety of the high-temperature purification equipment are improved; 4. Multi-channel monitoring function: dozens of water flow channels of the high-temperature purification equipment can be monitored at the same time, and the number of water flow monitoring channels can be flexibly configured, the requirement of multi-channel water flow monitoring for complex equipment processes is met, the process flow is optimized, the production efficiency and product quality are improved. BRIEF DESCRIPTION OF DRAWINGS
[0020] The application will be further described below in combination with the drawings: Figure 1System structure schematic diagram of data flow direction and processing efficiency of traditional PLC and high-speed data acquisition and analysis processing method and system based on the same; Figure 2 Circuit block diagram of Figure 1 ; Figure 3 Flow chart of the method of the present application; Figure 4 Structure block diagram of the cooperation between the interrupt dedicated PIP and the main program module of the present application; Figure 5 Structure schematic diagram of the cooperation between the PLC controller and the pulse water flow meter of the present application; Figure 6 Flow chart of the dynamic frequency adaptation of the present application; In the figure: 1 is a PLC controller, 2 is an input module, and 3 is a pulse water flow meter. DETAILED DESCRIPTION
[0021] In the description of the present application, it should be understood that the terms "center", "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer" and the like indicate relative or positional relationships, which are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second" and the like are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined with "first", "second" and the like can explicitly or implicitly include one or more of the features. In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0022] In the description of the present application, it should be noted that unless otherwise specified and limited, the terms "mounting", "connection", "connection" should be understood broadly, for example, it can be fixed connection, or detachable connection, or integral connection; it can be mechanical connection, or electrical connection; it can be directly connected, or indirectly connected through intermediate medium, or the communication between two elements inside. For those skilled in the art, the specific meaning of the above terms in the present application can be understood through specific circumstances.
[0023] As Figures 2 to 6As shown, the present application provides a PLC-based pulse water flow meter monitoring circuit, which comprises a plurality of pulse water flow meters 3, the output ends of the plurality of pulse water flow meters 3 are electrically connected to the input module 2 of the PLC controller 1 through twisted shielded cables, the input module 2 comprises a plurality of I / O direct current input channels, one pulse water flow meter 3 is connected to one I / O direct current input channel, the input module 2 can convert the water flow signals collected by the plurality of pulse water flow meters 3 into 0-24V level signals, the continuous level signal jump events and the corresponding time sequences constitute pulse signals, and a plurality of continuous pulse signals form a pulse sequence. A plurality of continuous pulse signals are arranged in a certain rule to form a pulse sequence. The output ends of the plurality of pulse water flow meters 3 and the input module 2 are also electrically connected to an RC filter circuit for suppressing electromagnetic interference.
[0024] The PLC controller 1 further comprises an interrupt dedicated process image area (hereinafter referred to as an interrupt dedicated PIP) and a main program process image area (hereinafter referred to as a main program PIP), the interrupt dedicated PIP and the main program PIP are arranged in isolation from each other, the interrupt dedicated PIP is configured to store and update the pulse signals output by the input module 2 in real time, and one pulse signal comprises a rising edge, a falling edge and a corresponding time sequence.
[0025] The interrupt dedicated PIP is communicatively connected to an interrupt program module, the interrupt program module is further communicatively connected to a timer module and a DB block, and the timer module stores a preset interrupt period. The interrupt program module reads the preset interrupt period stored in the timer module and triggers an interrupt action when the interrupt period is reached, the interrupt program module can access the interrupt dedicated PIP, and the interrupt action is triggered to calculate the pulse signals stored in the interrupt dedicated PIP at the interrupt time and mark a time stamp in real time.
[0026] The DB block is used to store the real-time pulse signals output by the interrupt program module and the marked time stamp.
[0027] The timer module and the DB block are also communicatively connected to the main program module, and the main program module comprises a water flow signal processing module, the water flow signal processing module is used to read the real-time pulse signals output by the interrupt program module and the marked time stamp stored in the DB block, and calculate a real-time water flow value.
[0028] The output end of the main program module is communicatively connected to a fault judgment module, the fault judgment module is used to monitor whether the real-time water flow value is abnormal, and the fault judgment module is communicatively connected to an alarm device and a protection device through an output module. The output module comprises a comparative analysis module, and the fault judgment module, the protection device and a temperature collector of a running device are all electrically connected to the comparative analysis module.
[0029] The fault judgment module is used for reading the real-time water flow value stored by the water flow signal processing module, and the water flow threshold value is preset in the fault judgment module, when the real-time water flow value read in the last 5 seconds is all lower than the water flow threshold value, and the temperature value of the running equipment read by the comparison analysis module exceeds the over-temperature threshold value, an alarm signal is output to the output module, the output module inputs the alarm signal into the alarm device to issue a warning information to prompt the staff to go to maintenance, and the output module inputs the alarm signal into the protection device to control the corresponding running equipment to stop.
[0030] The monitoring principle of the pulse water flow meter 3 is to install the pulse water flow meter 3 in the pipeline and output the monitoring result in the form of pulse, and the flow of the fluid is calculated according to the number of output pulses. The pulse water flow meter monitoring method based on the PLC provided by the application comprises the following steps: Step S1, hardware architecture and signal link configuration. The output end of the pulse water flow meter 3 is connected to the input module 2 of the PLC controller 1, and the input module 2 converts the water flow signal collected by the pulse water flow meter 3 into a pulse signal. At the same time, an independent interrupt dedicated PIP is allocated to the pulse signal input channel in the memory module of the PLC controller 1, and the interrupt dedicated PIP and the main program PIP are set to be isolated from each other. Specifically: Hardware connection: the output end of the pulse water flow meter 3 is electrically connected to the input module 2 of the PLC controller 1, and the input module 2 comprises a plurality of I / O direct current input channels; twisted shielded cable is used for line connection, and RC filter circuit is configured to suppress electromagnetic interference; Interrupt dedicated PIP division: an independent interrupt dedicated PIP is allocated to the pulse input channel in the memory module of the PLC controller 1, and the interrupt dedicated PIP and the main program PIP are set to be isolated from each other, and the interrupt dedicated PIP is configured to store the pulse signal output by the input module 2 in real time.
[0031] Step S2, interrupt mechanism and interrupt dedicated PIP synchronization strategy. The interrupt dedicated PIP reads the pulse signal output by the input module 2 in real time, reads the level signal jump state of the pulse signal and marks the time stamp through the timer module and the interrupt program module of the PLC controller 1, and identifies the rising edge / descending edge of the pulse signal by comparing the level signals at the adjacent two interrupt moments, accumulates the number of pulse signals and records the time stamp. Specifically: High-precision cycle interrupt configuration: enable the timer module of the PLC controller 1, the timer module stores a preset interrupt period, in this embodiment, the preset interrupt period is 1 ms, the scanning action of the timer module has a higher priority than the scanning action of the main program, so that the interrupt response time deviation is less than or equal to 10 microseconds, the interrupt period is strictly synchronized with the clock of the PLC controller 1, and the sampling interval drift is eliminated. A phase alignment algorithm is used to synchronize the interrupt triggering time with the millisecond boundary of the timing module of the PLC controller 1, so as to eliminate the sampling interval drift caused by the main program blocking.
[0032] Signal capture process: in the interrupt triggering stage, each time the interrupt is triggered, the interrupt dedicated PIP stores the pulse signal output by the input module 2 at the interrupt time and marks the time stamp.
[0033] Edge monitoring and counting: the level signal of the current interrupt time stored in the interrupt dedicated PIP is compared with the level signal of the last interrupt time buffered in the interrupt dedicated PIP, the rising edge / falling edge of the pulse signal formed by the two level signals is identified, the counting value (i.e., the number of pulses accumulated) is updated, and a pulse signal with a time stamp is generated, this process is called a pulse event. Real-time pulse edges are captured and time stamped, and data is zero-delay transmitted to the main program module, realizing microsecond-level real-time analysis.
[0034] Anti-interference processing: a digital anti-jitter algorithm is embedded in the interrupt program module, and only when the interrupt program module accesses the interrupt dedicated PIP for two consecutive times and both times the pulse signal stored in the interrupt dedicated PIP at the interrupt time has the same level change, the pulse event is determined to be valid, and the corresponding pulse signal is generated.
[0035] Step S3, data processing and pulse water flowmeter 3 calculation. The main program module calculates the time difference between the pulse signal and its adjacent pulse signal by reading the latest pulse signal from the DB block, and converts the real-time water flow value by combining the pulse water flowmeter 3 instrument coefficient. Specifically: Main program module data processing: the main program module calculates the time difference Δt between the pulse signal and its adjacent pulse signal by reading the latest pulse signal, and converts the real-time water flow value Q by combining the pulse water flowmeter 3 instrument coefficient K. The water flow value is: Q=K / Δt.
[0036] The sliding window algorithm is used to smooth the instantaneous flow value (the window length can be configured, and the default is 1s), and the average flow is output to the industrial computer.
[0037] Dynamic frequency adaptation: dynamically adjust the preset interrupt period of the interrupt program module according to the pulse frequency of the current pulse water flow meter 3 (1ms / 2ms / 5ms three gears, corresponding to high speed, medium speed and low speed respectively), when the monitored pulse frequency is lower than 100Hz, the interrupt program module switches to low sampling rate mode (lengthens the interrupt period) to reduce CPU load. Specifically, 500Hz sampling is used at the beginning, when the calculated value is less than 230Hz for three times in a row, the sampling interval of the interrupt program module is changed to 2ms, when the frequency is greater than 230Hz, it is switched to high speed sampling, and the low speed is the same. According to the pulse frequency, the interrupt period (1ms / 2ms / 5ms) is automatically switched, the CPU load is reduced at low frequency, and the performance and resource consumption are balanced.
[0038] The PLC-based pulse water flow meter 3 monitoring method of the present application also has a fault diagnosis mechanism. Specifically Low water flow protection: if the real-time water flow value read by the fault judgment module within 5 seconds is lower than the water flow threshold value, an alarm signal is output; if the temperature of the corresponding running device does not reach the over-temperature threshold value, the user can manually interrupt the alarm signal. In this embodiment, if the real-time water flow value read by the fault judgment module within 5 seconds is lower than the water flow threshold value, an alarm signal is output. The setting of the reading time can be adjusted according to actual needs.
[0039] Water cut-off protection: if there is no pulse signal within 10 interrupt periods, and the temperature of the corresponding running device reaches the over-temperature threshold value, the power supply of the running device is immediately cut off and the alarm device is triggered. The interrupt period in this embodiment can be adjusted according to actual needs.
[0040] Communication and human-computer interaction: HMI data integration: transmit the average flow fault code and other information to the industrial computer through the OPC UA protocol, display the real-time running state of the high-temperature purification device, including the water flow of each channel and other monitoring information of the device. Through HMI, the operator can intuitively understand the working condition of the device, and conveniently set and adjust parameters, support waveform display, historical backtracking and alarm log export.
[0041] The PLC-based pulse water flow meter monitoring method of the present application also includes system expansion function and compatibility design. Specifically: Multi-channel parallel processing: an independent I / O direct current input channel distribution mechanism is adopted, and a dedicated channel is configured for each pulse signal input. Multiple I / O direct current input channels do not affect the normal use of other I / O input channels on the PLC controller 1, each I / O direct current input channel supports 32-way water flow synchronous monitoring, the remaining other channels on the input module 2 can be flexibly reused as ordinary I / O terminals, and the total number of channels of the input module 2 can be flexibly expanded according to the model specification of the PLC control. Cross-platform adaptation: the water flow monitoring circuit core algorithm of the application has good portability and can adapt to various types of PLC controllers 1 such as Siemens 1200 / 1500 series, Mitsubishi FX5U, and compatible with hardware environments of different manufacturers.
[0042] The application further provides a readable storage medium, wherein a computer program is stored on the readable storage medium, and the computer program is executed by a processor to implement the method steps.
[0043] The working principle of the application is as follows: The pulse water flow meter 3 is connected to the DC input channel of the PLC controller 1, and the pulse water flow meter 3 converts the water flow signal into a 0-24V pulse sequence input to the interrupt dedicated PIP. When the pulse signal level changes, the interrupt dedicated PIP updates the stored pulse signal in real time.
[0044] After the timer module triggers the interrupt signal periodically, the interrupt service program (ISR) is immediately executed and directly accesses the interrupt dedicated PIP to calculate the pulse signal stored in the interrupt dedicated PIP at the interrupt time and mark the time stamp, and store the calculated pulse signal and the marked time stamp in the DB block. The main program module includes a water flow signal processing module, which can read the data in the DB block, that is, read the real-time pulse signal and the marked time stamp output by the interrupt program module stored in the DB block, and calculate the real-time water flow value, which is used to monitor whether the water flow is abnormal. If the water flow value is lower than the preset water flow threshold value in the fault judgment module within 5 seconds, an alarm signal is transmitted to the alarm device to alarm and enable the corresponding protection measures (such as cutting off the heater and stopping heating).
[0045] Regarding the specific structure of the application, the connection relationship between the components and modules used in the application is determined and can be realized. Except for the special description in the examples, the specific connection relationship can bring corresponding technical effects, and based on the premise of not relying on the execution of the corresponding software program, the technical problems proposed in the application are solved. The model of the components, modules, specific components, the connection mode between them, and the conventional use method and the expected technical effects brought by the above technical features, except for the specific description, belong to the public content disclosed in the patent, journal paper, technical manual, technical dictionary, textbook, etc. before the application date, or belong to the existing technology such as conventional technology and common knowledge, which does not need to be described in detail. The technical solution provided in the case is clear, complete, and can be realized, and the corresponding physical product can be reproduced or obtained according to the technical means.
[0046] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can be modified, or some or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A PLC-based pulsed water flow meter monitoring circuit, characterized by: The output end of the multiple pulse water flow meters (3) is electrically connected to the input module (2) of the PLC controller (1), the PLC controller (1) further comprises an interrupt dedicated PIP and a main program PIP, the interrupt dedicated PIP is in communication connection with the input module (2), the interrupt dedicated PIP and the main program PIP are arranged in isolation from each other, and the interrupt dedicated PIP is configured to store and update the pulse signal output by the input module (2) in real time; The interrupt program module is in communication connection with the interrupt dedicated PIP, and the interrupt program module is further in communication connection with the timer module and the DB block; The timer module and the DB block are both in communication connection with the main program module, and the main program module comprises a water flow signal processing module, which is configured to read the real-time pulse signal output by the interrupt program module and the marked time stamp stored in the DB block, and calculate a real-time water flow value; The output end of the main program module is in communication connection with the fault judgment module, the fault judgment module is in communication connection with the alarm device and the protection device through the output module, and the protection device is electrically connected to the operating equipment.
2. The PLC-based pulsed water flow meter monitoring circuit, method, and readable storage medium of claim 1, wherein: The output end of the multiple pulse water flow meters (3) is electrically connected to the input module (2) of the PLC controller (1), the PLC controller (1) further comprises an interrupt dedicated PIP and a main program PIP, the interrupt dedicated PIP is in communication connection with the input module (2), the interrupt dedicated PIP and the main program PIP are arranged in isolation from each other, and the interrupt dedicated PIP is configured to store and update the pulse signal output by the input module (2) in real time; 3. The PLC-based pulsed water flow meter monitoring circuit of claim 1, wherein: The PLC controller (1) is of a model of Siemens 1200 / 1500 series or Mitsubishi FX5U.
4. The PLC-based pulsed water flow meter monitoring circuit of claim 1, wherein: The output module comprises a comparative analysis module, the fault judgment module, the protection device and the temperature collector of the operating equipment are all electrically connected to the comparative analysis module.
5. A method of monitoring a PLC-based pulsed water flow meter using the PLC-based pulsed water flow meter monitoring circuit according to any one of claims 1 to 4, characterized in that: The method comprises the following steps: In step S1, the output end of the pulse water flow meter (3) is connected to the input module (2) of the PLC controller (1), and the input module (2) converts the water flow signal collected by the pulse water flow meter (3) into a pulse signal; Meanwhile, an independent interrupt dedicated PIP is allocated to the pulse signal input channel in the memory module of the PLC controller (1), and the interrupt dedicated PIP and the main program PIP are arranged in isolation from each other; In step S2, the interrupt dedicated PIP reads the pulse signal output by the input module (2) in real time, reads the level signal jump state of the pulse signal through the timer module and the interrupt program module of the PLC controller (1) and marks the time stamp, identifies the rising edge / falling edge of the pulse signal by comparing the level signals at adjacent two interrupt moments, accumulates the number of pulse signals and records the time stamp; In step S3, the main program module reads the latest pulse signal in the DB block, calculates the time difference between the pulse signal and its adjacent pulse signal by using the time stamp, and converts the real-time water flow value by combining the instrument coefficient of the pulse water flow meter (3).
6. The PLC based pulsed water flow meter monitoring method as claimed in claim 1 wherein: The priority of the scanning action of the timer module in step S2 is higher than that of the main program scanning action, so as to ensure that the interrupt response time deviation is less than or equal to 10 μs.
7. The PLC based pulsed water flow meter monitoring method as claimed in claim 1 wherein: A digital de-bouncing algorithm is embedded in the interrupt program module, and only when the interrupt program module accesses the interrupt dedicated PIP for a preset number of times and all collects the pulse signal stored in the interrupt dedicated PIP at the interrupt moment and causes the same level change, is the pulse signal determined as a valid pulse event and generated.
8. The PLC based pulsed water flow meter monitoring method as claimed in claim 1 wherein: The interrupt program module adopts a phase alignment algorithm to realize the synchronization of interrupt triggering and the boundary of the timing module, and eliminates the sampling interval drift.
9. The PLC based pulsed water flow meter monitoring method as claimed in claim 1 wherein: A fault diagnosis mechanism is also established, which includes low water flow protection and water cut-off protection. Low water flow protection: if the real-time water flow values read by the fault judgment module in a continuous period of time are all lower than the water flow threshold, an alarm signal is output; if the temperature of the corresponding operating device does not reach the over-temperature threshold, the user can manually interrupt the alarm signal.
10. Water cut-off protection: if there is no pulse signal in a plurality of continuous interrupt periods and the temperature of the corresponding operating device reaches the over-temperature threshold, the power supply of the operating device is immediately cut off and an alarm device is triggered.
11. A readable storage medium, characterized by: The readable storage medium has a computer program stored thereon, and the computer program is executed by the processor to implement the method steps of any one of claims 6 to 9.
Citation Information
Patent Citations
Device and method for detecting and determining output pulses of pulse type vortex shedding flowmeter
CN102466500B
PLC and high-speed data acquisition and analysis processing method and system based on PLC
CN115963771A