CN113299006A - Address allocation method, intelligent cabinet, readable storage medium and computer program product - Google Patents

Address allocation method, intelligent cabinet, readable storage medium and computer program product Download PDF

Info

Publication number
CN113299006A
CN113299006A CN202110524842.7A CN202110524842A CN113299006A CN 113299006 A CN113299006 A CN 113299006A CN 202110524842 A CN202110524842 A CN 202110524842A CN 113299006 A CN113299006 A CN 113299006A
Authority
CN
China
Prior art keywords
cabinet
address
auxiliary
information
response
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.)
Granted
Application number
CN202110524842.7A
Other languages
Chinese (zh)
Other versions
CN113299006B (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.)
Shenzhen Zhilai Science and Technology Co Ltd
Original Assignee
Shenzhen Zhilai Science and Technology 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 Shenzhen Zhilai Science and Technology Co Ltd filed Critical Shenzhen Zhilai Science and Technology Co Ltd
Priority to CN202110524842.7A priority Critical patent/CN113299006B/en
Publication of CN113299006A publication Critical patent/CN113299006A/en
Application granted granted Critical
Publication of CN113299006B publication Critical patent/CN113299006B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The application discloses an address allocation method, an intelligent cabinet, a readable storage medium and a computer program product, wherein the address allocation method comprises the following steps: sending reporting request information to each auxiliary cabinet through the main cabinet, respectively returning first response information responding to the reporting request information to the main cabinet through each auxiliary cabinet, wherein the first response information comprises identification tags of the auxiliary cabinets, generating address allocation information with the identification tags and target addresses corresponding to the identification tags through the main cabinet, sending the address allocation information to each auxiliary cabinet, and respectively setting equipment addresses for each auxiliary cabinet through each auxiliary cabinet responding to the address allocation information. The technical problem of the address allocation inefficiency of main cabinet and vice cabinet in the intelligence cabinet has been solved to this application.

Description

