CN115685832A - Mode switching method and device, power equipment and medium - Google Patents

Mode switching method and device, power equipment and medium Download PDF

Info

Publication number
CN115685832A
CN115685832A CN202211348667.1A CN202211348667A CN115685832A CN 115685832 A CN115685832 A CN 115685832A CN 202211348667 A CN202211348667 A CN 202211348667A CN 115685832 A CN115685832 A CN 115685832A
Authority
CN
China
Prior art keywords
mode
meter
service
processed
concurrent
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.)
Pending
Application number
CN202211348667.1A
Other languages
Chinese (zh)
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.)
Ningbo Sanxing Medical and Electric Co Ltd
Original Assignee
Ningbo Sanxing Medical and Electric 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 Ningbo Sanxing Medical and Electric Co Ltd filed Critical Ningbo Sanxing Medical and Electric Co Ltd
Priority to CN202211348667.1A priority Critical patent/CN115685832A/en
Publication of CN115685832A publication Critical patent/CN115685832A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention provides a mode switching method, a mode switching device, power equipment and a medium, which relate to the technical field of control, and the method comprises the following steps: and under the working mode of the carrier port, responding to a meter reading instruction, loading a meter reading task to be executed, determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter reading services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes. And inserting the obtained meter services into the queue to be processed according to the priority to obtain an updated queue to be processed, and after receiving a target signal representing that the meter services in the updated queue to be processed are allowed to be processed, sequentially executing the meter services corresponding to the acquisition modes according to the updated queue to be processed, thereby realizing reasonable switching of the acquisition modes.

Description

