A ship automation analog quantity data acquisition system and method

CN122593031APending Publication Date: 2026-08-18CSSC GUANGXI SHIPBUILDING & OFFSHORE ENG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610797696.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-04
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0003]然而,船舶机舱内集中布置有电机、变频器、发电机等大功率设备,这些设备运行时会产生强烈的电磁干扰,耦合到传感器信号线路上,导致模拟量信号失真

Benefits of technology

[0016] The advantages and beneficial effects of this invention are as follows: By replacing the traditional PLC polling sampling with an interrupt trigger program and a buffer mechanism, microsecond-level timing triggering and multi-channel synchronous acquisition are achieved, eliminating the sampling delay and inter-channel time deviation caused by the scan cycle. Secondly, when the system detects severe signal fluctuations, it automatically reduces the filter coefficient to make the output quickly follow the input changes; when the signal tends to be stable, it increases the filter coefficient to enhance noise suppression capability. Compared with the traditional filtering scheme with fixed coefficients, it can dynamically balance response speed and smoothing effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122593031A_ABST
    Figure CN122593031A_ABST
Patent Text Reader

Abstract

The application discloses a kind of ship automation analog quantity data acquisition system and method, belong to ship automation technical field.The system includes: sensor module, output standard analog signal;Signal conditioning module, standard analog signal is amplified, filtered and isolated processing;Analog-digital conversion module, analog signal is converted into digital signal;Controller, with interrupt trigger program and buffer zone are configured;Man-machine interface is connected with controller through communication bus and is embedded with communication protocol stack.Controller triggers analog-digital conversion module sampling by interrupt trigger program, and sampling data is stored in buffer zone, and is sent to man-machine interface analysis display after being packaged according to communication protocol frame format.The application improves the real-time performance and reliability of data acquisition by interrupt triggering and buffer zone mechanism, suppresses signal noise under the strong electromagnetic environment of ship engine room by adaptive filtering algorithm, and improves the precision and anti-interference ability of analog quantity acquisition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of marine automation technology, specifically to an automated analog data acquisition system and method for use in environments with strong electromagnetic interference, such as the ship's engine room. Background Technology

[0002] As the shipbuilding industry transforms towards digitalization and intelligence, marine automation analog data acquisition technology has become the foundation for precise control and decision-making of ship equipment. In the ship's engine room environment, a large number of physical quantities such as temperature, pressure, and gas concentration need to be converted into analog signals by sensors, and then converted into digital signals by the acquisition system for processing by programmable logic controllers (PLCs) or host computers.

[0003] However, the ship's engine room houses high-power equipment such as motors, frequency converters, and generators. The operation of these devices generates strong electromagnetic interference, which couples to the sensor signal lines, causing distortion of analog signals. Traditional acquisition systems use fixed-parameter filtering circuits, which struggle to adapt to the complex environment of real-time changes in electromagnetic interference intensity, resulting in significant acquisition errors and, in severe cases, equipment control failure. Furthermore, acquisition systems often use PLC polling to read analog-to-digital conversion results, and the sampling interval is limited by the PLC scanning cycle, making it difficult to meet the high-speed acquisition requirements of rapidly changing signals. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and solve at least one of the problems shown in the background art.

[0005] To achieve the above objectives, the technical solution provided by the present invention is as follows.

[0006] An automated analog data acquisition system for ships, comprising: The sensor module outputs a standard analog signal. The signal conditioning module is connected to the sensor module and performs amplification, filtering, and isolation processing on the standard analog signal. An analog-to-digital conversion module, connected to the signal conditioning module, converts the processed analog signal into a digital signal; A controller is connected to the analog-to-digital conversion module, and the controller is configured with an interrupt triggering program and a buffer. The human-computer interaction interface is connected to the controller via a communication bus, and the human-computer interaction interface has an embedded communication protocol stack. The controller triggers the analog-to-digital conversion module to sample via the interrupt trigger program and stores the sampled data in the buffer; the controller encapsulates the data in the buffer according to the communication protocol frame format and sends it to the human-machine interface; the human-machine interface parses the protocol frame and displays the data.

[0007] Optionally, the signal conditioning module includes a programmable gain amplifier for uniformly amplifying standard analog signals of different ranges to the input range of the analog-to-digital conversion module; the controller also executes an adaptive filtering algorithm, which dynamically adjusts the filtering coefficients based on the statistical characteristics of historical sampled values.

[0008] Optionally, the analog-to-digital conversion module adopts a multi-channel cyclic acquisition method. The controller reads the data of each channel sequentially through polling and stores the data of each channel into different storage areas of the buffer according to a preset address mapping relationship. Before sending a protocol frame, the controller detects the status of the communication bus. If the bus is idle, it sends the frame. If the bus is occupied, it waits for a backoff time and then detects the frame again.