Address allocation method, intelligent cabinet, readable storage medium and computer program product
Technical Field
The present application relates to the field of intelligent cabinet communication technologies, and in particular, to an address allocation method, an intelligent cabinet, a readable storage medium, and a computer program product.
Background
Along with the continuous development of computer technology, intelligent cabinets such as express delivery cabinets, vending machines and automatic deposit cabinets are also more and more widely applied, at present, communication modes such as RS485 and Ethernet are generally used for communication between a main cabinet and an auxiliary cabinet of the intelligent cabinet, and currently, the equipment address is usually set through dial-up switches or software configuration, but the equipment address needs to be manually set through the dial-up switches or the software configuration, when the number of the auxiliary cabinets is too large or the auxiliary cabinet is abnormal, the operation of setting the equipment address through traditional manual operation is complex, the workload is large, and further the efficiency of address allocation is low.
Disclosure of Invention
The present application mainly aims to provide an address allocation method, an intelligent cabinet, a readable storage medium and a computer program product, and aims to solve the technical problem in the prior art that the address allocation efficiency of a main cabinet and an auxiliary cabinet in the intelligent cabinet is low.
In order to achieve the above object, the present application provides an address allocation method, where the address allocation method is applied to an intelligent cabinet, and the address allocation method includes:
sending reporting request information to each auxiliary cabinet through the main cabinet;
returning first response information responding to the reporting request information to the main cabinet through each auxiliary cabinet, wherein the first response information comprises an identity identification tag of the auxiliary cabinet;
generating address allocation information with each identification tag and a target address corresponding to each identification tag through the main cabinet, and sending the address allocation information to each auxiliary cabinet;
and responding to the address allocation information through each auxiliary cabinet, and respectively setting equipment addresses for each auxiliary cabinet.
The present application further provides an address allocation apparatus, the address allocation apparatus is a virtual apparatus, and the address allocation apparatus is applied to the intelligent cabinet, the address allocation apparatus includes:
a report request module, configured to send report request information to each of the sub-cabinets through the main cabinet;
a response module, configured to return, to the main cabinet, first response information in response to the report request information through each of the sub-cabinets, where the first response information includes an identification tag of the sub-cabinet;
the address allocation module is used for generating address allocation information with each identification tag and a target address corresponding to each identification tag through the main cabinet and sending the address allocation information to each auxiliary cabinet;
and the address setting module is used for responding to the address allocation information through each auxiliary cabinet and respectively setting equipment addresses for each auxiliary cabinet.
The application further provides an intelligent cabinet, the intelligent cabinet includes: a main cabinet, at least one auxiliary cabinet memory, a processor and a program of the address allocation method stored on the memory and operable on the processor, the program of the address allocation method being executable by the processor to implement the steps of the address allocation method as described above.
The present application also provides a readable storage medium having stored thereon a program for implementing an address allocation method, the program implementing the steps of the address allocation method as described above when executed by a processor.
The present application also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of the address allocation method as described above.
The application provides an address allocation method, an intelligent cabinet, a readable storage medium and a computer program product, compared with the technical means of setting equipment addresses through dial switches or software configuration adopted in the prior art, the method comprises the steps of firstly sending report request information to each auxiliary cabinet through the main cabinet, then respectively returning first response information responding to the report request information to the main cabinet through each auxiliary cabinet, wherein the first response information comprises identification tags of the auxiliary cabinets, further generating address allocation information with the identification tags and target addresses corresponding to the identification tags through the main cabinet, further realizing the purpose of allocating the target addresses to the auxiliary cabinets based on the identification tags of the auxiliary cabinets through the main cabinet, and sending the address allocation information to the auxiliary cabinets, and each auxiliary cabinet responds to the address allocation information, and an equipment address is set for each auxiliary cabinet respectively, so that the aim of accurately transmitting the target address corresponding to each auxiliary cabinet is fulfilled, the equipment address is automatically set for each auxiliary cabinet, manual operation of a user is not needed, and the technical defect that in the prior art, when the equipment address is set by the user through a dial switch or software configuration, if the number of the auxiliary cabinets is large, the operation of manually setting the equipment address through the traditional method is complicated, the workload is large, and the address allocation efficiency is low is further overcome, so that the address allocation efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a first embodiment of an address assignment method according to the present application;
fig. 2 is a schematic flow chart illustrating the process of allocating the device address through the main cabinet in the address allocation method of the present application;
fig. 3 is a schematic view illustrating a process of allocating an address of a device in response to a report request message by the sub-cabinet in the address allocation method of the present application;
FIG. 4 is a flowchart illustrating a second embodiment of the address assignment method of the present application;
fig. 5 is a schematic flow chart illustrating the process of querying the number of the sub cabinets at regular time by the main cabinet in the address allocation method of the present application;
fig. 6 is a schematic flow chart illustrating the process of querying the number of the sub cabinets in response to the timing by the sub cabinet in the address allocation method of the present application;
fig. 7 is a schematic device structure diagram of a hardware operating environment related to an address assignment method in the embodiment of the present application.
The objectives, features, and advantages of the present application will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
At present, communication modes such as RS485 and Ethernet are generally adopted for communication between a main cabinet and an auxiliary cabinet of an intelligent cabinet, and the communication modes are usually used for setting equipment addresses for the main cabinet and the auxiliary cabinet in the intelligent cabinet through manual setting of dial switches or software configuration.
An embodiment of the present application provides an address allocation method, which is applied to an intelligent cabinet, where the intelligent cabinet includes a main cabinet and at least one auxiliary cabinet, and in a first embodiment of the address allocation method of the present application, referring to fig. 1, the address allocation method includes:
step S10, sending report request information to each auxiliary cabinet through the main cabinet;
in this embodiment, it should be noted that the address assignment method is applied to an intelligent cabinet, where the intelligent cabinet includes a main cabinet, at least one auxiliary cabinet, and a communication bus, where the communication bus is a channel for performing communication between the main cabinet and the auxiliary cabinet, the main cabinet sends information to the auxiliary cabinet through the communication bus, and the auxiliary cabinet returns response information to the main cabinet through the communication bus after receiving the information sent by the main cabinet. The reporting request information is a radio command generated by the main cabinet, and is used for requesting each sub-cabinet to report its own identity tag through the main cabinet, and the reporting request information includes the main cabinet identity tag of the main cabinet, where the main cabinet identity tag is an identifier representing the identity of the main cabinet, and may be an unique ID of the MCU of the main cabinet, or may be a preset character string.
And sending reporting request information to each auxiliary cabinet through the main cabinet, specifically, sending reporting request information to each auxiliary cabinet through the main cabinet when detecting that a communication bus of the intelligent cabinet is in an idle state.
Before the step of sending report request information to each of the sub-cabinets through the main cabinet, the address allocation includes:
step S11, reading the level of the adapter power supply interface;
in this embodiment, it should be noted that the intelligent cabinet includes an adapter power supply interface, and the adapter power supply interface is an interface for supplying voltage to the main cabinet and each of the sub-cabinets.
Reading the level of an adapter power supply interface, specifically, connecting a pin of a GPIO (general purpose input/output) to the adapter power supply interface, and outputting the level of the adapter power supply interface through the pin of the GPIO.
Step S12, if the level is high level, determining that the cabinet corresponding to the adapter power supply interface is the main cabinet;
and step S13, if the level is a low level, determining that the cabinet corresponding to the adapter power supply interface is the sub-cabinet.
Step S20, returning first response information in response to the report request information to the main cabinet through each of the sub-cabinets, wherein the first response information includes an identification tag of the sub-cabinet;
in this embodiment, it should be noted that when two sub-cabinets simultaneously send information to the main cabinet through the communication bus, a disorder of the communication bus may be caused, that is, the communication bus may only be used to carry a communication process between one sub-cabinet and the main cabinet at the same time point, the first response delay time is a time required to delay responding to the report request information through the sub-cabinet, the first response information is a response radio command generated by the sub-cabinet, and is used to respond to the report request information through each sub-cabinet, the identity identification tag is an identifier representing an identity of the sub-cabinet, and may be an MCU unique ID of the sub-cabinet, or may be a preset character string.
And returning first response information responding to the reporting request information to the main cabinet through each auxiliary cabinet, wherein the first response information comprises an identification tag of the auxiliary cabinet, specifically, receiving the reporting request information through the auxiliary cabinet, and generating first response delay time, wherein the first response delay time is calculated from the fact that the reporting request information is received through the auxiliary cabinet, and further, after the corresponding first response delay time reaches, returning the first response information responding to the reporting request information to the main cabinet respectively, so as to prevent the first response information from colliding on the communication bus to cause communication bus disorder, and thus, the efficiency of data transmission is improved.
Wherein the step of returning first response information in response to the report request information to the main cabinet through each of the sub-cabinets respectively, where the first response information includes an identification tag of the sub-cabinet, further includes:
step S21, receiving the report request information through the auxiliary cabinet and generating a first response delay time;
in this embodiment, it should be noted that the first response delay time corresponding to each of the sub-cabinets may be set differently.
Receiving the report request information by the sub-cabinets and generating a first response delay time, specifically, receiving the report request information by the sub-cabinets and randomly generating a first response delay time corresponding to the sub-cabinets, for example, randomly generating a random number by using a newRandom () function or a math.
Step S22, when the first response delay time is reached, returning first response information responding to the report request information to the main cabinet through the auxiliary cabinet.
In this embodiment, after the first response delay time arrives, the sub-cabinet returns the first response information in response to the report request information to the main cabinet, and specifically, after the first response delay time arrives, the sub-cabinet sends the first response information in response to the report request information to the main cabinet, and further detects whether the communication bus is disordered through a communication state line corresponding to the communication bus, where the communication state line is a state line used for detecting whether there are at least two sub-cabinets that simultaneously return response information to the main cabinet to cause communication disturbance, and further if no disturbance occurs, it is verified that there is no same first response delay time, and if there is disturbance, it is verified that there are at least two sub-cabinets that correspond to the same first response delay time, that is, there are at least two sub-cabinets that simultaneously return the first response information in response to the report request information to the main cabinet, and leading the two first response messages to be redundant and complicated mutually, so that the communication state line is disordered, deleting the first response messages at the moment, and returning to execute the step of sending the report request information to each auxiliary cabinet through the main cabinet.
After the step of returning the first response information in response to the report request information to the main cabinet by each of the sub-cabinets, respectively, the address allocation method further includes:
step S23, start the first response receiving period timing, and stop receiving the first response information sent by the sub-cabinet through the main cabinet after the first response receiving period timing is ended.
In this embodiment, it should be noted that the first response receiving period is a time period during which the main cabinet receives first response information returned by each of the sub-cabinets in response to the report request information.
Starting a first response receiving period timing, and after the first response receiving period timing is ended, stopping receiving first response information sent by the auxiliary cabinet through the main cabinet, specifically, after first response information responding to the report request information is respectively returned to the main cabinet through each auxiliary cabinet, starting the first response receiving period timing through the main cabinet, and continuously receiving first response information responding to the report request information returned by each auxiliary cabinet through the main cabinet in the first response receiving period, and further after the first response receiving period is ended, stopping receiving the first response information sent by the auxiliary cabinet through the main cabinet, so as to avoid communication obstacles possibly caused by the fact that the main cabinet and the auxiliary cabinet wait for too long time.
Step S30, generating, by the main cabinet, address assignment information including each of the identification tags and a destination address corresponding to each of the identification tags, and sending the address assignment information to each of the sub-cabinets;
in this embodiment, it should be noted that the address assignment information is a ping command generated by the main cabinet, and is used to send, to each of the sub-cabinets, an identification tag of each of the sub-cabinets and a target address corresponding to each of the identification tags through the main cabinet, where the address assignment information may include a main cabinet identification tag of the main cabinet and a main cabinet target address of the main cabinet, so that the sub-cabinet accurately sends response information to the main cabinet based on the main cabinet target address.
Generating, by the main cabinet, address assignment information including each of the identification tags and a target address corresponding to each of the identification tags, and sending the address assignment information to each of the sub-cabinets, specifically, after a first response receiving period is timed, according to a first response message that is returned by each of the sub-cabinets received by the main cabinet in the first response receiving period and is in response to the report request information, sorting the identification tags in the first response message to obtain an identification tag sequence, and according to the identification tag sequence, allocating a target address to each of the sub-cabinets to obtain a target address sequence, and further combining the identification tag sequence and the target address sequence, where, for example, the identification tag sequence may represent a sequential result of the identification tags corresponding to the sub-cabinets, the target address sequence can be expressed as a sequence result of allocating a target address to each of the identification tags, and is expressed as an (sub-cabinet, identification tag, target address), a merging result obtained after merging is an (sub-cabinet, identification tag, target address), according to the merging result, a mapping relationship between the identification tag corresponding to each of the sub-cabinets and each of the target addresses is determined, and then address allocation information having each of the identification tags and the target address corresponding to each of the identification tags is generated, and then the address allocation information is sent to each of the sub-cabinets through the main cabinet.
The step of generating, by the main cabinet, address assignment information including each of the identification tags and a destination address corresponding to each of the identification tags, and sending the address assignment information to each of the sub-cabinets further includes:
step S31, sequencing each identification tag through the main cabinet to obtain an identification tag sequence;
in this embodiment, it should be noted that the identification tag sequence is a sorting result obtained by sorting the identification tags.
The method includes the steps that the main cabinet sorts the identification labels to obtain an identification label sequence, specifically, the main cabinet sorts the identification labels according to a preset sorting mode, wherein the preset sorting mode includes a mode that the identification labels are sorted from small to large or from large to small, a sorting result is obtained, and the sorting result is used as the identification label sequence.
Step S32, generating a target address sequence by assigning the target address to each of the sub cabinets based on the id tag sequence;
in this embodiment, a target address sequence is generated by allocating a target address to each of the sub-cabinets based on the identification tag sequence, and specifically, a target address is allocated to each of the sub-cabinets according to the identification tag sequence, for example, if the number of the identification tags received by the main cabinet is 3, the target address of each of the sub-cabinets can be allocated to be 1 to 5, the identification tags are sorted from small to large, the target address corresponding to the smallest identification tag is set to be 1, the target address corresponding to the identification tag sequentially arranged in the second order is set to be 2, the target address corresponding to the largest identification tag is set to be 3, and the target addresses of 3 sub-cabinets are allocated, so that the target address sequence can be obtained.
Step S33, generating the address assignment information based on the id tag sequence and the target address sequence.
In this embodiment, the address assignment information is generated based on the identification tags and the target addresses corresponding to the identification tags, and specifically, the identification tag sequence and the target address sequence are combined according to the identification tag sequence and the target address sequence, a mapping relationship between the identification tags corresponding to the sub-cabinets and the target addresses is determined, and then the address assignment information having the identification tags and the target addresses corresponding to the identification tags is generated.
Step S40, setting an equipment address for each of the sub cabinets in response to the address assignment information by each of the sub cabinets, respectively.
In this embodiment, each of the sub-cabinets responds to the address allocation information to set an equipment address for each of the sub-cabinets, specifically, each of the sub-cabinets receives the address allocation information, and queries, from among the identification tags in the address allocation information, an identification tag that is consistent with a local identification tag locally stored in the sub-cabinet, thereby setting a target address corresponding to the identification tag as the equipment address of the sub-cabinet, and returns third response information responding to the address allocation information to the main cabinet through the sub-cabinet, respectively, where the third response information is a response ping command generated by the sub-cabinet, and is used for the sub-cabinet to respond to the address allocation information sent by the main cabinet to the sub-cabinet, and the third response information may include the main cabinet identification tag of the main cabinet, The target address of the main cabinet, the identification label of each auxiliary cabinet and the target address corresponding to the identification label of each auxiliary cabinet are different, wherein the equipment address of each auxiliary cabinet is different, and one auxiliary cabinet which uniquely corresponds to one equipment address can be set.
Wherein the step of setting an equipment address for each of the sub-cabinets respectively in response to the address allocation information by each of the sub-cabinets further comprises:
step S41, inquiring a target identification label consistent with a local identification label locally stored in the auxiliary cabinet from the identification labels in the address allocation information through the auxiliary cabinet;
in this embodiment, it should be noted that the target identification tag is a tag in which an identification tag in the address assignment information is consistent with a local identification tag locally stored in the secondary cabinet.
And querying, by the sub-cabinet, a target identification tag that is consistent with a local identification tag locally stored in the sub-cabinet among the identification tags in the address allocation information, specifically, receiving, by the sub-cabinet, the address allocation information sent by the main cabinet, and querying, according to the local identification tag locally stored in the sub-cabinet, the target identification tag that is consistent with the local identification tag among the identification tags in the address allocation information.
And step S42, setting the target address corresponding to the target identity identification label as the equipment address of the auxiliary cabinet.
In this embodiment, the target address corresponding to the target identification tag is set as the device address of the secondary cabinet, specifically, when it is found that the identification tag in the address assignment information is consistent with the local identification tag locally stored in the secondary cabinet, the target address corresponding to the identification tag is set as the device address of the secondary cabinet, and then third response information responding to the address assignment information is returned to the primary cabinet through each secondary cabinet.
Further, fig. 2 is a schematic flow chart of allocating an equipment address through the main cabinet in the address allocation method of the present application, where i is a target address corresponding to the identification tag of the sub-cabinet, and fig. 3 is a schematic flow chart of allocating an equipment address through the sub-cabinet responding to the report request information in the address allocation method of the present application.
Compared with the technical means of setting the equipment address through a dial switch or software configuration adopted in the prior art, the method for allocating the address comprises the steps that the main cabinet sends reporting request information to each auxiliary cabinet, then the auxiliary cabinets return first response information responding to the reporting request information to the main cabinet respectively, wherein the first response information comprises identification tags of the auxiliary cabinets, further, the main cabinet generates address allocation information with the identification tags and target addresses corresponding to the identification tags, the purpose of allocating the target addresses to the auxiliary cabinets through the identification tags of the main cabinet based on the auxiliary cabinets is achieved, the address allocation information is sent to the auxiliary cabinets, and then the auxiliary cabinets respond to the address allocation information, the method and the device for distributing the addresses of the auxiliary cabinets have the advantages that the equipment addresses are set for the auxiliary cabinets respectively, and the aim of accurately transmitting the target addresses corresponding to the auxiliary cabinets is achieved, so that the equipment addresses are automatically set for the auxiliary cabinets, manual operation of a user is not needed, the technical defect that when the equipment addresses are set by the user through dial switches or software configuration in the prior art, if the number of the auxiliary cabinets is large, the operation of manually setting the equipment addresses through traditional workers is complex, the workload is large, and the efficiency of address distribution is low is further caused is overcome, and the efficiency of address distribution is improved.
Further, referring to fig. 4, based on the first embodiment in the present application, in another embodiment of the present application, after the step of setting the device address for each of the sub-cabinets in response to the address allocation information by each of the sub-cabinets, respectively, the address allocation method further includes:
step A10, judging whether quantity inquiry information sent by the main cabinet to each auxiliary cabinet at regular time is received by the auxiliary cabinet;
in this embodiment, it should be noted that the quantity query information is a tick command generated by the main cabinet, and is used for querying the quantity of each of the sub-cabinets through the main cabinet.
Specifically, after the distribution of the device addresses for each of the sub cabinets by the main cabinet is completed, a timer is started by the main cabinet to set a timing time, so that the number inquiry information is periodically sent to each of the sub cabinets by the main cabinet, and whether the number inquiry information sent to each of the sub cabinets by the main cabinet is received by the sub cabinets is judged within a preset time, wherein the preset time is the time from sending the number inquiry information by the main cabinet to receiving the number inquiry information by the sub cabinets.
Step A20, if yes, returning second response information responding to the quantity inquiry information to the main cabinet through each auxiliary cabinet so as to judge whether each auxiliary cabinet is abnormal;
in this embodiment, it should be noted that the second response message is a response tick command generated by the secondary cabinet, and is used for responding to the quantity query message by the secondary cabinet.
If so, returning second response information responding to the quantity inquiry information to the main cabinet through each auxiliary cabinet to judge whether each auxiliary cabinet is abnormal, specifically, if so, proving that the auxiliary cabinet receives the quantity inquiry information, further randomly generating second response delay time corresponding to the auxiliary cabinet, after the second response delay time arrives, sending the second response information responding to the quantity inquiry information to the main cabinet through the auxiliary cabinet, further detecting whether the communication bus is disordered through a communication state line corresponding to the communication bus, if not, proving that the same second response delay time does not exist, if so, proving that the second response delay time corresponding to at least two auxiliary cabinets is the same, namely, at least two auxiliary cabinets simultaneously return the second response information responding to the report request information to the main cabinet, and causing the two second response messages to be redundant and complicated, so that the communication state line is disturbed, deleting the second response messages at the moment, and returning to the step of sending the quantity inquiry information to each auxiliary cabinet at regular time through the main cabinet.
Wherein the step of returning second response information in response to the quantity query information to the main cabinet through each of the sub-cabinets to determine whether each of the sub-cabinets is abnormal includes:
step B10, receiving second response information from each sub-cabinet to the main cabinet through the main cabinet;
in this embodiment, the main cabinet receives second response information that is returned by each of the sub-cabinets to the main cabinet in response to the quantity query information, and specifically, after the second response information that is returned by each of the sub-cabinets to the main cabinet in response to the quantity query information, the main cabinet starts second response receiving cycle timing, where the second response receiving cycle is a time period during which the main cabinet receives the second response information that is returned by each of the sub-cabinets in response to the quantity query information. And in the second response receiving period, continuously receiving second response information returned by each auxiliary cabinet through the main cabinet and responding to the quantity inquiry information, and further stopping receiving the second response information sent by the auxiliary cabinets through the main cabinet after the second response receiving period is ended so as to avoid communication obstacles possibly caused by the fact that the main cabinet and the auxiliary cabinets wait for too long.
Step B20, if the number of the second response messages is greater than the number of the first response messages, determining that the sub-cabinets have an abnormal address allocation, and returning to execute the step of sending report request messages to the sub-cabinets through the main cabinet;
in this embodiment, if the number of the second response messages is greater than the number of the first response messages, determining that the sub-cabinet has an abnormal address allocation, and returning to the step of sending report request information to each sub-cabinet through the main cabinet, specifically, after the second response receiving period is timed, comparing the quantity of the second response information with the quantity of the first response information according to second response information received in the second response receiving period by the main cabinet, if the quantity of the second response information is larger than the quantity of the first response information, proving that an auxiliary cabinet without an allocated equipment address exists, and then returning to the step of sending the report request information to each auxiliary cabinet through the main cabinet, so as to re-distribute the equipment address for each auxiliary cabinet through the main cabinet.
Step B30, if the number of the second response messages is equal to the number of the first response messages, determining that no address allocation abnormality has occurred in the sub-cabinet, and returning to the step of determining whether the number query message sent to each sub-cabinet by the main cabinet at regular time is received by the sub-cabinet;
in this embodiment, specifically, if the number of the second response messages is equal to the number of the first response messages, it is determined that no address allocation abnormality has occurred in the sub-cabinet, and the step of determining whether the number query message sent to each sub-cabinet by the main cabinet is received by the sub-cabinet is further performed.
Step B40, if the number of the second response information is smaller than the number of the first response information, determining that the sub-cabinet has a fault, and eliminating the equipment address of the sub-cabinet which does not return the second response information to the main cabinet.
In this embodiment, if the number of the second response information is smaller than the number of the first response information, it is determined that the sub-cabinet has a fault, and an equipment address of the sub-cabinet that does not return the second response information to the main cabinet is removed, specifically, if the number of the second response information is smaller than the number of the first response information, it is verified that the sub-cabinet has a fault, and then the equipment address of the sub-cabinet that does not return the second response information to the main cabinet is removed by the main cabinet, and a fault is reported to an equipment maintainer for maintenance.
Step A30, if not, determining that the main cabinet has a fault, reselecting the main cabinet from the auxiliary cabinets, and returning to execute the step of sending the report request information to the auxiliary cabinets through the main cabinet.
In this embodiment, specifically, if not, it is determined that the main cabinet has a fault, that is, the number query information periodically sent to each of the sub-cabinets by the main cabinet cannot be received by the sub-cabinets, and then the sub-cabinet with the smallest identification tag is selected from the sub-cabinets as a new main cabinet, and the step of sending report request information to each of the sub-cabinets by the main cabinet is performed in return, so as to reallocate an equipment address, and report the faulty main cabinet to an equipment maintainer for maintenance.
Further, fig. 5 is a schematic flow chart of the address allocation method of the present application for regularly querying the number of the sub cabinets through the main cabinet, and fig. 6 is a schematic flow chart of the address allocation method of the present application for regularly querying the number of the sub cabinets through the sub cabinet response.
The embodiment of the application provides a method for regularly detecting abnormity, namely, whether quantity inquiry information sent to each auxiliary cabinet by a main cabinet regularly is received by the auxiliary cabinets is judged to judge whether the main cabinet breaks down or not, if so, second response information responding to the quantity inquiry information is returned to the main cabinet by each auxiliary cabinet to judge whether each auxiliary cabinet breaks down or not, if not, the main cabinet breaks down is judged to be broken down, the main cabinet is reselected from each auxiliary cabinet, the step of sending report request information to each auxiliary cabinet by the main cabinet is executed in a return mode, the fault is reported to an equipment maintainer for maintenance, the purpose of regularly detecting abnormity is achieved, and further, when the main cabinet breaks down or the auxiliary cabinets break down, equipment addresses are automatically distributed to each auxiliary cabinet again, need not user manual operation, set up the basis for overcoming the user through dial switch or software configuration and set up the equipment address, if vice cabinet takes place unusually or main cabinet breaks down, it is loaded down with trivial details through traditional artifical manual setting equipment address operation, and work load is great, and then leads to the lower technical defect of efficiency of address allocation.
Referring to fig. 7, fig. 7 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present application.
As shown in fig. 7, the intelligent cabinet may include: a main cabinet, at least one sub-cabinet, a processor 1001, e.g., a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used for implementing connection communication between the processor 1001 and the memory 1005 and communication between the main cabinet and each of the sub-cabinets. The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a memory device separate from the processor 1001 described above.
Optionally, the intelligent cabinet may further include a rectangular user interface, a network interface, a camera, RF (Radio Frequency) circuitry, a sensor, audio circuitry, a WiFi module, and the like. The rectangular user interface may comprise a Display screen (Display), an input sub-module such as a Keyboard (Keyboard), and the optional rectangular user interface may also comprise a standard wired interface, a wireless interface. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface).
Those skilled in the art will appreciate that the smart cabinet configuration shown in fig. 7 does not constitute a limitation of the smart cabinet and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
As shown in fig. 7, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, and an address assignment program. The operating system is a program for managing and controlling hardware and software resources of the intelligent cabinet, and supports the operation of an address allocation program and other software and/or programs. The network communication module is used to enable communication between the various components within the memory 1005, as well as with other hardware and software in the address assignment system.
In the intelligent cabinet shown in fig. 7, the processor 1001 is configured to execute an address assignment program stored in the memory 1005, and implement the steps of the address assignment method described in any one of the above.
The specific implementation of the intelligent cabinet is basically the same as that of the above embodiments of the address allocation method, and is not described herein again.
The embodiment of the present application further provides an address allocation apparatus, where the address allocation apparatus is applied to an intelligent cabinet, and the address allocation apparatus includes:
a report request module, configured to send report request information to each of the sub-cabinets through the main cabinet;
a response module, configured to return, to the main cabinet, first response information in response to the report request information through each of the sub-cabinets, where the first response information includes an identification tag of the sub-cabinet;
the address allocation module is used for generating address allocation information with each identification tag and a target address corresponding to each identification tag through the main cabinet and sending the address allocation information to each auxiliary cabinet;
and the address setting module is used for responding to the address allocation information through each auxiliary cabinet and respectively setting equipment addresses for each auxiliary cabinet.
Optionally, the response module is further configured to:
receiving the report request information through the auxiliary cabinet and generating a first response delay time;
and when the first response delay time is up, returning first response information responding to the report request information to the main cabinet through the auxiliary cabinet.
Optionally, the address allocation module is further configured to:
sequencing the identity identification tags through the main cabinet to obtain an identity identification tag sequence;
generating a target address sequence by allocating the target address to each of the sub-cabinets based on the identification tag sequence;
generating the address assignment information based on the ID tag sequence and the target address sequence
Optionally, the address setting module is further configured to:
inquiring a target identity identification label consistent with a local identity identification label locally stored in the auxiliary cabinet in each identity identification label in the address allocation information through the auxiliary cabinet;
and setting the target address corresponding to the target identity identification tag as the equipment address of the auxiliary cabinet.
Optionally, the address allocating apparatus is further configured to:
and starting first response receiving period timing, and stopping receiving the first response information sent by the auxiliary cabinet through the main cabinet after the first response receiving period timing is ended.
Optionally, the address allocating apparatus is further configured to:
judging whether quantity inquiry information sent to each auxiliary cabinet by the main cabinet at regular time is received through the auxiliary cabinet;
if so, returning second response information responding to the quantity inquiry information to the main cabinet through each auxiliary cabinet so as to judge whether each auxiliary cabinet is abnormal or not;
if not, judging that the main cabinet has a fault, reselecting the main cabinet from the auxiliary cabinets, and returning to execute the step of sending the report request information to the auxiliary cabinets through the main cabinet.
Optionally, the address allocating apparatus is further configured to:
receiving second response information which is responded to the quantity inquiry information and is returned to the main cabinet by the auxiliary cabinets through the main cabinet;
if the number of the second response messages is larger than that of the first response messages, judging that the auxiliary cabinets have abnormal address allocation, and returning to execute the step of sending report request messages to the auxiliary cabinets through the main cabinet;
if the quantity of the second response information is equal to the quantity of the first response information, judging that the auxiliary cabinet is not abnormal in address allocation, and returning to execute the step of sending quantity query information to each auxiliary cabinet at regular time through the main cabinet;
and if the quantity of the second response information is less than that of the first response information, judging that the auxiliary cabinet has a fault, and eliminating the equipment address of the auxiliary cabinet which does not return the second response information to the main cabinet.
The specific implementation of the address allocation apparatus of the present application is substantially the same as that of the above-mentioned embodiments of the address allocation method, and is not described herein again.
The embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs are also executable by one or more processors for implementing the steps of the address allocation method described in any one of the above.
The specific implementation of the readable storage medium of the present application is substantially the same as the embodiments of the address allocation method, and is not described herein again.
The present application provides a computer program product, and the computer program product includes one or more computer programs, which can also be executed by one or more processors for implementing the steps of any one of the above address allocation methods.
The specific implementation of the computer program product of the present application is substantially the same as the embodiments of the address allocation method, and is not described herein again.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.