Mode switching method and device, power equipment and medium
Technical Field
The invention relates to the technical field of control, in particular to a mode switching method, a mode switching device, power equipment and a medium.
Background
Mode switching is often required under the multi-service meter reading state, and the mode switching mode under the corresponding condition is not deeply researched in the prior art, so that the switching mechanism is simple and violent, and the reasonability needs to be improved.
Disclosure of Invention
One of the objects of the present invention includes, for example, providing a mode switching method, apparatus, power device and medium to at least partially improve the rationality of each mode switching in a meter reading state.
Embodiments of the invention may be implemented as follows:
in a first aspect, the present invention provides a mode switching method, applied to an electrical device, where the electrical device includes a carrier port, and priorities of acquisition modes are prestored in the electrical device, the method including:
in the carrier port working mode, responding to a meter reading instruction, and loading a meter reading task to be executed;
determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter reading services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes;
based on the carrier port, inserting the obtained meter service into a queue to be processed according to priority to obtain an updated queue to be processed, and after receiving a target signal representing that the meter service in the updated queue to be processed is allowed to be processed, sequentially executing the meter service corresponding to each acquisition mode according to the updated queue to be processed.
In an optional embodiment, the acquisition mode includes a concurrent mode, a single-shot mode, a broadcast mode and a transparent transmission mode;
the priority of each of the acquisition modes includes: the broadcast mode and the transparent transmission mode have the same priority, the concurrent mode and the single transmission mode have the same priority, and the broadcast mode and the transparent transmission mode have higher priority than the concurrent mode and the single transmission mode.
In an alternative embodiment, the method further comprises the step of acquiring the target signal, the step comprising:
based on the carrier port, sending a data message corresponding to the meter service in execution to corresponding acquired equipment;
and if a response message returned by the acquired equipment is received and the condition for executing at least one meter service in the updated queue to be processed is met, generating a target signal representing that the at least one meter service in the updated queue to be processed is allowed to be processed.
In an alternative embodiment, the generating a target signal characterizing at least one meter service allowed to be processed in the updated pending queue includes:
classifying meter services based on the concurrent mode, the single-sending mode, the broadcast mode and the transparent transmission mode, taking the meter services corresponding to the concurrent mode as concurrent services, and taking the meter services corresponding to the single-sending mode, the broadcast mode and the transparent transmission mode as non-concurrent services;
under the condition of entering a data sending and receiving mode, aiming at a concurrent service to be sent, if a non-concurrent service exists in a concurrent pool, waiting for a target signal mcond of the concurrent service, after the non-concurrent service in the concurrent pool is sent, regenerating the target signal mcond, allowing the concurrent service to be sent, and keeping the concurrent service in a blocking state before the target signal mcond is obtained; aiming at a non-concurrent service to be sent, if the concurrent service exists in a concurrent pool, waiting for a target signal connected of the non-concurrent service, after the concurrent service which is executed in the concurrent pool is executed, regenerating the target signal connected, allowing the non-concurrent service to be sent, and keeping the non-concurrent service in a blocking state before the target signal connected is obtained;
under the condition of exiting from the sending and receiving mode, aiming at the concurrent service to be sent, if the concurrent service does not exist in the concurrent pool, generating a target signal scond of the non-concurrent service; aiming at the non-concurrent service to be sent, if the non-concurrent service exists in the concurrent pool, generating a target signal scond of the non-concurrent service; and aiming at the non-concurrent services to be sent, if no non-concurrent services exist in the concurrent pool, generating a target signal mcond of the concurrent services.
In an alternative embodiment, the generating a target signal characterizing at least one meter service allowed to be processed in the updated pending queue includes:
in a data sending stage, if the meter service at the forefront of the updated queue to be processed corresponds to a concurrent mode, judging whether the meter services corresponding to the broadcast mode and the transparent transmission mode have sending tasks, if so, generating a first target signal after the sending tasks are executed, wherein the first target signal represents that the meter service corresponding to the concurrent mode in the updated queue to be processed is allowed to be executed;
if the meter service at the front of the updated queue to be processed corresponds to a single-sending mode, judging whether the meter services corresponding to the broadcast mode and the transparent transmission mode have sending tasks, if so, after the sending tasks are executed, generating a second target signal, wherein the second target signal represents that the meter service corresponding to the single-sending mode in the updated queue to be processed is allowed to be executed;
and if the meter service at the forefront of the updated queue to be processed corresponds to a broadcast mode or a transparent transmission mode, directly generating a third target signal, wherein the third target signal represents the meter service which is allowed to be executed in the updated queue to be processed and corresponds to the broadcast mode or the transparent transmission mode.
In an alternative embodiment, the generating a target signal characterizing at least one meter service allowed to be processed in the updated pending queue includes:
in a data receiving stage, if a received response message corresponds to a concurrency mode, subtracting 1 from the concurrency number, and directly generating a third target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to a broadcast mode or a transparent transmission mode, wherein the third target signal represents that the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed is allowed to be executed; maintaining the first target signal under the condition that the updated meter service at the front of the queue to be processed corresponds to a concurrency mode and the concurrency number is nonzero; generating a second target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to a single-shot mode, wherein the second target signal represents the meter service which is allowed to be executed and corresponds to the single-shot mode in the updated queue to be processed;
if the received response message corresponds to a single-sending mode, generating a third target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to a broadcasting mode or a transparent transmission mode, wherein the third target signal represents the meter service which is allowed to be executed in the updated queue to be processed and corresponds to the broadcasting mode or the transparent transmission mode; under the condition that the updated meter service at the forefront of the queue to be processed corresponds to a concurrent mode, directly generating a first target signal; and keeping the second target signal under the condition that the table meter service at the forefront of the updated queue to be processed corresponds to a single-shot mode.
In an alternative embodiment, the method further comprises:
verifying the legality and integrity of each response message;
if the validity and integrity check passes, data storage is carried out based on the response message;
if the validity or integrity check is not passed, the data message is retransmitted to the corresponding acquired equipment until the obtained response message passes the validity or integrity check; and
and keeping the blocking state until the corresponding target signal is obtained aiming at the meter service of the corresponding target signal which is not received in the updated queue to be processed.
In an optional embodiment, the inserting the obtained meter service into the queue to be processed according to the priority to obtain an updated queue to be processed includes:
determining priorities corresponding to the obtained meter services and the meter services in the queue to be processed respectively;
if a first meter service exists in the obtained meter services, and the priority corresponding to the first meter service is higher than the priority corresponding to at least one existing meter service in the queue to be processed, inserting the first meter service into the queue to be processed, so that the first meter service is positioned in front of each existing meter service;
and if a second meter service exists in the obtained meter services, the priority corresponding to the second meter service is lower than the priority corresponding to at least one existing meter service in the queue to be processed, and the second meter service is inserted into the queue to be processed so as to be positioned behind each existing meter service.
In a second aspect, an embodiment of the present invention provides a mode switching apparatus, which is applied to an electrical device, where the electrical device includes a carrier port, and priorities of acquisition modes are prestored in the electrical device, and the mode switching apparatus includes:
the data loading module is used for responding to a meter reading instruction and loading a meter reading task to be executed in the carrier port working mode; determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter reading services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes;
and the data processing module is used for inserting the obtained meter services into a queue to be processed according to priority based on the carrier port to obtain an updated queue to be processed, and sequentially executing the meter services corresponding to the acquisition modes according to the updated queue to be processed after receiving a target signal representing that the meter services in the updated queue to be processed are allowed to be processed.
In a third aspect, an embodiment of the present invention provides an electrical device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the mode switching method of any one of the preceding embodiments when executing the program.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and the computer program controls, when executed, an electric power apparatus in which the computer-readable storage medium is located to execute the mode switching method described in any one of the foregoing embodiments.
The beneficial effects of the embodiment of the invention include, for example: and updating the queue to be processed according to the priority of the meter service, and executing the corresponding meter service after receiving a target signal representing that the meter service in the queue to be processed is allowed to be processed, so that the rationality of the processing of each meter service is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 shows a schematic diagram of an application scenario provided in an embodiment of the present invention.
Fig. 2 is a flowchart illustrating a mode switching method according to an embodiment of the present invention.
Fig. 3 shows another schematic flow chart of a mode switching method according to an embodiment of the present invention.
Fig. 4 shows another schematic flow chart of a mode switching method according to an embodiment of the present invention.
Fig. 5 shows an exemplary structural block diagram of a mode switching device according to an embodiment of the present invention.
Icon: 100-a power device; 110-a memory; 120-a processor; 130-a communication module; 140-mode switching means; 141-data loading module; 142-a data processing module.
Detailed Description
Nowadays, the mode switching mechanism of the power equipment is often simple and rough under the multi-service meter reading state, and the rationality needs to be improved. For example, when it is necessary to switch from the first mode to the second mode, the first mode related task is often directly interrupted and the second mode related task is executed, and by using the switching manner, the task corresponding to the first mode may not be completely executed and is directly switched to the second mode, which results in the waste of the interactive content in the first mode, for example, the message corresponding to the first mode is completely sent, but the response message is directly switched to the second mode without receiving the response message, which results in the rejection of the response message corresponding to the first mode in the subsequent mode as an invalid message, and the service acquisition efficiency and the data integrity are invisibly wasted, thereby affecting the overall efficiency of the power equipment for acquiring data. For another example, the lack of reliable research and design on the timing and conditions of each mode switch leaves the rationality of mode switching to be improved.
Based on the above research, embodiments of the present invention provide a mode switching scheme, which can determine whether to execute each service corresponding to each mode according to whether a target signal is acquired by setting a priority and a signal protection mechanism, and is simple, efficient, and friendly, and the mode switching rationality is improved.
The defects existing in the above solutions are the results obtained after the inventor has practiced and studied carefully, and therefore, the discovery process of the above problems and the solutions proposed by the embodiments of the present invention below for the above problems should be the contributions of the inventor in the invention process.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined or explained in subsequent figures.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Referring to fig. 1, a block schematic diagram of an electrical device 100 provided in this embodiment is shown, where the electrical device 100 in this embodiment may be a server, a processing device, a processing platform, and the like, which are capable of performing data interaction and performing a meter reading task. The power apparatus 100 includes a memory 110, a processor 120, and a communication module 130. The memory 110, the processor 120 and the communication module 130 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 110 is used to store programs or data. The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The processor 120 is used to read/write data or programs stored in the memory 110 and perform corresponding functions.
The communication module 130 is configured to establish a communication connection between the power device 100 and another communication terminal through the network, and to transmit and receive data through the network.
It should be understood that the configuration shown in fig. 1 is merely a schematic configuration of the power device 100, and the power device 100 may include more or less components than those shown in fig. 1, or have a different configuration than that shown in fig. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof. For example, power device 100 may also include a carrier port, 485 port, and the like.
Referring to fig. 2, a flowchart of a mode switching method according to an embodiment of the invention is shown, which can be executed by the power device 100 shown in fig. 1, for example, can be executed by the processor 120 in the power device 100. The power equipment comprises a carrier port, and the priority of each acquisition mode is prestored in the power equipment. The mode switching method includes S110, S120, and S130.
And S110, responding to a meter reading instruction in the carrier port working mode, and loading a meter reading task to be executed.
And S120, determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes.
And S130, based on the carrier port, inserting the obtained meter service into a queue to be processed according to priority to obtain an updated queue to be processed, and after receiving a target signal representing that the meter service in the updated queue to be processed is allowed to be processed, sequentially executing the meter service corresponding to each acquisition mode according to the updated queue to be processed.
In the embodiment of the invention, by setting the priority and the signal type protection mechanism, after a target signal representing that the meter service in the queue to be processed is allowed to be processed is received, the corresponding meter service is executed, the smooth switching among the modes is ensured, and the mode switching friendliness and the reasonability of the processing of the meter service are improved.
The acquisition modes supported by the carrier port may be various, and may include, for example, a concurrent mode, a single-shot mode, a broadcast mode, a transparent transmission mode, and the like. According to the requirements of each scene, the priority of each acquisition mode can be flexibly set. For example, in one implementation, the priority of each acquisition mode may include: the broadcast mode and the transparent transmission mode have the same priority, the concurrent mode and the single transmission mode have the same priority, and the broadcast mode and the transparent transmission mode have higher priority than the concurrent mode and the single transmission mode. For another example, in another implementation, the priority of each acquisition mode may include: the broadcast mode has a higher priority than the transparent transmission mode, the transparent transmission mode has a higher priority than the concurrent mode, and the concurrent mode has a higher priority than the single-shot mode. This embodiment does not exemplify this.
In S110, each acquisition mode is in a carrier port operating mode of the power device, a concurrent mode is supported, and in a case of receiving a meter reading instruction, a meter reading parameter of the power acquisition device starts to be loaded, a meter reading task to be executed is obtained, and then a carrier meter reading service is executed based on the meter reading task.
The meter reading instruction can be obtained in various ways, for example, the meter reading instruction can be sent to a user in real time. For example, the transmission may be automatically performed at a predetermined time interval or under predetermined conditions. For another example, it may be generated for an operation performed according to a user. The present embodiment does not limit this.
In S120, the meter reading task may correspond to multiple acquisition modes, and accordingly, when the carrier meter reading service is executed, service acquisition in each acquisition mode is performed, and meter reading services corresponding to each acquisition mode are loaded to the carrier port according to the priority of each acquisition mode for subsequent processing.
And the carrier port arranges the meter services according to the priority of each acquisition mode, and the meter service with high priority is processed preferentially. In this embodiment, the ordered processing of each meter service can be realized by maintaining the queue to be processed. Correspondingly, inserting the obtained meter service into the queue to be processed according to the priority in S130 to obtain an updated queue to be processed may include: and determining the priority corresponding to the obtained meter service and each meter service in the queue to be processed. If a first meter service exists in the obtained meter services, the priority corresponding to the first meter service is higher than the priority corresponding to at least one existing meter service in the queue to be processed, and the first meter service is inserted into the queue to be processed, so that the first meter service is positioned in front of each existing meter service.
For example, if the priority of the first meter service is higher than the priority of three existing meter services in the queue to be processed, the first meter service is inserted into the queue to be processed before the three existing meter services, so that the first meter service is executed before the three existing meter services with lower priorities.
And if a second meter service exists in the obtained meter services, and the priority corresponding to the second meter service is lower than the priority corresponding to at least one existing meter service in the queue to be processed, inserting the second meter service into the queue to be processed, so that the second meter service is positioned behind each existing meter service.
For example, if the priority of the second meter service is lower than the priority of two existing meter services in the queue to be processed, the second meter service is inserted into the queue to be processed, and after the two existing meter services, the second meter service is executed after the two existing meter services with higher priority.
The obtained metering services can be one or more, and each obtained metering service is processed according to the method, so that each obtained metering service is ensured to be positioned in the updated queue to be processed, before the metering service with the priority lower than that of the obtained metering service and after the metering service with the priority higher than that of the obtained metering service. Therefore, the meter services are ensured to be arranged according to the priorities of the corresponding acquisition modes in the updated queue to be processed.
According to the application requirements of each scene, in S130, the target signal can be flexibly obtained. For example, in order to avoid interruption of a task being executed due to mode switching, so that the interacted content generated for the task being executed is wasted, in the case that the power device has sent a data message corresponding to the meter service being executed to the corresponding device to be collected, the power device may determine whether to generate the target signal according to whether a response message returned by the device to be collected is received. In the case where a response message returned for the data message has been received, the interaction has been completed to characterize the task being executed, and execution of the next task may begin. In this case, a target signal representing that the meter service in the updated queue to be processed is allowed to be processed may be generated, so that the meter service in the queue to be processed may be controlled to be executed in sequence within a reasonable time, the acquisition modes may be switched smoothly, and the interactive content may not be wasted, thereby improving the overall data acquisition efficiency and integrity.
Illustratively, under the condition that the priorities of the broadcast mode and the transparent transmission mode are the same, the priorities of the concurrent mode and the single transmission mode are the same, and the priorities of the broadcast mode and the transparent transmission mode are higher than those of the concurrent mode and the single transmission mode, if only the meter service corresponding to the concurrent mode and the meter service corresponding to the single transmission mode are simultaneously executed at a certain time in the power equipment, and the meter service corresponding to the broadcast mode or the transparent transmission mode is triggered in the process, the carrier port will rearrange the meter service corresponding to the currently newly added high-priority mode (the meter service corresponding to the broadcast mode or the transparent transmission mode) to the forefront end of the queue to be processed, for example, arrange the transmission message of the meter service corresponding to the newly added high-priority mode to the forefront end of the unsent queue pool. After the meter services corresponding to the concurrent mode and the single-sending mode which are executed are processed, if the messages in the sending pool are processed, the target signal is generated again, the sending messages of the meter services corresponding to the newly added high-priority mode are allowed to be executed based on the target signal, and the sending messages of the meter services corresponding to the high-priority mode are sent.
The power device may determine whether the message already in the sending pool is processed by determining whether the corresponding response message is received. If yes, judging that the processed message in the sending pool is finished; if not, the message in the sending pool is judged to be not processed.
In this embodiment, the data interaction in the process of executing each meter service generally involves framing a packet according to a protocol of interaction between the power device and the device to be collected, and performing packet sending and receiving processing, which will not be described further herein.
In order to ensure the reliability of data interaction, the data required to be acquired can be acquired based on the response message, and the response message can be verified. Referring to fig. 3, the process of verifying the response packet may be implemented by S210, S220, and S230.
S210, verifying the legality and the integrity of each response message.
And S220, if the validity and integrity check passes, storing data based on the response message.
And S230, if the validity or integrity check is not passed, retransmitting the data message to the corresponding acquired equipment until the obtained response message passes the validity and integrity check.
By checking the response message, the reliability of data acquisition at each time is ensured, and the overall acquisition efficiency is further ensured.
In order to improve convenience and reliability of model switching management, corresponding target signals can be set for each acquisition mode, and execution permission of meter service corresponding to each acquisition mode is determined by whether the target signals are obtained or not. Correspondingly, referring to fig. 4, the present embodiment provides another implementation manner for acquiring a target signal, which includes S310 and S320.
And S310, based on the carrier port, sending the data message corresponding to the meter service in execution to the corresponding acquired equipment.
And S320, if a response message returned by the acquired equipment is received and the condition of executing at least one meter service in the updated queue to be processed is met, generating a target signal representing that the processing of at least one meter service in the updated queue to be processed is allowed.
The condition for executing at least one meter service in the updated queue to be processed can be set according to the priority.
For example, in a data sending stage, if the meter service at the head of the updated queue to be processed corresponds to a concurrent mode, it is determined whether the meter services corresponding to the broadcast mode and the transparent transmission mode have a sending task, if so, after the sending task is completed, a first target signal is generated, and the first target signal represents that the meter service corresponding to the concurrent mode in the updated queue to be processed is allowed to be executed. Thereby completing the switching from the broadcast mode or the transparent transmission mode to the concurrent mode.
After the first target signal is obtained, the meter service corresponding to the concurrent mode in the updated queue to be processed can be executed. And under the condition that the first target signal is not acquired, maintaining the meter service corresponding to the concurrent mode in the updated queue to be processed in a blocking state.
For another example, in the data sending stage, if the meter service at the head of the updated queue to be processed corresponds to the single-sending mode, it is determined whether there is a sending task in the meter services corresponding to the broadcast mode and the transparent transmission mode, if yes, after the sending task is completed, a second target signal is generated, where the second target signal represents that the meter service corresponding to the single-sending mode in the updated queue to be processed is allowed to be executed. Thereby completing the switching from the broadcast mode or the transparent transmission mode to the single shot mode.
After the second target signal is obtained, the meter service corresponding to the single-shot mode in the updated queue to be processed can be executed. And under the condition that the second target signal is not acquired, maintaining the meter service corresponding to the single-shot mode in the updated queue to be processed in a blocking state.
For another example, in the data sending stage, if the meter service at the head of the updated queue to be processed corresponds to the broadcast mode or the transparent transmission mode, since the priority of the broadcast mode and the transparent transmission mode is highest and a response message indicating that the previous data interaction is completed has been received, a third target signal may be directly generated, where the third target signal indicates that the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed is allowed to be executed. Thereby completing the switching from the other mode to the broadcast mode or the transparent transmission mode.
And under the condition that the third target signal is not acquired, the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed is kept in a blocking state.
For another example, in the data receiving stage, if the received response packet corresponds to the concurrency mode, the meter service corresponding to the last concurrency mode is completed, and the concurrency number is reduced by 1. And under the condition that the meter service at the forefront of the updated queue to be processed corresponds to the broadcast mode or the transparent transmission mode, because the priority of the broadcast mode and the transparent transmission mode is highest, and a response message representing that the last data interaction is completed is received, a third target signal can be directly generated, wherein the third target signal represents that the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed is allowed to be executed. After the third target signal is obtained, the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed can be executed. Thereby completing the switching from the concurrent mode to the broadcast mode or the transparent transmission mode.
And under the condition that the third target signal is not acquired, the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed is kept in a blocking state.
And under the condition that the updated meter service at the front of the queue to be processed corresponds to a concurrency mode and the concurrency number is nonzero, maintaining the first target signal because the meter service corresponding to the concurrency mode is still executed subsequently.
And generating a second target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to the single-shot mode, wherein the second target signal represents the meter service which is allowed to be executed and corresponds to the single-shot mode in the updated queue to be processed. After the third target signal is obtained, the meter service corresponding to the single-shot mode in the updated queue to be processed can be executed. Thereby completing the switching from the concurrent mode to the single shot mode.
Similarly, if the received response message corresponds to a single-sending mode, a third target signal is generated under the condition that the updated meter service at the forefront of the queue to be processed corresponds to a broadcast mode or a transparent transmission mode, so that the switching from the single-sending mode to the broadcast mode or the transparent transmission mode is completed. And under the condition that the updated meter service at the forefront of the queue to be processed corresponds to a concurrent mode, directly generating a first target signal so as to complete the switching from the single-shot mode to the concurrent mode. And keeping the second target signal under the condition that the table meter service at the forefront of the updated queue to be processed corresponds to a single-shot mode.
The broadcast mode and the transparent transmission mode are similar to the switching logic of other modes, and are not illustrated here.
For example, in order to achieve signal preemption among the modes and scheduling of the services more conveniently, the acquisition modes may be classified, for example, the data request of the metering service corresponding to the concurrent mode is characterized as M. And the single-sending mode, the broadcasting mode and the transparent transmission mode are all used as non-concurrent modes, the data request of the meter service corresponding to the non-concurrent modes is characterized as S, and the maximum number of the requests which can be simultaneously sent in the concurrent modes is N. Then:
when entering a data transmission and reception mode, if there is S in the parallel pool, the M to be transmitted waits for a target signal mcond (mcond < = N) of M, and after the S transmission in the parallel pool is completed, the target signal mcond is regenerated to allow the M to be transmitted, and before the target signal mcond is obtained, the M keeps a blocking state. And for S to be sent, if M exists in the concurrent pool, waiting for a target signal scond of S, after the execution of the M which is being executed in the concurrent pool is finished, generating the target signal scond again, allowing S to be sent, and keeping the S in a blocking state before the target signal scond is obtained.
And under the condition of exiting the sending and receiving mode, aiming at M to be sent, if the concurrent pool has no M, generating a target signal scond of S. And aiming at the S to be sent, if the concurrency pool has S, generating a target signal scond of the S. And aiming at the S to be sent, if the concurrency pool has no S, generating a target signal mcond of M.
The concurrency pool is a service in a concurrency mode, and means that a plurality of messages can be sent out and processed by a carrier port, and when a plurality of messages are sent out, a plurality of received messages need to be waited for coming back, so that the representation is performed by the concurrency pool. For example, if five messages are sent out concurrently, five received messages need to be returned, if only one message is returned, four messages need to be returned, at this time, only 4 sent messages exist in the concurrent pool, and if only one received message is returned, three sent messages remain in the sending pool until all five received messages are returned, so that complete processing of the sending task being executed in the concurrent pool is represented, a target signal can be obtained according to a strategy, and processing of the next task can be performed according to the priority.
In an implementation manner, the plurality of concurrencies are broadband module features, and support the concurrency function, and the sending messages in the concurrency mode and the other modes are in the same queue pool, which is also referred to as a concurrency pool, a sending pool, and a task pool in this embodiment. And the carrier port layer manages the queue pool, performs priority arrangement on the sent messages, and manages the time for sending the messages by combining with the target signals.
Based on the setting, the scheduling relation among the services can be processed by carrying out service preemption signals according to different types of modes. Based on the setting and priority setting, in the sending stage, if a meter service M corresponding to a concurrent mode comes in at this time when a sending and receiving function interface is entered, whether a sending task S exists in the meter service corresponding to a non-concurrent mode is judged first, if S exists, a target signal mcond corresponding to the concurrent mode needs to be waited, the meter service corresponding to the concurrent mode is allowed to be executed only when the target signal mcond is taken, and otherwise, the meter service corresponding to the concurrent mode is allowed to be executed only when the target signal mcond is blocked and waited to be acquired. The method aims to preferentially execute meter services corresponding to a non-concurrent mode (such as meter services corresponding to a broadcast mode, a transparent transmission mode and the like). On the contrary, if the meter service S corresponding to the non-concurrent mode is entered, the target signal scond needs to be waited, and the meter service corresponding to the non-concurrent mode is allowed to be sent only after the target signal scond is acquired.
In the receiving stage, if the currently received service is in the meter service corresponding to the concurrent mode, subtracting 1 from the concurrent number (N), and if the sending service corresponding to the non-concurrent mode (such as a broadcast mode and a transparent transmission mode) exists at this time, acquiring a target signal connected corresponding to the non-concurrent mode. And if the sending service corresponding to the non-concurrent mode does not exist and the concurrent number (N) is not zero, the real-time signal is still in the target signal mcond corresponding to the concurrent mode. Otherwise, if the currently received service is in the meter service corresponding to the non-concurrent mode and the number of the sent services exists, acquiring a target signal scond corresponding to the non-concurrent mode, and otherwise, setting the target signal mcond.
The above is only an enumeration of the processing strategies in one of the mode switching processes, and it can be understood that there may be other processing strategies according to different priorities and different application requirements, for example, corresponding target signals may be set for each acquisition mode, or the same target signal may be set for two of the acquisition modes. Different target signals are generated based on the priority and the status of the service being executed in the sending pool to perform mode switching, which is not described in this embodiment. For example, when the meter transaction is performed for the first time, since there is no task being executed in the transmission pool, the first transaction may not need to wait for the target signal, that is, the first transmission is idle.
By adopting the scheme in the embodiment, the signal state of the current sending pool can be known in real time, whether the corresponding target signal is in waiting or not is inquired before mode switching is carried out, the execution is allowed only when the corresponding target signal is obtained, and the task processing with higher priority is carried out after the current task exits through a signal blocking strategy, so that the sending and receiving services in operation at present are prevented from being forcibly interrupted, and the waste of the interacted contents is avoided. And the target signal controls the mode switching, so that the convenience and the friendliness of mode switching management are improved, and the acquisition efficiency, the real-time performance and the data integrity can be effectively improved.
After the meter reading task is completed, such as message interaction of each acquisition mode, data storage processing can be performed on the received messages for subsequent application.
In order to perform the corresponding steps in the above embodiments and various possible modes, an implementation mode of the mode switching device is given below. Referring to fig. 5, fig. 5 is a functional block diagram of a mode switching device 140 according to an embodiment of the present invention, where the mode switching device 140 may be applied to the power equipment 100 shown in fig. 1, the power equipment includes a carrier port, and priorities of the acquisition modes are prestored in the power equipment. It should be noted that the basic principle and the resulting technical effects of the mode switching device 140 provided in the present embodiment are the same as those of the method embodiments described above, and for brevity, reference may be made to the corresponding contents in the method embodiments described above. The mode switching device 140 includes a data loading module 141 and a data processing module 142.
The data loading module 141 is configured to, in the carrier port operating mode, respond to a meter reading instruction and load a meter reading task to be executed; and determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter reading services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes.
And the data processing module 142 is configured to insert the obtained meter services into a queue to be processed according to priority based on the carrier port to obtain an updated queue to be processed, and after receiving a target signal indicating that the meter services in the updated queue to be processed are allowed to be processed, sequentially execute the meter services corresponding to the acquisition modes according to the updated queue to be processed.
On the basis, the embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and the computer program controls, when running, the power device where the computer-readable storage medium is located to execute the above mode switching method.
By adopting the scheme in the embodiment of the invention, the task acquisition data of each mode is processed by the service of the carrier port layer instead of being managed by the traditional local meter reading service layer, so that the management convenience is improved. The blocking type signal is more friendly, the sending and receiving of the message in the task execution pool is forcibly finished in a non-violent mode, and the service executed in the task pool can be completely processed. The concurrent service pool considers the broadcast mode and the transparent transmission mode more friendly, so that the two high-priority mode services can be preferentially executed, and the timeliness and the reliability of high-priority service acquisition are improved. The task pool service mode interruption, waiting and operation completely depend on the acquisition of signal authority, if the task pool service mode is in a waiting signal, the service in the current task pool is preferentially processed, and after the signal is acquired, the operation processing is allowed according to the priority level of the task pool. And smooth switching is carried out aiming at each mode, a time window is not wasted, and the messages to be sent and received in the service pool can be supplemented in time.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A mode switching method is applied to electric equipment, the electric equipment comprises a carrier port, and priorities of acquisition modes are prestored in the electric equipment, and the method comprises the following steps:
in the carrier port working mode, responding to a meter reading instruction, and loading a meter reading task to be executed;
determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter reading services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes;
based on the carrier port, inserting the obtained meter service into a queue to be processed according to priority to obtain an updated queue to be processed, and after a target signal representing that the meter service in the updated queue to be processed is allowed to be processed is received, sequentially executing the meter service corresponding to each acquisition mode according to the updated queue to be processed.
2. The mode switching method according to claim 1, wherein the acquisition mode includes a concurrent mode, a single-shot mode, a broadcast mode, and a transparent transmission mode;
the priority of each of the acquisition modes includes: the broadcast mode and the transparent transmission mode have the same priority, the concurrent mode and the single transmission mode have the same priority, and the broadcast mode and the transparent transmission mode have higher priority than the concurrent mode and the single transmission mode.
3. The method of claim 2, further comprising the step of acquiring the target signal, the step comprising:
based on the carrier wave port, sending a data message corresponding to the meter service in execution to corresponding acquired equipment;
and if a response message returned by the acquired equipment is received and the condition for executing at least one meter service in the updated queue to be processed is met, generating a target signal representing that the at least one meter service in the updated queue to be processed is allowed to be processed.
4. The method of claim 3, wherein the generating a target signal characterizing the permission to process the at least one meter traffic in the updated pending queue comprises:
classifying meter services based on the concurrent mode, the single-sending mode, the broadcast mode and the transparent transmission mode, taking the meter services corresponding to the concurrent mode as concurrent services, and taking the meter services corresponding to the single-sending mode, the broadcast mode and the transparent transmission mode as non-concurrent services;
under the condition of entering a data sending and receiving mode, aiming at a concurrent service to be sent, if a non-concurrent service exists in a concurrent pool, waiting for a target signal mcond of the concurrent service, after the non-concurrent service in the concurrent pool is sent, regenerating the target signal mcond, allowing the concurrent service to be sent, and keeping the concurrent service in a blocking state before obtaining the target signal mcond; aiming at non-concurrent services to be sent, if the concurrent services exist in a concurrent pool, waiting for a target signal scond of the non-concurrent services, after the concurrent services which are executed in the concurrent pool are executed, generating the target signal scond again, allowing the non-concurrent services to be sent, and keeping the non-concurrent services in a blocking state before the target signal scond is obtained;
under the condition of exiting from the sending and receiving mode, aiming at the concurrent service to be sent, if the concurrent service does not exist in the concurrent pool, generating a target signal scond of the non-concurrent service; aiming at the non-concurrent service to be sent, if the non-concurrent service exists in the concurrent pool, generating a target signal scond of the non-concurrent service; and aiming at the non-concurrent services to be sent, if no non-concurrent services exist in the concurrent pool, generating a target signal mcond of the concurrent services.
5. The method of claim 3, wherein the generating a target signal characterizing the permission to process the at least one meter traffic in the updated pending queue comprises:
in a data sending stage, if the meter service at the forefront of the updated queue to be processed corresponds to a concurrent mode, judging whether the meter service corresponding to the broadcast mode and the transparent transmission mode has a sending task, if so, after the sending task is executed, generating a first target signal, wherein the first target signal represents that the meter service corresponding to the concurrent mode in the updated queue to be processed is allowed to be executed;
if the meter service at the front of the updated queue to be processed corresponds to a single-sending mode, judging whether the meter services corresponding to the broadcast mode and the transparent transmission mode have sending tasks, if so, after the sending tasks are executed, generating a second target signal, wherein the second target signal represents that the meter service corresponding to the single-sending mode in the updated queue to be processed is allowed to be executed;
if the meter service at the front of the updated queue to be processed corresponds to a broadcast mode or a transparent transmission mode, directly generating a third target signal, wherein the third target signal represents that the meter service in the updated queue to be processed, which corresponds to the broadcast mode or the transparent transmission mode, is allowed to be executed;
in a data receiving stage, if a received response message corresponds to a concurrency mode, subtracting 1 from the concurrency number, and directly generating a third target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to a broadcast mode or a transparent transmission mode, wherein the third target signal represents that the meter service corresponding to the broadcast mode or the transparent transmission mode in the updated queue to be processed is allowed to be executed; under the condition that the updated meter service at the forefront of the queue to be processed corresponds to a concurrency mode and the concurrency number is nonzero, keeping the first target signal; generating a second target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to a single-shot mode, wherein the second target signal represents the meter service which is allowed to be executed and corresponds to the single-shot mode in the updated queue to be processed;
if the received response message corresponds to a single-sending mode, generating a third target signal under the condition that the meter service at the forefront of the updated queue to be processed corresponds to a broadcasting mode or a transparent transmission mode, wherein the third target signal represents the meter service which is allowed to be executed in the updated queue to be processed and corresponds to the broadcasting mode or the transparent transmission mode; under the condition that the updated meter service at the forefront of the queue to be processed corresponds to a concurrent mode, directly generating a first target signal; and keeping the second target signal under the condition that the table meter service at the forefront of the updated queue to be processed corresponds to a single-shot mode.
6. The method of claim 3, further comprising:
checking the legality and integrity of each response message;
if the validity and integrity check is passed, data storage is carried out based on the response message;
if the validity or integrity check is not passed, the data message is retransmitted to the corresponding acquired equipment until the obtained response message passes the validity or integrity check; and
and keeping a blocking state until the corresponding target signal is obtained aiming at the meter service of the updated target signal which is not received in the queue to be processed.
7. The method of claim 2, wherein the inserting the obtained meter service into the pending queue according to priority to obtain an updated pending queue comprises:
determining priorities corresponding to the obtained meter services and the meter services in the queue to be processed respectively;
if a first meter service exists in the obtained meter services, and the priority corresponding to the first meter service is higher than the priority corresponding to at least one existing meter service in the queue to be processed, inserting the first meter service into the queue to be processed, so that the first meter service is positioned in front of each existing meter service;
and if a second meter service exists in the obtained meter services, and the priority corresponding to the second meter service is lower than the priority corresponding to at least one existing meter service in the queue to be processed, inserting the second meter service into the queue to be processed, so that the second meter service is positioned behind each existing meter service.
8. A mode switching device is applied to power equipment, the power equipment comprises a carrier port, the power equipment prestores the priority of each acquisition mode, and the mode switching device comprises:
the data loading module is used for responding to a meter reading instruction and loading a meter reading task to be executed in the carrier port working mode; determining all corresponding target acquisition modes according to the meter reading task, and sequentially loading meter reading services corresponding to the target acquisition modes to the carrier port according to the priority of the target acquisition modes;
and the data processing module is used for inserting the obtained meter services into a queue to be processed based on the carrier port according to the priority to obtain an updated queue to be processed, and sequentially executing the meter services corresponding to the acquisition modes according to the updated queue to be processed after receiving a target signal representing that the meter services in the updated queue to be processed are allowed to be processed.
9. An electrical device, comprising: memory, processor and computer program stored on the memory and executable on the processor, which when executed by the processor implements the mode switching method of any one of claims 1 to 7.
10. A computer-readable storage medium, comprising a computer program, which when executed controls an electric power apparatus in which the computer-readable storage medium is located to perform the mode switching method according to any one of claims 1 to 7.
CN202211348667.1A 2022-10-31 2022-10-31 Mode switching method and device, power equipment and medium Pending CN115685832A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211348667.1A CN115685832A (en) 2022-10-31 2022-10-31 Mode switching method and device, power equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211348667.1A CN115685832A (en) 2022-10-31 2022-10-31 Mode switching method and device, power equipment and medium

