CN-121996438-A - Management and communication method suitable for electric energy meter metering chip
Abstract
The invention provides a management and communication method suitable for electric energy meter metering chips, wherein a state machine is configured corresponding to each real metering chip, and the communication state of the corresponding real metering chip is managed; the communication method comprises an asynchronous non-blocking communication mechanism based on an asynchronous virtual metering chip and a multichannel synchronous communication mechanism based on a synchronous virtual metering chip, wherein the asynchronous virtual metering chip is deployed in one-to-one correspondence with each real metering chip and is used for proxy access requests of all service modules to the real metering chip, the synchronous virtual metering chip is used for proxy access to service requests of a plurality of real metering chips at the same time and coordinates communication starting time of each channel to realize time alignment of data acquisition, the method remarkably improves the utilization rate of communication resources in a multi-service scene, reduces communication conflict and time delay, ensures stability and high efficiency of multi-chip cooperative work, and provides reliable technical support for complex metering scenes.
Inventors
- HE ZONGKUI
- LIU YINHU
- LI YUANYUAN
- MIAO YANGYANG
- LI YIMIN
- Tao Liangshuai
Assignees
- 江苏林洋能源股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251225
Claims (10)
- 1. The management and communication method suitable for the electric energy meter metering chips is characterized in that a state machine is configured corresponding to each real metering chip to manage the communication state of the corresponding real metering chip; The asynchronous virtual metering chips are deployed in one-to-one correspondence with each real metering chip and are used for proxy access requests of all service modules to the real metering chips; The synchronous virtual metering chip is used for proxy to access the service requests of a plurality of real metering chips at the same time and coordinating the communication starting time of each channel so as to realize the time alignment of data acquisition.
- 2. The method for managing and communicating a metering chip for an electric energy meter according to claim 1, wherein, Aiming at an asynchronous virtual metering chip, when a task needs to access a real metering chip, sending a communication request to the asynchronous virtual metering chip, wherein the asynchronous virtual metering chip inserts the communication request into an asynchronous communication request ring; Extracting a communication request from an asynchronous communication request ring by adopting an asynchronous scheduler, generating communication frame data according to parameters of the communication request and a metering chip protocol, and providing the communication frame data to a state machine, wherein the communication frame data comprises a transmission frame, a transmission length and a receiving length; after the scheduler sends the first byte of the communication frame data, it is managed by the state machine.
- 3. The method for managing and communicating the metering chip of the electric energy meter according to claim 2, wherein the asynchronous communication request ring is a ring-shaped data structure, can sequentially store a plurality of communication requests, and circularly uses a preset RAM space; When a communication request is inserted into an asynchronous communication request ring, if a low-priority task is being inserted, a high-priority task passes through mutual exclusion protection, and access can be performed after the low-priority task is inserted; the asynchronous communication request ring provides an occupation function, and for tasks needing to guarantee the execution sequence, the asynchronous communication request ring prevents other tasks from accessing, at the moment, the tasks independently share an asynchronous virtual metering chip, and the access to the asynchronous virtual metering chip is equivalent to the direct access to a real metering chip.
- 4. The method for managing and communicating the metering chip of the electric energy meter according to claim 1, wherein the state machine comprises five types of communication idle, transmitting, receiving, communication error and serial port reset; The state machine is initially in a communication idle state; after the asynchronous scheduler sends the first byte, the state machine is switched to the sending state; After the transmission is completed, the state machine is switched to the receiving state; in the receiving process, if the number of the received bytes reaches the length designated by the request, checking is carried out according to the metering chip protocol, if the checking is passed, the received data is filled into the task container to restore the communication idle state, and if the checking is failed or the flow break occurs in the receiving process, the state machine is switched into the communication error state.
- 5. The method for managing and communicating a metering chip for an electric energy meter according to claim 4, wherein, In a communication error state, the state machine checks whether the communication request is configured with retry times; if the residual retry times exist, after a period of preset serial port silence time is passed, the state machine is restored to an idle state, and the communication request is re-extracted and retransmitted in the next period by the asynchronous scheduler; If the number of the retries is not remained, the state machine is switched into a serial port reset state, and after the intervention processing of the task to be managed is abnormal, the state machine is put back into an idle state.
- 6. The method for managing and communicating a metering chip for an electric energy meter according to claim 1, wherein, For the synchronous virtual metering chip, when a task needs to acquire data of a plurality of metering chips at the same time, a synchronous communication request is sent to the synchronous virtual metering chip, and the synchronous virtual metering chip inserts the communication request of each real metering chip into a corresponding synchronous communication request ring; and checking a synchronous communication request ring by adopting a synchronous scheduler, stopping new request scheduling of all asynchronous schedulers if synchronous requests exist, indicating that the corresponding real metering chip channel is idle after the ongoing communication is finished, extracting the synchronous requests to generate a communication frame at the moment, sequentially starting communication of each channel, and then managing by a state machine.
- 7. The method for managing and communicating with meter chips of electric energy meter of claim 6, wherein said synchronous request ring is a ring group structure corresponding to a plurality of real meter chips, and a plurality of symmetrical communication request rings of a single real meter chip are arranged inside; When a task accesses the synchronous virtual metering chip, the communication requests containing the real metering chips are combined and inserted into a synchronous request ring together.
- 8. The method for managing and communicating with a meter chip for electric energy meter according to claim 6, wherein the synchronization scheduler is used to periodically check whether the synchronization request ring has a synchronization communication request, If so, stopping the new request scheduling of all asynchronous schedulers, and checking whether the state machine of each corresponding real metering chip is in an idle state; After all the state machines are idle, the synchronous scheduler extracts synchronous requests from the synchronous request ring, generates all the communication frames according to synchronous request parameters, shortens the starting interval of all the channels and sequentially transmits the first byte, and then the state machines manage all the channel communication.
- 9. A management and communication system for a metering chip of an electric energy meter, applied to the method of any one of claims 1 to 8, comprising: The state machine module is configured corresponding to each real metering chip and is used for managing the communication state of the corresponding real metering chip; the asynchronous communication module is used for realizing an asynchronous non-blocking communication mechanism based on an asynchronous virtual metering chip, wherein the asynchronous virtual metering chip is deployed in one-to-one correspondence with each real metering chip and is used for acting the access requests of all service modules to the corresponding real metering chips; the synchronous communication module is used for realizing a multichannel synchronous communication mechanism based on a synchronous virtual metering chip, wherein the synchronous virtual metering chip is used for proxy service requests which need to access a plurality of real metering chips at the same time, and coordinating communication starting time of each channel so as to realize time alignment of data acquisition of the plurality of real metering chips.
- 10. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method for managing and communicating applicable to a power meter metering chip according to any of claims 1-8.
Description
Management and communication method suitable for electric energy meter metering chip Technical Field The invention relates to the field of intelligent electric meters, in particular to a management and communication method suitable for an electric energy meter measuring chip. Background With the continuous evolution of the technology of intelligent electric meters, the functional requirements of users on the electric meters are increasingly improved. Especially, under the background that the electric energy quality monitoring demands such as harmonic waves and inter-harmonic waves are continuously increased, higher requirements are put on the communication speed and the data interaction content of the metering chip. However, the low-cost metering chip widely adopted at present usually only supports low-speed UART communication, and if advanced functions such as harmonic analysis are realized on such chip, the conventional in-situ waiting UART communication processing mode is difficult to be suitable, and the system overall response and processing efficiency are seriously affected because the low-cost metering chip occupies CPU resources for a long time. In a composite scheme (such as a three-manganese-copper scheme electric energy meter) adopting a plurality of single-phase low-cost metering chips, a system needs to access each metering chip at a higher frequency to acquire instantaneous power data so as to complete power integration operation, and meanwhile, synchronous acquisition of multi-chip data needs to be realized so as to ensure the consistency of each phase of data in time. In addition, complex communication tasks such as raw waveform transmission also place demands on the system for greater real-time and concurrent processing capabilities. On the other hand, although advanced metering chips such as a metering SOC (system on chip) can provide more abundant functions and support complex services such as harmonic analysis, original waveform output, power quality monitoring and the like, a communication channel between the advanced metering chips and an external system is always still a single interface. When a certain business task continuously occupies the communication interface to perform data interaction with the metering chip, other businesses are forced to be in a waiting state, so that the whole resource utilization rate of the system and the task parallel processing capacity are limited. Therefore, a novel metering chip communication management method is needed, which can effectively improve the communication throughput capacity, ensure the concurrent execution of multiple tasks and realize the synchronous acquisition and processing of data among multiple chips on the premise of not increasing the hardware cost. Disclosure of Invention The invention provides a management and communication method suitable for a metering chip of an electric energy meter, aiming at a series of technical problems caused by the fact that the low-cost metering chip adopted in the existing electric energy meter only supports a low-speed UART communication interface. The method realizes non-blocking scheduling, multi-task concurrency support and multi-channel quasi-synchronous communication control of the real metering chip communication process by constructing the architecture of the asynchronous virtual metering chip and the synchronous virtual metering chip. The technical scheme of the invention is as follows: in a first aspect, the invention provides a management and communication method suitable for electric energy meter metering chips, wherein a state machine is configured corresponding to each real metering chip to manage the communication state of the corresponding real metering chip; The asynchronous virtual metering chips are deployed in one-to-one correspondence with each real metering chip and are used for proxy access requests of all service modules to the real metering chips; The synchronous virtual metering chip is used for proxy to access the service requests of a plurality of real metering chips at the same time and coordinating the communication starting time of each channel so as to realize the time alignment of data acquisition. Further, aiming at the asynchronous virtual metering chip, when a task needs to access the real metering chip, a communication request is sent to the asynchronous virtual metering chip, and the asynchronous virtual metering chip inserts the communication request into an asynchronous communication request ring; Extracting a communication request from an asynchronous communication request ring by adopting an asynchronous scheduler, generating communication frame data according to parameters of the communication request and a metering chip protocol, and providing the communication frame data to a state machine, wherein the communication frame data comprises a transmission frame, a transmission length and a receiving length; after the scheduler sends the first byte of the com