Claims (10)

1. An address allocation method, applied to an intelligent cabinet, wherein the intelligent cabinet comprises a main cabinet and at least one auxiliary cabinet, the address allocation method comprising:
sending reporting request information to each auxiliary cabinet through the main cabinet;
returning first response information responding to the reporting request information to the main cabinet through each auxiliary cabinet, wherein the first response information comprises an identity identification tag of the auxiliary cabinet;
generating address allocation information with each identification tag and a target address corresponding to each identification tag through the main cabinet, and sending the address allocation information to each auxiliary cabinet;
and responding to the address allocation information through each auxiliary cabinet, and respectively setting equipment addresses for each auxiliary cabinet.
2. The address assigning method according to claim 1, wherein the step of returning first response information in response to the report request information to the main cabinet through each of the sub-cabinets comprises:
receiving the report request information through the auxiliary cabinet and generating a first response delay time;
and when the first response delay time is up, returning first response information responding to the report request information to the main cabinet through the auxiliary cabinet.
3. The address assigning method of claim 1, wherein the step of generating, by the master cabinet, address assignment information having each of the identification tags and a destination address corresponding to each of the identification tags comprises:
sequencing the identity identification tags through the main cabinet to obtain an identity identification tag sequence;
generating a target address sequence by allocating the target address to each of the sub-cabinets based on the identification tag sequence;
and generating the address allocation information based on the identification label sequence and the target address sequence.
4. The address assigning method according to claim 1, wherein after the step of returning first response information in response to the report request information to the main cabinet through each of the sub-cabinets, the address assigning method further comprises:
and starting first response receiving period timing, and stopping receiving the first response information sent by the auxiliary cabinet through the main cabinet after the first response receiving period timing is ended.
5. The address assigning method of claim 1, wherein the step of setting the device address for each of the sub-cabinets in response to the address assignment information by each of the sub-cabinets, respectively, comprises:
inquiring a target identity identification label consistent with a local identity identification label locally stored in the auxiliary cabinet in each identity identification label in the address allocation information through the auxiliary cabinet;
and setting the target address corresponding to the target identity identification tag as the equipment address of the auxiliary cabinet.
6. The address assigning method according to claim 1, wherein after the step of setting the device address for each of the sub-cabinets in response to the address assignment information by each of the sub-cabinets, respectively, the address assigning method further comprises:
judging whether quantity inquiry information sent to each auxiliary cabinet by the main cabinet at regular time is received through the auxiliary cabinet;
if so, returning second response information responding to the quantity inquiry information to the main cabinet through each auxiliary cabinet so as to judge whether each auxiliary cabinet is abnormal or not;
if not, judging that the main cabinet has a fault, reselecting the main cabinet from the auxiliary cabinets, and returning to execute the step of sending the report request information to the auxiliary cabinets through the main cabinet.
7. The address assigning method according to claim 6, wherein the step of returning second response information in response to the quantity inquiry information to the main cabinet through each of the sub-cabinets to determine whether each of the sub-cabinets is abnormal includes:
receiving second response information which is responded to the quantity inquiry information and is returned to the main cabinet by the auxiliary cabinets through the main cabinet;
if the number of the second response messages is larger than that of the first response messages, judging that the auxiliary cabinets have abnormal address allocation, and returning to execute the step of sending report request messages to the auxiliary cabinets through the main cabinet;
if the number of the second response messages is equal to the number of the first response messages, judging that the auxiliary cabinet is not abnormal in address allocation, and returning to execute the judgment whether the number query messages sent to each auxiliary cabinet by the main cabinet at regular time are received through the auxiliary cabinet;
and if the quantity of the second response information is less than that of the first response information, judging that the auxiliary cabinet has a fault, and eliminating the equipment address of the auxiliary cabinet which does not return the second response information to the main cabinet.
8. An intelligent cabinet, characterized in that the intelligent cabinet comprises: a main cabinet, at least one sub-cabinet, a memory, a processor, and a program stored on the memory for implementing the address allocation method,
the memory is used for storing a program for realizing the address allocation method;
the processor is configured to execute a program implementing the address allocation method to implement the steps of the address allocation method according to any one of claims 1 to 7.
9. A readable storage medium, characterized in that the readable storage medium has stored thereon a program for implementing an address allocation method, the program being executed by a processor to implement the steps of the address allocation method according to any one of claims 1 to 7.
10. A computer program product comprising a computer program, wherein the computer program when executed by a processor implements the steps of the device address assignment method as claimed in any one of claims 1 to 7.
CN202110524842.7A 2021-05-13 2021-05-13 Address allocation method, intelligent cabinet, readable storage medium and computer program product Active CN113299006B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110524842.7A CN113299006B (en) 2021-05-13 2021-05-13 Address allocation method, intelligent cabinet, readable storage medium and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110524842.7A CN113299006B (en) 2021-05-13 2021-05-13 Address allocation method, intelligent cabinet, readable storage medium and computer program product

