CN115878551A - Method and system for communication between main equipment and sub-equipment - Google Patents

Method and system for communication between main equipment and sub-equipment Download PDF

Info

Publication number
CN115878551A
CN115878551A CN202211721115.0A CN202211721115A CN115878551A CN 115878551 A CN115878551 A CN 115878551A CN 202211721115 A CN202211721115 A CN 202211721115A CN 115878551 A CN115878551 A CN 115878551A
Authority
CN
China
Prior art keywords
instruction
equipment
sub
list
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
CN202211721115.0A
Other languages
Chinese (zh)
Other versions
CN115878551B (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.)
Guangzhou Felicity Solar Technology Co ltd
Original Assignee
Guangzhou Felicity Solar 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 Guangzhou Felicity Solar Technology Co ltd filed Critical Guangzhou Felicity Solar Technology Co ltd
Priority to CN202211721115.0A priority Critical patent/CN115878551B/en
Publication of CN115878551A publication Critical patent/CN115878551A/en
Application granted granted Critical
Publication of CN115878551B publication Critical patent/CN115878551B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a method and a system for communication between main equipment and sub-equipment. The method comprises the following steps: s1, the sub-equipment starts timing and waits for receiving an instruction sent by the main equipment; s2, if the sub-equipment receives the instruction, judging whether the instruction exists in an instruction list of the sub-equipment or not; s3, if the instruction exists in the instruction list, increasing one bit for the instruction frequency value, acquiring response instruction data from a cache region of the instruction, and sending the response instruction data to the main equipment; s4, if the instruction does not exist in the instruction list, adding the instruction into the instruction list, assigning the frequency value of the instruction to 1 and the weight value of the instruction to 1, forwarding the instruction to a machine, and sending response instruction data of the machine to the main equipment; and S5, the sub-equipment finishes timing, assigns the frequency value of each instruction to the corresponding instruction weight, and restarts timing. The invention reduces the time for the sub-equipment to forward the instruction to the machine and the time for the machine to answer the instruction to the sub-equipment, and improves the instruction response speed.

Description

