Data processing method of a flow control card and flow control card

CN122963273APending Publication Date: 2026-10-23CHANGSHA HUAYI SEMICONDUCTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611450572.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-18
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

由于检测数据采集、控制数据计算以及输出信号配置之间存在数据交互过程,现有流量控制卡的数据处理流程中,各模块之间的数据传输关联性较弱,难以形成统一的数据处理链路

Benefits of technology

本申请中,流量控制卡根据目标压力参数、目标流量参数、实际压力值和实际流量值确定压力控制数据和流量控制数据,并利用数模转换器输出对应的模拟控制信号,能够提高压力控制和流量控制与当前检测状态的匹配程度;同时,直接存储器访问能够减少微控制器执行采样数据搬移时的处理占用,数据映像与EtherCAT从站控制器的配合能够完成流量控制卡与上位主站之间的过程数据交互。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122963273A_ABST
    Figure CN122963273A_ABST
Patent Text Reader

Abstract

The application discloses a data processing method of a flow control card and the flow control card, and can improve the matching degree of pressure control and flow control and the actual operation state of equipment. The method comprises the following steps: receiving control data issued by an upper master station through an EtherCAT slave station controller; obtaining pressure sampling data, flow sampling data and temperature sampling data through a multiplexer; transmitting the pressure sampling data, the flow sampling data and the temperature sampling data to a microcontroller; performing data conversion to obtain actual pressure value, actual flow value and actual temperature value; determining pressure control data and flow control data; outputting analog control signals to a pressure control channel and a flow control channel through a digital-to-analog converter; and writing the actual pressure value, the actual flow value, the actual temperature value, the pressure control data and the flow control data into a data image, and sending the data image to the upper master station through the EtherCAT slave station controller.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of flow control card technology, and in particular to a data processing method for a flow control card and a flow control card. Background Technology

[0002] Existing flow control cards are typically used to collect and control pressure and flow parameters from external devices. They generally receive control parameters sent by the host computer through a communication interface and generate corresponding control signals based on the collected pressure and flow signals to control the external regulating equipment.

[0003] In related technologies, flow control cards typically need to process multiple analog detection signals simultaneously and acquire corresponding sampling data through analog-to-digital conversion modules. However, since different detection channels correspond to different sampling objects, detection channel switching, sampling data classification, and data conversion processing are required during multi-channel acquisition. Existing methods are prone to problems where the correspondence between sampling channel configuration and detection data is unclear, making it difficult to accurately associate the detection object in subsequent data processing.

[0004] Furthermore, when a flow control card outputs control data based on collected data, it typically needs to compare the detected parameters with the target control parameters, generate corresponding control data, and then output the control signal through a digital-to-analog converter. Because there is a data interaction process between data acquisition, control data calculation, and output signal configuration, the data transmission correlation between modules in the existing flow control card's data processing flow is weak, making it difficult to form a unified data processing link.

[0005] Therefore, how to unify the processing of detection data acquisition, data conversion, control data generation, and communication data interaction in the flow control card in order to realize data association between various functional modules within the flow control card is an urgent problem to be solved. Summary of the Invention

[0006] This application provides a data processing method for a flow control card and a flow control card, which can improve the matching degree between pressure control and flow control and the actual operating status of the equipment.

[0007] The first aspect of this application provides a data processing method for a flow control card, the flow control card including a microcontroller, an EtherCAT slave controller connected to the microcontroller, an analog-to-digital converter, a digital-to-analog converter, and a multiplexer, the data processing method including: The EtherCAT slave controller receives control data from the master station, including target pressure parameters and target flow parameters. The multiplexer is controlled to sequentially connect the pressure detection channel, the flow detection channel, and the temperature detection channel, and the analog-to-digital converter is used to sample the analog signals output by the pressure detection channel, the flow detection channel, and the temperature detection channel to obtain pressure sampling data, flow sampling data, and temperature sampling data. The pressure sampling data, the flow sampling data, and the temperature sampling data are transmitted to the microcontroller's storage area via direct memory access; The pressure sampling data, flow sampling data, and temperature sampling data are read from the storage area and converted to obtain the actual pressure value, actual flow value, and actual temperature value. Based on the target pressure parameter, the target flow rate parameter, the actual pressure value, and the actual flow rate value, determine the pressure control data and the flow rate control data; The digital-to-analog converter is configured according to the pressure control data and the flow control data, and analog control signals are output to the pressure control channel and the flow control channel respectively through the digital-to-analog converter. The actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data are written into a data image, and the data image is sent to the master station via the EtherCAT slave controller.

[0008] Optionally, the control unit sequentially connects the pressure detection channel, flow detection channel, and temperature detection channel to the multiplexer, and samples the analog signals output from the pressure detection channel, flow detection channel, and temperature detection channel through the analog-to-digital converter to obtain pressure sampling data, flow sampling data, and temperature sampling data, including: A detection channel sequence is established based on the channel identifiers corresponding to the pressure detection channel, the flow detection channel, and the temperature detection channel, respectively; The channel identifiers in the detection channel sequence are configured into the rule group sequence of the analog-to-digital converter according to the sampling order, and a sampling time is configured for each channel identifier; The multiplexer is controlled to switch to the corresponding pressure detection channel, flow detection channel, or temperature detection channel according to the sampling sequence. After each channel switch is completed, an external trigger signal is provided to the analog-to-digital converter to obtain the conversion data output by the analog-to-digital converter; Based on the channel identifier corresponding to the current conversion, the conversion data is determined to be the pressure sampling data, the flow sampling data, or the temperature sampling data.

[0009] Optionally, determining the conversion data as the pressure sampling data, the flow sampling data, or the temperature sampling data based on the channel identifier corresponding to the current conversion includes: In response to the conversion completion event generated by the analog-to-digital converter, the current rule group sequence position and the conversion data are read; Based on the current rule group sequence position, obtain the corresponding channel identifier from the rule group sequence; The detection object type is queried based on the channel identifier; The conversion data is written into the sampling data area corresponding to the type of the detection object, and the data written into the sampling data area is determined to be the pressure sampling data, the flow sampling data, or the temperature sampling data.

[0010] Optionally, the step of reading the pressure sampling data, the flow sampling data, and the temperature sampling data from the storage area, and performing data conversion to obtain the actual pressure value, the actual flow value, and the actual temperature value includes: The pressure sampling data, the flow sampling data, and the temperature sampling data are written into the corresponding sampling data sets according to their data sources; The calibration parameters corresponding to each of the aforementioned sampling data sets are invoked to calibrate the sampling data in each of the aforementioned sampling data sets, thereby obtaining pressure calibration data, flow calibration data, and temperature calibration data. The actual pressure value is determined based on the pressure conversion relationship corresponding to the pressure calibration data. The actual flow value is determined based on the flow conversion relationship corresponding to the flow calibration data; The actual temperature value is determined based on the temperature conversion relationship corresponding to the temperature calibration data.

[0011] Optionally, determining the pressure control data and flow control data based on the target pressure parameter, the target flow parameter, the actual pressure value, and the actual flow value includes: The target pressure parameter is compared with the actual pressure value to obtain a pressure comparison result; The target flow rate parameter is compared with the actual flow rate value to obtain the flow rate comparison result; The pressure deviation and pressure adjustment direction are determined based on the pressure comparison results. The flow deviation and flow adjustment direction are determined based on the flow comparison results. The pressure control data is generated based on the pressure deviation and the pressure adjustment direction, and the flow control data is generated based on the flow deviation and the flow adjustment direction.

[0012] Optionally, configuring the digital-to-analog converter based on the pressure control data and the flow control data, and outputting analog control signals to the pressure control channel and the flow control channel respectively through the digital-to-analog converter, includes: Establish a first mapping relationship between the pressure control data and the digital-to-analog conversion channel corresponding to the pressure control channel; Establish a second mapping relationship between the flow control data and the digital-to-analog conversion channel corresponding to the flow control channel; The pressure control data is written into the conversion register of the corresponding digital-to-analog conversion channel according to the first mapping relationship; The flow control data is written into the conversion register of the corresponding digital-to-analog conversion channel according to the second mapping relationship; The digital-to-analog converter is triggered to update its output, causing each of the digital-to-analog conversion channels to output the corresponding analog control signal.

[0013] Optionally, the step of writing the actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data into a data image, and sending the data image to the host master station via the EtherCAT slave controller, includes: Based on the data types corresponding to the actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data, the process data fields in the data image are determined; The actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data are respectively written into the corresponding process data fields; In response to a synchronization interruption signal, a data transmission task for the data image is established based on the process data storage area of ​​the EtherCAT slave controller; The data transmission task is executed to copy the data image to the process data storage area, and the EtherCAT slave controller sends the data image to the master station.

[0014] Optionally, the step of establishing a data transmission task for the data image based on the process data storage area of ​​the EtherCAT slave controller in response to a synchronization interrupt signal includes: Read the interrupt flag corresponding to the synchronization interrupt signal and the operating status of the EtherCAT slave controller; When the operating state is the process data exchange state, the data image is marked as a data image to be sent; Obtain the target write address corresponding to the process data storage area and the data length of the data image to be sent; The data transmission task is established based on the data image to be sent, the target write address, and the data length.