Publications (2)

Publication Number Publication Date
CN113299006A true CN113299006A (en) 2021-08-24
CN113299006B CN113299006B (en) 2022-05-20

Family

ID=77322065

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110524842.7A Active CN113299006B (en) 2021-05-13 2021-05-13 Address allocation method, intelligent cabinet, readable storage medium and computer program product

Country Status (1)

Country Link
CN (1) CN113299006B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500469A (en) * 2022-04-15 2022-05-13 深圳曼顿科技有限公司 Automatic identification and address allocation method for intelligent electric equipment
CN114584020A (en) * 2022-05-05 2022-06-03 广东科伺智能科技有限公司 Servo system
CN117424352A (en) * 2023-12-19 2024-01-19 浙江简捷物联科技有限公司 Master-slave autonomous switching method and system for energy storage cabinet

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102088383A (en) * 2010-11-23 2011-06-08 深圳市豪恩安全科技有限公司 Online slave query and response method and device, bus system
CN109936640A (en) * 2017-12-19 2019-06-25 苏州阿特斯阳光电力科技有限公司 From the address distribution method and device of node device
CN109981821A (en) * 2019-04-10 2019-07-05 深圳市信锐网科技术有限公司 Distribution method, system, device, equipment and the medium of Internet of Things bus address
CN110377871A (en) * 2019-06-12 2019-10-25 深圳市智莱科技股份有限公司 Determine the method and system of secondary cabinet position in Intelligent storage cabinet system
CN110933194A (en) * 2019-11-05 2020-03-27 珠海格力电器股份有限公司 Automatic address allocation method, equipment and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102088383A (en) * 2010-11-23 2011-06-08 深圳市豪恩安全科技有限公司 Online slave query and response method and device, bus system
CN109936640A (en) * 2017-12-19 2019-06-25 苏州阿特斯阳光电力科技有限公司 From the address distribution method and device of node device
CN109981821A (en) * 2019-04-10 2019-07-05 深圳市信锐网科技术有限公司 Distribution method, system, device, equipment and the medium of Internet of Things bus address
CN110377871A (en) * 2019-06-12 2019-10-25 深圳市智莱科技股份有限公司 Determine the method and system of secondary cabinet position in Intelligent storage cabinet system
CN110933194A (en) * 2019-11-05 2020-03-27 珠海格力电器股份有限公司 Automatic address allocation method, equipment and system

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500469A (en) * 2022-04-15 2022-05-13 深圳曼顿科技有限公司 Automatic identification and address allocation method for intelligent electric equipment
CN114500469B (en) * 2022-04-15 2022-07-08 深圳曼顿科技有限公司 Automatic identification and address allocation method for intelligent electric equipment
CN114584020A (en) * 2022-05-05 2022-06-03 广东科伺智能科技有限公司 Servo system
CN114584020B (en) * 2022-05-05 2022-07-15 广东科伺智能科技有限公司 Servo system
CN117424352A (en) * 2023-12-19 2024-01-19 浙江简捷物联科技有限公司 Master-slave autonomous switching method and system for energy storage cabinet
CN117424352B (en) * 2023-12-19 2024-03-12 浙江简捷物联科技有限公司 Master-slave autonomous switching method and system for energy storage cabinet