Method and system for communication between main equipment and sub-equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and a system for communicating between a master device and a slave device.
Background
Generally, the topology of the communication system between the internet of things devices is shown in fig. 1, and mainly includes a main device 101, one or more sub devices 102, one or more machines 103 configured with the sub devices, and instructions thereof. Wherein the higher the machine complexity, the more instructions. The communication medium of the main device 101 and the sub-device 102 can be zigbee, wiFi or RS485, and the communication medium of the sub-device and the machine is RS232, TTL or RS485. The sub-device 102 implements forwarding functions of different communication media, when the main device 101 acquires data of a machine, it needs to send a machine instruction to the sub-device 102 first, the sub-device 102 forwards the instruction to the machine, after the machine responds to the instruction, it sends a response instruction to the sub-device 102, and after receiving the response instruction of the machine, the sub-device 102 forwards the response instruction to the gateway.
In the existing communication system between the Internet of things devices, the sub-devices adopt a forwarding function, so that the diversification of machines can be met. However, when the data volume of the machine is large, the time delay of the main device for acquiring the machine data is large; the time for the main device to acquire the machine data = the time from the sending instruction to the sub-device t1 (104) + the time from the sub-device forwarding instruction to the machine t2 (105) + the time from the machine response instruction to the sub-device t3 (106) + the time from the sub-device forwarding response instruction to the main device t4 (107).
Based on the above disadvantages of the communication method, it is necessary to provide a method and system for communication between the main device and the sub-devices.
Disclosure of Invention
The invention aims to provide a method and a system for communication between a main device and a sub-device, which are used for overcoming the defects in the prior art.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
the communication method of the main equipment and the sub-equipment comprises the following steps:
s1, the sub-equipment starts timing and waits for receiving an instruction sent by the main equipment;
s2, if the sub-equipment receives the instruction, judging whether the instruction exists in an instruction list of the sub-equipment or not;
s3, if the instruction exists in the instruction list, increasing one bit for the instruction frequency value, acquiring response instruction data from a cache region of the instruction, and sending the response instruction data to the main equipment;
s4, if the instruction does not exist in the instruction list, adding the instruction into the instruction list, assigning 1 to the frequency value of the instruction and assigning 1 to the weight value of the instruction, forwarding the instruction to a machine, and sending response instruction data of the machine to the main equipment;
and S5, the sub-equipment finishes timing, assigns the frequency value of each instruction to the corresponding instruction weight, and restarts timing.
Further, the step of determining whether the instruction exists in the instruction table of the child device in step S2 is:
an assigned base value of 0;
starting traversing the instruction list for the first time, acquiring a first instruction of the instruction list, if the weight of the instruction is greater than the base number value, sending the instruction to the machine, then waiting for receiving a response instruction message of the machine, and after receiving the response instruction message of the machine, storing the response instruction message in a corresponding response data area in the instruction list; and then acquiring a second instruction of the instruction list until the whole instruction list is traversed.
Further, after the first traversal of the instruction list is finished, the base number value is changed to 1, secondary traversal of the instruction list is started, the first instruction of the instruction list is obtained, if the weight value of the instruction is larger than the base number value, the instruction is sent to the machine, a response instruction message of the machine is waited to be received, and after the response instruction message of the machine is received, the response instruction message is stored in a corresponding response data area in the instruction list; and then acquiring a second instruction of the instruction list until the whole instruction list is traversed.
The invention also provides a system according to the communication method between the main equipment and the sub-equipment, which comprises the following steps:
the timing module is used for the sub-equipment to start timing, wait for receiving the instruction sent by the main equipment and finish timing of the sub-equipment, assign the frequency value of each instruction to the corresponding instruction weight and restart timing;
the judging module is used for judging whether the command exists in a command list of the sub-equipment or not if the sub-equipment receives the command;
the obtaining module is used for increasing one bit for the instruction frequency value if the instruction exists in the instruction list, obtaining response instruction data from a cache region of the instruction and sending the response instruction data to the main equipment;
and the sending module is used for adding the instruction into the instruction table if the instruction does not exist in the instruction table, assigning 1 to the frequency value of the instruction and assigning 1 to the weight value of the instruction, forwarding the instruction to the machine, and sending response instruction data of the machine to the main equipment.
Compared with the prior art, the invention has the advantages that: according to the invention, the frequency algorithm is added to the sub-equipment, the received machine instruction is pre-judged, the response instruction data of the machine instruction is obtained in advance, the response instruction data of the instruction is directly returned after the machine instruction sent by the main equipment is received, the time t2 for the sub-equipment to forward the instruction to the machine and the time t3 for the machine to respond the instruction to the sub-equipment are reduced, and the response instruction speed is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a general topology diagram of a communication system between internet of things devices.
Fig. 2 is a flow chart of an implementation of the present invention.
FIG. 3 is a flow chart of the present invention for determining whether there is an instruction in the instruction list of the child device.
Fig. 4 is a schematic diagram of a master device and slave device communication system of the present invention.
Detailed Description
The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, and the scope of the present invention will be more clearly and clearly defined.
Referring to fig. 1 to 3, the present invention provides a method for a master device to communicate with a slave device, including the following steps:
s1, the sub-equipment starts timing and waits for receiving an instruction sent by the main equipment;
and S2, if the sub-equipment receives the instruction, judging whether the instruction exists in an instruction list of the sub-equipment.
Wherein, whether the instruction exists in the instruction list of the sub-equipment is judged: if the instruction list is traversed once each time, the base number value +1 is compared with the base number value through the weight value of the instruction, and the period of sending the instruction to the machine is determined, and the method specifically comprises the following steps:
the assigned base value is 0; starting traversing the instruction list for the first time, acquiring a first instruction of the instruction list, if the weight of the instruction is greater than the base number value, sending the instruction to the machine, then waiting for receiving a response instruction message of the machine, and after receiving the response instruction message of the machine, storing the response instruction message in a corresponding response data area in the instruction list; and then acquiring a second instruction of the instruction list until the whole instruction list is traversed.
After the first traversal of the instruction list is finished, the basic value is changed into +1 (the value is changed into 1), the second traversal of the instruction list is started, the first instruction of the instruction list is obtained, if the weight value of the instruction is larger than the basic value, the instruction is sent to a machine, a response instruction message of the machine is waited to be received, and after the response instruction message of the machine is received, the response instruction message is stored in a corresponding response data area in the instruction list; and then acquiring a second instruction of the instruction list until the whole instruction list is traversed.
And circulating the steps, assigning the base value to be 0 until all the instruction weights are smaller than the base value, and repeating the step of traversing the instruction table for the first time to restart traversing the instruction table.
S3, if the instruction exists in the instruction list, increasing one bit for the instruction frequency value, acquiring response instruction data from a cache region of the instruction, and sending the response instruction data to the main equipment;
s4, if the instruction does not exist in the instruction list, adding the instruction into the instruction list, assigning the frequency value of the instruction to 1 and assigning the weight value of the instruction to 1, forwarding the instruction to a machine, and sending response instruction data of the machine to the main equipment;
and S5, the timing of the sub-equipment is finished, the frequency value of each instruction is assigned to the corresponding instruction weight, and the timing is restarted.
The response flow of the sub-equipment comprises the following steps: and after the sub-equipment processes and receives the instruction sent by the main equipment, determining whether to use the response data of the response data area of the instruction list to return to the main equipment according to whether the instruction exists in the instruction list.
Referring to fig. 4, the present invention further provides a system according to the communication method between the master device and the slave device, including: the timing module 1 is used for the sub-equipment to start timing, wait for receiving the instruction sent by the main equipment, finish timing of the sub-equipment, assign the frequency value of each instruction to the corresponding instruction weight, and restart timing; the judging module 2 is used for judging whether the instruction exists in an instruction list of the sub-equipment or not if the sub-equipment receives the instruction; the obtaining module 3 is configured to increase the instruction frequency value by one bit if the instruction exists in the instruction table, obtain response instruction data from a cache region of the instruction, and send the response instruction data to the main device; and the sending module 4 is used for adding the instruction into the instruction table if the instruction does not exist in the instruction table, assigning 1 to the frequency value of the instruction and assigning 1 to the weight value of the instruction, forwarding the instruction to the machine, and sending response instruction data of the machine to the main equipment.
According to the invention, the frequency algorithm is added to the sub-equipment, the received machine instruction is pre-judged, the response instruction data of the machine instruction is obtained in advance, the response instruction data of the instruction is directly returned after the machine instruction sent by the main equipment is received, the time t2 for the sub-equipment to forward the instruction to the machine and the time t3 for the machine to respond the instruction to the sub-equipment are reduced, and the response instruction speed is improved.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, various changes or modifications may be made by the patentees within the scope of the appended claims, and within the scope of the invention, as long as they do not exceed the scope of the invention described in the claims.

