CN112486886B - Method for stable communication between double cores of double-core intelligent electric energy meter - Google Patents

Method for stable communication between double cores of double-core intelligent electric energy meter Download PDF

Info

Publication number
CN112486886B
CN112486886B CN202011426810.5A CN202011426810A CN112486886B CN 112486886 B CN112486886 B CN 112486886B CN 202011426810 A CN202011426810 A CN 202011426810A CN 112486886 B CN112486886 B CN 112486886B
Authority
CN
China
Prior art keywords
core
management
communication
metering
management core
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011426810.5A
Other languages
Chinese (zh)
Other versions
CN112486886A (en
Inventor
汪佳
丁熠辉
吴蒙
徐严军
谢智
王竣平
薛莉思
李洵
陈维民
白佳灵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Marketing Service Center Of State Grid Sichuan Electric Power Co
Original Assignee
Electric Power Research Institute of State Grid Sichuan Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Electric Power Research Institute of State Grid Sichuan Electric Power Co Ltd filed Critical Electric Power Research Institute of State Grid Sichuan Electric Power Co Ltd
Priority to CN202011426810.5A priority Critical patent/CN112486886B/en
Publication of CN112486886A publication Critical patent/CN112486886A/en
Application granted granted Critical
Publication of CN112486886B publication Critical patent/CN112486886B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Abstract

The invention discloses a method for stable communication between double cores of a double-core intelligent electric energy meter, which is characterized in that based on interaction between a management core and a metering core, on a physical layer, the management core and the metering core adopt an SPI communication mode, and on a protocol layer, a communication protocol conforming to DL/T698.45 protocol specification is uniformly adopted between the management core and the metering core; the dual-core communication interaction mode comprises a management core program mode and a metering core program mode; the three communication modes of the management core can ensure that command frames which must be issued by the management core can be issued certainly, meanwhile, aiming at the condition that response command frames possibly exist in the metering core have longer time consumption, a queue sending mode can give out tasks in time, and a metering core reading and immediate reply mechanism can ensure the real-time performance of communication; after the setting command received by the metering core each time is ensured, the response frame is returned only after the actual setting is finished, the phenomena of 'false frame' and 'empty frame' are avoided, and the reliability of communication is ensured.

Description

Method for stable communication between double cores of double-core intelligent electric energy meter
Technical Field
The invention relates to the field of double-core intelligent electric energy meters, in particular to a method for stable communication between double cores of a double-core intelligent electric energy meter.
Background
The IR46 standard, as a mandatory technical regulation promulgated by the metering organization of international legal title, must be adopted and implemented by all members of the metering organization of international legal title, including our country. The IR46 double-core intelligent electric energy meter is divided into two functional modules: the management module and the base table sequentially correspond to a management core and a metering core on the hardware design. In field application, once the twin-core electric meter is connected to the network, the management core supports the software updating function, local updating or remote updating can be carried out through an acquisition network, but the program of the metering core does not allow upgrading. In practical application, after the supervisor core program is upgraded, the situation that the supervisor core programs of different versions and the metering core programs of different versions are combined with each other exists in the field. If a stable and reliable communication scheme is not provided between the two cores, the problems of frame collision, frame error, response dislocation, unstable communication and the like can be caused during the two-core communication due to slow response of the metering core, overlong waiting response time of the management core and the like, so that the stable work of the two-core electric energy meter system is influenced.
Disclosure of Invention
The invention aims to solve the technical problems that after a management core program is upgraded, the situation that management core programs of different versions and metering core programs of different versions are combined with each other exists on site, so that the response of a metering core is slow, and the waiting response time of the management core is too long.
The invention is realized by the following technical scheme:
a method for stable communication between double cores of a double-core intelligent electric energy meter is based on interaction between a management core and a metering core, and is characterized by comprising the following steps: physical layer configuration: on a physical layer, an SPI communication mode is adopted between the management core and the metering core, wherein the management core is an SPI host computer, the metering core is an SPI slave computer, and the time sequence configuration between the SPI host computer and the SPI slave computer is the same; protocol layer protocol: on a protocol layer, a communication protocol conforming to DL/T698.45 protocol specification is uniformly adopted between the management core and the metering core; two-core communication interaction mode: the dual-core communication interaction mode comprises a management core program mode and a metering core program mode; the management core controls the establishment and the release of a communication link, a dual-core communication mutual exclusion flag SPIColFlag is set in a management core program, when the SPIColFlag is 0, the management core program is indicated to carry out a dual-core communication task, and when the SPIColFlag is 1, the management core program is indicated to be in a dual-core communication idle state; the metering core program responds to each command issued by the management core; after the management core issues the command frame, the metering core returns a corresponding response frame; wherein the supervisor core program mode comprises: a waiting reply mode, an idle time sending mode and a queue sending mode; the metering core program mode comprises: reading an immediate reply mode and a set completion reply mode;
the method comprises the following steps that a physical layer configuration, a protocol layer protocol and a communication interaction mode are unified, so that the requirement that a management core program can still stably interact with an existing metering core program after being upgraded on site is met; the three communication modes of the management core can ensure that command frames which must be issued by the management core can be issued, and meanwhile, aiming at the condition that the response command frame possibly existing in the metering core takes longer time, the queue sending mode can give out tasks in time, thereby preventing the condition of program blockage of the management core and improving the robustness of the program and the robustness of the system; the metering core reading and immediate reply mechanism can ensure the real-time performance of communication; the reply mechanism after the setting of the metering core can ensure that the metering core returns a response frame after the actual setting is finished after the setting command is received every time, thereby avoiding the phenomena of 'false frame' and 'empty frame' and ensuring the reliability of communication.
Furthermore, the management core waiting reply mode is suitable for the situation of waiting for the reply of the metering core in real time, such as reading key data of system operation, waiting for receiving a setting result and the like; after the management core issues the command frame, the management core waits in a double-core communication task until the metering core receives an effective data frame; after the management core enters a waiting reply mode, the management core firstly judges whether a communication task exists at present, namely whether SPIColFlag is 0 or not, if the last communication task does not end, the management core actively sends inquiry bytes continuously through an SPI (serial peripheral interface) interface to wait for the response of the metering core until the management core receives a complete metering core response frame, processes the last communication task, and then calls a sending function to send a command frame to the metering core; otherwise, after entering a waiting reply mode, detecting that SPIColFlag =1, namely that the management core program is in a dual-core communication idle state, directly calling a sending function by the management core to send a command frame to the metering core; the management core issues the current command frame to the metering core and then continuously sends inquiry bytes until the management core receives a frame of metering core response data after receiving the response frame header 68H, the management core processes the current communication task and sets the SPIColFlag to 1, and one-time effective dual-core communication is completed.
Further, the management core idle sending mode is suitable for unnecessary command frames which need to be frequently called, such as frequently reading real-time voltage, current and the like; when the management core program needs to read the current real-time voltage and current, if SPIColFlag =0, namely the current program is carrying out a double-core communication task, directly giving up the double-core communication request; if the SPIColFlag =1, the management core directly issues the reading current command frame to the metering core, then sets the SPIColFlag to 0, the command issuing is finished, and the receiving and the releasing of the data frame are processed in the management core circulation task.
Further, the management core queue sending mode is suitable for the communication situation that the management core sends a command frame and the metering core has long processing time, and the CPU of the management core can be idle by adopting the queue sending mode, so that the phenomenon that the program waiting time is too long, such as the RTC of the metering core is set through the management core, is avoided; after the management core program enters a queue sending mode, if a dual-core communication task of the management core is idle, namely SPIColFlag =1, the management core directly calls a sending function, the management core sends the command frame to the metering core, then sets the SPIColFlag to 0, and exits the queue sending mode; when the command is issued, the receiving and the receiving of the data frame are processed in a management core circulating task; otherwise, after the supervisor core program enters a queue sending mode, if SPIColFlag =0, that is, the current program is performing a dual-core communication task, the current command frame needs to be stored in a sending queue array; the specific process comprises the following steps: the management core program firstly judges whether the queue is over-long, if the queue is over-long, the management core clears the content stored at the first bit of the queue, the content of the queue is moved forward by one bit in sequence, then the management core stores the data frame to be sent to the end of the queue, then the length of the queue is increased by 1, the queue sending mode is exited, and the process is ended; if the management core program judges that the queue is not over long, the management core directly stores the data frame to be sent to the end of the queue, then adds 1 to the length of the queue and quits the queue sending mode; the flow is finished; after the management core exits the queue sending mode, the CPU executes other tasks, and the real command frame in the queue is sent and executed in the circular detection task.
The management core dual-core communication cycle detection task is placed in a management core program main cycle and needs to be matched with a management core idle sending mode and a management core queue sending mode for use; after entering a circular detection task, continuously polling a communication mutual exclusion flag SPIColFlag by a management core, and if the SPIColFlag =0, namely a current management core program is carrying out a double-core communication task, sending a polling byte by the management core program for judging whether a metering core is ready to respond data or not; if the frame header 68H is received, the management core program continues to enter a frame receiving flow, processes the last communication task of the management core, and then enters a queue polling flow; if the management core does not receive the 68H frame header, directly entering a queue polling process; judging the queue length SPIQueueLen in the queue polling process, if the queue length SPIQueueLen is 0, directly ending the double-core communication cycle detection task by the management core program, and releasing a CPU to execute other tasks; if the queue length SPIQueueLen is not 0 and the management core program is in a dual-core communication idle state, namely spiolflag =1, the management core program firstly takes out the data frame at the forefront in the queue and sends the data frame to the metering core, then the management core program sequentially moves the queue content forward by one bit, meanwhile, the queue length SPIQueueLen is reduced by 1, the management core program sets the spiolflag to 0, and the dual-core communication cycle detection task is ended.
Further, the copy-reading immediate reply mode is as follows: when the measuring core updates data (voltage, current, demand and the like) which need to be read frequently into the memory in time, and when the measuring core receives a command sent by the management core and is of a data reading type, the measuring core immediately reads a corresponding variable value in the memory to form a response frame and returns the response frame to the management core.
Further, the set-up completion reply mode is: when the metering core receives the command sent by the management core and is of the set data type, the metering core correspondingly sets the value of a target object (such as a memory, a memorizer, an RTC and the like), and after the setting is finished, the metering core takes the setting result to form a response frame and returns the response frame to the management core.
Furthermore, an overtime exit mechanism is arranged in the management core program and the metering core program; in the communication task, when either one of the management core program and the metering core program detects the communication overtime, the current communication task can be forcibly ended.
Compared with the prior art, the invention has the following advantages and beneficial effects:
the invention discloses a method for stable communication between double cores of a double-core intelligent electric energy meter, which unifies physical layer configuration, protocol layer protocol and communication interaction mode, and can still perform stable interaction with the existing metering core program after a management core program is upgraded on site.
The three communication modes of the management core can ensure that command frames which must be issued by the management core can be issued, and meanwhile, aiming at the condition that the response command frame possibly existing in the metering core takes longer time, the queue sending mode can give out tasks in time, thereby preventing the condition of program blockage of the management core and improving the robustness of the program and the robustness of the system;
the metering core reading and immediate reply mechanism can ensure the real-time performance of communication; the reply mechanism after the setting of the metering core can ensure that the metering core returns a response frame after the actual setting is finished after the setting command is received every time, thereby avoiding the phenomena of 'false frame' and 'empty frame' and ensuring the reliability of communication.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
fig. 1 is a management core wait for reply mode flow diagram.
Fig. 2 is a flow chart of a management core queue send mode.
Fig. 3 is a management core two-core communication cycle detection flow diagram.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to examples and the accompanying drawings, and the exemplary embodiments and descriptions thereof are only used for explaining the present invention and are not used as limiting the present invention.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one of ordinary skill in the art that: it is not necessary to employ these specific details to practice the present invention. In other instances, well-known structures, circuits, materials, or methods have not been described in detail so as not to obscure the present invention.
Throughout the specification, reference to "one embodiment," "an embodiment," "one example," or "an example" means: the particular features, structures, or characteristics described in connection with the embodiment or example are included in at least one embodiment of the invention. Thus, the appearances of the phrases "one embodiment," "an embodiment," "one example" or "an example" in various places throughout this specification are not necessarily all referring to the same embodiment or example. Furthermore, the particular features, structures, or characteristics may be combined in any suitable combination and/or sub-combination in one or more embodiments or examples. Further, those of ordinary skill in the art will appreciate that the illustrations provided herein are for illustrative purposes and are not necessarily drawn to scale. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
In the description of the present invention, it is to be understood that the terms "front", "rear", "left", "right", "upper", "lower", "vertical", "horizontal", "high", "low", "inner", "outer", etc. indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of description and simplicity of description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and therefore, are not to be construed as limiting the scope of the present invention.
Examples
As shown in fig. 1, the method for stable communication between two cores of a dual-core intelligent electric energy meter of the present invention can ensure the independence of programs between a metering core and a management core module, and can also ensure the stable and reliable operation of a dual-core electric energy meter system.
On a physical layer, an SPI communication mode is adopted between a management core and a metering core, wherein the management core is an SPI host, the metering core is an SPI slave, and time sequence configuration between the master device and the slave device is consistent.
On the protocol layer, a unified communication protocol which accords with DL/T698.45 protocol specifications is adopted between the management core and the metering core.
The dual-core communication guaranteeing method comprises a management core program and a metering core program.
The management core controls the establishment and the release of the communication link, and the metering core program must respond to each command issued by the management core. After the management core issues the command frame, the metering core returns the corresponding response frame, and the two links form an effective double-core communication process.
The supervisor core programs three communication modes: a waiting reply mode, an idle time transmission mode and a queue transmission mode.
Waiting for a reply mode: after the management core issues the command frame, the management core actively and continuously sends the inquiry byte through the SPI interface to wait for the response of the metering core until the management core receives a complete metering core response frame, and one-time effective dual-core communication is completed. This mode is suitable for situations where it is necessary to wait in real time for the metrology core to recover.
Idle transmission mode: and the management core program detects that the communication between the two cores is carried out currently, the communication task is abandoned, and otherwise, the management core starts the communication between the two cores once. This mode is suitable for situations where frequent communication is required and where occasional communication failures do not affect the normal operation of the system.
Queue sending mode: when the management core program detects that the double-core communication is currently carried out, the command frame to be issued to the metering core at this time is stored in a sending queue, the management core program continues to execute other tasks, program blockage is avoided, after the last double-core communication task is completed, the command frame is taken from the queue and issued to the metering core, and one time of effective double-core communication is completed. This mode is suitable for communication situations where the metering core has to transmit and the processing time is long.
The metering core program designs two response mechanisms: and the reading is immediately replied, and the setting is finished, and the reading data command and the setting data command are sent by the corresponding management core.
Reading by a metering core and immediately replying: the metering core timely updates the data which needs to be read frequently into the memory, and when the management core reads the data type, the metering core immediately takes the corresponding variable value in the memory to form a response frame and then reports the response frame to the management core.
And (5) returning after the metering core is arranged: when the command received by the metering core is the type of the set data, the corresponding value of the target object is set, and after the setting is finished, the set result is taken to form a response frame which is returned to the management core, so that the phenomenon of response dislocation is prevented.
An overtime exit mechanism is added in the management core program and the metering core program, and when any party detects communication overtime in a communication task, the communication task can be forcibly ended, so that the program is prevented from flying away.
In summary, the method has the advantages that:
the configuration of a physical layer, a protocol layer protocol and a communication interaction mode are unified, so that the requirement that the management core program can still stably interact with the existing metering core program after the field upgrading is met.
The three communication modes of the management core can ensure that command frames which must be issued by the management core can be issued certainly, and meanwhile, aiming at the condition that the response command frame possibly existing in the metering core consumes a long time, the queue sending mode can give out tasks in time, so that the condition of program blockage of the management core is prevented, and the robustness of the program and the robustness of the system are improved;
the metering core reading and immediate reply mechanism can ensure the real-time performance of communication; the reply mechanism after the metering core is set can ensure that the metering core returns a response frame after the actual setting is finished after the setting command received each time, thereby avoiding the phenomena of 'false frame' and 'empty frame' and ensuring the reliability of communication.
The establishment and the release of the SPI communication link between the two cores are controlled by the management core, a two-core communication exclusive mark SPIColFlag is arranged in the management core program, when the SPIColFlag is 0, the management core program is indicated to be in a two-core communication task, and when the SPIColFlag is 1, the management core program is indicated to be in a two-core communication idle state.
The management core waiting reply mode is suitable for the situation that the measurement core has to wait for reply in real time, such as reading the running key data of the system, waiting for receiving the setting result and the like. After the management core issues the command frame, the management core can wait in the dual-core communication task until the effective data frame is received. As shown in fig. 1, after entering the waiting reply mode, it is first determined whether there is a communication task at present, that is, it is determined whether SPIColFlag is 0, if there is a last communication task that has not ended, the management core actively sends query bytes through the SPI interface continuously, waits for a response of the metering core until the management core receives a complete metering core response frame, processes the last communication task, and then calls a sending function to send the current command frame to the metering core. Otherwise, after entering the reply waiting mode, detecting that SPIColFlag =1, that is, the management core program is in the dual-core communication idle state, the management core directly calls the sending function to send the command frame to the metering core. And after the management core issues the command frame of this time to the metering core, continuously sending inquiry bytes until a response frame header (68H) is received, receiving a frame of metering core response data, processing the communication task of this time, setting the SPIColFlag to 1, and completing one effective double-core communication.
The management core idle transmission mode is suitable for unnecessary command frames which need to be called frequently, such as frequently reading real-time voltage, current and the like. Taking reading the current as an example, when the management core program needs to read the current, if SPIColFlag =0, that is, the current program is performing a dual-core communication task, directly giving up the dual-core communication request; otherwise, if the SPIColFlag =1, the management core directly issues the reading current command frame to the metering core, then sets the SPIColFlag to 0, the command issuing is finished, and the receiving and releasing of the data frame are processed in the management core circulation task.
The management core queue sending mode is suitable for communication situations which need to be sent and have long processing time of the metering core, and the CPU of the management core can be released in time by adopting the queue sending mode, so that the problem that the program waiting time is too long, such as the RTC of the metering core arranged by the management core, is avoided. As shown in fig. 2, after the supervisor core program enters the queue sending mode, if the supervisor core dual-core communication task is idle, i.e. spiolflag =1, the supervisor core directly calls the sending function, issues the command frame this time to the metering core, then sets spiolflag to 0, exits from the queue sending mode, the command issuing this time is finished, and the receiving and sending of the data frame this time are processed in the supervisor core circular task. On the contrary, after entering the queue sending mode, if SPIColFlag =0, that is, the current program is performing a dual-core communication task, the current command frame needs to be stored in the sending queue array, and the specific flow is as follows: the program firstly judges whether the queue is over-long, if the queue is over-long, the content stored at the first bit of the queue is removed, the content of the queue is sequentially moved forward by one bit, then the data frame to be sent is stored at the last of the queue, then the length of the queue is added by 1, and the queue sending mode is exited; if the queue is not too long, the data frame to be sent is directly stored to the end of the queue, then the queue length is added by 1, and the queue sending mode is quitted. After exiting the queue sending mode, the CPU executes another task, and the real distribution of the command frames in the queue is executed in the circular detection task.
The management core dual-core communication cycle detection task is placed in a program main cycle and needs to be matched with an idle sending mode and a queue sending mode. As shown in fig. 3, entering a loop detection task, continuously polling a communication mutual exclusion flag SPIColFlag, if SPIColFlag =0, that is, the current program is performing a two-core communication task, sending a query byte by the management core program to determine whether the metering core is ready to respond to data, if a frame header (68H) is received, continuing entering a frame receiving process, processing the last communication task, and then entering a queue polling process; and if the 68H frame header is not received, directly entering a queue polling process. Judging the queue length SPIQueueLen in the queue polling process, if the queue length SPIQueueLen is 0, directly ending the double-core communication cycle detection task, and releasing a CPU to execute other tasks; if the queue length SPIQueueLen is not 0 and the management core program is in a dual-core communication idle state, namely SPIColFlag =1, firstly taking out the data frame at the forefront end of the queue and sending the data frame to the metering core, then sequentially moving the queue content forward by one bit, simultaneously subtracting 1 from the queue length SPIQueueLen, setting SPIColFlag to be 0, and ending the dual-core communication cycle detection task.
The metering core programs two response mechanisms: reading and immediate replying, and replying after setting.
Reading and immediate replying: the metering core updates data (voltage, current, demand and the like) which need to be read frequently into the memory in time, and when the command received by the metering core is of a data reading type, the corresponding variable value in the memory is immediately taken to form a response frame which is returned to the management core;
and (5) after setting, replying: when the command received by the metering core is a set data type, the corresponding value of a target object (such as a memory, a storage, an RTC and the like) is set, and after the setting is finished, a setting result is taken to form a response frame which is returned to the management core.
In order to prevent the situation that one of the base table or the management module is in failure, the other party is blocked in the communication program, and a timeout exit mechanism is added in the management core program and the metering core program. In the communication task, when any party detects the communication overtime, the communication task can be forcibly ended, and the phenomenon of program blocking or running away is prevented.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are merely exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (8)

1. A method for stable communication between double cores of a double-core intelligent electric energy meter is based on interaction between a management core and a metering core, and is characterized by comprising the following steps:
physical layer configuration: on a physical layer, an SPI communication mode is adopted between the management core and the metering core, wherein the management core is an SPI host computer, the metering core is an SPI slave computer, and the time sequence configuration between the SPI host computer and the SPI slave computer is the same;
protocol layer protocol: on a protocol layer, a communication protocol conforming to DL/T698.45 protocol specification is uniformly adopted between the management core and the metering core;
two-core communication interaction mode: the dual-core communication interaction mode comprises a management core program mode and a metering core program mode; the management core controls the establishment and the release of a communication link, a dual-core communication mutual exclusion mark SPIColFlag is arranged in a management core program, when the SPIColFlag is 0, the management core program is indicated to carry out a dual-core communication task, and when the SPIColFlag is 1, the management core program is indicated to be in a dual-core communication idle state; the metering core program responds to each command issued by the management core; after the management core issues the command frame, the metering core returns a corresponding response frame;
wherein the supervisor core program mode comprises: a waiting reply mode, an idle time sending mode and a queue sending mode; the metering core program mode comprises: reading an immediate reply mode and setting a complete reply mode.
2. The method according to claim 1, wherein the management core waiting reply mode is suitable for a situation of waiting for the reply of the metering core in real time, and after the management core issues a command frame, the management core waits in the twin-core communication task until the metering core receives a valid data frame; after the management core enters a waiting reply mode, the management core firstly judges whether a communication task exists at present, namely whether SPIColFlag is 0 or not, if the last communication task does not end, the management core actively sends inquiry bytes continuously through an SPI (serial peripheral interface) interface to wait for the response of the metering core until the management core receives a complete metering core response frame, processes the last communication task, and then calls a sending function to send a command frame to the metering core; otherwise, detecting SPIColFlag =1 after entering a waiting reply mode, namely that the management core program is in a dual-core communication idle state, directly calling a sending function by the management core to send the command frame to the metering core; the management core issues the current command frame to the metering core and then continuously sends inquiry bytes until the management core receives a frame of metering core response data after receiving the response frame header 68H, the management core processes the current communication task and sets the SPIColFlag to 1, and one-time effective dual-core communication is completed.
3. The method for stable communication between two cores of a dual-core intelligent electric energy meter according to claim 1, wherein the management core idle transmission mode is suitable for non-essential command frames which need to be frequently called, when the management core program needs to read the current real-time voltage and current, if SPIColFlag =0, that is, the current program is performing a dual-core communication task, the dual-core communication request is directly abandoned; if the SPIColFlag =1, the management core directly issues the reading current command frame to the metering core, then sets the SPIColFlag to 0, the command issuing is finished, and the receiving and the releasing of the data frame are processed in the management core circulation task.
4. The method for stable communication between two cores of a dual-core intelligent electric energy meter according to claim 1, characterized in that the management core queue sending mode is suitable for the communication situation that the management core sends a command frame and the metering core has a long processing time, the CPU of the management core can be idle by adopting the queue sending mode, after the management core program enters the queue sending mode, if the management core dual-core communication task is idle, i.e. spiolflag =1, the management core directly calls the sending function, the management core sends the command frame to the metering core, and then sets spiolflag to 0, and exits the queue sending mode; otherwise, after the supervisor core program enters a queue sending mode, if SPIColFlag =0, that is, the current program is performing a dual-core communication task, the current command frame needs to be stored in a sending queue array; wherein, the specific flow is as follows: the management core program firstly judges whether the queue is over-long, if the queue is over-long, the management core clears the first stored content of the queue, the queue content is moved forward one bit in sequence, then the management core stores the data frame to be sent to the end of the queue, then the queue length is increased by 1, the queue sending mode is exited, and the process is ended; if the management core program judges that the queue is not over long, the management core directly stores the data frame to be sent to the end of the queue, then adds 1 to the length of the queue and quits the queue sending mode; the flow ends.
5. The method for stable communication between the two cores of the two-core intelligent electric energy meter according to claim 1, further comprising a management core two-core communication cycle detection mode, wherein the management core two-core communication cycle detection task is placed in a management core program main cycle and is required to be used in cooperation with a management core idle sending mode and a management core queue sending mode; after entering a circular detection task, continuously polling a communication mutual exclusion flag SPIColFlag by a management core, and if the SPIColFlag =0, namely a current management core program is carrying out a double-core communication task, sending a polling byte by the management core program for judging whether a metering core is ready to respond data or not; if the frame header 68H is received, the management core program continues to enter a frame receiving flow, processes the last communication task of the management core, and then enters a queue polling flow; if the management core does not receive the 68H frame header, directly entering a queue polling process; judging the queue length SPIQueueLen in the queue polling process, and if the queue length SPIQueueLen is 0, directly ending the double-core communication cycle detection task by the management core program; if the queue length SPIQueueLen is not 0 and the management core program is in a dual-core communication idle state, namely spiolflag =1, the management core program firstly takes out the data frame at the forefront in the queue and sends the data frame to the metering core, then the management core program sequentially moves the queue content forward by one bit, meanwhile, the queue length SPIQueueLen is reduced by 1, the management core program sets the spiolflag to 0, and the dual-core communication cycle detection task is ended.
6. The method for stable communication between two cores of a two-core intelligent electric energy meter according to claim 1, wherein the reading immediate reply mode is as follows: when the metering core updates the data which needs to be read frequently into the memory, and when the metering core receives the reading data type of the command sent by the management core, the metering core immediately reads the corresponding variable value in the memory to form a response frame which is returned to the management core.
7. The method for stable communication between two cores of a two-core intelligent electric energy meter according to claim 1, wherein the set-up reply mode is: when the metering core receives the command sent by the management core and is of the set data type, the metering core correspondingly sets the value of the target object, and after the setting is finished, the metering core takes the setting result to form a response frame to be returned to the management core.
8. The method for stable communication between the double cores of the double-core intelligent electric energy meter according to claim 1, wherein a timeout exit mechanism is arranged in the management core program and the metering core program; in the communication task, when either one of the management core program and the metering core program detects the communication overtime, the current communication task can be forcibly ended.
CN202011426810.5A 2020-12-09 2020-12-09 Method for stable communication between double cores of double-core intelligent electric energy meter Active CN112486886B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011426810.5A CN112486886B (en) 2020-12-09 2020-12-09 Method for stable communication between double cores of double-core intelligent electric energy meter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011426810.5A CN112486886B (en) 2020-12-09 2020-12-09 Method for stable communication between double cores of double-core intelligent electric energy meter

Publications (2)

Publication Number Publication Date
CN112486886A CN112486886A (en) 2021-03-12
CN112486886B true CN112486886B (en) 2023-04-18

Family

ID=74940632

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011426810.5A Active CN112486886B (en) 2020-12-09 2020-12-09 Method for stable communication between double cores of double-core intelligent electric energy meter

Country Status (1)

Country Link
CN (1) CN112486886B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106324337A (en) * 2016-08-03 2017-01-11 宁波三星医疗电气股份有限公司 Electric quantity synchronous processing-based intelligent electric energy meter dual core communication method
CN108445436A (en) * 2018-03-01 2018-08-24 宁波迦南智能电气股份有限公司 A kind of electric energy meter that twin-core operating status is mutually examined
CN111343052A (en) * 2020-03-11 2020-06-26 中国电力科学研究院有限公司 System and method for carrying out protocol consistency test on intelligent electric energy meter
CN111343199A (en) * 2020-04-28 2020-06-26 南方电网数字电网研究院有限公司 Communication method and system of double-core intelligent electric meter
CN111540190A (en) * 2020-07-07 2020-08-14 南方电网数字电网研究院有限公司 Data distribution method and device based on double-core intelligent electric meter and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101149648B1 (en) * 2010-07-29 2012-05-29 한국전력공사 Automatic meter reading system based on wired and wireless communication for underground distribution line

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106324337A (en) * 2016-08-03 2017-01-11 宁波三星医疗电气股份有限公司 Electric quantity synchronous processing-based intelligent electric energy meter dual core communication method
CN108445436A (en) * 2018-03-01 2018-08-24 宁波迦南智能电气股份有限公司 A kind of electric energy meter that twin-core operating status is mutually examined
CN111343052A (en) * 2020-03-11 2020-06-26 中国电力科学研究院有限公司 System and method for carrying out protocol consistency test on intelligent electric energy meter
CN111343199A (en) * 2020-04-28 2020-06-26 南方电网数字电网研究院有限公司 Communication method and system of double-core intelligent electric meter
CN111540190A (en) * 2020-07-07 2020-08-14 南方电网数字电网研究院有限公司 Data distribution method and device based on double-core intelligent electric meter and computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王立州等."基于IR46标准的新型智能双芯电表设计".《自动化仪表》.2018,第第39卷卷(第第5期期),20-24. *

Also Published As

Publication number Publication date
CN112486886A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN105224362A (en) Host computer carries out the method and system of program upgrade to slave computer
CN110955626A (en) Method and system for realizing Modbus communication on serial link
US20100332908A1 (en) Performing Remote Loads and Stores over Networks
CN105573794A (en) Long-distance updating method and system for embedded system software
CN103475747A (en) Electric energy meter networked system capable of automatically sending address information and sending method thereof
CN104199795A (en) Bus framework
CN112835616A (en) Version upgrading method and device, electronic equipment and storage medium
CN112486886B (en) Method for stable communication between double cores of double-core intelligent electric energy meter
CN112350914A (en) Modbus communication method and system based on MQTT cloud platform
CN113141288B (en) Mailbox message receiving and sending method and device of CAN bus controller
CN112698973A (en) System, method and device for automatic registration and management of modbus equipment
CN107483569A (en) A kind of server with automatically upgrading firmware, system and upgrade method
CN113630368B (en) Communication method, system, terminal and medium of automatic cloud meter
CN114866504B (en) Communication method between energy controller processes based on MQTT message protocol
CN102044912B (en) Method for concurrently surveying terminal time in batch
CN115361263A (en) AT command processing system and method based on embedded system
CN103457786A (en) Sensor access detection method, device and system
CN108804343B (en) Embedded storage interface data transmission method and device, computer equipment and medium
CN113672259A (en) Intelligent software upgrading method and equipment for distributed network equipment
CN112433968A (en) Controller sharing synchronization method and device
CN112463545A (en) Detection method and device for operating system
CN111324559A (en) Serial port shunting device with independent request
CN110188021A (en) A kind of automated testing method of server
CN108153687B (en) Serial port communication method and system based on MCU
CN113452761B (en) Updating method of energy storage system, updating management equipment, energy storage system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230831

Address after: Floor 1, No. 50, section 4, Renmin South Road, Wuhou District, Chengdu, Sichuan 610000

Patentee after: Marketing service center of State Grid Sichuan Electric Power Co.

Address before: 610000 1-7 25 Qinghua Road, Qingyang District, Chengdu, Sichuan, China 25

Patentee before: STATE GRID SICHUAN ELECTRIC POWER Research Institute