Metering device

文档序号:1503510 发布日期:2020-02-07 浏览:20次 中文

阅读说明:本技术 一种计量装置 (Metering device ) 是由 李望 魏勇 李俊刚 王全海 孟乐 史宏光 毋炳鑫 孟令浩 王淇森 程昆仑 胡志明 于 2019-09-29 设计创作,主要内容包括:本发明涉及一种计量装置,包括计量芯片、处理器、阻容滤波器和处理器供电模块;所述计量芯片包括用于采集采样数据的采样接口和计量芯片SPI接口,用于通过计量芯片SPI接口将采样数据传输给处理器;所述处理器包括处理器SPI接口和电源接口,用于通过处理器SPI接口接收计量芯片传输的数据;所述阻容滤波器用于将计量芯片和处理器之间传输的数据进行滤波处理;所述处理器供电模块连接所述处理器的电源接口。该装置通过阻容滤波器解决了计量装置在强电磁干扰环境下通过SPI通信线传输数据有误的问题,保证了计量芯片与处理器之间数据传输的正确性,提高了计量装置的可靠性。(The invention relates to a metering device, which comprises a metering chip, a processor, a resistance-capacitance filter and a processor power supply module, wherein the processor is connected with the metering chip through a power supply; the metering chip comprises a sampling interface for collecting sampling data and a metering chip SPI interface, and is used for transmitting the sampling data to the processor through the metering chip SPI interface; the processor comprises a processor SPI interface and a power interface and is used for receiving data transmitted by the metering chip through the processor SPI interface; the resistance-capacitance filter is used for filtering data transmitted between the metering chip and the processor; the processor power supply module is connected with a power interface of the processor. The device has solved the problem that metering device has the mistake through SPI communication line transmission data under the strong electromagnetic interference environment through resistance-capacitance filter, has guaranteed the exactness of data transmission between measurement chip and the treater, has improved metering device's reliability.)

1. A metering device is characterized by comprising a metering chip, a processor, a resistance-capacitance filter and a processor power supply module;

the metering chip comprises a sampling interface and a metering chip SPI interface and is used for transmitting sampling data to the processor through the metering chip SPI interface;

the processor comprises a processor SPI interface and a power interface and is used for receiving data transmitted by the metering chip through the processor SPI interface;

the resistance-capacitance filter is used for filtering data transmitted between the metering chip and the processor;

the processor power supply module is connected with a power interface of the processor.

2. The metering device of claim 1, wherein the rc filter is disposed on the SPI communication line between the metering chip SPI interface and the processor SPI interface, the metering chip SPI interface, the processor SPI interface, or is integrally disposed within the metering chip.

3. The metering device of claim 2, wherein the SPI communication line comprises a serial clock line, a master input slave output line, a master output slave input line, and a slave select line, wherein the rc filter is provided in series on at least one line.

4. The metering device of claim 1, wherein the processor power module comprises an AC/DC converter and a common mode filter; the alternating current end of the AC/DC converter is used for connecting an alternating current power supply, and the direct current end of the AC/DC converter is connected with the power interface of the processor; the common mode filter is arranged on a line between an alternating current end of the AC/DC converter and an alternating current power supply in series.

5. The metering device of claim 1, wherein the metering chip further comprises a configuration register, and the configuration register is a configuration register with a locking function.

6. The metering device according to claim 1, wherein the metering chip is further configured to calculate a CRC check code of data to be sent, and store the calculated CRC check code in a register corresponding to the metering chip; the processor is further used for reading the data to be sent from the register of the metering chip, in which the data to be sent is stored, recalculating the CRC check code, reading the CRC check code calculated by the metering chip from the corresponding register of the metering chip, comparing the recalculated CRC check code with the CRC check code calculated by the metering chip, and judging whether the sampled data is valid or not according to the comparison result.

Technical Field

The invention belongs to the technical field of measurement acquisition processing, and particularly relates to a metering device.

Background

In order to realize the acquisition and processing of sampling data, various metering devices are introduced. For example, chinese utility model patent with an authorization publication number CN203658459U provides a metering circuit based on SWF2L23A chip, each sampling circuit in the metering circuit inputs respective sampling data to the metering chip SWF2L23A, and the metering chip SWF2L23A is connected to a corresponding SPI (Serial Peripheral Interface) Interface of the main control unit of the metering device through an SPI communication circuit. The metering circuit performs RC filtering processing on the sampling data, and the anti-interference capacity of the circuit can be improved. However, when the device is applied to some strong electromagnetic environments, the data transmitted between the metering chip and the processor is often subjected to strong magnetic interference, so that a transmission error phenomenon occurs. For example, when the device is applied to a strong electromagnetic environment such as an intelligent distribution terminal, an abnormal phenomenon that transmission data errors easily occur includes: under the condition that a certain phase source end does not have alternating current value input, the intelligent distribution and transformation terminal occasionally flashes irregular numerical values, or when the phase A current source end has alternating current value input, the intelligent distribution and transformation terminal displays the numerical values which are fixed times of the input values. Such anomalies will affect the security and reliability of the entire distribution network system.

Disclosure of Invention

The invention aims to provide a metering device, which is used for solving the problem of transmission errors caused by the fact that data transmission between a metering chip and a processor is easily interfered by strong magnetism.

In order to solve the technical problems, the technical scheme of the invention is as follows:

the invention discloses a metering device, which comprises a metering chip, a processor, a resistance-capacitance filter and a processor power supply module, wherein the processor is connected with the metering chip; the metering chip comprises a sampling interface and a metering chip SPI interface and is used for transmitting sampling data to the processor through the metering chip SPI interface; the processor comprises a processor SPI interface and a power interface and is used for receiving data transmitted by the metering chip through the processor SPI interface; the resistance-capacitance filter is used for filtering data transmitted between the metering chip and the processor; the processor power supply module is connected with a power interface of the processor.

The beneficial effects are as follows: according to the invention, the resistance-capacitance filter is serially arranged on the SPI communication line between the SPI interface of the metering chip and the SPI interface of the processor, so that the problem that the metering device has errors in data transmission through the SPI communication line in a strong electromagnetic interference environment is solved, the correctness of data transmission between the metering chip and the processor is ensured, and the reliability of the metering device is improved.

Further, in order to further improve the correctness of the data transmitted by the SPI communication line, the rc filter is arranged on the SPI communication line between the metering chip SPI interface and the processor SPI interface, at the metering chip SPI interface, at the processor SPI interface, or integrated inside the metering chip.

Further, in order to ensure the correctness of the data transmitted by the SPI communication line, the SPI communication line comprises a serial clock line, a master input slave output line, a master output slave input line, and a slave selection line, wherein at least one line is provided with the rc filter in series.

Further, in order to improve the stability of the processor power supply, the processor power supply module comprises an AC/DC converter and a common mode filter; the alternating current end of the AC/DC converter is used for connecting an alternating current power supply, and the direct current end of the AC/DC converter is connected with the power interface of the processor; the common mode filter is arranged on a line between an alternating current end of the AC/DC converter and an alternating current power supply in series.

Further, in order to prevent the configuration of the metering chip from being maliciously tampered to improve the correctness of data transmission of the SPI communication line, the metering chip further comprises a configuration register which is a configuration register with a locking function.

Further, in order to ensure the integrity of the data received by the processor, the metering chip is further configured to calculate a CRC check code of the data to be sent, and store the calculated CRC check code in a register corresponding to the metering chip; the processor is further used for reading the data to be sent from the register of the metering chip, in which the data to be sent is stored, recalculating the CRC check code, reading the CRC check code calculated by the metering chip from the corresponding register of the metering chip, comparing the recalculated CRC check code with the CRC check code calculated by the metering chip, and judging whether the sampled data is valid or not according to the comparison result.

Drawings

FIG. 1 is a block diagram of a metering device of the present invention;

FIG. 2 is a block diagram of the SPI communication incorporating a RC filter of the present invention;

FIG. 3 is a circuit diagram of a RC filter of the present invention;

FIG. 4 is a block diagram of a processor power module of the present invention;

FIG. 5 is a circuit diagram of a common mode filter of the present invention;

FIG. 6 is a flow chart of a CRC check of the present invention;

FIG. 7 is a flow chart of the metering chip configuration register lock of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention is further described in detail below with reference to the accompanying drawings and embodiments.

Metering device embodiment:

the embodiment provides a metering device, the structure of which is shown in fig. 1, and the device comprises a metering chip, a processor and a processor power supply module. In the embodiment, the device is applied to the intelligent distribution terminal.

The metering chip comprises a sampling interface and a metering chip SPI interface. The sampling interface comprises a voltage sampling interface and a current sampling interface which are respectively and correspondingly connected with data collected by the voltage transformer and data collected by the current transformer. The metering chip SPI interface comprises a serial clock interface SCK, a master output slave input interface MOSI, a master input slave output interface MISO and a slave selection interface SS, and the collected voltage and current data are transmitted to the processor through the metering chip SPI interface.

The processor includes a processor SPI interface and a power interface. The processor SPI interface comprises a serial clock interface SCK, a master output slave input interface MOSI, a master input slave output interface MISO and a slave selection interface SS, and the interfaces are correspondingly connected with the metering chip SPI interface through corresponding serial clock lines, master input slave output lines, master output slave input lines and slave selection lines (the four lines are SPI communication lines) so that the processor can receive data transmitted by the metering chip through the processor SPI interface. The power interface is connected with the processor power supply module to take power from the processor power supply module. The processor power supply module comprises an AC/DC converter, wherein the AC end of the AC/DC converter is used for connecting an AC power supply, and the DC end of the AC/DC converter is connected with a power interface of the processor. The AC/DC converter may convert the AC power to 12V DC power to power the processor.

In general, the processor needs to acquire data of the metering chip and directly read the data from the register of the metering chip, and the data acquisition process is realized through a corresponding SPI interface.

In order to effectively inhibit the electromagnetic interference of the communication between the SPI boards, a low-pass filter is arranged on the SPI communication line. The low-pass filter selects a resistance-capacitance filter (i.e., an RC filter) composed of a resistor and a capacitor, and the structural form of the low-pass filter is shown in fig. 3, and the structural diagram of the SPI communication including the resistance-capacitance filter is shown in fig. 2. And an RC filter is added on each of the serial clock line, the master input-slave output line, the master output-slave input line and the slave selection line. Of course, an RC filter may be added to one or both of the lines. The selection of the resistance value of the resistor and the capacitance value of the capacitor is selected according to the SPI communication rate and the type of the processor. Specifically, in this embodiment, the specific SPI communication rate is 1Mbps, the processor is a HiSD5115 type processor, the corresponding resistor is a resistor having a resistance value of 30 Ω, and the capacitor is a capacitor having a capacitance value of 30 pF.

In order to suppress common mode interference on the power supply line, a common mode filter is provided on a line between the AC terminal of the AC/DC converter and the AC power supply, and the configuration thereof is as shown in fig. 4. And the common mode filters are respectively connected to the three-phase power lines and respectively correspondingly connected to the phase line and the neutral line of the power line. In general, a common mode filter uses two common mode inductors (the two common mode inductors are a common mode choke), and the number of turns and the winding direction of the two coils are the same. When the common-mode interference passes through the two coils, the common-mode interference presents high impedance and can be consumed in the form of heat energy, and in order to have a better suppression effect on common-mode interference signals, a common-mode filter which uses the common-mode inductance coil and the capacitor in a matched mode is adopted.

The specific structure of the common-mode filter in this embodiment is shown in fig. 5, and the common-mode filter includes three common-mode filter units arranged in series, each common-mode filter unit being composed of a common-mode inductor and a capacitor. For the first common mode filter unit, the first common mode filter unit comprises a capacitor C1, a capacitor C2, a common mode inductance coil L1 and a common mode inductance coil L2, two ends of the capacitor C1 are input ends of the common mode filter unit and are used for being connected with a power supply input end, a series branch formed by the common mode inductance coil L1, the capacitor C2 and the common mode inductance coil L2 which are sequentially connected in series is connected to two ends of the capacitor C1, and two ends of the capacitor C2 are output ends of the common mode filter unit. The second common mode filter unit and the third common mode filter unit have the same structural form as the first common mode filter unit, and only the capacitance values of part of the capacitors are selected differently, which is not described herein again.

In this embodiment, the common mode chokes from left to right in fig. 5 are all wound by ferrite beads with an outer diameter of 40mm, an inner diameter of 30mm and a height of 15mm, and the coils are formed by two copper wires respectively wound around the ferrite beads 30, 25 and 20. The capacitor C1, the capacitor C3, the capacitor C4 and the capacitor C6 are capacitors with capacitance values of 1.5 muF, and the capacitor C2 and the capacitor C5 are capacitors with capacitance values of 0.2 muF.

In order to Check the integrity of data received by the processor, the processor needs to compare a Cyclic Redundancy Check (CRC) Check code calculated by the metering chip read from the metering chip with a CRC Check code recalculated by the processor itself to determine whether the data in the metering chip is valid, i.e., complete. As shown in fig. 6, the metering chip needs to calculate a 16-bit cyclic redundancy check value (i.e., a CRC check code) of data output by the host from the slave input interface MOSI, and then store the calculated CRC value in the CRC _ SPI register, so that the processor can obtain the CRC check code calculated by the metering chip by reading the CRC _ SPI register of the metering chip. The method comprises the steps of designing an interface function in a processor, firstly reading data collected by a metering chip and stored in each corresponding register, recalculating to obtain a CRC check code of the data by using a CRC-16CCITT algorithm, then reading the CRC check code calculated by the metering chip from a CRC _ SPI register of the metering chip, comparing the two, if the two are consistent, indicating that the data is valid, returning to an effective value of 0, and otherwise, returning to an invalid value of-1.

In addition, a configuration locking characteristic is specially added to a configuration register of the metering chip, so that the configuration register is a configuration register with a configuration locking function and is used for preventing the configuration of the metering chip from being maliciously changed. To enable this feature, the value 0x3C64 is written to the WR _ LOCK register with 0x4BF as the metering chip address, and to return the valid value 0, the value 0x4AD1 is written to disable this feature. After the configuration locking characteristic is enabled, if the intelligent distribution and transformation terminal is always in an operating state, the configuration locking characteristic is kept in an enabled state, but after the intelligent distribution and transformation terminal is restarted after power failure, the configuration locking characteristic is automatically recovered to a disabled state, in order to automatically enable the configuration locking characteristic after a metering chip is initialized, as shown in fig. 7, another interface function is designed in a processor, a configuration unlocking command is added firstly, so that the processor can update the content in a configuration register when the metering chip is controlled to be initialized, and after the metering chip is initialized, a command for enabling the metering chip to be configured and locked is added, so that the processor can be prevented from being interfered when data communication is carried out with the metering chip through an SPI communication line.

In the above embodiment, the rc filter is disposed on the SPI communication line between the SPI interface of the metering chip and the SPI interface of the processor, and as another embodiment, the rc filter may be disposed at the SPI interface of the metering chip, the SPI interface of the processor, or integrally disposed inside the metering chip.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于测氚电离室的大动态范围电流转换电路及方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!