[0009] Optionally, the communication protocol stack embedded in the human-computer interaction interface includes a verification algorithm. The human-computer interaction interface verifies the received protocol frames. If the verification fails, the frame is discarded and a retransmission is requested from the controller. The controller is configured with a timeout detection program, which generates an alarm signal when no valid data is received for multiple consecutive sampling periods.

[0010] Optionally, the sensor module includes a gas sensor and a temperature sensor, wherein the gas sensor is a piezoresistive pressure sensor and the temperature sensor is a thermocouple coupled with a transmitter; the human-machine interface is also configured with a data visualization interface, which includes a real-time data display area, a historical data curve area and an alarm event recording area.

[0011] Optionally, the adaptive filtering algorithm is as follows: Let the current sample value be X. t The mean square error of the historical N sample values ​​is σ t Filtering coefficient α t = α0 × Then the filtered output value Y t = α t × t Where α0 is the initial filter coefficient, and σmax is the preset maximum allowable mean square error threshold; when σ t Exceeding σ max At that time, α t = 0, meaning the current sampled value is used directly as the output.

[0012] Optionally, the adaptive filtering algorithm includes the following judgment process: Step 1: Collect the most recent M sample values ​​and calculate their root mean square error σ; Step 2: Determine if σ is greater than the first threshold; if σ is greater than the first threshold, set the filter coefficient α to the first value so that the output quickly follows the input change; if σ is not greater than the first threshold, proceed to Step 3. Step 3: Determine if σ is less than the second threshold, where the second threshold is less than the first threshold; if σ is less than the second threshold, set the filter coefficient α to a second value, where the second value is greater than the first value, to enhance the smoothing effect; if σ is not less than the second threshold, keep the current filter coefficient α unchanged. Step 4: Output filter value = α × previous output value + × Current sampled value.

[0013] Optionally, it also includes an electromagnetic environment monitoring module, located near the sensor module and / or the signal conditioning module, for real-time acquisition of electromagnetic field strength data at the location; the electromagnetic environment monitoring module is connected to the controller, the controller is configured with an electromagnetic interference historical database for storing electromagnetic field strength time-series data within a preset time window; the controller, based on the measured electromagnetic field strength value at the current moment, queries the electromagnetic interference historical database for the historical period closest to the current electromagnetic environment, extracts the signal correction coefficients of each sampling channel within that historical period, and compensates and corrects the current sampling data.

[0014] Optionally, the electromagnetic environment monitoring module includes a power frequency magnetic field sensor and / or a high frequency electromagnetic field sensor; the controller is configured with an electromagnetic interference characteristic curve generation unit, used to fit the electromagnetic field intensity time series data within a preset time window into an electromagnetic interference characteristic curve; the controller performs correlation matching between the electromagnetic interference characteristic curve of the current time period and the characteristic curve in the historical database, and selects the signal correction coefficient corresponding to the historical time period with the highest correlation as the current correction coefficient; the signal correction coefficient is positively correlated with the electromagnetic field intensity, and different sampling channels correspond to different correction coefficient weights.

[0015] A method for acquiring automated analog data of ships based on the system described in any of the above technical features, characterized by comprising the following steps: Step A: Acquire standard analog signals using the sensor module; Step B: The analog signal is amplified, filtered, and isolated using the signal conditioning module. Step C: Convert the processed analog signal into a digital signal using the analog-to-digital conversion module; Step D: The interrupt triggering program of the controller triggers the reading of the digital signal and stores it in the buffer; Step E: The controller encapsulates the digital signals in the buffer according to the communication protocol frame format and adds a checksum; Step F: The controller sends the protocol frame to the human-machine interface through the communication bus; Step G: The human-computer interaction interface receives the protocol frame, performs verification, and after the verification is successful, parses out the data and displays it.

[0016] The advantages and beneficial effects of this invention are as follows: By replacing the traditional PLC polling sampling with an interrupt trigger program and a buffer mechanism, microsecond-level timing triggering and multi-channel synchronous acquisition are achieved, eliminating the sampling delay and inter-channel time deviation caused by the scan cycle. Secondly, when the system detects severe signal fluctuations, it automatically reduces the filter coefficient to make the output quickly follow the input changes; when the signal tends to be stable, it increases the filter coefficient to enhance noise suppression capability. Compared with the traditional filtering scheme with fixed coefficients, it can dynamically balance response speed and smoothing effect.

[0017] This invention introduces an electromagnetic environment monitoring module and a historical database matching and correction mechanism. Electromagnetic field sensors deployed near the sensors and conditioning circuits collect interference intensity data in real time. The controller performs correlation matching between the electromagnetic interference characteristic curve of the current period and the historical database, selects the most similar historical scenario and verified effective correction coefficient to compensate for the current sampled value. As the running time accumulates, the anti-interference performance of the system can be continuously optimized.