[0015] A second aspect of this application provides a flow control card, comprising: The receiving unit is used to receive control data sent by the master station through the EtherCAT slave station controller. The control data includes target pressure parameters and target flow parameters. The control unit is used to control the multiplexer to sequentially connect the pressure detection channel, the flow detection channel, and the temperature detection channel, and to sample the analog signals output by the pressure detection channel, the flow detection channel, and the temperature detection channel through the analog-to-digital converter to obtain pressure sampling data, flow sampling data, and temperature sampling data; A transmission unit is used to transmit the pressure sampling data, the flow sampling data, and the temperature sampling data to the storage area of ​​the microcontroller via direct memory access; The reading unit is used to read the pressure sampling data, the flow sampling data, and the temperature sampling data from the storage area, and perform data conversion to obtain the actual pressure value, the actual flow value, and the actual temperature value. The determining unit is used to determine pressure control data and flow control data based on the target pressure parameter, the target flow parameter, the actual pressure value, and the actual flow value. The configuration unit is used to configure the digital-to-analog converter according to the pressure control data and the flow control data, and to output analog control signals to the pressure control channel and the flow control channel respectively through the digital-to-analog converter; The writing unit is used to write the actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data into a data image, and send the data image to the host master station through the EtherCAT slave controller.

[0016] A third aspect of this application provides an electronic device, comprising: Processor, memory, input / output units, and bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method of the first aspect and any possible implementation of the first aspect.

[0017] The fourth aspect of this application provides a computer-readable storage medium storing a program that, when executed on a computer, causes the computer to perform the methods of the first aspect and any possible implementation thereof.

[0018] As can be seen from the above technical solutions, this application has the following advantages: In this application, the flow control card determines pressure control data and flow control data based on target pressure parameters, target flow parameters, actual pressure values, and actual flow values, and outputs corresponding analog control signals using a digital-to-analog converter, which can improve the matching degree between pressure control and flow control and the current detection state. At the same time, direct memory access can reduce the processing overhead of the microcontroller when performing sample data transfer, and the cooperation between the data mapping and the EtherCAT slave controller can complete the process data interaction between the flow control card and the upper master station. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in 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.

[0020] Figure 1 This is a flowchart illustrating one embodiment of the data processing method for the flow control card in this application; Figure 2 This is a flowchart illustrating the first sub-implementation of the data processing method for the flow control card in this application; Figure 3 This is a flowchart illustrating the second sub-implementation of the data processing method for the flow control card in this application; Figure 4 This is a flowchart illustrating the third sub-implementation of the data processing method for the flow control card in this application; Figure 5 This is a flowchart illustrating the fourth sub-implementation of the data processing method for the flow control card in this application; Figure 6 This is a flowchart illustrating the fifth sub-implementation of the data processing method for the flow control card in this application; Figure 7 This is a flowchart illustrating the sixth sub-implementation of the data processing method for the flow control card in this application; Figure 8 This is a flowchart illustrating the seventh sub-implementation of the data processing method for the flow control card in this application; Figure 9 This is a schematic diagram of the structure of one embodiment of the flow control card in this application; Figure 10 This is a schematic diagram of the structure of one embodiment of the electronic device in this application. Detailed Implementation

[0021] The method described in this application can be applied to servers, terminals, or other devices with logical processing capabilities; therefore, this application does not limit its application. For ease of description, the following description uses a server as the executing entity.

[0022] The embodiments of this application will now be described with reference to the accompanying drawings.

[0023] Please see Figure 1 , Figure 1 One embodiment of the data processing method for the flow control card provided in this application includes a microcontroller, an EtherCAT slave controller connected to the microcontroller, an analog-to-digital converter, a digital-to-analog converter, and a multiplexer. This embodiment includes: 101. Receive control data sent from the master station via the EtherCAT slave controller. The control data includes target pressure parameters and target flow parameters.

[0024] The data processing method of this flow control card can be applied to industrial control equipment that simultaneously requires pressure and flow regulation. For example, in gas transportation, vacuum control, or process medium supply, the host station can determine the desired pressure and flow states based on the current process task and send the corresponding control data to the flow control card, which then performs the corresponding data acquisition and control processing.

[0025] The master station establishes a communication connection with the EtherCAT slave controller and sends control data according to the pre-configured process data format. After receiving the control data, the EtherCAT slave controller extracts the target pressure parameter and target flow parameter according to the position and length of each data field in the process data, and transmits the extraction results to the microcontroller.

[0026] The target pressure parameter represents the pressure value required by the current control task, and the target flow rate parameter represents the flow rate required by the current control task. The microcontroller saves the target pressure and target flow rate parameters to the corresponding control parameter storage locations. When the host station reissues control data, it updates the original parameters in the corresponding storage locations using the newly received parameters.

[0027] 102. Control the multiplexer to sequentially connect the pressure detection channel, flow detection channel and temperature detection channel, and sample the analog signals output from the pressure detection channel, flow detection channel and temperature detection channel through the analog-to-digital converter to obtain pressure sampling data, flow sampling data and temperature sampling data.

[0028] After receiving control data, the flow control card initiates analog signal acquisition. The pressure detection channel connects to a pressure detection device, the flow detection channel connects to a flow detection device, and the temperature detection channel connects to a temperature detection device. Each detection device outputs an analog signal based on the current state of its corresponding detection object. Since multiple detection channels share an analog-to-digital converter, the microcontroller controls the multiplexer to switch signal transmission paths according to a pre-configured sampling order.

[0029] When the multiplexer activates the pressure detection channel, it establishes a signal transmission path between the pressure detection channel and the analog-to-digital converter (ADC) input. After pressure signal sampling is completed, it sequentially switches to the flow detection channel and then the temperature detection channel. Activation here means connecting the current detection channel to the ADC input and disconnecting other detection channels from that input to distinguish the analog signals output by different detection objects.

[0030] During the period when each detection channel is turned on, the analog-to-digital converter samples and converts the input analog signal into digital signal. The conversion result corresponding to the pressure detection channel is determined as pressure sampling data, the conversion result corresponding to the flow detection channel is determined as flow sampling data, and the conversion result corresponding to the temperature detection channel is determined as temperature sampling data.

[0031] 103. Direct memory access is used to transfer pressure sampling data, flow sampling data, and temperature sampling data to the microcontroller's storage area.

[0032] After the analog-to-digital converter completes the sampling conversion, the flow control card initiates direct memory access (DMI) transfer. DMI refers to the data transfer performed between the analog-to-digital converter and the microcontroller's memory area by the DMI control unit without the microcontroller manually moving the sampled data one by one.

[0033] When configuring the data transmission process, the data register address of the analog-to-digital converter is set to the data source address, the storage address in the microcontroller used to store the sampled data is set to the target address, and the data length for a single transmission and the target address update method for continuous transmissions are configured. When the analog-to-digital converter generates sampled data, the corresponding data transmission request triggers the direct memory access control unit to read the sampled data and write it to the target address.

[0034] Pressure sampling data, flow sampling data, and temperature sampling data can be written to different storage locations, or they can be written sequentially to the same storage area according to the sampling order of the pressure detection channel, flow detection channel, and temperature detection channel. After a set of sampling data transmissions is completed, the Direct Memory Access Control (DMI) unit generates a transmission completion status, and the microcontroller determines that the sampling data in the storage area has been updated based on this status.

[0035] 104. Read pressure sampling data, flow sampling data, and temperature sampling data from the storage area, and perform data conversion to obtain actual pressure value, actual flow value, and actual temperature value.

[0036] After confirming the completion of data transmission, the flow control card reads the three types of sampled data according to their storage locations in the storage area: pressure, flow, and temperature. For data stored sequentially in the order of sampling, the corresponding detection channel can be identified based on the data's position within a set of data. For data stored separately, the three types of sampled data can be distinguished based on the correspondence between each storage address and the detection channel.

[0037] Since the sampled data output by the analog-to-digital converter is a digital quantity corresponding to the input analog signal, and this digital quantity cannot directly represent pressure, flow rate, or temperature, it is necessary to call the data conversion relationship corresponding to each detection channel. The data conversion relationship can be pre-configured in the microcontroller according to the input range of the analog-to-digital converter, the output range of the detection device, and the range of the corresponding physical quantity.

[0038] The flow control card processes the pressure sampling data according to the data conversion relationship corresponding to the pressure detection channel to obtain the actual pressure value; processes the flow sampling data according to the data conversion relationship corresponding to the flow detection channel to obtain the actual flow value; processes the temperature sampling data according to the data conversion relationship corresponding to the temperature detection channel to obtain the actual temperature value, and saves each actual value to the corresponding data storage location.

[0039] 105. Determine the pressure control data and flow control data based on the target pressure parameter, target flow parameter, actual pressure value, and actual flow value.