Also Published As

Publication number Publication date
CN113299006B (en) 2022-05-20

Similar Documents

Publication Publication Date Title
CN113299006B (en) Address allocation method, intelligent cabinet, readable storage medium and computer program product
US10409251B2 (en) Automatic inspection and monitoring method based on time domain slotting control
CN106412091A (en) Method, device and system for controlling data transmission
CN106101299B (en) Method for assigning address to indoor unit and multi-line system
WO2022127504A1 (en) Network element management method and apparatus, and storage medium
CN103298016A (en) Test system for mobile terminals
CN104092774A (en) Software defined network connection establishment control method and device
CN105338078A (en) Data storage method and device used for storing system
CN105808407A (en) Equipment management method, equipment and equipment management controller
CN106888100B (en) Ethernet power supply switch and power supply method thereof
CN114116014A (en) Instruction issuing method and device, intelligent equipment and storage medium
CN112953774A (en) Network topology generation method, system, equipment and computer storage medium
CN108710534A (en) The tune of multi-process plays method, apparatus, terminal device and computer storage media
CN109462522A (en) A kind of state monitoring method of external terminal device, terminal and its system
CN113658351B (en) Method and device for producing product, electronic equipment and storage medium
CN104468337A (en) Message transmission method and device, message management center device and data centers
CN105740180A (en) Virtual machine access method and apparatus for USB device
WO2020093910A1 (en) Wireless access platform and switching method
CN109388498B (en) Mutual exclusion processing method, device, equipment and medium
CN103152386A (en) Business data distribution server and business data distribution method thereof
CN106919488B (en) Method and device for determining response state of application program
CN112532524B (en) Message processing method and device
CN108989057A (en) A kind of AI intelligent power supply method of POE interchanger
CN111064599B (en) Method and system for monitoring plug-in migration
CN112995704B (en) Cache management method and device, electronic equipment and storage 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