[0018] This invention embeds a communication protocol stack into the human-computer interaction interface and introduces a verification and retransmission mechanism. The receiving end performs CRC verification on each frame of data. If the verification fails, it automatically requests a retransmission from the controller, which effectively solves the problems of bit error and packet loss in long-distance wiring environments on ships. Attached Figure Description

[0019] Figure 1 This is a system block diagram of the present invention. Detailed Implementation

[0020] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the specific embodiments of this application will be described in detail below with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of this application and not intended to limit it. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0021] The terms “comprising” and “having”, and any variations thereof, used in this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.

[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly or implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0023] This embodiment uses a hydrogen sulfide gas monitoring system in a ship's engine room as an application scenario to illustrate the specific implementation of the ship automation analog data acquisition system and method provided by this invention. The ship's engine room environment is characterized by high temperature, high humidity, and strong electromagnetic interference. The engine room houses diesel generator sets, frequency converters, high-power motors, pumps, and other equipment. These devices generate strong electromagnetic radiation during operation, which couples to the sensor signal lines through both conduction and radiation, causing distortion of the analog signals. Traditional analog data acquisition systems often exhibit problems such as large sampling delays, poor anti-interference capabilities, and low data transmission reliability when facing such complex environments, making it difficult to meet the stringent data quality requirements of ship automation systems.

[0024] The system described in this invention includes a sensor module, a signal conditioning module, an analog-to-digital converter module, a controller, and a human-machine interface. The sensor module employs a piezoresistive 4-20mA current-type hydrogen sulfide gas sensor with a range of 0 to 100 ppm, outputting a 4-20mA current loop signal. The choice of a 4-20mA current-type sensor over a voltage-type sensor ensures that the current signal is unaffected by changes in line resistance during transmission, making it suitable for the potentially long wiring distances between the sensor and controller within a ship's engine room. Additionally, a PT100 thermocouple is selected to work with a 4-20mA transmitter for ambient temperature monitoring, with a range of -20°C to 80°C; and a capacitive relative humidity sensor is selected, with a range of 0 to 100% relative humidity. All of the above sensors use a three-wire connection, with two wires for power supply and one wire for signal transmission. This connection method can compensate for errors caused by line resistance to a certain extent.

[0025] The signal conditioning module consists of an operational amplifier circuit, a low-pass filter circuit, and an optocoupler isolation circuit. The operational amplifier circuit uses the AD620 instrumentation amplifier, which features high input impedance and high common-mode rejection ratio, making it suitable for processing weak signals from industrial environments. The 4-20mA current signal output by the sensor is first converted into a 1-5V voltage signal through a 250Ω precision resistor, following Ohm's law that voltage equals current multiplied by resistance. For example, when the sensor outputs 9.6mA of current, the voltage drop across the 250Ω resistor is 2.4V. This voltage signal is then input to the instrumentation amplifier, with the gain set to 2, outputting 4.8V, bringing it close to the full-scale input range (0-10V) of the analog-to-digital converter (ADC) to fully utilize its resolution.

[0026] The low-pass filter circuit uses a second-order Butterworth filter with a cutoff frequency set to 100Hz. The filter utilizes an RC network composed of capacitors and resistors to present different impedance characteristics to signals of different frequencies: low-frequency signals can pass through, while high-frequency signals are attenuated. The second-order Butterworth filter has the flattest amplitude-frequency response characteristic within its passband, without introducing additional ripple. Major interference sources in the ship's engine room, such as high-frequency switching noise generated by frequency converters, are typically above kilohertz, while measured signals such as hydrogen sulfide concentration are slowly varying signals with effective frequency components usually below 10Hz. Therefore, a cutoff frequency of 100Hz effectively filters out high-frequency interference without affecting the integrity of the useful signal.

[0027] The optocoupler isolation circuit uses an HCNR201 linear optocoupler to achieve electrical isolation between the sensor-side signal ground and the controller-side digital ground. The input-side LED converts the electrical signal into a light signal, and the output-side photodiode converts the light signal back into an electrical signal. Since the light signal does not depend on an electrical connection, electrical isolation is achieved between the input and output sides. This isolation can block ground loop interference. When the sensor and controller are located at different grounding points, a potential difference may exist between the two grounds. This potential difference will be superimposed on the signal, forming common-mode interference, which may even damage the equipment in severe cases. In this embodiment, the optocoupler isolation circuit has an isolation voltage rating of 2500Vrms, which is sufficient to handle common interference in the ship's engine room.