[0040] After obtaining the actual pressure and flow rates, the flow control card performs pressure data processing and flow data processing, respectively. Pressure data processing takes the target pressure parameter and the actual pressure value as input to determine the difference between the current pressure state and the target pressure state; flow data processing takes the target flow parameter and the actual flow rate as input to determine the difference between the current flow rate state and the target flow rate state.

[0041] The flow control card can compare the target pressure parameter with the actual pressure value and the target flow parameter with the actual flow value, and determine the pressure adjustment direction, pressure adjustment amount, flow adjustment direction, and flow adjustment amount based on the comparison results. For example, when the actual pressure value is lower than the target pressure parameter, the pressure adjustment direction is to increase the pressure; when the actual pressure value is higher than the target pressure parameter, the pressure adjustment direction is to decrease the pressure.

[0042] Pressure control data is generated based on the pressure regulation direction and amount, and flow control data is generated based on the flow regulation direction and amount. Pressure control data represents the digital control quantity corresponding to the current pressure control requirement, and flow control data represents the digital control quantity corresponding to the current flow control requirement. When the target parameter or actual value changes, the corresponding control data is redefined.

[0043] 106. Configure a digital-to-analog converter based on the pressure control data and flow control data, and output analog control signals to the pressure control channel and flow control channel respectively through the digital-to-analog converter.

[0044] After determining the pressure control data and flow control data, the flow control card configures the pressure control data to the corresponding digital-to-analog conversion channel according to the correspondence between the pressure control channel and the digital-to-analog conversion channel, and configures the flow control data to the corresponding digital-to-analog conversion channel according to the correspondence between the flow control channel and another digital-to-analog conversion channel.

[0045] The configuration process may include converting pressure control data and flow control data into digital code values ​​that the digital-to-analog converter (DAC) can recognize, and writing them into the conversion registers of the corresponding DAC channels. After writing is complete, the microcontroller provides an output update instruction to the DAC, so that each DAC channel updates its output according to the digital code values ​​in the current conversion registers.

[0046] The digital-to-analog converter (DAC) converts the digital code values ​​corresponding to the pressure control data into analog pressure control signals, which are then output through the pressure control channel. Similarly, it converts the digital code values ​​corresponding to the flow control data into analog flow control signals, which are also output through the flow control channel. Each analog control signal can be a voltage or current signal, and its output magnitude matches the corresponding control data.

[0047] 107. Write the actual pressure value, actual flow rate value, actual temperature value, pressure control data, and flow control data into the data image, and send the data image to the upper master station through the EtherCAT slave controller.

[0048] After completing the analog control signal output, the flow control card organizes the actual pressure value, actual flow value, actual temperature value, pressure control data, and flow control data obtained during the current data processing. The data image is a data storage area set up according to a predetermined data structure, including data fields used to store different process data.

[0049] Based on the storage location and data length of each data field, the actual pressure value is written to the pressure data field, the actual flow rate value to the flow rate data field, and the actual temperature value to the temperature data field. Pressure control data and flow control data are then written to their respective control data fields. For parameters with different data lengths or formats, the data can be formatted according to the field format corresponding to the data image before writing.

[0050] After the data image update is completed, the microcontroller provides the process data in the data image to the EtherCAT slave controller. The EtherCAT slave controller reads the data image according to the data exchange method corresponding to the EtherCAT communication process and sends the read data to the master station, so that the master station can obtain the current actual pressure value, actual flow value, actual temperature value, pressure control data, and flow control data.

[0051] In this embodiment, the flow control card determines pressure control data and flow control data based on the target pressure parameter, target flow parameter, actual pressure value, and actual flow value, and outputs corresponding analog control signals using a digital-to-analog converter, which can improve the matching degree between pressure control and flow control and the current detection state. At the same time, direct memory access can reduce the processing overhead of the microcontroller when performing sampled data transfer, and the cooperation between the data mapping and the EtherCAT slave controller can complete the process data interaction between the flow control card and the upper master station.

[0052] Please see Figure 2 In some embodiments of this application, step 102 in the above embodiments, which controls the multiplexer to sequentially connect the pressure detection channel, the flow detection channel, and the temperature detection channel, and samples the analog signals output by the pressure detection channel, the flow detection channel, and the temperature detection channel through an analog-to-digital converter to obtain pressure sampling data, flow sampling data, and temperature sampling data, may include the following steps: 201. Establish a detection channel sequence based on the channel identifiers corresponding to the pressure detection channel, flow detection channel, and temperature detection channel.

[0053] Channel identifiers are used to uniquely identify a detection channel and can be channel numbers, interface numbers, or codes corresponding to the input ports of analog-to-digital converters. The flow control card acquires the channel identifiers corresponding to the pressure detection channel, flow detection channel, and temperature detection channel, and establishes a correspondence between channel identifiers and detection object types to distinguish the analog signals carried by each detection channel.

[0054] Based on this, the channel identifiers are arranged according to a pre-defined detection order to form a detection channel sequence. The detection channel sequence records the sequential position of each detection channel in a sampling process, and may sequentially include the channel identifiers corresponding to the pressure detection channel, the flow detection channel, and the temperature detection channel. The detection channel sequence can be stored in the microcontroller's configuration area and updated when the sampling configuration changes.

[0055] 202. Configure the channel identifiers in the detection channel sequence to the rule group sequence of the analog-to-digital converter according to the sampling order, and configure the sampling time for each channel identifier.

[0056] After the detection channel sequence is established, the flow control card sequentially reads the channel identifiers in the detection channel sequence and configures each channel identifier into the rule group sequence of the analog-to-digital converter according to its position in the detection channel sequence. The rule group sequence is a hardware sequence in the analog-to-digital converter used to specify the conversion order of multiple detection channels, and each sequence position corresponds to one analog-to-digital conversion task.

[0057] For example, the channel identifier corresponding to the pressure detection channel can be configured in the first position of the rule group sequence, the channel identifier corresponding to the flow detection channel can be configured in the next position, and the channel identifier corresponding to the temperature detection channel can be configured in the next position. The flow control card also configures the corresponding sampling time for each channel identifier according to the stabilization time of the analog signal output by each detection channel, the signal source impedance, or the detection accuracy requirements.

[0058] The sampling time is used to define the duration for which the analog-to-digital converter (ADC) holds the input analog signal before performing the conversion. Different channel identifiers can be configured with the same sampling time, or different sampling times can be configured according to the signal characteristics of the corresponding detection channel. After configuration, the rule group sequence can characterize the sampling order of each detection channel and the corresponding sampling time for each detection channel.

[0059] 203. Control the multiplexer to switch to the corresponding pressure detection channel, flow detection channel or temperature detection channel according to the sampling sequence.

[0060] After configuring the rule group sequence, the flow control card reads the corresponding channel identifier from the detection channel sequence based on the current position of the sequence to be executed, and determines the detection channel to be connected based on the channel identifier. When the channel identifier corresponding to the pressure detection channel is read, the multiplexer is switched to the pressure detection channel; when the channel identifier corresponding to the flow detection channel or temperature detection channel is read, the corresponding channel switching is performed.

[0061] When controlling the multiplexer to switch channels, the microcontroller outputs a gating signal corresponding to the channel identifier to the multiplexer's gating control terminal. This establishes a signal transmission path between the currently detected channel and the analog-to-digital converter (ADC) input, while disconnecting the signal transmission paths between other detected channels and that input. Therefore, only one detected channel provides an analog signal to the ADC at any given sampling time.

[0062] After the current detection channel is switched, the flow control card records the current channel identifier and the current sequence position. After the current detection channel completes its corresponding processing, the sequence position is updated to the next position. The sequence position is updated cyclically according to the detection channel sequence, allowing for sequential switching between pressure detection channel, flow detection channel, and temperature detection channel.

[0063] 204. After each channel switch is completed, provide an external trigger signal to the analog-to-digital converter to obtain the conversion data output by the analog-to-digital converter.

[0064] After the multiplexer switches to the target detection channel, the flow control card can wait for the sampling time corresponding to the current channel identifier, keeping the analog signal output from the target detection channel stable at the analog-to-digital converter input. Once the corresponding sampling time is reached, an external trigger signal is provided to the analog-to-digital converter to initiate sampling and conversion of the current input analog signal.

[0065] External trigger signals can be generated by the microcontroller's hardware timer or by other hardware trigger sources associated with the sampling timing. The flow control card configures the external trigger source, trigger edge, and trigger timing to the analog-to-digital converter (ADC), causing the ADC to perform an analog-to-digital conversion when a valid trigger edge is detected, and write the conversion result to the corresponding data register.

[0066] After the analog-to-digital converter completes the current conversion, it can generate a conversion completion flag or a conversion completion interrupt. In response to the conversion completion flag or the conversion completion interrupt, the flow control card reads the conversion result from the data register and uses the read digital value as the conversion data corresponding to the current detection channel, while recording the channel identifier corresponding to the current conversion.