Publications (1)

Publication Number Publication Date
CN115685832A true CN115685832A (en) 2023-02-03

Family

ID=85045316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211348667.1A Pending CN115685832A (en) 2022-10-31 2022-10-31 Mode switching method and device, power equipment and medium

Country Status (1)

Country Link
CN (1) CN115685832A (en)

Similar Documents

Publication Publication Date Title
CN106534345B (en) A kind of message forwarding method and device
CN110557416B (en) Multi-node collaborative blocking method and system
CN111858007A (en) Task scheduling method and device based on message middleware
CN108829526A (en) A kind of inter-process communication methods, electronic equipment and readable storage medium storing program for executing
CN113157465B (en) Message sending method and device based on pointer linked list
CN113138812A (en) Spacecraft task scheduling method and device
CN115685832A (en) Mode switching method and device, power equipment and medium
CN111831408A (en) Asynchronous task processing method and device, electronic equipment and medium
CN111881018A (en) Automatic test dynamic scheduling system
CN110912958A (en) HTTP connection processing method, device, equipment and medium
CN112954716A (en) Network access method and device of mesh network, computer equipment and storage medium
CN114201293A (en) Kafka middleware cluster parameter modification method and device and storage medium
CN113126958B (en) Decision scheduling customization method and system based on information flow
CN113656374A (en) Method and device for processing service message with attachment
CN110162415B (en) Method, server, device and storage medium for processing data request
CN114860740A (en) Distributed transaction processing method, device and system based on programmable switch
CN112333262A (en) Data updating prompting method and device, computer equipment and readable storage medium
CN113452777B (en) Message pushing method and device
CN112822238B (en) Main node switching method and computer readable storage medium
CN111479084B (en) Video networking conference establishment method, device, system and storage medium
CN110018908A (en) A kind of inter-process communication methods, electronic equipment and readable storage medium storing program for executing
CN116911393B (en) Quantum chip design system, quantum chip design method, electronic equipment and storage medium
CN115242687B (en) Node activity detection method, device, equipment and medium
CN116684074B (en) Method and device for driving multi-core scheduling algorithm of hardware password module and electronic equipment
JP5262329B2 (en) Scheduling program, scheduling method, and scheduling apparatus

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