[0028] The analog-to-digital conversion module uses the ADS1115 16-bit Δ-Σ ADC chip, with a built-in programmable gain amplifier, supporting 4 channels of single-ended input or 2 channels of differential input. The working principle of the Δ-Σ ADC differs from traditional successive approximation ADCs. It employs oversampling and noise shaping techniques, sampling the input signal at frequencies much higher than the Nyquist frequency to push quantization noise to a higher frequency band, which is then filtered out by digital filtering, thus achieving high resolution. In this embodiment, the ADC chip is configured in continuous conversion mode, with a sampling rate set to 860 SPS (samples per second), and an internal 4.096V reference voltage. The selection of the sampling rate requires a trade-off between time resolution and noise performance: a higher sampling rate results in higher time resolution but a decrease in the number of effective bits; 860 SPS is a commonly used setting for the ADS1115, balancing both requirements. The ADC chip connects via I... 2 The C bus connects to the controller, I 2 The C bus requires only two wires (data line and clock line) to complete data transmission, making it suitable for board-level communication.

[0029] The controller uses a programmable logic controller (PLC), specifically the Siemens S7-200 SMART CPUSR40, equipped with 24 digital inputs, 16 relay outputs, and an expanded EM AR04 analog input module.

[0030] The controller is internally configured with a timer interrupt routine and a Direct Memory Access (DMA) buffer. The timer interrupt is a hardware timing mechanism; when the timer reaches a set value, the CPU pauses the currently executing program and executes the interrupt service routine, returning to the original program after completion. Compared to polling, the interrupt method has the advantages of faster response speed and higher timing accuracy. In this embodiment, the timer interrupt interval is set to 10ms, meaning a sampling operation is triggered every 10 milliseconds. DMA is a technology that allows peripherals to directly exchange data with memory without CPU intervention. In traditional data acquisition methods, the CPU needs to read data from the ADC and write it to memory sequentially, which consumes a significant amount of CPU processing time. With DMA, after the ADC conversion is complete, the DMA controller automatically transfers the data from the ADC's data register to the designated memory area, interrupting the CPU only when the transfer is complete, thus reducing CPU load. In this embodiment, the DMA buffer capacity is 256 bytes, using a circular queue structure. Data is automatically written from the beginning after the buffer is full, with new data overwriting old data. This structure is suitable for temporary storage of continuous data streams.

[0031] The human-machine interface uses a Kunlun Tongtai TPC7022Ei touchscreen, with a 7-inch screen size and a resolution of 1024 x 600, and embeds a MODBUS RTU protocol stack. The RS-485 bus uses shielded twisted-pair cable as the physical medium. The shielding layer resists coupling interference from external electromagnetic fields, and the twisted-pair structure ensures that the interference experienced by the two signal lines is approximately equal, thus canceling each other out during differential reception. A 120Ω terminating resistor is connected in parallel at each end of the bus. The purpose of the terminating resistor is to absorb signal reflections at the bus ends, preventing waveform distortion caused by the superposition of reflected signals with the original signal. The PLC acts as the MODBUS master, and the touchscreen acts as the slave, with the slave address set to 1.

[0032] The data acquisition and transmission process is carried out according to the following steps.

[0033] The first step is to preheat the hydrogen sulfide gas sensor for 30 minutes after power-on to allow its internal electrochemical components to reach a stable operating state. The gas diffuses into the sensor through the permeable membrane, where it undergoes an oxidation-reduction reaction at the working electrode, generating a current signal proportional to the gas concentration. When the hydrogen sulfide concentration in the cabin is 35 ppm, the sensor output current is 9.6 mA, calculated as 4 mA plus (35 ppm divided by 100 ppm) multiplied by 16 mA, which equals 9.6 mA.

[0034] In the second step, the 9.6mA current signal is converted into a 2.4V voltage signal through a 250Ω precision resistor. After being amplified by 2 times by an instrumentation amplifier to obtain 4.8V, it then passes through a second-order low-pass filter with a cutoff frequency of 100Hz to filter out high-frequency noise. The transfer function of the filter determines its attenuation degree for different frequency components. The attenuation slope of the second-order filter is 40dB per decade, meaning that for every tenfold increase in frequency, the signal is attenuated by 100 times. For example, a 2kHz noise signal, whose frequency is 20 times the cutoff frequency, will have an attenuation of approximately 40dB multiplied by log20, which is approximately 52dB, equivalent to an attenuation of about 400 times. The filtered signal enters the optocoupler isolation circuit, and the output is an isolated voltage signal in the range of 4.75V to 4.85V. The nonlinearity error of the isolation circuit is approximately 0.01%.

[0035] The third step involves the isolated voltage signal entering channel 1 of the ADC chip. The ADC chip is configured for continuous conversion mode. With the PGA gain set to 1x, the input range is 0 to 4.096V. Since the current signal is approximately 4.8V, exceeding the range, the system automatically switches the PGA gain to 0.5x. At this point, the input range is 0 to 8V, within the range. The PGA works by changing the feedback resistor network of the ADC's internal front-end amplifier to amplify the signal by different factors, thus matching input signals of varying amplitudes. The ADC performs conversion at a sampling rate of 860 SPS, producing a 16-bit digital value.