[0067] 205. Based on the channel identifier corresponding to the current conversion, determine the conversion data as pressure sampling data, flow sampling data, or temperature sampling data.

[0068] After acquiring the conversion data, the flow control card reads the channel identifier recorded during the current conversion and determines whether the conversion data originates from the pressure detection channel, flow detection channel, or temperature detection channel based on the correspondence between the channel identifier and the detection object type. The channel identifier corresponding to the current conversion refers to the identifier of the detection channel connected by the multiplexer when an external trigger signal is generated.

[0069] When the channel identifier corresponding to the current conversion matches the pressure detection channel, the conversion data is determined as pressure sampling data; when the channel identifier corresponding to the current conversion matches the flow detection channel, the conversion data is determined as flow sampling data; when the channel identifier corresponding to the current conversion matches the temperature detection channel, the conversion data is determined as temperature sampling data.

[0070] After determining the data type, different types of sampled data can be recorded in their corresponding data locations, ensuring that each sampled data corresponds to the detection channel that generated it. The current sequence position is then updated to continue processing the next channel identifier in the detection channel sequence; when the current sequence position reaches the end of the detection channel sequence, it can return to the beginning of the detection channel sequence.

[0071] In this embodiment, the flow control card establishes a detection channel sequence based on the channel identifier corresponding to each detection channel, and configures each channel identifier and corresponding sampling time to the rule group sequence of the analog-to-digital converter. This enables the sampling process of pressure, flow, and temperature signals to be organized according to a determined sampling order. At the same time, the sequential switching of the multiplexer, the external trigger signal, and the corresponding processing of the converted data and channel identifier can reduce data confusion between different detection channels and improve the matching accuracy between various types of sampling data and corresponding detection objects.

[0072] Please see Figure 3 In some embodiments of this application, step 205 in the above embodiments, which determines the conversion data as pressure sampling data, flow sampling data, or temperature sampling data based on the channel identifier corresponding to the current conversion, may include the following steps: 301. In response to the conversion completion event generated by the analog-to-digital converter, read the current rule group sequence position and conversion data.

[0073] After an analog-to-digital converter completes an analog-to-digital conversion, it generates a conversion completion event. This event can manifest as a conversion completion flag being set, a conversion completion interrupt being triggered, or a direct memory access transmission completion notification. It indicates that the analog signal corresponding to the currently detected channel has completed the analog-to-digital conversion and the conversion result is readable.

[0074] In response to the conversion completion event, the flow control card reads the current rule group sequence position of the analog-to-digital converter. The current rule group sequence position is used to indicate the position of this conversion in the rule group sequence, for example, it can be represented by the sequence position, the conversion count value, or the register status corresponding to the sequence position.

[0075] Simultaneously, converted data is read from the data register of the analog-to-digital converter (ADC) or from the data buffer area connected to the ADC. The converted data is a digital quantity generated by the ADC based on the current input analog signal. After reading, the current rule group sequence position is associated with and saved with the converted data, indicating that the converted data originates from the corresponding position in the rule group sequence.

[0076] 302. Based on the current rule group sequence position, obtain the corresponding channel identifier from the rule group sequence.

[0077] After obtaining the current rule group sequence position, the flow control card accesses the pre-configured rule group sequence and searches for the sequence item corresponding to the current rule group sequence position. Each sequence item in the rule group sequence records a channel identifier, and different sequence items are arranged according to the order in which the analog-to-digital converter performs the conversion of each detection channel.

[0078] For example, when the current rule group sequence position represents the first sequence item in the rule group sequence, the channel identifier configured in the first sequence item is read; when the current rule group sequence position represents a subsequent sequence item, the channel identifier in the corresponding sequence item is read. Thus, the flow control card can determine the detection channel participating in this conversion based on the current conversion position completed by the analog-to-digital converter.

[0079] To avoid discrepancies between the current rule group sequence position and the actual transformation order, it's possible to check whether the current rule group sequence position is within the valid position range of the rule group sequence when reading the channel identifier. If the current position is valid, the corresponding channel identifier is output; if the current position is outside the valid position range, the reading result is marked as invalid.

[0080] 303. Query the type of the object to be detected based on the channel identifier.

[0081] After obtaining the channel identifier, the flow control card queries the pre-established channel mapping relationship. The channel mapping relationship records the mapping information between each channel identifier and the detection object type, which can be stored in the microcontroller's configuration area and updated synchronously when the detection channel configuration changes.

[0082] The detection object type is used to characterize the physical detection object corresponding to the detection channel, including pressure type, flow type, and temperature type. For example, the channel identifier corresponding to the pressure detection channel is mapped to the pressure type, the channel identifier corresponding to the flow detection channel is mapped to the flow type, and the channel identifier corresponding to the temperature detection channel is mapped to the temperature type.

[0083] During the query process, the channel identifier corresponding to the current transformation is used as an index to search for a matching item in the channel correspondence, and the detection object type recorded in the matching item is read. If no detection object type matching the channel identifier is found, the current transformation can be marked as having an abnormal channel configuration to avoid classifying transformation data with an uncertain source into any detection object.

[0084] 304. Write the converted data into the sampling data area corresponding to the type of the object being detected, and determine whether the data written into the sampling data area is pressure sampling data, flow sampling data, or temperature sampling data.

[0085] After determining the type of object to be detected, the flow control card selects the corresponding sampling data area based on the type of object. The sampling data area is a storage area in the microcontroller's storage space used to classify and save conversion data. It can include pressure sampling data area, flow sampling data area, and temperature sampling data area, each with its own independent starting address and data write location.

[0086] When the object being detected is pressure type, the conversion data is written to the pressure sampling data area, and the written data is identified as pressure sampling data; when the object being detected is flow type, the conversion data is written to the flow sampling data area, and the written data is identified as flow sampling data; when the object being detected is temperature type, the conversion data is written to the temperature sampling data area, and the written data is identified as temperature sampling data.

[0087] When writing conversion data, multiple conversion results can be saved sequentially according to the write position corresponding to each sampling data area, and the corresponding write position can be updated after each write is completed. Therefore, conversion data corresponding to the same detection object type can be continuously stored in the corresponding sampling data area, while preserving the classification relationship between sampling data corresponding to different detection objects.

[0088] In this embodiment, the flow control card responds to the conversion completion event by reading the current rule group sequence position and conversion data, obtaining the channel identifier based on the current rule group sequence position, and querying the corresponding detection object type, thus determining the detection object corresponding to each conversion data. At the same time, the conversion data is written to the sampling data area corresponding to the detection object type, which enables the classification and storage of pressure sampling data, flow sampling data, and temperature sampling data, reducing the confusion between data corresponding to different detection channels.

[0089] Please see Figure 4 In some embodiments of this application, step 104 in the above embodiments, which reads pressure sampling data, flow sampling data, and temperature sampling data from the storage area and performs data conversion to obtain actual pressure values, actual flow values, and actual temperature values, may include the following steps: 401. Write the pressure sampling data, flow sampling data, and temperature sampling data into the corresponding sampling data sets according to the data source.

[0090] After reading various types of sampling data from the storage area, the flow control card determines the data source of each sampling data based on the corresponding detection channel, channel identifier, or storage location. Specifically, the data source type generated by the pressure detection channel is pressure type, the data source type generated by the flow detection channel is flow type, and the data source type generated by the temperature detection channel is temperature type.

[0091] A sampling dataset is a data storage structure that categorizes one or more sampling results according to the type of object being detected. It can include pressure sampling datasets, flow sampling datasets, and temperature sampling datasets. The flow control card writes pressure sampling data into the pressure sampling dataset, flow sampling data into the flow sampling dataset, and temperature sampling data into the temperature sampling dataset, ensuring that sampling results from different data sources are stored in their respective data storage structures.

[0092] When writing to each sampled data set, the corresponding write position can be updated according to the sampling time or data reading order, while preserving the arrangement relationship of each sampled data in the sampled data set. When the sampled data set already contains historical sampled data, the newly read sampled data is written to the next available position to form continuous sampled data for the corresponding detection object.

[0093] 402. Call the calibration parameters corresponding to each sampling data set to calibrate the sampling data in each sampling data set to obtain pressure calibration data, flow calibration data and temperature calibration data.

[0094] After classifying the sampled data, the flow control card obtains pressure calibration parameters, flow calibration parameters, and temperature calibration parameters based on the correspondence between the sampled data set and the calibration parameters. These calibration parameters are used to correct data deviations caused by the detection device, analog signal transmission path, and analog-to-digital conversion process. They can be pre-configured and stored in the microcontroller based on the calibration results of the corresponding detection channel.

[0095] For the pressure sampling dataset, the pressure calibration parameters are called to calibrate the pressure sampling data to obtain pressure calibration data; for the flow sampling dataset, the flow calibration parameters are called to calibrate the flow sampling data to obtain flow calibration data; for the temperature sampling dataset, the temperature calibration parameters are called to calibrate the temperature sampling data to obtain temperature calibration data.