Claims (4)

1. The communication method between the main equipment and the sub-equipment is characterized by comprising the following steps:
s1, the sub-equipment starts timing and waits for receiving an instruction sent by the main equipment;
s2, if the sub-equipment receives the instruction, judging whether the instruction exists in an instruction list of the sub-equipment or not;
s3, if the instruction exists in the instruction list, the instruction frequency value is increased by one bit, response instruction data are obtained from a cache region of the instruction, and the response instruction data are sent to the main equipment;
s4, if the instruction does not exist in the instruction list, adding the instruction into the instruction list, assigning 1 to the frequency value of the instruction and assigning 1 to the weight value of the instruction, forwarding the instruction to a machine, and sending response instruction data of the machine to the main equipment;
and S5, the sub-equipment finishes timing, assigns the frequency value of each instruction to the corresponding instruction weight, and restarts timing.
2. The method according to claim 1, wherein the step of determining whether the command exists in the command list of the sub-device in step S2 comprises:
an assigned base value of 0;
starting traversing the instruction list for the first time, acquiring a first instruction of the instruction list, if the weight of the instruction is greater than the base number value, sending the instruction to the machine, then waiting for receiving a response instruction message of the machine, and after receiving the response instruction message of the machine, storing the response instruction message in a corresponding response data area in the instruction list; and then acquiring a second instruction of the instruction list until the whole instruction list is traversed.
3. The communication method of the main device and the sub-device according to claim 2, wherein after the first traversal of the instruction list is finished, the base number value is changed to 1, a second traversal of the instruction list is started to obtain a first instruction of the instruction list, if the weight of the instruction is greater than the base number value, the instruction is sent to the machine, a response instruction message of the machine is waited to be received, and after the response instruction message of the machine is received, the response instruction message is stored in a corresponding response data area in the instruction list; and then acquiring a second instruction of the instruction list until the whole instruction list is traversed.
4. A system of a master device and a slave device communicating method according to any one of claims 1 to 3,
the timing module is used for the sub-equipment to start timing, wait for receiving the instruction sent by the main equipment and finish timing of the sub-equipment, assign the frequency value of each instruction to the corresponding instruction weight and restart timing;
the judging module is used for judging whether the command exists in a command list of the sub-equipment or not if the sub-equipment receives the command;
the obtaining module is used for increasing one bit for the instruction frequency value if the instruction exists in the instruction list, obtaining response instruction data from a cache region of the instruction and sending the response instruction data to the main equipment;
and the sending module is used for adding the instruction into the instruction table if the instruction does not exist in the instruction table, assigning 1 to the frequency value of the instruction and assigning 1 to the weight value of the instruction, forwarding the instruction to the machine, and sending response instruction data of the machine to the main equipment.
CN202211721115.0A 2022-12-30 2022-12-30 Method and system for communication between main device and sub device Active CN115878551B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211721115.0A CN115878551B (en) 2022-12-30 2022-12-30 Method and system for communication between main device and sub device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211721115.0A CN115878551B (en) 2022-12-30 2022-12-30 Method and system for communication between main device and sub device