[0036] The fourth step involves the PLC's timer interrupt routine triggering every 10ms. The interrupt service routine is accessed via I / O. 2 The C bus sends a read command to the ADS1115 to read the conversion results of four channels (this embodiment actually uses three channels: hydrogen sulfide concentration, temperature, and humidity). 2 In this embodiment, the communication rate of the C-bus is set to 100kHz, with a transmission time of approximately 80 microseconds per byte. Reading data from four channels requires sending about 10 bytes, with a total time of less than 1 millisecond, far less than the 10ms interrupt interval, thus avoiding data backlog. The read raw data is stored in a circular queue of the DMA buffer. The DMA buffer stores the raw ADC values ​​of each channel and their corresponding timestamps in channel number order, with a timestamp accuracy of 1ms.

[0037] Fifth, after the PLC reads data from the DMA buffer, it first performs physical quantity conversion: based on the correspondence between the ADC value and the sensor range, the digital quantity is converted back into the actual physical quantity value. For the hydrogen sulfide channel, the conversion formula is: concentration equals (ADC value divided by 65535 multiplied by 8V) divided by 250Ω minus 4mA, divided by 16mA multiplied by 100ppm. Then, adaptive filtering is performed.

[0038] Adaptive filtering algorithms dynamically adjust the filter coefficients based on the signal's inherent volatility. Traditional fixed-coefficient filters, such as Y... t It equals α multiplied by Y{t-1} plus the difference of 1 minus α multiplied by X. t α is a constant ranging from 0 to 1. When α is close to 1, the output mainly depends on historical values, resulting in good smoothing but slow response; when α is close to 0, the output mainly depends on the current sampled value, resulting in fast response but poor smoothing. This contradiction cannot be reconciled in fixed-coefficient filtering. The adaptive filtering algorithm of this invention introduces a mean square error σ that reflects the degree of signal fluctuation. t The formula for calculating the mean square error is: σ t =sqrt(1 / N*sum{i=t-N+1}^{t} (X i - μ)^2), where μ is the average of these N sampled values. The larger the mean square error, the more severe the signal fluctuation. In this embodiment, N is set to 10, the initial filter coefficient α0 is set to 0.7, and the maximum allowable mean square error threshold σmax is set to 5.0ppm.

[0039] When the signal is stable, σ t It is very small, close to α0, has a strong filtering effect, and effectively suppresses noise; when the signal undergoes a step change, σ t Rapidly increases, α t The output quickly follows the input as the signal decreases; when the signal is subjected to transient interference pulses, σ tIt may briefly increase, but since the duration of the interference pulse is usually very short, the contribution of a single abnormal sampling point to the mean square error is limited, and the algorithm will not overreact; when σ t When the threshold is exceeded, it indicates that the interference intensity has exceeded the normal range. At this point, completely trusting the current sampled value is essentially assuming that "the authenticity of the signal cannot be determined, so it is simply accepted directly." This embodiment records comparative data before and after filtering during actual operation. In the step response test, when the input signal jumps from 30ppm to 45ppm, the rise time of the fixed filtering coefficient scheme is approximately 150ms, while the rise time of the adaptive filtering scheme of this invention is approximately 60ms. In the steady-state test, when the input signal stabilizes around 35ppm, the steady-state fluctuation of the fixed filtering coefficient scheme is approximately ±1.2ppm, while the steady-state fluctuation of the adaptive filtering scheme of this invention is approximately ±0.4ppm.

[0040] As an alternative, this embodiment also employs a dual-threshold adaptive filtering algorithm. The algorithm's process is as follows: First, the mean square error σ is calculated from the most recent M sampled values. Then, it is determined whether σ is greater than a first threshold (e.g., 3.0 ppm). If it is, the filtering coefficient α is set to a first value of 0.3, allowing the output to quickly follow the input changes. If σ is not greater than the first threshold, it is further determined whether σ is less than a second threshold (e.g., 1.0 ppm). If it is, α is set to a second value of 0.8 to enhance the smoothing effect. If σ is between the first and second thresholds, the current α remains unchanged. The dual-threshold algorithm is simpler and has less computational complexity than the continuous adjustment algorithm, making it suitable for controllers with lower processing power. In the step response test, the rise time of this scheme is approximately 55 ms, and the steady-state fluctuation is approximately ±0.35 ppm.