[0096] The calibration process may include gain correction, offset correction, or a combination of both on the sampled data. Various types of calibration data are associated with their corresponding sampled data sets to allow for the retrieval of subsequent data transformation relationships based on pressure type, flow rate type, and temperature type.

[0097] 403. Determine the actual pressure value based on the pressure conversion relationship corresponding to the pressure calibration data.

[0098] After obtaining the pressure calibration data, the flow control card calls the pressure conversion relationship corresponding to the pressure detection channel. The pressure conversion relationship is used to characterize the correspondence between pressure calibration data and pressure physical quantities, and can be pre-established based on the signal output range, pressure detection range, and data expression format of the pressure detection device.

[0099] Substitute the pressure calibration data into the pressure conversion relationship to determine the pressure physical quantity corresponding to the current pressure calibration data, and use this pressure physical quantity as the actual pressure value. If the pressure sampling data set includes multiple sampling data points, each pressure calibration data point can be converted separately, or the currently valid actual pressure value can be determined according to the position of the pressure calibration data in the set.

[0100] The actual pressure value is saved in a pre-defined pressure data format and correlated with the pressure sampling data and pressure calibration data. Therefore, the corresponding sampling and calibration results can be traced based on the actual pressure value.

[0101] 404. Determine the actual flow rate value based on the flow rate conversion relationship corresponding to the flow rate calibration data.

[0102] After the pressure data conversion is complete, the flow control card calls the flow conversion relationship corresponding to the flow detection channel. The flow conversion relationship describes the correspondence between flow calibration data and physical flow quantities, and can be pre-configured according to the output characteristics of the flow detection device, the flow detection range, and the flow data format.

[0103] The flow calibration data is processed according to the flow conversion relationship to obtain the physical quantity of flow corresponding to the current flow detection state, and this physical quantity of flow is determined as the actual flow value. If the flow sampling data set contains multiple consecutive sampling results, each flow calibration data can be processed according to the corresponding sampling order to determine the actual flow value corresponding to the current sampling period.

[0104] After determining the actual flow rate, the actual flow rate is saved to the flow rate data storage location, and the correlation between the actual flow rate, flow rate calibration data, and corresponding flow rate sampling data is maintained to distinguish the flow rate data generated at different sampling times.

[0105] 405. Determine the actual temperature value based on the temperature conversion relationship corresponding to the temperature calibration data.

[0106] After completing the flow data conversion, the flow control card obtains the temperature conversion relationship corresponding to the temperature calibration data. The temperature conversion relationship is used to represent the mapping relationship between temperature calibration data and temperature physical quantities, and can be preset according to the output characteristics, temperature detection range, and temperature data format of the temperature sensing device.

[0107] Input the temperature calibration data into the temperature conversion relationship to determine the physical temperature quantity corresponding to the current temperature detection state, and use this physical temperature quantity as the actual temperature value. If the temperature calibration data contains multiple consecutive data points, the conversion can be performed separately according to the data arrangement order, and the conversion result corresponding to the current sampling period can be selected.

[0108] Once the actual temperature value is determined, it is written to the corresponding temperature data storage location, and the correspondence between the actual temperature value and the temperature calibration data is retained. After the pressure, flow rate, and temperature data are converted respectively, the actual pressure value, actual flow rate value, and actual temperature value reflecting the current detection status can be generated.

[0109] In this embodiment, the flow control card writes the pressure sampling data, flow sampling data, and temperature sampling data into the corresponding sampling data sets according to the data source, and calls the matching calibration parameters and conversion relationships for processing. This can reduce the mixing of data from different detection objects during calibration and conversion, and improve the matching accuracy between the actual pressure value, actual flow value, and actual temperature value and the corresponding sampling data.

[0110] Please see Figure 5 In some embodiments of this application, step 105 in the above embodiments, which determines pressure control data and flow control data based on target pressure parameters, target flow parameters, actual pressure values, and actual flow values, may include the following steps: 501. Compare the target pressure parameter with the actual pressure value to obtain the pressure comparison result.

[0111] After obtaining the actual pressure value, the flow control card reads the target pressure parameter from the control parameter storage location and the actual pressure value from the pressure data storage location. During the reading process, the data format, unit, and validity status of the target pressure parameter and the actual pressure value can be checked to ensure that the two pressure data being compared have a consistent data representation.

[0112] Given consistent pressure data formats, the target pressure parameter and the actual pressure value are compared numerically to determine whether the actual pressure value is less than, equal to, or greater than the target pressure parameter. The pressure comparison result records the relationship between the target pressure parameter and the actual pressure value, which can be represented by a comparison status identifier or by simultaneously associating the target pressure parameter and the actual pressure value involved in the comparison.

[0113] When the target pressure parameter or actual pressure value is updated, the pressure comparison is re-executed, and the new pressure comparison result replaces the previous pressure comparison result. Therefore, the currently saved pressure comparison result corresponds to the target pressure state and actual pressure state most recently acquired by the flow control card.

[0114] 502. Compare the target flow rate parameter with the actual flow rate value to obtain the flow rate comparison result.

[0115] After comparing the pressure data, the flow control card reads the target flow parameter and the actual flow value. The target flow parameter comes from the control data sent by the upper master station, and the actual flow value comes from the data conversion result corresponding to the flow sampling data. The two respectively represent the expected flow state and the currently detected flow state.

[0116] Before comparing the target flow parameter with the actual flow value, both can be converted to the same data format and flow unit. Then, it can be determined whether the actual flow value is less than, equal to, or greater than the target flow parameter. The flow comparison result can be recorded using a pre-configured comparison status identifier to distinguish the relative magnitude of the current actual flow to the target flow.

[0117] The flow comparison results are associated with and saved along with the target flow parameters and actual flow values ​​currently being compared. When the target flow parameters are adjusted or the actual flow values ​​change, the flow control card updates the flow comparison results to ensure that the results correspond to the current flow status.

[0118] 503. Determine the pressure deviation and pressure adjustment direction based on the pressure comparison results.

[0119] The flow control card reads the pressure comparison results and determines the pressure adjustment direction based on the magnitude relationship recorded in the results. When the actual pressure value is less than the target pressure parameter, the pressure adjustment direction is set to increase; when the actual pressure value is greater than the target pressure parameter, the pressure adjustment direction is set to decrease; when the actual pressure value is equal to the target pressure parameter, the pressure adjustment direction is set to maintain.

[0120] The pressure deviation is used to represent the numerical difference between the target pressure parameter and the actual pressure value. The flow control card calculates the difference between the target pressure parameter and the actual pressure value, and uses the absolute value of the difference as the pressure deviation, making the pressure deviation a non-negative value to represent the degree of deviation between the current pressure state and the target pressure state.

[0121] After determining the pressure deviation and pressure adjustment direction, the two are linked and saved. The pressure adjustment direction indicates the adjustment trend of the pressure control quantity, and the pressure deviation indicates the adjustment range corresponding to this adjustment trend, thus forming the pressure adjustment information corresponding to the current pressure state.

[0122] 504. Determine the flow deviation and flow adjustment direction based on the flow comparison results.

[0123] Corresponding to pressure data processing, the flow control card determines the flow adjustment direction corresponding to the current flow state based on the flow comparison results. When the actual flow value is less than the target flow parameter, the flow adjustment direction is determined to be increasing; when the actual flow value is greater than the target flow parameter, the flow adjustment direction is determined to be decreasing; when the two are equal, the flow adjustment direction is determined to be maintaining.

[0124] The flow deviation is calculated based on the numerical difference between the target flow parameter and the actual flow value. Specifically, the absolute value of the difference between the target flow parameter and the actual flow value can be calculated, and this absolute value can be used to represent the degree of deviation of the current actual flow from the target flow.

[0125] Subsequently, the flow deviation is associated with and recorded in relation to the flow adjustment direction. The flow deviation reflects the degree of adjustment required for flow control, while the flow adjustment direction reflects the adjustment trend that flow control needs to execute. Together, they constitute the flow adjustment information required for generating flow control data.

[0126] 505. Generate pressure control data based on pressure deviation and pressure adjustment direction, and generate flow control data based on flow deviation and flow adjustment direction.

[0127] The flow control card determines the adjustment range corresponding to the pressure control data based on the pressure deviation, and determines the direction of action of the adjustment range in the pressure control process based on the pressure adjustment direction. When the pressure adjustment direction is increasing, the current pressure control value is increased according to the pressure deviation; when the pressure adjustment direction is decreasing, the current pressure control value is decreased according to the pressure deviation; when the pressure adjustment direction is maintaining, the current pressure control value is maintained, thereby generating pressure control data.

[0128] For flow control, the flow control card determines the adjustment range of the flow control data based on the flow deviation, and determines whether to increase, decrease, or maintain the flow control quantity based on the flow adjustment direction. The flow deviation can be processed according to a pre-configured correspondence between the deviation and the control adjustment quantity, and then the processing result is combined with the flow adjustment direction to generate the flow control data.