Publications (2)

Publication Number Publication Date
CN115878551A true CN115878551A (en) 2023-03-31
CN115878551B CN115878551B (en) 2023-08-08

Family

ID=85757466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211721115.0A Active CN115878551B (en) 2022-12-30 2022-12-30 Method and system for communication between main device and sub device

Country Status (1)

Country Link
CN (1) CN115878551B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090077187A1 (en) * 2007-09-14 2009-03-19 Yoshikazu Azuma Method and apparatus for communications
CN103713608A (en) * 2013-12-27 2014-04-09 广东康宝电器有限公司 Hierarchical network architecture of wireless Internet-of-Things home system and networking communication method thereof
CN104836737A (en) * 2015-03-27 2015-08-12 北京邮电大学 Internet of things communication method taking named data as center
WO2015129664A1 (en) * 2014-02-27 2015-09-03 オムロン株式会社 Wireless communication system, wireless communication device, wireless communication method, and program
CN115065700A (en) * 2022-06-09 2022-09-16 施耐德智能技术有限公司 Electronic equipment and thing networking communication module thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090077187A1 (en) * 2007-09-14 2009-03-19 Yoshikazu Azuma Method and apparatus for communications
CN103713608A (en) * 2013-12-27 2014-04-09 广东康宝电器有限公司 Hierarchical network architecture of wireless Internet-of-Things home system and networking communication method thereof
WO2015129664A1 (en) * 2014-02-27 2015-09-03 オムロン株式会社 Wireless communication system, wireless communication device, wireless communication method, and program
CN104836737A (en) * 2015-03-27 2015-08-12 北京邮电大学 Internet of things communication method taking named data as center
CN115065700A (en) * 2022-06-09 2022-09-16 施耐德智能技术有限公司 Electronic equipment and thing networking communication module thereof

Also Published As

Publication number Publication date
CN115878551B (en) 2023-08-08

Similar Documents

Publication Publication Date Title
CN110661870B (en) HPLC communication networking method, device, storage medium and electronic equipment
JPH0620203B2 (en) Data communication method and communication system
CN104168140B (en) VTEP abnormal conditions processing method and processing devices
CN113630725A (en) Communication method and device based on non-simultaneous receiving and transmitting multilink equipment
CN110517676A (en) A kind of voice awakening method and terminal, server, storage medium
CN105246137B (en) A kind of micropower wireless network data transmission method and system
CN106953767A (en) A kind of network-building method of equipment room, apparatus and system
WO2014079308A1 (en) Method and apparatus for processing timeslot resource occupation
CN112565349A (en) Wireless communication method based on central range hood and related equipment
CN102207920A (en) Conversion bridge for conversion from BVCI (basic virtual component interface) bus to AHB (advanced high performance bus)
CN115878551A (en) Method and system for communication between main equipment and sub-equipment
CN202041950U (en) Anti-collision controller for RS485 bus
CN100493079C (en) Method for main node supporting different agreement type secondary unit apparatus on secondary node
KR100424753B1 (en) Communication terminal accommodating apparatus and communication terminal accommodating method
CN112261512B (en) Master station remote control method, device, storage medium and equipment of unbalanced polling protocol
CN111614442B (en) Network communication method, device, electronic equipment and storage medium
CN113923073B (en) Method for distributing ID (identity) to CAN (controller area network) bus and CAN bus system
JP3164302B2 (en) Unrecognized communication method and mobile wireless device having unrecognized communication function
CN110290571B (en) Master station networking method, slave station networking method and data frame structure for data distribution wireless transmission
CN112600765A (en) Method and device for scheduling configuration resources
CN113949628B (en) Automatic equipment adding method and system
CN113096668B (en) Method and device for constructing collaborative voice interaction engine cluster
KR20040022231A (en) Method and device for identifying devices connected to a communication network
US6463491B1 (en) Data transfer making efficient use of time concerning bus arbitration
WO2022007682A1 (en) Method and device for sending data

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
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 510000, No. 2, 4, 6, 8, 10, and 12 Donghua Huaye Road, Renhe Town, Baiyun District, Guangzhou City, Guangdong Province (Airport Baiyun)

Patentee after: GUANGZHOU FELICITY SOLAR TECHNOLOGY Co.,Ltd.

Country or region after: China

Address before: No.23, Donghua Xingfu street, Renhe Town, Baiyun District, Guangzhou, Guangdong 510000

Patentee before: GUANGZHOU FELICITY SOLAR TECHNOLOGY Co.,Ltd.

Country or region before: China