[0041] Step 6: The PLC encapsulates the preprocessed data according to the MODBUS RTU protocol frame format. The MODBUS RTU frame structure includes a start bit, slave address, function code, data field, and CRC checksum. This embodiment uses the function code response frame format. Taking the hydrogen sulfide concentration value as an example, the concentration value of 35.5 ppm is scaled to an integer of 355 and stored in a 2-byte register. The high byte stores the high 8 bits of the value, i.e., 0x01, and the low byte stores the low 8 bits of the value, i.e., 0x63. CRC checksum is a cyclic redundancy check algorithm. Its principle is to treat the data frame as a polynomial, divide it by a preset generator polynomial, and the remainder is the CRC code. This embodiment uses the CRC-16-IBM algorithm, where the generator polynomial corresponds to hexadecimal, with an initial value of 0xFFFF. The calculation is performed byte-by-byte, processing 8 bits of data each time, ultimately obtaining a 16-bit checksum.

[0042] Step 7: Before sending the protocol frame, the PLC checks the current status of the RS-485 bus. RS-485 is a half-duplex bus, meaning only one device can send data at a time. Before sending, the PLC sets the RE / DE control pin to receive mode and listens to the bus for 100 microseconds. The listening principle is to read the differential voltage of the bus: when the bus is idle, the differential voltage is approximately 0V; when a device is sending, the differential voltage is ±200mV or higher. If the bus is idle, the PLC immediately switches the RE / DE pin to transmit mode and sends the complete frame; if the bus is occupied, it waits for a random backoff time before re-detecting. The random backoff time is introduced to avoid repeated collisions caused by multiple devices waiting to send retrying at the same time. With three slave devices connected to the bus, the frame collision rate is reduced from 3.2% without the detection mechanism to 0.15% after adopting the collision detection mechanism of this invention.

[0043] Step 8: The touchscreen continuously monitors the RS-485 bus. Upon receiving a complete frame, the MODBUSRTU protocol stack embedded in the touchscreen performs parsing. First, it identifies the frame start marker by detecting a bus silence period of at least 3.5 characters. At a baud rate of 19200bps, the transmission time of each character is approximately 10 bits divided by 19200, which is about 520.8 microseconds; 3.5 characters take approximately 1.82 milliseconds. Then, it performs a CRC check on the received data frame: the touchscreen recalculates the CRC value of the received data using the same algorithm as the PLC and compares it with the CRC checksum at the end of the frame. The CRC check can detect all single-bit errors, double-bit errors, odd-numbered bit errors, and burst errors shorter than 16 bits, with a false negative probability of approximately 2^-16, or 0.0015%. If they match, the check passes, and the touchscreen parses the register value in the data field, converts it into a physical quantity, and displays it on the human-machine interface; if the check fails, the frame is discarded, and a retransmission request is sent to the PLC. The retransmission request itself is also a MODBUS frame, with the function code being diagnostic and the sub-function code being a return query data. After receiving the retransmission request, the PLC rereads the data from the previous frame from the DMA buffer and retransmits it.

[0044] In some preferred embodiments, an electromagnetic environment monitoring module is additionally deployed near the sensor module and signal conditioning module. This module includes a power frequency magnetic field sensor and a high-frequency electromagnetic field sensor. The power frequency magnetic field sensor uses a magnetoresistive sensor with a range of ±100 microtesla to monitor a 50Hz power frequency magnetic field. The magnetoresistive sensor operates by utilizing the characteristic that the resistance of certain materials changes with an applied magnetic field, converting the resistance change into a voltage signal through a Wheatstone bridge. The high-frequency electromagnetic field sensor uses a broadband electric field probe with a frequency range of 100kHz to 3GHz to monitor high-frequency radiation generated by equipment such as frequency converters. The electromagnetic environment monitoring module is connected to the controller via an RS-485 bus, and the communication parameters are the same as those of the touchscreen.

[0045] The controller is equipped with an electromagnetic interference history database to store time-series data of electromagnetic field strength within a preset time window. In this embodiment, the time window length is 60 seconds, meaning that data from every 60 seconds is stored as a single storage unit. The database operates in a circular storage mode, storing a maximum of the data from the most recent 100 time windows; data exceeding 100 windows is automatically overwritten by the oldest data. Each record includes a timestamp, the average power frequency magnetic field strength sampled per second within the 60 seconds, the average high-frequency electric field strength sampled per second within the 60 seconds, and the signal correction coefficients for each sampling channel within the corresponding time period. The correction coefficients are obtained through experimental calibration: under specific electromagnetic conditions, a known value is input to the acquisition system using a standard signal source, the acquisition error is measured, and the correction coefficients are calculated to ensure that the corrected output equals the true value. The calibration of the correction coefficients requires traversing various typical operating conditions, such as inverter no-load, half-load, and full-load conditions, and water pump start-up and shutdown, to establish a mapping relationship between electromagnetic environment characteristics and correction coefficients.