[0129] When generating pressure control data and flow control data, boundary checks can be performed on the calculation results according to the allowable data range of the control data. When the calculation result is within the allowable range, the corresponding calculation result is retained; when the calculation result exceeds the allowable range, it is adjusted to the corresponding boundary value to form digital control data that can be further processed by the flow control card.

[0130] In this embodiment, the flow control card compares the target pressure parameter with the actual pressure value and the target flow parameter with the actual flow value, and determines the deviation and adjustment direction based on the corresponding comparison results. This enables the pressure control data and flow control data to simultaneously reflect the degree of deviation and adjustment trend between the current state and the target state, thereby improving the matching degree between the control data and the actual changes in pressure and flow.

[0131] Please see Figure 6 In some embodiments of this application, step 106 in the above embodiments, which configures the digital-to-analog converter based on the pressure control data and flow control data, and outputs analog control signals to the pressure control channel and flow control channel respectively through the digital-to-analog converter, may include the following steps: 601. Establish the first mapping relationship between pressure control data and the corresponding digital-to-analog conversion channel of pressure control channel.

[0132] The pressure control channel is used to transmit analog control signals to the pressure-controlled object. The digital-to-analog converter (DAC) includes multiple DAC channels capable of independently performing digital-to-analog conversion. The flow control card determines the DAC channels used to carry the pressure control signals based on the hardware connection relationship between the pressure control channel and each output terminal of the DAC.

[0133] After determining the corresponding analog-to-digital conversion channel, the data identifier of the pressure control data, the channel identifier of the pressure control channel, and the channel address of the analog-to-digital conversion channel are associated and recorded to form a first mapping relationship. The first mapping relationship is used to characterize which analog-to-digital conversion channel the pressure control data should be configured to, and can be stored in the channel configuration area of ​​the microcontroller for querying when writing pressure control data.

[0134] When the hardware connection relationship or channel configuration of the pressure control channel changes, the first mapping relationship can be re-established according to the updated configuration to maintain the correspondence between the pressure control data and the actual digital-to-analog conversion channel.

[0135] 602. Establish a second mapping relationship between flow control data and the digital-to-analog conversion channel corresponding to the flow control channel.

[0136] After configuring the pressure control data channels, the flow control card determines the corresponding digital-to-analog converter (DAC) channel based on the connection between the flow control channel and the DAC output. This DAC channel is independent of the DAC channel corresponding to the pressure control channel, and is used to carry pressure control data and flow control data respectively.

[0137] A second mapping relationship is formed by associating the data identifier of the flow control data, the channel identifier of the flow control channel, and the channel address of the corresponding digital-to-analog converter (DAC). This second mapping relationship indicates the target configuration location of the flow control data in the DAC, enabling the microcontroller to directly locate the corresponding DAC channel based on the flow control data.

[0138] The first and second mapping relationships can be stored in the form of a mapping table, a channel configuration array, or an address index. Different mapping relationships record the pressure control path and the flow control path respectively, to avoid the two types of control data being configured to the wrong digital-to-analog conversion channel.

[0139] 603. Write the pressure control data into the conversion register of the corresponding digital-to-analog conversion channel according to the first mapping relationship.

[0140] After the first mapping relationship is established, the flow control card uses the data identifier of the pressure control data as the query condition to obtain the channel address of the corresponding digital-to-analog conversion channel from the first mapping relationship, and locates the corresponding conversion register in the digital-to-analog converter based on the channel address. The conversion register is used to store the digital data to be converted by the digital-to-analog conversion channel this time.

[0141] When the pressure control data does not match the data format required by the digital-to-analog converter (DAC), the microcontroller can convert the pressure control data according to the DAC's data bit width and input range to obtain a digital code value that matches the conversion register. This digital code value represents the numerical position of the pressure control data within the DAC's conversion range.

[0142] After data format processing is completed, the digital code value corresponding to the pressure control data is written to the target conversion register, and the register write status is read to confirm that the target conversion register has saved the pressure control data. This write operation only updates the conversion register corresponding to the pressure control channel and does not change the data saved in other digital-to-analog conversion channels.

[0143] 604. Write the flow control data into the conversion register of the corresponding digital-to-analog conversion channel according to the second mapping relationship.

[0144] After the pressure control data is written, the flow control card queries the digital-to-analog conversion channel corresponding to the flow control data according to the second mapping relationship and obtains the channel address of that digital-to-analog conversion channel. Based on the obtained channel address, the conversion register used to store the flow control data is located.

[0145] Flow control data can be converted into corresponding digital code values ​​according to the data bit width, conversion range, and register arrangement of the digital-to-analog converter (DAC). For flow control data that exceeds the range that the conversion register can represent, the corresponding digital code value can be determined according to the data boundaries allowed to be written by the DAC, thus avoiding the writing of data that cannot be recognized by the DAC.

[0146] Subsequently, the digital code value corresponding to the flow control data is written to the target conversion register, and the correspondence between the flow control data and this register write operation is recorded. The pressure control data and flow control data are stored in their respective conversion registers, forming independent data to be converted.

[0147] 605. Trigger the digital-to-analog converter to update its output, causing each digital-to-analog converter channel to output the corresponding analog control signal.

[0148] After both pressure control data and flow control data are written to the corresponding conversion registers, the flow control card sends an output update command to the digital-to-analog converter (DAC). The output update command can be generated by the microcontroller writing to the control register, or by a hardware trigger connected to the DAC, and is used to instruct the DAC to load the digital code values ​​from each conversion register.

[0149] The digital-to-analog converter responds to the output update command by converting the digital code value corresponding to the pressure control data into a pressure analog control signal, and outputting it through the digital-to-analog conversion channel corresponding to the pressure control channel; at the same time, it converts the digital code value corresponding to the flow control data into a flow analog control signal, and outputting it through the digital-to-analog conversion channel corresponding to the flow control channel.

[0150] After each digital-to-analog converter (DAC) channel completes its output update, it maintains the current analog control signal until the corresponding conversion register is written with new control data and triggers another output update. The flow control card can read the update status of the DAC to determine whether each DAC channel has completed the current digital-to-analog conversion.

[0151] In this embodiment, the flow control card establishes a mapping relationship between pressure control data and flow control data and the corresponding digital-to-analog conversion channels, and writes the two types of control data into the corresponding conversion registers according to the mapping relationship. This can reduce channel mismatch between pressure control data and flow control data. At the same time, it can uniformly trigger the output update of each digital-to-analog conversion channel, which is beneficial to coordinate the output timing of pressure analog control signal and flow analog control signal.

[0152] Please see Figure 7 In some embodiments of this application, step 107 in the above embodiments, which writes the actual pressure value, actual flow rate value, actual temperature value, pressure control data, and flow control data into a data image and sends the data image to the upper master station through the EtherCAT slave controller, may include the following steps: 701. Based on the data types corresponding to the actual pressure value, actual flow rate value, actual temperature value, pressure control data, and flow control data, determine the process data fields in the data mapping.

[0153] A data map is a collection of process data created by the flow control card according to a predetermined data structure. It is used to organize the data that needs to be exchanged between the microcontroller and the EtherCAT slave controller. The data map can be divided into multiple process data fields. Each process data field has a corresponding field identifier, field location, data length, and data format to store a type of process data.

[0154] The flow control card identifies the data types of actual pressure, actual flow, actual temperature, pressure control data, and flow control data. Among these, actual pressure, actual flow, and actual temperature are detection data, while pressure control data and flow control data are control data. Furthermore, each data type can be categorized by its numerical representation as integer, fixed-point, or floating-point.

[0155] Based on the data type corresponding to each data, query the pre-configured data image structure to determine the pressure process data field corresponding to the actual pressure value, the flow process data field corresponding to the actual flow value, the temperature process data field corresponding to the actual temperature value, and the control process data fields corresponding to the pressure control data and flow control data, respectively, and record the field position and data length of each process data field in the data image.

[0156] 702. Write the actual pressure value, actual flow rate value, actual temperature value, pressure control data, and flow control data into the corresponding process data fields.

[0157] After determining the data fields for each process, the flow control card writes the actual pressure value into the pressure process data field, the actual flow rate value into the flow process data field, and the actual temperature value into the temperature process data field, according to the field's location. Simultaneously, it writes the pressure control data into the corresponding pressure control process data field and the flow control data into the corresponding flow control process data field.

[0158] When the data format of the data to be written is inconsistent with the data format required by the corresponding process data field, the data to be written can be converted according to the data length, byte arrangement, and numerical expression method of the field. For example, the physical quantity data used internally by the microcontroller can be converted into a fixed-point format specified by the data image, or the bytes in the data can be arranged according to a predetermined byte order.

[0159] To avoid inconsistencies in data update times, each data point can be first written to a temporary area corresponding to the data image. Only after the actual pressure, flow, and temperature values, pressure control data, and flow control data have all been written can the update status be marked as valid. This ensures that each process data field in the data image corresponds to the detection and control data generated within the same data processing cycle.

[0160] 703. In response to the synchronization interrupt signal, establish a data transmission task for the data image based on the process data storage area of ​​the EtherCAT slave controller.

