[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN106953896B - Data transmission method of adapter and adapter - Google Patents

Data transmission method of adapter and adapter Download PDF

Info

Publication number
CN106953896B
CN106953896B CN201710094559.9A CN201710094559A CN106953896B CN 106953896 B CN106953896 B CN 106953896B CN 201710094559 A CN201710094559 A CN 201710094559A CN 106953896 B CN106953896 B CN 106953896B
Authority
CN
China
Prior art keywords
request
local terminal
controller
cloud server
adapter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710094559.9A
Other languages
Chinese (zh)
Other versions
CN106953896A (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 Mixliner Network Co ltd
Original Assignee
Shenzhen Mixliner Network 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 Mixliner Network Co ltd filed Critical Shenzhen Mixliner Network Co ltd
Priority to CN201710094559.9A priority Critical patent/CN106953896B/en
Publication of CN106953896A publication Critical patent/CN106953896A/en
Application granted granted Critical
Publication of CN106953896B publication Critical patent/CN106953896B/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
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/13Flow control; Congestion control in a LAN segment, e.g. ring or bus
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • H04L67/125Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks involving control of end-device applications over a network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention is suitable for the technical field of communication, and provides a data transmission method of an adapter and the adapter, wherein the data transmission method comprises the following steps: receiving a data request from a cloud server or a local terminal; when the data request is a control request, according to a response result of the controller to a previous control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal; when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, and the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism. The invention solves the problem of communication competition of the RS485 bus, and avoids the problems of data loss, disorder and incompleteness of data received by a local terminal or a cloud server caused by competition of multiple host computers.

Description

Data transmission method of adapter and adapter
Technical Field
The invention belongs to the technical field of communication, and particularly relates to a data transmission method of an adapter and the adapter.
Background
In the existing industrial internet of things, industrial equipment and a controller are communicated with each other mainly through an RS485 interface. The network formed by the devices which realize the networking communication with each other through the RS485 interface is called an RS485 network. As the RS485 interface is a half-duplex interface, a bidirectional single-channel communication mode is adopted. Therefore, the devices in the RS485 network are divided into a master device and a slave device, and the slave device does not actively transmit data, but transmits data according to a request of the master device, that is, adopts request-response communication. In the industrial internet of things, if a slave is a controller and a host is an adapter and a local terminal which are respectively connected with the controller through an RS485 interface, data sent by the adapter and the local terminal are active and random and are directly connected with the controller, and the situation that two paths of hosts simultaneously request the controller for data is bound to occur, so that the problem of RS485 bus communication competition is caused; the controller cannot determine which host to send when sending data through the RS485 bus, so that the data collected by the controller is lost and disordered, and if the cloud server or the local terminal connected with the adapter receives incomplete data sent by the controller, the effectiveness of data analysis and the result of monitoring the operation of the equipment are affected.
Disclosure of Invention
In view of this, the embodiment of the invention provides a data transmission method of an adapter and the adapter, so as to solve the problem of RS485 bus communication competition in the industrial internet of things.
In a first aspect, a data transmission method of an adapter is provided, where the adapter is used for communicating with a cloud server, and one RS485 interface is connected with a controller, and another RS485 interface is connected with a local terminal, and the method includes:
receiving a data request from a cloud server or a local terminal;
when the data request is a control request, according to a response result of the controller to a previous control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal;
when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, and the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism.
Further, when the data request is a control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal according to a response result of the controller to a previous control request includes:
when a control request from a local terminal \ a cloud server is received, if a response result of a controller to a previous control request from the cloud server \ the local terminal is not received currently, a request failure message is returned to the local terminal \ the cloud server; otherwise, sending the control request to the controller;
when control requests from a local terminal and a cloud server are received at the same time, the control requests from the local terminal are forwarded to the controller, the control requests from the cloud server are shielded, and a request failure message is returned to the cloud server to inform the cloud server that the local terminal sends the control requests to the controller.
Further, after receiving the status information returned by the controller according to the status class request, the communication method further includes:
and caching the state information into a preset shared area of the adapter, wherein the preset shared area adopts a ring queue structure.
Further, the returning the state information to the cloud server or the local terminal according to a preset feedback mechanism includes:
according to a state class request from a local terminal, acquiring state information corresponding to the state class request from the preset sharing area within preset response time, and sending the state information to the local terminal; and
and acquiring the state information to be reported from the preset sharing area according to a preset reporting period, and sending the state information to the cloud server.
Further, the reporting period is greater than the response time, so as to stagger time for acquiring the state information from the preset sharing area and sending the state information to the local terminal and the cloud server.
In a second aspect, an adapter is provided, where the adapter is used to communicate with a cloud server, and one RS485 interface is connected to a controller, and another RS485 interface is connected to a local terminal, and the adapter includes:
the receiving module is used for receiving a data request from a cloud server or a local terminal;
the control communication module is used for sending the control request to the controller or returning a request failure message to the cloud server or the local terminal according to a response result of the controller to the previous control request when the data request is the control request;
and the state communication module is used for sending the state request to a controller when the data request is the state request, receiving state information returned by the controller according to the state request, and returning the state information to the cloud server or the local terminal according to a preset feedback mechanism.
Further, the control type communication module comprises:
the first control communication unit is used for returning a request failure message to the local terminal/cloud server when receiving a control request from the local terminal/cloud server and if a response result of a controller to a previous control request from the cloud server/local terminal is not received currently; otherwise, sending the control request to the controller;
and the second control communication unit is used for forwarding the control request from the local terminal to the controller when receiving the control requests from the local terminal and the cloud server at the same time, shielding the control request from the cloud server, and returning a request failure message to the cloud server to inform that the cloud server has the local terminal to send the control request to the controller at present.
Further, the status class communication module is further configured to:
after receiving the state information returned by the controller according to the state class request, caching the state information into a preset sharing area of the adapter, wherein the preset sharing area adopts a ring queue structure.
Further, the status class communication module comprises:
the first state type communication unit is used for acquiring state information corresponding to the state type request from the preset sharing area within preset response time according to the state type request from the local terminal and sending the state information to the local terminal; and
and the second state communication unit is used for acquiring the state information to be reported from the preset sharing area according to a preset reporting period and sending the state information to the cloud server.
Further, the reporting period is greater than the response time, so as to stagger time for acquiring the state information from the preset sharing area and sending the state information to the local terminal and the cloud server.
Compared with the prior art, one RS485 interface of the adapter is connected with the controller, and the other RS485 interface of the adapter is connected with the local terminal by improving the connection mode of the adapter in the industrial Internet of things; during communication, receiving a data request from a cloud server or a local terminal through an adapter; when the data request is a control request, the control request is sent to the controller or a request failure message is returned to the cloud server or the local terminal according to a response result of the controller to the last control request, so that the problem of communication competition of an RS485 bus is solved; when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, and the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism, so that the problems of data loss, disorder and incompleteness of the controller caused by competition of multiple paths of hosts are avoided.
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 description of the embodiments or the prior art 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 schematic diagram of an RS485 network according to an embodiment of the present invention;
FIG. 2 is a flow chart of an implementation of a communication method of an adapter according to an embodiment of the present invention;
fig. 3 is a schematic diagram of the adapter according to the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
According to the embodiment of the invention, one RS485 interface of the adapter is connected with the controller, and the other RS485 interface of the adapter is connected with the local terminal by improving the connection mode of the adapter in the industrial Internet of things; during communication, receiving a data request from a cloud server or a local terminal through an adapter; when the data request is a control request, the control request is sent to the controller or a request failure message is returned to the cloud server or the local terminal according to a response result of the controller to the last control request, so that the problem of communication competition of an RS485 bus is solved; when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, and the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism, so that the problems that data received by the local terminal or the cloud server are lost, disordered and incomplete due to competition of multiple hosts are solved. The embodiment of the invention also provides a corresponding adapter, which is respectively explained in detail below.
In order to solve the problem of host communication competition in an RS485 network of an industrial Internet of things, the embodiment of the invention changes the mode that a plurality of host devices are connected in parallel into one slave device into the mode that the plurality of host devices are connected in series through RS485 interfaces and then are connected with the slave device. Because the RS485 interface is a bus only supporting a single host, the intermediate device providing the RS485 interface is used as a host device and a slave device to be respectively communicated with the two devices connected with the intermediate device through the RS485 bus. In the embodiment of the present invention, the intermediate device providing the RS485 interface may be an adapter for communicating with a cloud server. The adapter comprises two RS485 interfaces, wherein one RS485 interface is connected with the RS485 interface of the controller, and the other RS485 interface is connected with the local terminal. In this case, the adapter communicates with the controller as a master device and communicates with the local terminal as a slave device. Fig. 1 shows a schematic composition diagram of an RS485 system provided by an embodiment of the present invention. Wherein, the adapter 1 provides at least two RS485 interfaces for the connection of the controller 2 and the local terminal 3 respectively. In the embodiment of the present invention, the local terminal is a terminal that needs to collect field data of an industrial device, and includes, but is not limited to, a local computer, a notebook computer, and a server.
Fig. 2 shows an implementation flow of a data transmission method of an adapter according to an embodiment of the present invention. Referring to fig. 2, the data transmission method includes:
in step S201, a data request from a cloud server or a local terminal is received.
As can be seen from fig. 1, data sent by the local terminal and the cloud server both need to pass through the adapter, and the adapter can obtain information such as the data type and the sending time sent by the local terminal and the cloud server. The embodiment of the invention divides the data sent by the adapter and the local terminal into two categories in advance, wherein one category is a control category request, and the other category is a state category request. And the control request is instruction information for instructing the controller to execute the action by the adapter or the local terminal. The state data request is instruction information of the adapter or the local terminal requesting the controller to return the equipment running state information. Here, the priority of the control class data request is higher than that of the status class data request, that is, the control class data request of either the local terminal or the adapter is sent to the controller in preference to the status class data request. After the data request is acquired, the embodiment of the present invention identifies the type of the data request, and adopts different communication modes for different types of data requests: when the data request is a control type request, step S202 is executed, and when the data request is a status type request, step S203 is executed.
In step S202, when the data request is a control request, according to a response result of the controller to a previous control request, the control request is sent to the controller or a request failure message is returned to the cloud server or the local terminal.
Illustratively, the step S202 specifically includes the following three ways:
when a control request from a local terminal is received, if a response result of a controller to the last control request from the cloud server is not received currently, a request failure message is returned to the local terminal; otherwise, sending the control request to the controller;
when a control request from a cloud server is received, if a response result of a controller to a previous control request from a local terminal is not received currently, a request failure message is returned to the cloud server; otherwise, sending the control request to the controller;
when control requests from a local terminal and a cloud server are received at the same time, the control requests from the local terminal are forwarded to the controller, the control requests from the cloud server are shielded, and a request failure message is returned to the cloud server to inform the cloud server that the local terminal sends the control requests to the controller.
By the aid of the sending strategy of the control request, the problem of communication competition of the RS485 bus is effectively solved, two or more hosts are prevented from requesting data to the controller at the same time, and a local terminal or a cloud server sending the control request can timely know whether the request is successfully sent out.
In step S203, when the data request is a status request, the status request is sent to a controller, and status information returned by the controller according to the status request is received, and the status information is returned to the cloud server or the local terminal according to a preset feedback mechanism.
After receiving the state class request sent by the adapter, the controller responds to the state class request and continuously returns state information corresponding to the state class request to the adapter. In the embodiment of the present invention, a resource sharing area is created in advance on the memory of the adapter to cache and process the status information returned by the controller, so after receiving the status information returned by the controller according to the status class request, the method may further include: and caching the state information into a preset shared area of the adapter.
Optionally, the preset shared area adopts a ring queue structure. The data entering the preset sharing area follows a first-in first-out mode.
For the state class requests of the cloud server and the local terminal, different feedback mechanisms are adopted to return state information to the cloud server or the local terminal. The step S203 includes:
according to a state class request from a local terminal, acquiring state information corresponding to the state class request from the preset sharing area within preset response time, and sending the state information to the local terminal; and
and acquiring the state information to be reported from the preset sharing area according to a preset reporting period, and sending the state information to the cloud server.
Here, for a status class request from a local terminal, the adapter sends corresponding status information in the shared area to the local terminal within a preset response time. And if the adapter cannot finish sending in the response time, the local terminal defaults to communication failure. And for the state class request from the cloud server, the adapter reads corresponding state information from the shared area according to a preset reporting period in a circulating manner and reports the state information to the cloud server. Further, the reporting period in the embodiment of the present invention is greater than the response time, so as to avoid that the adapter reads data from the shared area too frequently, and stagger the return time of the state information of the local terminal and the cloud server, thereby effectively avoiding the problems of loss, disorder and incompleteness of the data received by the local terminal or the cloud server due to competition of multiple hosts in the RS485 network. Alternatively, the response time may be 30 milliseconds or 50 milliseconds; accordingly, the reporting period may be 10 seconds.
In summary, the embodiment of the invention eliminates the problem of communication competition among multiple hosts in the RS485 network of the industrial internet of things, and avoids the situation that data received by a local terminal or a cloud server is lost, disordered and incomplete due to the communication competition among the multiple hosts.
It should be understood that, in the above embodiments, the order of execution of the steps is not meant to imply any order, and the order of execution of the steps should be determined by their function and inherent logic, and should not limit the implementation process of the embodiments of the present invention.
Fig. 3 shows a constituent structure of an adapter provided in an embodiment of the present invention, and for convenience of explanation, only a portion related to the embodiment of the present invention is shown.
In this embodiment of the present invention, the adapter is used to implement the communication method of the adapter described in the above embodiment of fig. 2. The adapter is used for communicating with the cloud server, one RS485 interface is connected with the controller, and the other RS485 interface is connected with the local terminal.
Referring to fig. 3, the adaptor includes:
a receiving module 31, configured to receive a data request from a cloud server or a local terminal;
the control communication module 32 is configured to, when the data request is a control request, send the control request to the controller or return a request failure message to the cloud server or the local terminal according to a response result of the controller to a previous control request;
and the state type communication module 33 is configured to send the state type request to the controller when the data request is the state type request, receive state information returned by the controller according to the state type request, and return the state information to the cloud server or the local terminal according to a preset feedback mechanism.
Further, the control type communication module 32 includes:
the first control type communication unit 321 is configured to, when receiving a control type request from a local terminal \ a cloud server, return a request failure message to the local terminal \ the cloud server if a response result of a controller to a previous control type request from the cloud server \ the local terminal is not currently received; otherwise, sending the control request to the controller;
the second control type communication unit 322 is configured to, when receiving control type requests from the local terminal and the cloud server at the same time, forward the control type request from the local terminal to the controller, shield the control type request from the cloud server, and return a request failure message to the cloud server to notify the cloud server that the local terminal has currently sent the control type request to the controller.
Through the first control type communication unit 321 and the second control type communication unit 322, the problem of communication competition of the RS485 bus is effectively solved, two or more hosts are prevented from requesting data to the controller at the same time, and a local terminal or a cloud server sending a control type request can also know whether the request is successfully sent out in time.
Further, the status class communication module 33 is further configured to:
after receiving the state information returned by the controller according to the state class request, caching the state information into a preset sharing area of the adapter, wherein the preset sharing area adopts a ring queue structure.
Further, the status class communication module 33 includes:
the first state type communication unit 331 is configured to, according to a state type request from a local terminal, acquire state information corresponding to the state type request from the preset shared area within a preset response time, and send the state information to the local terminal; and
the second state type communication unit 332 is configured to obtain, according to a preset reporting period, the state information to be reported this time from the preset shared area, and send the state information to the cloud server.
In the embodiment of the present invention, for a status class request from a local terminal, the first status class communication unit 331 sends corresponding status information in the shared area to the local terminal within a preset response time. And if the adapter cannot finish sending in the response time, the local terminal defaults to communication failure. For the status class request from the cloud server, the second status class communication unit 332 cyclically reads the corresponding status information from the shared area according to a preset reporting period and reports the status information to the cloud server. Further, the reporting period in the embodiment of the present invention is greater than the response time, so as to avoid that the adapter reads data from the shared area too frequently, and stagger the return time of the state information of the local terminal and the cloud server, thereby effectively solving the problems of loss, disorder and incompleteness of data acquired by the controller due to competition of multiple hosts in the RS485 network. Alternatively, the response time may be 30 milliseconds or 50 milliseconds; accordingly, the reporting period may be 10 seconds.
It should be noted that the adapter in the embodiment of the present invention may be configured to implement all technical solutions in the foregoing method embodiments, and the functions of each functional module may be implemented specifically according to the method in the foregoing method embodiments, and the specific implementation process may refer to the relevant description in the foregoing example, which is not described herein again.
In summary, in the embodiment of the invention, one RS485 interface of the adapter is connected with the controller, and the other RS485 interface of the adapter is connected with the local terminal by improving the connection mode of the adapter in the industrial internet of things; during communication, receiving a data request from a cloud server or a local terminal through an adapter; when the data request is a control request, the control request is sent to the controller or a request failure message is returned to the cloud server or the local terminal according to a response result of the controller to the last control request, so that the problem of communication competition of an RS485 bus is solved; when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, and the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism, so that the problems of data loss, disorder and incompleteness of the controller caused by competition of multiple paths of hosts are avoided.
Optionally, embodiments of the invention also provide a non-transitory computer-readable storage medium storing instructions executable by one or more processors to perform operations comprising:
receiving a data request from a cloud server or a local terminal;
when the data request is a control request, according to a response result of the controller to a previous control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal;
when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, and the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism.
Optionally, when the data request is a control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal according to a response result of the controller to a previous control request includes:
when a control request from a local terminal/cloud server is received, if a response result of a controller to the previous control request from the cloud server/local terminal is not received currently, a request failure message is returned to the local terminal/cloud server; otherwise, sending the control request to the controller;
when control requests from a local terminal and a cloud server are received at the same time, the control requests from the local terminal are forwarded to the controller, the control requests from the cloud server are shielded, and a request failure message is returned to the cloud server to inform the cloud server that the local terminal sends the control requests to the controller.
Optionally, after receiving the status information returned by the controller according to the status class request, the operations further include:
and caching the state information into a preset shared area of the adapter, wherein the preset shared area adopts a ring queue structure.
Optionally, the returning the state information to the cloud server or the local terminal according to a preset feedback mechanism includes:
according to a state class request from a local terminal, acquiring state information corresponding to the state class request from the preset sharing area within preset response time, and sending the state information to the local terminal; and
and acquiring the state information to be reported from the preset sharing area according to a preset reporting period, and sending the state information to the cloud server.
Optionally, the reporting period is greater than the response time, so as to stagger time for acquiring the state information from the preset shared area and sending the state information to the local terminal and the cloud server.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the modules and units described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed method and adapter may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units and modules in the embodiments of the present invention may be integrated into one processing unit, or each unit and module may exist alone physically, or two or more units and modules may be integrated into one unit.
The functions, if implemented in the form of software functional units 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 for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (8)

1. A data transmission method for an adapter of an industrial Internet of things is characterized in that the adapter is used for communicating with a cloud server, one RS485 interface is connected with a controller, the other RS485 interface is connected with a local terminal, the adapter is used as a host device to communicate with the controller and a slave device to communicate with the local terminal, and the method comprises the following steps:
receiving a data request from a cloud server or a local terminal;
when the data request is a control request, according to a response result of the controller to a previous control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal, wherein the control request is instruction information for indicating the controller to execute an action by the adapter or the local terminal;
when the data request is a state request, the state request is sent to a controller, state information returned by the controller according to the state request is received, the state information is returned to the cloud server or the local terminal according to a preset feedback mechanism, and the state request is instruction information of an adapter or the local terminal requesting the controller to return equipment running state information;
when the data request is a control request, sending the control request to the controller or returning a request failure message to the cloud server or the local terminal according to a response result of the controller to a previous control request includes:
when a control request from a local terminal \ a cloud server is received, if a response result of a controller to a previous control request from the cloud server \ the local terminal is not received currently, a request failure message is returned to the local terminal \ the cloud server; otherwise, sending the control request to the controller;
when control requests from a local terminal and a cloud server are received at the same time, the control requests from the local terminal are forwarded to the controller, the control requests from the cloud server are shielded, and a request failure message is returned to the cloud server to inform the cloud server that the local terminal sends the control requests to the controller.
2. The adapter data transmission method according to claim 1, wherein after receiving the status information returned by the controller according to the status class request, the communication method further comprises:
and caching the state information into a preset shared area of the adapter, wherein the preset shared area adopts a ring queue structure.
3. The data transmission method of the adapter according to claim 2, wherein the returning the status information to the cloud server or the local terminal according to a preset feedback mechanism comprises:
according to a state class request from a local terminal, acquiring state information corresponding to the state class request from the preset sharing area within preset response time, and sending the state information to the local terminal; and
and acquiring the state information to be reported from the preset sharing area according to a preset reporting period, and sending the state information to the cloud server.
4. The data transmission method of the adapter according to claim 3, wherein the reporting period is longer than the response time, so as to stagger time for acquiring the state information from the preset sharing area and sending the state information to the local terminal and the cloud server.
5. An adapter for industrial internet of things, wherein the adapter is used for communicating with a cloud server, one RS485 interface is connected with a controller, the other RS485 interface is connected with a local terminal, the adapter is used as a host device to communicate with the controller and a slave device to communicate with the local terminal, and the adapter comprises:
the receiving module is used for receiving a data request from a cloud server or a local terminal;
the control communication module is used for sending the control request to the controller or returning a request failure message to the cloud server or the local terminal according to a response result of the controller to the previous control request when the data request is the control request, wherein the control request is instruction information for indicating the controller to execute an action by the adapter or the local terminal;
the state communication module is used for sending the state request to a controller when the data request is the state request, receiving state information returned by the controller according to the state request, and returning the state information to the cloud server or the local terminal according to a preset feedback mechanism, wherein the state request is instruction information of an adapter or the local terminal requesting the controller to return equipment running state information;
the control type communication module comprises:
the first control communication unit is used for returning a request failure message to the local terminal/cloud server when receiving a control request from the local terminal/cloud server and if a response result of a controller to a previous control request from the cloud server/local terminal is not received currently; otherwise, sending the control request to the controller;
and the second control communication unit is used for forwarding the control request from the local terminal to the controller when receiving the control requests from the local terminal and the cloud server at the same time, shielding the control request from the cloud server, and returning a request failure message to the cloud server to inform that the cloud server has the local terminal to send the control request to the controller at present.
6. The adapter of claim 5, wherein the status class communication module is further to:
after receiving the state information returned by the controller according to the state class request, caching the state information into a preset sharing area of the adapter, wherein the preset sharing area adopts a ring queue structure.
7. The adapter of claim 6, wherein the status class communication module comprises:
the first state type communication unit is used for acquiring state information corresponding to the state type request from the preset sharing area within preset response time according to the state type request from the local terminal and sending the state information to the local terminal; and
and the second state communication unit is used for acquiring the state information to be reported from the preset sharing area according to a preset reporting period and sending the state information to the cloud server.
8. The adapter according to claim 7, wherein the reporting period is greater than the response time to stagger the time for obtaining status information from the predetermined sharing area and sending the status information to the local terminal and the cloud server.
CN201710094559.9A 2017-02-21 2017-02-21 Data transmission method of adapter and adapter Active CN106953896B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710094559.9A CN106953896B (en) 2017-02-21 2017-02-21 Data transmission method of adapter and adapter

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710094559.9A CN106953896B (en) 2017-02-21 2017-02-21 Data transmission method of adapter and adapter

Publications (2)

Publication Number Publication Date
CN106953896A CN106953896A (en) 2017-07-14
CN106953896B true CN106953896B (en) 2020-05-01

Family

ID=59467836

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710094559.9A Active CN106953896B (en) 2017-02-21 2017-02-21 Data transmission method of adapter and adapter

Country Status (1)

Country Link
CN (1) CN106953896B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101344871A (en) * 2008-08-20 2009-01-14 北京中星微电子有限公司 Bus arbitration unit for guaranteeing access sequence and its implementing method
CN102143195A (en) * 2010-07-29 2011-08-03 华为技术有限公司 Method, device and service system providing service information
CN102752084A (en) * 2012-07-27 2012-10-24 湖南先步信息股份有限公司 Multi-device controller area network (CAN) communication intelligent retransmission method
CN103166821A (en) * 2011-12-12 2013-06-19 深圳市华为安捷信电气有限公司 Method, device and system capable of achieving serial port communication
CN105354159A (en) * 2015-09-28 2016-02-24 上海海视电子有限公司 RS485 distributed bus system based control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101344871A (en) * 2008-08-20 2009-01-14 北京中星微电子有限公司 Bus arbitration unit for guaranteeing access sequence and its implementing method
CN102143195A (en) * 2010-07-29 2011-08-03 华为技术有限公司 Method, device and service system providing service information
CN103166821A (en) * 2011-12-12 2013-06-19 深圳市华为安捷信电气有限公司 Method, device and system capable of achieving serial port communication
CN102752084A (en) * 2012-07-27 2012-10-24 湖南先步信息股份有限公司 Multi-device controller area network (CAN) communication intelligent retransmission method
CN105354159A (en) * 2015-09-28 2016-02-24 上海海视电子有限公司 RS485 distributed bus system based control method

Also Published As

Publication number Publication date
CN106953896A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
CN107547589B (en) Data acquisition processing method and device
CN100570566C (en) The method of coordinated scheduling and heterogeneous multi-core system between a kind of heterogeneous polynuclear
JP5444906B2 (en) Plant monitoring system, plant monitoring device, terminal device
WO2016107270A1 (en) Device managing method, device and device managing controller
CN104854845B (en) Use the method and apparatus of efficient atomic operation
CN111835578B (en) Information transmission management method, information transmission management apparatus, and readable storage medium
US9514068B2 (en) Broadcast and unicast communication between non-coherent processors using coherent address operations
CN113799135A (en) Robot control method, system, server, storage medium and mechanical arm
AU2013266541A1 (en) Aircraft information management system
CN112235127B (en) Node fault reporting method and device, terminal equipment and storage medium
JP2011229006A (en) On-vehicle control device
CN107517167B (en) Data transmission control method and device and SoC chip
CN106953896B (en) Data transmission method of adapter and adapter
CN103684950B (en) Multisensor multiplex bus system and method
CN103353750B (en) A kind of microwave metallurgical control method based on multibus
CN114090493B (en) Data transmission control method based on RS485 bus and related device
US10356009B2 (en) Processor designed for a deterministic switched ethernet network
CN109189699A (en) Multipath server communication means, system, middle controller and readable storage medium storing program for executing
CN114418432A (en) Integrated prevention and control GIS service management and control system
CN111901366B (en) Data pushing method, device, equipment and storage medium
WO2016150155A1 (en) Data decision method, apparatus and system
CN116319610B (en) Data transmission method, device, electronic equipment and storage medium
CN107608483B (en) Method and device for controlling server fan
CN116405377B (en) Network state detection method, protocol conversion component, equipment and storage medium
EP2981898B1 (en) Microcontroller at a cartridge of a chassis

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