[0046] During system operation, the controller first collects real-time electromagnetic field strength data through the electromagnetic environment monitoring module, sampling once per second for 60 consecutive seconds to form an electromagnetic interference characteristic curve for the current period. The characteristic curve consists of 60 data points and can be considered a 60-dimensional vector. Then, the controller performs correlation matching between the current characteristic curve and historical characteristic curves in the electromagnetic interference historical database, using the Pearson correlation coefficient as a similarity metric. The Pearson correlation coefficient is calculated as follows: r equals the covariance divided by the product of the standard deviations of the two vectors, ranging from -1 to 1. When r is close to 1, it indicates a positive correlation, meaning the two curves have the same trend; when r is close to 0, it indicates no correlation; and when r is close to -1, it indicates a negative correlation. In this embodiment, r greater than 0.8 is selected as the successful matching threshold, and the correction coefficient corresponding to the historical period with the highest correlation coefficient is selected as the current correction coefficient. If the correlation coefficients of all historical periods are lower than 0.8, it is considered a no-match, and no correction is performed, but the electromagnetic environment data for that period and the current sampling data are stored in the database for future matching.

[0047] The signal correction coefficient is positively correlated with the electromagnetic field strength: the higher the electromagnetic field strength, the larger the absolute value of the correction coefficient. Simultaneously, different sampling channels correspond to different correction coefficient weights. The weighting coefficients are set based on the channel's sensitivity to electromagnetic interference: channels with longer signal cables, poorer shielding, and proximity to high-power equipment are assigned larger correction weights; channels with shorter signal cables, better shielding, and distance from interference sources are assigned smaller correction weights. The controller compensates and corrects the current sampled data based on the extracted correction coefficients, using the following formula: X corrected =X raw* (1 + w * C), where Xraw is the original sampled value, w is the channel weight coefficient (ranging from 0 to 1), and C is the correction coefficient related to the electromagnetic field strength (ranging from -0.2 to 0.2).

[0048] During the frequency ramp-up process from 0Hz to 50Hz, the electromagnetic environment monitoring module detected an increase in the power frequency magnetic field strength from 2 microtesla to 45 microtesla, and an increase in the high-frequency electric field strength from 0.5 volts per meter to 8 volts per meter. The controller matched the current electromagnetic interference characteristic curve with the historical database and extracted a correction coefficient C=0.12. The initial concentration sample value was 35.5 ppm, and the corrected value was 38.9 ppm. Compared with the measured value of 39.2 ppm from the standard gas analyzer, the error decreased from 3.7% to 0.8%.

[0049] To verify the technical effectiveness of this invention, a comparative experiment was conducted in this embodiment, using three different data acquisition schemes to synchronously acquire data from the same signal source. The signal source was an analog 4-20mA current signal output from a standard signal generator, corresponding to a concentration value that stepped from 30ppm to 50ppm and then fell back to 30ppm, repeated 10 times. Scheme A was a traditional PLC polling scheme, without interrupt triggering, DMA buffer, adaptive filtering, or CRC check retransmission. Scheme B employed the interrupt triggering and DMA buffer mechanism of this invention, but did not use adaptive filtering or electromagnetic environment correction; the filtering used a fixed coefficient α=0.5.

[0050] The comparative experimental results are as follows: Scheme A has an average sampling period of 50 milliseconds, a step response rise time of 200 milliseconds, a steady-state acquisition error of ±0.35% of full scale, and a data packet loss rate of 2.1%. Under electromagnetic interference conditions with the inverter at full load, the acquisition error increases to ±0.52% of full scale. Scheme B has an average sampling period of 10 milliseconds, a step response rise time of 80 milliseconds, a steady-state acquisition error of ±0.18% of full scale, and a data packet loss rate of 0.8%. Under electromagnetic interference conditions, the error is ±0.31% of full scale.

[0051] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A ship automated analog data acquisition system, characterized in that, include: The sensor module outputs a standard analog signal. The signal conditioning module is connected to the sensor module and performs amplification, filtering, and isolation processing on the standard analog signal. An analog-to-digital conversion module, connected to the signal conditioning module, converts the processed analog signal into a digital signal; A controller is connected to the analog-to-digital conversion module, and the controller is configured with an interrupt triggering program and a buffer. The human-computer interaction interface is connected to the controller via a communication bus, and the human-computer interaction interface has an embedded communication protocol stack. The controller triggers the analog-to-digital conversion module to sample via the interrupt triggering program and stores the sampled data in the buffer. The controller encapsulates the data in the buffer according to the communication protocol frame format and sends it to the human-computer interaction interface; the human-computer interaction interface parses the protocol frame and displays the data.