[0161] After the data image is updated, the flow control card waits for a synchronization interrupt signal from the EtherCAT slave controller. The synchronization interrupt signal indicates that the current EtherCAT communication cycle has reached the predetermined data exchange time, enabling the microcontroller to organize the transmission and processing of process data according to the EtherCAT communication cycle.

[0162] In response to the synchronization interrupt signal, the flow control card reads the current communication status of the EtherCAT slave controller and obtains the starting address and available data length corresponding to the process data storage area. The process data storage area is a storage area in the EtherCAT slave controller used to store process data to be exchanged, and its stored contents can be accessed by the EtherCAT communication process.

[0163] After confirming that the data image is valid and the process data storage area can receive data, the flow control card establishes a data transmission task based on the starting address of the data image, the data length, and the destination address of the process data storage area. The data transmission task records the source address, destination address, and transmission length required for a single data transmission, and is associated with the communication cycle corresponding to the current synchronization interrupt signal.

[0164] 704. Execute the data transmission task, copy the data image to the process data storage area, and send the data image to the master station via the EtherCAT slave controller.

[0165] After the data transmission task is established, the flow control card reads the data image according to the source address recorded in the task, and copies each process data field in the data image to the process data storage area of ​​the EtherCAT slave controller according to the destination address and transmission length. During the copying process, the order of each process data field is kept consistent with the pre-configured data image structure.

[0166] After data copying is complete, the actual copied data length can be compared with the transmission length recorded in the data sending task. Based on the comparison result, it can be determined whether the data in the process data storage area is complete. When they match, the current data in the process data storage area is marked as sendable data; when they do not match, the current data image is retained to avoid sending incomplete data as process data.

[0167] The EtherCAT slave controller reads the transmittable data from the process data storage area according to the current communication cycle, and organizes the actual pressure value, actual flow rate value, actual temperature value, pressure control data, and flow control data into EtherCAT process data before sending it to the upper master station. After transmission is complete, the flow control card can update the execution status of the data transmission task to record that the current data image has been transmitted.

[0168] In this embodiment, the flow control card determines the process data fields in the data image according to the data type of each data, and writes the actual pressure value, actual flow value, actual temperature value, pressure control data and flow control data into the corresponding fields, which can maintain the fixed correspondence between different process data in the data image; at the same time, based on the synchronous interrupt signal, a data transmission task is established and executed, which can make the data image be copied to the process data storage area according to the EtherCAT communication cycle, reducing the situation where the data received by the upper master station is inconsistent with the current data processing cycle of the flow control card.

[0169] Please see Figure 8 In some embodiments of this application, step 703 in the above embodiments, in response to a synchronization interruption signal, establishes a data transmission task for the data image based on the process data storage area of ​​the EtherCAT slave controller, and may include the following steps: 801. Read the interrupt flag corresponding to the synchronous interrupt signal and the operating status of the EtherCAT slave controller.

[0170] After the EtherCAT slave controller generates a synchronization interrupt signal, the flow control card enters the corresponding interrupt handling process and reads the interrupt flag used to characterize the source of the synchronization interrupt. The interrupt flag can be stored in the interrupt status register of the EtherCAT slave controller to indicate whether the current interrupt was triggered by a process data synchronization event, in order to distinguish between synchronization interrupts and communication anomalies, application layer events, or other interrupt types.

[0171] After reading the interrupt flag, the flow control card determines whether the current synchronization interrupt signal is a valid process data synchronization event. When the interrupt flag matches the pre-configured synchronization interrupt identifier, it confirms that the current communication cycle has reached the data exchange time; when the interrupt flag does not match the synchronization interrupt identifier, it can end the current processing flow or transfer to the processing branch corresponding to the interrupt type.

[0172] After confirming the synchronization interrupt signal is valid, the operating status of the EtherCAT slave controller is further read. The operating status indicates the current communication stage of the EtherCAT slave controller and can include initialization status, pre-running status, safe operation status, and process data exchange status. The read operating status is temporarily stored in the microcontroller as a basis for determining whether process data transmission is currently permitted.

[0173] 802. When the running status is process data exchange status, mark the data image as the data image to be sent.

[0174] After completing the read of the operating status, the flow control card compares the current operating status with the status identifier corresponding to the process data exchange status. The process data exchange status refers to the operating stage where the EtherCAT slave controller has completed the communication parameter configuration and is able to exchange periodic process data with the upper master station.

[0175] When both match, the flow control card reads the currently updated data image and configures a send-ready flag for it. The send-ready flag indicates that the data image has met the data transmission conditions for this communication cycle and can be recorded using a status bit, task identifier, or data buffer flag.

[0176] To ensure that the data image to be sent corresponds to complete data processing results, the update status of the data image can be checked before setting the send mark. When the actual pressure value, actual flow rate value, actual temperature value, pressure control data, and flow control data have all been written to the corresponding process data fields, the data image is marked as a data image to be sent; when the data image has not yet been updated, the send mark is not set.

[0177] 803. Obtain the target write address corresponding to the process data storage area and the data length of the data image to be sent.

[0178] After determining the data image to be sent, the flow control card obtains the target write address corresponding to the process data storage area based on the process data configuration of the EtherCAT slave controller. The target write address indicates the specific storage location in the EtherCAT slave controller where the data image to be sent should be copied, and can be determined based on the mapping relationship of the process data objects, the storage area base address, and the data offset.

[0179] The process data storage area may include an output storage area for storing the transmitted process data. The flow control card reads the starting address of this output storage area and checks whether the starting address is within the allowed write address range. When the process data is divided into multiple contiguous or non-contiguous storage segments, the write address corresponding to each storage segment can also be obtained separately.

[0180] At the same time, the data length of the data image to be sent is determined based on the range of valid process data fields in the image. The data length can be obtained by summing the byte lengths occupied by each process data field, or it can be read from the pre-configured data image description information, which represents the total amount of data to be written to the process data storage area.

[0181] 804. Create a data transmission task based on the data image to be sent, the target write address, and the data length.

[0182] After obtaining the target write address and data length, the flow control card uses the data image to be sent as the data source for this data transmission and reads the starting address corresponding to the data image to be sent. Subsequently, the starting address of the data source, the target write address, and the data length are associated and recorded to form a data transmission task describing this data transmission.

[0183] Data transmission tasks can be stored using a task description structure, which includes a source data identifier, source address, destination address, transmission length, and task status. The source data identifier points to the data image to be transmitted, the source address locates the first valid process data field in the data image, the destination address locates the process data storage area in the EtherCAT slave controller, and the transmission length limits the range of data to be transmitted.

[0184] After configuring all task parameters, the flow control card sets the task status of the data transmission task to "pending execution" and associates the data transmission task with the communication cycle corresponding to the current synchronization interrupt signal. If the target write address or data length does not meet the pre-configured transmission conditions, a valid data transmission task will not be established to avoid data write location errors or incomplete transmission ranges caused by abnormal task parameters.

[0185] In this embodiment, the flow control card determines the data transmission conditions based on the interrupt flag corresponding to the synchronization interrupt signal and the operating status of the EtherCAT slave controller. It marks the updated data image as the data image to be transmitted and establishes a data transmission task based on the target write address and data length. This enables the data transmission task to match the current process data exchange status of the EtherCAT slave controller, while also clarifying the data source, write location, and transmission range of the data image to be transmitted.

[0186] Please see Figure 9 , Figure 9 One embodiment of the flow control card provided in this application includes a microcontroller, an EtherCAT slave controller connected to the microcontroller, an analog-to-digital converter, a digital-to-analog converter, and a multiplexer. This embodiment includes: The receiving unit 901 is used to receive control data sent by the master station via the EtherCAT slave controller. The control data includes target pressure parameters and target flow parameters. The control unit 902 is used to control the multiplexer to sequentially connect the pressure detection channel, flow detection channel and temperature detection channel, and to sample the analog signals output by the pressure detection channel, flow detection channel and temperature detection channel through the analog-to-digital converter to obtain pressure sampling data, flow sampling data and temperature sampling data; The transmission unit 903 is used to transmit pressure sampling data, flow sampling data, and temperature sampling data to the storage area of ​​the microcontroller via direct memory access; The reading unit 904 is used to read pressure sampling data, flow sampling data and temperature sampling data from the storage area, and perform data conversion to obtain actual pressure value, actual flow value and actual temperature value; The determining unit 905 is used to determine pressure control data and flow control data based on the target pressure parameter, target flow parameter, actual pressure value and actual flow value; Configuration unit 906 is used to configure digital-to-analog converter according to pressure control data and flow control data, and output analog control signals to pressure control channel and flow control channel respectively through digital-to-analog converter; The writing unit 907 is used to write the actual pressure value, actual flow rate value, actual temperature value, pressure control data and flow control data into the data image, and send the data image to the upper master station through the EtherCAT slave controller.

[0187] In this embodiment, the functions of each unit are as described above. Figures 1 to 8 The steps in the illustrated embodiments and sub-embodiments are corresponding and will not be repeated here.