2. The ship automated analog data acquisition system according to claim 1, characterized in that, The signal conditioning module includes a programmable gain amplifier, which is used to amplify standard analog signals of different ranges to the input range of the analog-to-digital conversion module; the controller also executes an adaptive filtering algorithm, which dynamically adjusts the filtering coefficients based on the statistical characteristics of historical sampled values.

3. The ship automated analog data acquisition system according to claim 2, characterized in that, The analog-to-digital conversion module adopts a multi-channel cyclic acquisition method. The controller reads the data of each channel sequentially through polling and stores the data of each channel into different storage areas of the buffer according to a preset address mapping relationship. Before sending a protocol frame, the controller detects the status of the communication bus. If the bus is idle, it sends the frame. If the bus is occupied, it waits for a backoff time and then detects the frame again.

4. The ship automated analog data acquisition system according to claim 2, characterized in that, The communication protocol stack embedded in the human-computer interaction interface includes a verification algorithm. The human-computer interaction interface verifies the received protocol frames. If the verification fails, the frame is discarded and a retransmission is requested from the controller. The controller is configured with a timeout detection program, which generates an alarm signal when no valid data is received for several consecutive sampling periods.

5. The ship automated analog data acquisition system according to claim 1, characterized in that, The sensor module includes a gas sensor and a temperature sensor. The gas sensor is a piezoresistive pressure sensor, and the temperature sensor is a thermocouple with a transmitter. The human-machine interface is also equipped with a data visualization interface, which includes a real-time data display area, a historical data curve area, and an alarm event recording area.

6. The ship automated analog data acquisition system according to claim 1, characterized in that, The adaptive filtering algorithm is specifically as follows: Let the current sample value be X. t The mean square error of the historical N sample values ​​is σ t Filtering coefficient α t = α0 × Then the filtered output value Y t = α t × t Where α0 is the initial filter coefficient, and σmax is the preset maximum allowable mean square error threshold; when σ t Exceeding σ max At that time, α t = 0, meaning the current sampled value is used directly as the output.

7. The ship automated analog data acquisition system according to claim 1, characterized in that, The adaptive filtering algorithm includes the following judgment process: Step 1: Collect the most recent M sample values ​​and calculate their root mean square error σ; Step 2: Determine if σ is greater than the first threshold; if σ is greater than the first threshold, set the filter coefficient α to the first value so that the output quickly follows the input change; if σ is not greater than the first threshold, proceed to Step 3. Step 3: Determine if σ is less than the second threshold, where the second threshold is less than the first threshold; if σ is less than the second threshold, set the filter coefficient α to a second value, where the second value is greater than the first value, to enhance the smoothing effect; if σ is not less than the second threshold, keep the current filter coefficient α unchanged. Step 4: Output filter value = α × previous output value + × Current sampled value.

8. The ship automated analog data acquisition system according to claim 1, characterized in that, Also includes: An electromagnetic environment monitoring module is located near the sensor module and / or the signal conditioning module to collect electromagnetic field strength data at the location in real time. The electromagnetic environment monitoring module is connected to the controller. The controller is equipped with an electromagnetic interference historical database to store electromagnetic field strength time series data within a preset time window. Based on the measured electromagnetic field strength value at the current moment, the controller queries the electromagnetic interference historical database for the historical period closest to the current electromagnetic environment, extracts the signal correction coefficients of each sampling channel within that historical period, and compensates and corrects the current sampling data.

9. The ship automated analog data acquisition system according to claim 8, characterized in that, The electromagnetic environment monitoring module includes a power frequency magnetic field sensor and / or a high frequency electromagnetic field sensor; the controller is equipped with an electromagnetic interference characteristic curve generation unit, which is used to fit the time series data of electromagnetic field intensity within a preset time window into an electromagnetic interference characteristic curve; the controller performs correlation matching between the electromagnetic interference characteristic curve of the current time period and the characteristic curve in the historical database, and selects the signal correction coefficient corresponding to the historical time period with the highest correlation as the current correction coefficient; the signal correction coefficient is positively correlated with the electromagnetic field intensity, and different sampling channels correspond to different correction coefficient weights.

10. A method for acquiring automated analog data of ships based on the system described in any one of claims 1 to 9, characterized in that, Includes the following steps: Step A: Acquire standard analog signals using the sensor module; Step B: The analog signal is amplified, filtered, and isolated using the signal conditioning module. Step C: Convert the processed analog signal into a digital signal using the analog-to-digital conversion module; Step D: The interrupt triggering program of the controller triggers the reading of the digital signal and stores it in the buffer; Step E: The controller encapsulates the digital signals in the buffer according to the communication protocol frame format and adds a checksum; Step F: The controller sends the protocol frame to the human-machine interface through the communication bus; Step G: The human-computer interaction interface receives the protocol frame, performs verification, and after the verification is successful, parses out the data and displays it.