[0188] Please see Figure 10 , Figure 10 One embodiment of the electronic device provided in this application includes: Processor 1001, memory 1002, input / output unit 1003, and bus 1004; The processor 1001 is connected to the memory 1002, the input / output unit 1003, and the bus 1004; The memory 1002 stores a program, and the processor 1001 calls the program to execute it. Figures 1 to 8 The steps in the illustrated embodiment.

[0189] In this embodiment, the function of processor 1001 is the same as described above. Figures 1 to 8 The steps in the illustrated embodiments are the same and will not be repeated here.

[0190] This application also provides a computer-readable storage medium on which a program is stored. When the program is executed on a computer, it causes the computer to perform the aforementioned actions. Figures 1 to 8 The method in any possible implementation.

[0191] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0192] 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 an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0193] 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.

[0194] Furthermore, 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. The integrated unit can be implemented in hardware or as a software functional unit.

[0195] If the integrated unit 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 application, in essence, or the part that contributes to the prior art, or all or 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 described in the various embodiments of this application. 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.

Claims

1. A data processing method for a flow control card, characterized in that, The flow control card includes a microcontroller, an EtherCAT slave controller connected to the microcontroller, an analog-to-digital converter, a digital-to-analog converter, and a multiplexer. The data processing method includes: The EtherCAT slave controller receives control data from the master station, including target pressure parameters and target flow parameters. The multiplexer is controlled to sequentially connect the pressure detection channel, the flow detection channel, and the temperature detection channel, and the analog-to-digital converter is used to sample the analog signals output by the pressure detection channel, the flow detection channel, and the temperature detection channel to obtain pressure sampling data, flow sampling data, and temperature sampling data. The pressure sampling data, the flow sampling data, and the temperature sampling data are transmitted to the microcontroller's storage area via direct memory access; The pressure sampling data, flow sampling data, and temperature sampling data are read from the storage area and converted to obtain the actual pressure value, actual flow value, and actual temperature value. Based on the target pressure parameter, the target flow rate parameter, the actual pressure value, and the actual flow rate value, determine the pressure control data and the flow rate control data; The digital-to-analog converter is configured according to the pressure control data and the flow control data, and analog control signals are output to the pressure control channel and the flow control channel respectively through the digital-to-analog converter. The actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data are written into a data image, and the data image is sent to the master station via the EtherCAT slave controller.

2. The data processing method according to claim 1, characterized in that, The control unit sequentially connects the pressure detection channel, flow detection channel, and temperature detection channel to the multiplexer, and samples the analog signals output from the pressure detection channel, flow detection channel, and temperature detection channel through the analog-to-digital converter to obtain pressure sampling data, flow sampling data, and temperature sampling data, including: A detection channel sequence is established based on the channel identifiers corresponding to the pressure detection channel, the flow detection channel, and the temperature detection channel, respectively; The channel identifiers in the detection channel sequence are configured into the rule group sequence of the analog-to-digital converter according to the sampling order, and a sampling time is configured for each channel identifier; The multiplexer is controlled to switch to the corresponding pressure detection channel, flow detection channel, or temperature detection channel according to the sampling sequence. After each channel switch is completed, an external trigger signal is provided to the analog-to-digital converter to obtain the conversion data output by the analog-to-digital converter; Based on the channel identifier corresponding to the current conversion, the conversion data is determined to be the pressure sampling data, the flow sampling data, or the temperature sampling data.

3. The data processing method according to claim 2, characterized in that, The step of determining the conversion data as the pressure sampling data, the flow sampling data, or the temperature sampling data based on the channel identifier corresponding to the current conversion includes: In response to the conversion completion event generated by the analog-to-digital converter, the current rule group sequence position and the conversion data are read; Based on the current rule group sequence position, obtain the corresponding channel identifier from the rule group sequence; The detection object type is queried based on the channel identifier; The conversion data is written into the sampling data area corresponding to the type of the detection object, and the data written into the sampling data area is determined to be the pressure sampling data, the flow sampling data, or the temperature sampling data.

4. The data processing method according to claim 1, characterized in that, The step of reading the pressure sampling data, the flow sampling data, and the temperature sampling data from the storage area, and performing data conversion to obtain the actual pressure value, the actual flow value, and the actual temperature value includes: The pressure sampling data, the flow sampling data, and the temperature sampling data are written into the corresponding sampling data sets according to their data sources; The calibration parameters corresponding to each of the aforementioned sampling data sets are invoked to calibrate the sampling data in each of the aforementioned sampling data sets, thereby obtaining pressure calibration data, flow calibration data, and temperature calibration data. The actual pressure value is determined based on the pressure conversion relationship corresponding to the pressure calibration data. The actual flow value is determined based on the flow conversion relationship corresponding to the flow calibration data; The actual temperature value is determined based on the temperature conversion relationship corresponding to the temperature calibration data.

5. The data processing method according to claim 1, characterized in that, The step of determining pressure control data and flow control data based on the target pressure parameter, the target flow parameter, the actual pressure value, and the actual flow value includes: The target pressure parameter is compared with the actual pressure value to obtain a pressure comparison result; The target flow rate parameter is compared with the actual flow rate value to obtain the flow rate comparison result; The pressure deviation and pressure adjustment direction are determined based on the pressure comparison results. The flow deviation and flow adjustment direction are determined based on the flow comparison results. The pressure control data is generated based on the pressure deviation and the pressure adjustment direction, and the flow control data is generated based on the flow deviation and the flow adjustment direction.

6. The data processing method according to claim 1, characterized in that, The step of configuring the digital-to-analog converter based on the pressure control data and the flow control data, and outputting analog control signals to the pressure control channel and the flow control channel respectively through the digital-to-analog converter includes: Establish a first mapping relationship between the pressure control data and the digital-to-analog conversion channel corresponding to the pressure control channel; Establish a second mapping relationship between the flow control data and the digital-to-analog conversion channel corresponding to the flow control channel; The pressure control data is written into the conversion register of the corresponding digital-to-analog conversion channel according to the first mapping relationship; The flow control data is written into the conversion register of the corresponding digital-to-analog conversion channel according to the second mapping relationship; The digital-to-analog converter is triggered to update its output, causing each of the digital-to-analog conversion channels to output the corresponding analog control signal.

7. The data processing method according to claim 1, characterized in that, The step of writing the actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data into a data image, and sending the data image to the master station via the EtherCAT slave controller, includes: Based on the data types corresponding to the actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data, the process data fields in the data image are determined; The actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data are respectively written into the corresponding process data fields; In response to a synchronization interruption signal, a data transmission task for the data image is established based on the process data storage area of ​​the EtherCAT slave controller; The data transmission task is executed to copy the data image to the process data storage area, and the EtherCAT slave controller sends the data image to the master station.

8. The data processing method according to claim 7, characterized in that, The step of responding to a synchronization interruption signal by establishing a data transmission task for the data image based on the process data storage area of ​​the EtherCAT slave controller includes: Read the interrupt flag corresponding to the synchronization interrupt signal and the operating status of the EtherCAT slave controller; When the operating state is the process data exchange state, the data image is marked as a data image to be sent; Obtain the target write address corresponding to the process data storage area and the data length of the data image to be sent; The data transmission task is established based on the data image to be sent, the target write address, and the data length.

9. A flow control card, characterized in that, For implementing the method of any one of claims 1 to 8, the flow control card includes a microcontroller, an EtherCAT slave controller connected to the microcontroller, an analog-to-digital converter, a digital-to-analog converter, and a multiplexer, wherein the flow control card includes: The receiving unit is used to receive control data sent by the master station through the EtherCAT slave station controller. The control data includes target pressure parameters and target flow parameters. The control unit is used to control the multiplexer to sequentially connect the pressure detection channel, the flow detection channel, and the temperature detection channel, and to sample the analog signals output by the pressure detection channel, the flow detection channel, and the temperature detection channel through the analog-to-digital converter to obtain pressure sampling data, flow sampling data, and temperature sampling data; A transmission unit is used to transmit the pressure sampling data, the flow sampling data, and the temperature sampling data to the storage area of ​​the microcontroller via direct memory access; The reading unit is used to read the pressure sampling data, the flow sampling data, and the temperature sampling data from the storage area, and perform data conversion to obtain the actual pressure value, the actual flow value, and the actual temperature value. The determining unit is used to determine pressure control data and flow control data based on the target pressure parameter, the target flow parameter, the actual pressure value, and the actual flow value. The configuration unit is used to configure the digital-to-analog converter according to the pressure control data and the flow control data, and to output analog control signals to the pressure control channel and the flow control channel respectively through the digital-to-analog converter; The writing unit is used to write the actual pressure value, the actual flow rate value, the actual temperature value, the pressure control data, and the flow control data into a data image, and send the data image to the host master station through the EtherCAT slave controller.

10. An electronic device, characterized in that, include: Processor, memory, input / output units, and bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method as described in any one of claims 1 to 8.