CN115208794B - Timer adjustment method, device, equipment and medium of Profibus-DP protocol - Google Patents

Timer adjustment method, device, equipment and medium of Profibus-DP protocol Download PDF

Info

Publication number
CN115208794B
CN115208794B CN202210967934.7A CN202210967934A CN115208794B CN 115208794 B CN115208794 B CN 115208794B CN 202210967934 A CN202210967934 A CN 202210967934A CN 115208794 B CN115208794 B CN 115208794B
Authority
CN
China
Prior art keywords
slave station
timer
time
station
slave
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
CN202210967934.7A
Other languages
Chinese (zh)
Other versions
CN115208794A (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.)
Hangzhou Hollysys Automation Co Ltd
Original Assignee
Hangzhou Hollysys Automation 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 Hangzhou Hollysys Automation Co Ltd filed Critical Hangzhou Hollysys Automation Co Ltd
Priority to CN202210967934.7A priority Critical patent/CN115208794B/en
Publication of CN115208794A publication Critical patent/CN115208794A/en
Application granted granted Critical
Publication of CN115208794B publication Critical patent/CN115208794B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0811Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • 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

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

Abstract

The application discloses a method, a device, equipment and a medium for adjusting a timer of a Profibus-DP protocol, which are applied to a DP master station and relate to the technical field of network communication. The method comprises the following steps: transmitting a diagnostic request to the target DP slave station to receive the first reply message; determining the corresponding consumed time when the first response message is received, and storing the consumed time as a TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication; and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer. By the technical scheme of the application, the timer of the Profibus-DP protocol can be dynamically adjusted, and when the DP slave station with high response speed fails or is offline, the DP master station can timely find out in the shortest time.

Description

Timer adjustment method, device, equipment and medium of Profibus-DP protocol
Technical Field
The present application relates to the field of network communications technologies, and in particular, to a method, an apparatus, a device, and a medium for adjusting a timer of a Profibus-DP protocol.
Background
The Profibus-DP protocol is a bus communication protocol applied to industrial sites, and two types of devices, namely a DP master station and a DP slave station, are arranged on the bus, and the DP master station and the DP slave station carry out data communication according to a message frame format specified by the protocol. When the DP master station sends out a request message to the DP slave station, the DP master station waits for a response message sent by the DP slave station in a certain time, and if the DP master station receives the response message of the DP slave station in the certain time, the DP master station can continuously send the next message; if the DP master does not receive the reply message from the DP slave within this period of time, the DP slave is considered to be down or offline. When the DP master waits for a DP slave acknowledge message, this waiting time is referred to as TSL in the protocol.
At present, the value of TSL can be configured to the DP master station through an upper computer, and a fixed value can be written into software of the DP master station. After the DP master station sends a request message to the DP slave station, a timer is set according to the value of the TSL, and the DP master station waits for a response message of the DP slave station. Because the TSL value is configured to the DP master station by the upper computer or the fixed value is written into the software of the DP master station, the value cannot be dynamically changed, and the waiting time is the same after the DP master station sends the request message to each DP slave station. However, in practical application in industrial field, each DP slave station has different hardware performance, processing capability and transmission distance, so the time of the response message is also different, so that in order to be compatible with each DP slave station, the configuration of the upper computer or the TSL value fixedly written into the DP master station needs to be configured to be large enough to ensure that the response message of the DP slave station with the slowest response speed can be normally received. If the response speed of some DP slave stations is high and the response speed of some DP slave stations is low, the TSL value is large enough to ensure that the DP master station can receive the data of the slowest DP slave station response in the period of time. However, when the TSL is configured too large, if the DP slave station with a fast response fails or goes offline, it cannot respond to the master station, and the DP master station must wait until the timer expires before it can detect the data. Thus, the DP master station detecting DP slave station failure or going offline may slow down.
In summary, how to avoid that all DP slave stations use the same TSL value, when the DP slave station with fast response fails or goes offline, the DP master station can find out the problem to be solved in time in the shortest time.
Disclosure of Invention
Accordingly, the present application aims to provide a method, apparatus, device and medium for adjusting a timer of a Profibus-DP protocol, which can avoid that all DP slave stations use the same TSL value, and when a DP slave station with a fast response speed fails or goes offline, a DP master station can find in time in the shortest time. The specific scheme is as follows:
in a first aspect, the application discloses a timer adjustment method of Profibus-DP protocol, which is applied to a DP master station and comprises the following steps:
determining a target DP slave station which is to send a diagnosis request currently, and sending the diagnosis request to the target DP slave station so as to receive a first response message of the target DP slave station;
determining the corresponding consumed time when the first response message is received, and storing the consumed time as a TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication;
and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
Optionally, before determining the target DP slave station which is currently sending the diagnostic request, the method further includes:
uniformly setting a preset threshold value to be the TSL value in a preset configuration mode, and setting the timer according to the current TSL value;
accordingly, the sending the diagnostic request to the target DP slave station to receive the first reply message of the target DP slave station includes:
and sending the diagnosis request to the target DP slave station so as to receive a first response message of the target DP slave station based on the time corresponding to the current preset threshold value.
Optionally, the uniformly setting the preset threshold to the TSL value in the preset configuration mode includes:
uniformly setting a preset threshold value to be the TSL value through an upper computer;
or directly writing the preset threshold value into the software of the DP master station to uniformly set the preset threshold value as the TSL value.
Optionally, after determining the consumed time corresponding to the first response message received and storing the consumed time as the TSL value corresponding to the target DP slave station, the method further includes:
and sequentially sending the diagnosis requests to other DP slave stations, and determining TSL values corresponding to the other DP slave stations.
Optionally, the method for adjusting the timer of the Profibus-DP protocol further includes:
acquiring the time of the timer corresponding to the DP slave station to obtain target time;
judging whether the DP slave station returns the second response message within the target time;
and if the DP slave station does not return the second response message within the target time, judging that the current DP slave station is abnormal.
In a second aspect, the present application discloses a timer adjustment method of a Profibus-DP protocol, which is applied to a DP slave station, and includes:
receiving a diagnosis request sent by a DP master station, and sending a first response message to the DP master station;
when the DP master station performs data communication with the DP master station, receiving a request message sent by the DP master station, and returning a corresponding second response message based on the time of a timer; the time of the timer is set according to the TSL value corresponding to the current DP slave station stored in the DP master station; the TSL value is a corresponding time-consuming value stored when the DP master station receives the first response message; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station are in data communication.
In a third aspect, the present application discloses a timer adjustment device of a Profibus-DP protocol, which is applied to a DP master station, and includes:
a diagnostic request sending module, configured to determine a target DP slave that is currently sending a diagnostic request, and send the diagnostic request to the target DP slave, so as to receive a first response message of the target DP slave;
the TSL value determining module is used for determining the consumed time corresponding to the received first response message and storing the consumed time as the TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication;
and the timer setting module is used for sending a request message to the DP slave station when the DP slave station is in data communication with the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
Optionally, the timer adjustment device of the Profibus-DP protocol is further configured to: acquiring the time of the timer corresponding to the DP slave station to obtain target time; judging whether the DP slave station returns the second response message within the target time; and if the DP slave station does not return the second response message within the target time, judging that the current DP slave station is abnormal.
In a fourth aspect, the present application discloses an electronic device comprising a processor and a memory; wherein the memory is configured to store a computer program that is loaded and executed by the processor to implement the timer adjustment method of the Profibus-DP protocol as described above.
In a fifth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements a timer adjustment method of a Profibus-DP protocol as described above.
In the application, the method is applied to a DP master station, and firstly, a target DP slave station which is to send a diagnosis request at present is determined, and the diagnosis request is sent to the target DP slave station so as to receive a first response message of the target DP slave station; then determining the corresponding consumed time when the first response message is received, and taking the consumed time as a TSL value corresponding to the target DP slave station to be stored; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication; and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer. It can be seen that a method for dynamically adjusting the timer of the Profibus-DP protocol is provided. And saving the consumed time when each DP slave station returns the response message as the respective TSL value, and setting the respective corresponding timer according to the TSL value. Therefore, when the DP master station and each DP slave station start normal data communication, after the DP master station sends messages to each DP slave station, the timer is set according to the unique TSL value of the DP slave station, and the response message of the DP slave station is waited, the Profibus-DP protocol timer can be dynamically adjusted, so that all the DP slave stations can be prevented from using the same TSL value, and when the DP master station and each DP slave station are applied in an industrial field, if the response speed difference of different DP slave stations is large, the DP master station can set the timer waiting for the response message according to the unique TSL value of each DP slave station, and when the DP slave station with high response speed fails or is offline, the DP master station can discover in time in the shortest time. In addition, the application does not change the message format and the message flow of the Profibus-DP protocol, and is completely compatible with the original protocol.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for adjusting a timer of a Profibus-DP protocol according to the present application;
FIG. 2 is a flowchart of a method for adjusting a timer of a Profibus-DP protocol according to the present disclosure;
FIG. 3 is a flowchart of a method for adjusting a timer of a Profibus-DP protocol according to the present application;
fig. 4 is a schematic structural diagram of a timer adjustment device of a Profibus-DP protocol according to the present application;
fig. 5 is a block diagram of an electronic device according to the present disclosure.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Currently, when the Profibus-DP protocol is actually applied to an industrial field, in order to be compatible with each DP slave station, the configuration of an upper computer or the fixed writing of the TSL value to the DP master station needs to be configured to be large enough to ensure that the response message of the DP slave station with the slowest response speed can be normally received. However, if the response speed of some DP slave stations is high and the response speed of some DP slave stations is low, the TSL value should be large enough to ensure that the DP master station can receive the slowest data of the DP slave station response in the period of time. Then, it appears that: when the TSL is configured too large, if a DP slave station with a fast response speed fails or goes offline, it cannot respond to the data from the master station, and the DP master station must wait until the timer expires before it can be detected. Thus, the DP master station detecting DP slave station failure or going offline may slow down.
Therefore, the application provides a timer adjustment scheme of Profibus-DP protocol, which can avoid that all DP slave stations use the same TSL value, and when the DP slave station with high response speed fails or is offline, the DP master station can timely find in the shortest time.
The embodiment of the application discloses a timer adjustment method of Profibus-DP protocol, which is shown in fig. 1 and applied to a DP master station, and comprises the following steps:
step S11: a target DP slave which is currently transmitting a diagnostic request is determined and the diagnostic request is transmitted to the target DP slave so as to receive a first reply message of the target DP slave.
In the embodiment of the application, the DP master station transmits the diagnostic request to the plurality of DP slaves, so that the target DP slave station which is currently transmitting the diagnostic request is first determined, then the diagnostic request is transmitted to the target DP slave station, and the target DP slave station transmits the response message, that is, the first response message corresponding to the transmission of the diagnostic request, to the DP master station within a certain time.
It should be noted that a sufficiently large TSL value is preset in software of the DP master station, and after the DP master station is powered on and starts working, a timer is set according to the preset TSL value, and accordingly, when the DP master station sends diagnostic requests to a plurality of DP slave stations, the DP master station waits for response messages of each DP slave station based on the time of the preset TSL value setting timer. The preset threshold value can be uniformly set as the TSL value through the upper computer; the preset threshold may also be directly written into the software of the DP master station, so as to uniformly set the preset threshold to the TSL value, which is not limited herein.
In the embodiment of the application, the TSL is the polling time of one DP slave station when the DP master station and the DP slave station carry out data communication, namely, if the DP slave station does not respond after the polling time is finished, the time can be retried, and the next station can be polled.
Specifically, before the target DP slave station which is to send the diagnostic request currently is determined, uniformly setting a preset threshold to be the TSL value in a preset configuration mode, and setting the timer according to the current TSL value; correspondingly, the diagnosis request is sent to the target DP slave station so as to receive a first response message of the target DP slave station based on the time corresponding to the preset threshold.
Step S12: determining the corresponding consumed time when the first response message is received, and storing the consumed time as a TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication.
In the embodiment of the application, after the DP master station works in a power-on mode, a diagnosis request is sent to a first DP slave station, a response message of the first DP slave station is waited, and timing is started at the same time; when the DP master station receives the response message of the first DP slave station, the time spent by the response message of the first DP slave station is calculated, and the time is used as the TSL value of the first DP slave station to be stored.
In the embodiment of the application, after the TSL value of the first DP slave station is stored, according to the same method steps, diagnostic requests are sequentially sent to all DP slave stations and messages are received, and then the TSL value of each slave station is calculated and stored independently; that is, the diagnostic request is sequentially sent to other DP slave stations, and TSL values corresponding to the other DP slave stations are determined.
Step S13: and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
In the embodiment of the application, after the TSL values of all the DP slave stations are stored separately and correspondingly, the DP master station and each DP slave station start normal data communication. After the DP master station transmits a message to each DP slave station, it sets a timer according to the TSL value unique to the DP slave station, and waits for the reply message of the DP slave station, that is, the second reply message.
In the embodiment of the application, each DP slave station sets a timer based on the unique TSL value, and when the DP master station performs data communication with the current DP slave station, the time of the timer corresponding to the DP slave station is taken as target time; judging whether the DP slave station returns the second response message within the target time; and if the DP slave station does not return the second response message within the target time, judging that the current DP slave station is abnormal. Therefore, not only is the fact that all the DP slave stations use the same TSL value avoided, but also the DP master station can timely find out in the shortest time when the DP slave station with high response speed fails or goes offline.
In the application, the method is applied to a DP master station, and firstly, a target DP slave station which is to send a diagnosis request at present is determined, and the diagnosis request is sent to the target DP slave station so as to receive a first response message of the target DP slave station; then determining the corresponding consumed time when the first response message is received, and taking the consumed time as a TSL value corresponding to the target DP slave station to be stored; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication; and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer. It can be seen that a method for dynamically adjusting the timer of the Profibus-DP protocol is provided. And saving the consumed time when each DP slave station returns the response message as the respective TSL value, and setting the respective corresponding timer according to the TSL value. Therefore, when the DP master station and each DP slave station start normal data communication, after the DP master station sends messages to each DP slave station, the timer is set according to the unique TSL value of the DP slave station, and the response message of the DP slave station is waited, the Profibus-DP protocol timer can be dynamically adjusted, so that all the DP slave stations can be prevented from using the same TSL value, and when the DP master station and each DP slave station are applied in an industrial field, if the response speed difference of different DP slave stations is large, the DP master station can set the timer waiting for the response message according to the unique TSL value of each DP slave station, and when the DP slave station with high response speed fails or is offline, the DP master station can discover in time in the shortest time. In addition, the application does not change the message format and the message flow of the Profibus-DP protocol, and is completely compatible with the original protocol.
The embodiment of the application discloses a specific Profibus-DP protocol timer adjustment method, which is shown in fig. 2 and applied to a DP master station, and comprises the following steps:
step S21: and uniformly setting a preset threshold value to be the TSL value through a preset configuration mode, and setting the timer according to the current TSL value.
In the embodiment of the application, firstly, the software of the DP master station uniformly sets the preset threshold value as the TSL value in a preset configuration mode, and the preset threshold value is large enough to ensure that the response message of the DP slave station with the slowest response speed can be normally received. And after the DP master station is powered on to start working, a timer is set according to a preset threshold value.
The TSL value may be configured to the DP master station by the host computer, or may be a fixed value written into the software of the DP master station.
Step S22: and determining a target DP slave station which is to send a diagnosis request currently, and sending the diagnosis request to the target DP slave station so as to receive a first response message of the target DP slave station based on the time corresponding to the current preset threshold value.
In the embodiment of the application, after the timer is set according to the preset threshold, the DP master station sends a diagnosis request to each DP slave station based on the time of the timer, and the first response message of each DP slave station can be received within the time specified by the timer.
Step S23: and determining the consumed time corresponding to the first response message, storing the consumed time as the TSL value corresponding to the target DP slave station, sequentially sending the diagnosis request to other DP slave stations, and determining the TSL value corresponding to the other DP slave stations.
In the embodiment of the application, the DP master station is powered on to work, and after sending a diagnosis request to the first slave station, the DP master station starts timing when waiting for the response message of the first DP slave station, so that after receiving the first response message, the DP master station determines the corresponding consumed time when receiving the first response message.
In the embodiment of the application, the time taken by the target DP slave station to send the first response message to the DP master station to receive the first response message is taken as the TSL value of the target DP slave station to be stored; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication. It will be appreciated that the DP master will send a request message to the DP slave and will wait for a certain period of time for the reply message sent by the DP slave. If the DP master station receives the DP slave station response message in the period of time, the DP master station continuously transmits the next message; if the DP master station does not receive the response message of the DP slave station in the period of time, the DP slave station is considered to be faulty or offline; this latency is referred to in the protocol as TSL.
Step S24: and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
For more specific processing in step S24, reference may be made to the corresponding content disclosed in the foregoing embodiment, and no further description is given here.
In the application, the method is applied to a DP master station, and firstly, a target DP slave station which is to send a diagnosis request at present is determined, and the diagnosis request is sent to the target DP slave station so as to receive a first response message of the target DP slave station; then determining the corresponding consumed time when the first response message is received, and taking the consumed time as a TSL value corresponding to the target DP slave station to be stored; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication; and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer. It can be seen that a method for dynamically adjusting the timer of the Profibus-DP protocol is provided. And saving the consumed time when each DP slave station returns the response message as the respective TSL value, and setting the respective corresponding timer according to the TSL value. Therefore, when the DP master station and each DP slave station start normal data communication, after the DP master station sends messages to each DP slave station, the timer is set according to the unique TSL value of the DP slave station, and the response message of the DP slave station is waited, the Profibus-DP protocol timer can be dynamically adjusted, so that all the DP slave stations can be prevented from using the same TSL value, and when the DP master station and each DP slave station are applied in an industrial field, if the response speed difference of different DP slave stations is large, the DP master station can set the timer waiting for the response message according to the unique TSL value of each DP slave station, and when the DP slave station with high response speed fails or is offline, the DP master station can discover in time in the shortest time. In addition, the application does not change the message format and the message flow of the Profibus-DP protocol, and is completely compatible with the original protocol.
The embodiment of the application discloses a timer adjustment method of Profibus-DP protocol, which is applied to a DP slave station, and is shown in FIG. 3, and the method comprises the following steps:
step S31: and receiving a diagnosis request sent by the DP master station and sending a first response message to the DP master station.
In the embodiment of the application, the method is applied to the DP slave station, and the DP master station sends the diagnosis request to the DP slave station based on the time of the timer set by the preset threshold after starting working at the upper point, so that the DP slave station receives the diagnosis request sent by the DP master station and returns a corresponding first response message. In this way, the DP master station sets the timer with the corresponding TSL value unique to the DP slave station for the time consumed after each DP slave station returns the response message, thereby avoiding that all DP slave stations use the same TSL value.
Step S32: and when the DP master station performs data communication with the DP master station, receiving a request message sent by the DP master station, and returning a corresponding second response message based on the time of the timer.
In the embodiment of the application, the DP master station and each DP slave station start normal data communication, and after the DP master station transmits a message to each DP slave station, the DP master station transmits a second response message to the DP master station based on the time of the respective timer set by the DP slave station, and the DP master station waits for the response message of each DP slave station based on the time of the respective timer set by the DP slave station.
The time of the timer is set according to the TSL value corresponding to the current DP slave station stored in the DP master station; the TSL value is a corresponding time-consuming value stored when the DP master station receives the first response message; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station are in data communication.
In the application, the method is applied to a DP slave station, and firstly receives a diagnosis request sent by a DP master station and sends a first response message to the DP master station; when the DP master station performs data communication with the DP master station, receiving a request message sent by the DP master station, and returning a corresponding second response message based on the time of a timer; the time of the timer is set according to the TSL value corresponding to the current DP slave station stored in the DP master station; the TSL value is a corresponding time-consuming value stored when the DP master station receives the first response message; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station are in data communication. It can be seen that a method for dynamically adjusting the timer of the Profibus-DP protocol is provided. And saving the consumed time when each DP slave station returns the response message as the respective TSL value, and setting the respective corresponding timer according to the TSL value. Therefore, when the DP master station and each DP slave station start normal data communication, after the DP master station sends messages to each DP slave station, the timer is set according to the unique TSL value of the DP slave station, and the response message of the DP slave station is waited, the Profibus-DP protocol timer can be dynamically adjusted, so that all the DP slave stations can be prevented from using the same TSL value, and when the DP master station and each DP slave station are applied in an industrial field, if the response speed difference of different DP slave stations is large, the DP master station can set the timer waiting for the response message according to the unique TSL value of each DP slave station, and when the DP slave station with high response speed fails or is offline, the DP master station can discover in time in the shortest time. In addition, the application does not change the message format and the message flow of the Profibus-DP protocol, and is completely compatible with the original protocol.
Correspondingly, the embodiment of the application also discloses a timer adjusting device of the Profibus-DP protocol, which is applied to the DP master station, and is shown in fig. 4, and the device comprises:
a diagnostic request sending module 11, configured to determine a target DP slave that is currently sending a diagnostic request, and send the diagnostic request to the target DP slave, so as to receive a first response message of the target DP slave;
the TSL value determining module 12 is configured to determine a consumed time corresponding to the time when the first response message is received, and store the consumed time as a TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication;
and the timer setting module 13 is used for sending a request message to the DP slave station when carrying out data communication with the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
The more specific working process of each module may refer to the corresponding content disclosed in the foregoing embodiment, and will not be described herein.
It can be seen that, by the above-described scheme of this embodiment, applied to a DP master station, a target DP slave station that is currently transmitting a diagnostic request is first determined, and the diagnostic request is transmitted to the target DP slave station, so as to receive a first response message of the target DP slave station; then determining the corresponding consumed time when the first response message is received, and taking the consumed time as a TSL value corresponding to the target DP slave station to be stored; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication; and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer. It can be seen that a method for dynamically adjusting the timer of the Profibus-DP protocol is provided. And saving the consumed time when each DP slave station returns the response message as the respective TSL value, and setting the respective corresponding timer according to the TSL value. Therefore, when the DP master station and each DP slave station start normal data communication, after the DP master station sends messages to each DP slave station, the timer is set according to the unique TSL value of the DP slave station, and the response message of the DP slave station is waited, the Profibus-DP protocol timer can be dynamically adjusted, so that all the DP slave stations can be prevented from using the same TSL value, and when the DP master station and each DP slave station are applied in an industrial field, if the response speed difference of different DP slave stations is large, the DP master station can set the timer waiting for the response message according to the unique TSL value of each DP slave station, and when the DP slave station with high response speed fails or is offline, the DP master station can discover in time in the shortest time. In addition, the application does not change the message format and the message flow of the Profibus-DP protocol, and is completely compatible with the original protocol.
Further, the embodiment of the present application further discloses an electronic device, and fig. 5 is a block diagram of an electronic device 20 according to an exemplary embodiment, where the content of the figure is not to be considered as any limitation on the scope of use of the present application.
Fig. 5 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program that is loaded and executed by the processor 21 to implement relevant steps in the timer adjustment method of the Profibus-DP protocol disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be a server.
In this embodiment, the power supply 23 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and the communication protocol to be followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited herein; the input/output interface 25 is used for acquiring external input data or outputting external output data, and the specific interface type thereof may be selected according to the specific application requirement, which is not limited herein.
The memory 22 may be a carrier for storing resources, such as a read-only memory, a random access memory, a magnetic disk, or an optical disk, and the resources stored thereon may include an operating system 221, a computer program 222, data 223, and the like, and the data 223 may include various data. The storage means may be a temporary storage or a permanent storage.
The operating system 221 is used for managing and controlling various hardware devices on the electronic device 20 and computer programs 222, which may be Windows Server, netware, unix, linux, etc. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the timer adjustment method of the Profibus-DP protocol performed by the electronic device 20 as disclosed in any of the previous embodiments.
Further, embodiments of the present application also disclose a computer readable storage medium, where the computer readable storage medium includes random access Memory (Random Access Memory, RAM), memory, read-Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, magnetic disk, or optical disk, or any other form of storage medium known in the art. The timer adjustment method of the Profibus-DP protocol is realized when the computer program is executed by a processor. For specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and no further description is given here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
The steps of a timer adjustment or algorithm of the Profibus-DP protocol described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above describes the timer adjustment method, device, equipment and medium of the Profibus-DP protocol provided by the present application in detail, and specific examples are applied to illustrate the principles and embodiments of the present application, and the above description of the examples is only used to help understand the method and core idea of the present application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (10)

1. The method for adjusting the timer of the Profibus-DP protocol is characterized by being applied to a DP master station and comprising the following steps of:
determining a target DP slave station which is to send a diagnosis request currently, and sending the diagnosis request to the target DP slave station so as to receive a first response message of the target DP slave station;
determining the corresponding consumed time when the first response message is received, and storing the consumed time as a TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication;
and when the data communication is carried out with the DP slave station, sending a request message to the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
2. The timer adjustment method of Profibus-DP protocol according to claim 1, wherein before determining the target DP slave that is currently sending the diagnostic request, further comprising:
uniformly setting a preset threshold value to be the TSL value in a preset configuration mode, and setting the timer according to the current TSL value;
accordingly, the sending the diagnostic request to the target DP slave station to receive the first reply message of the target DP slave station includes:
and sending the diagnosis request to the target DP slave station so as to receive a first response message of the target DP slave station based on the time corresponding to the current preset threshold value.
3. The method for adjusting the timer of the Profibus-DP protocol according to claim 2, wherein the uniformly setting the preset threshold to the TSL value by the preset configuration mode includes:
uniformly setting a preset threshold value to be the TSL value through an upper computer;
or directly writing the preset threshold value into the software of the DP master station to uniformly set the preset threshold value as the TSL value.
4. The method for adjusting the timer of the Profibus-DP protocol according to claim 1, wherein after determining the elapsed time corresponding to the reception of the first response message and saving the elapsed time as the TSL value corresponding to the target DP slave station, further comprising:
and sequentially sending the diagnosis requests to other DP slave stations, and determining TSL values corresponding to the other DP slave stations.
5. The timer adjustment method of the Profibus-DP protocol according to any one of claims 1 to 4, further comprising:
acquiring the time of the timer corresponding to the DP slave station to obtain target time;
judging whether the DP slave station returns the second response message within the target time;
and if the DP slave station does not return the second response message within the target time, judging that the current DP slave station is abnormal.
6. A timer adjustment method for a Profibus-DP protocol, applied to a DP slave station, comprising:
receiving a diagnosis request sent by a DP master station, and sending a first response message to the DP master station;
when the DP master station performs data communication with the DP master station, receiving a request message sent by the DP master station, and returning a corresponding second response message based on the time of a timer; the time of the timer is set according to the TSL value corresponding to the current DP slave station stored in the DP master station; the TSL value is a corresponding time-consuming value stored when the DP master station receives the first response message; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station are in data communication.
7. A timer adjustment mechanism for a Profibus-DP protocol, for use in a DP master station, comprising:
a diagnostic request sending module, configured to determine a target DP slave that is currently sending a diagnostic request, and send the diagnostic request to the target DP slave, so as to receive a first response message of the target DP slave;
the TSL value determining module is used for determining the consumed time corresponding to the received first response message and storing the consumed time as the TSL value corresponding to the target DP slave station; the TSL is the polling time of one DP slave station when the DP master station and the DP slave station perform data communication;
and the timer setting module is used for sending a request message to the DP slave station when the DP slave station is in data communication with the DP slave station, and setting a timer according to the TSL value so as to wait for a second response message returned by the corresponding DP slave station based on the time of the timer.
8. The Profibus-DP protocol timer adjustment device of claim 7, further configured to: acquiring the time of the timer corresponding to the DP slave station to obtain target time; judging whether the DP slave station returns the second response message within the target time; and if the DP slave station does not return the second response message within the target time, judging that the current DP slave station is abnormal.
9. An electronic device comprising a processor and a memory; wherein the memory is for storing a computer program that is loaded and executed by the processor to implement the timer adjustment method of the Profibus-DP protocol of any of claims 1 to 6.
10. A computer-readable storage medium storing a computer program; wherein the computer program when executed by a processor implements the timer adjustment method of the Profibus-DP protocol according to any of claims 1 to 6.
CN202210967934.7A 2022-08-12 2022-08-12 Timer adjustment method, device, equipment and medium of Profibus-DP protocol Active CN115208794B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210967934.7A CN115208794B (en) 2022-08-12 2022-08-12 Timer adjustment method, device, equipment and medium of Profibus-DP protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210967934.7A CN115208794B (en) 2022-08-12 2022-08-12 Timer adjustment method, device, equipment and medium of Profibus-DP protocol

Publications (2)

Publication Number Publication Date
CN115208794A CN115208794A (en) 2022-10-18
CN115208794B true CN115208794B (en) 2023-09-15

Family

ID=83585171

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210967934.7A Active CN115208794B (en) 2022-08-12 2022-08-12 Timer adjustment method, device, equipment and medium of Profibus-DP protocol

Country Status (1)

Country Link
CN (1) CN115208794B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01192239A (en) * 1988-01-28 1989-08-02 Fujitsu Ltd Polling system in communication circuit
CN111464388A (en) * 2020-03-31 2020-07-28 北京和利时系统工程有限公司 Polling frequency self-adaptive communication method, device, equipment and storage medium
CN111711704A (en) * 2020-08-20 2020-09-25 北京和利时系统工程有限公司 Data acquisition method and device based on response polling protocol
WO2021052590A1 (en) * 2019-09-19 2021-03-25 Siemens Aktiengesellschaft Method for operating a radio communication system for an industrial automation system, radio communication system, base station and subscriber station
CN113938387A (en) * 2021-10-20 2022-01-14 杭州和利时自动化有限公司 Communication method, device and readable storage medium
CN114265808A (en) * 2021-12-22 2022-04-01 杭州和利时自动化有限公司 Communication method, device, Profibus DP master station and medium
CN114820275A (en) * 2022-04-25 2022-07-29 麒麟软件有限公司 Dynamic timer and VirtiO GPU performance optimization method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH01192239A (en) * 1988-01-28 1989-08-02 Fujitsu Ltd Polling system in communication circuit
WO2021052590A1 (en) * 2019-09-19 2021-03-25 Siemens Aktiengesellschaft Method for operating a radio communication system for an industrial automation system, radio communication system, base station and subscriber station
CN111464388A (en) * 2020-03-31 2020-07-28 北京和利时系统工程有限公司 Polling frequency self-adaptive communication method, device, equipment and storage medium
CN111711704A (en) * 2020-08-20 2020-09-25 北京和利时系统工程有限公司 Data acquisition method and device based on response polling protocol
CN113938387A (en) * 2021-10-20 2022-01-14 杭州和利时自动化有限公司 Communication method, device and readable storage medium
CN114265808A (en) * 2021-12-22 2022-04-01 杭州和利时自动化有限公司 Communication method, device, Profibus DP master station and medium
CN114820275A (en) * 2022-04-25 2022-07-29 麒麟软件有限公司 Dynamic timer and VirtiO GPU performance optimization method

Also Published As

Publication number Publication date
CN115208794A (en) 2022-10-18

Similar Documents

Publication Publication Date Title
CN111901076B (en) Vehicle diagnosis data forwarding method and device and gateway
CN109040295B (en) Method and device for determining abnormal disconnection, terminal and storage medium
JP5221617B2 (en) COMMUNICATION DEVICE, COMMUNICATION SYSTEM, CONTROL METHOD, AND PROGRAM
CN113905050B (en) Method, device and system for detecting internet access information
CN107947906B (en) Slave device
CN110830579B (en) Equipment state display method, system, device and computer storage medium
CN111541596A (en) Relay response automatic numbering method, device, equipment and storage medium
CN114422288B (en) Communication system based on Modbus protocol
CN115314540A (en) Request response timeout processing method, device, equipment and medium
CN115208794B (en) Timer adjustment method, device, equipment and medium of Profibus-DP protocol
CN112615700B (en) Data sending method, gateway, system, electronic equipment and readable storage medium
CN107820277B (en) Parent node device for wireless network, terminal device and data transmission method thereof
CN111083016B (en) Polling table processing method and device, storage medium and equipment
JP3343036B2 (en) Programmable controller network system
CN113821074B (en) Time synchronization method and device, electronic equipment and storage medium
CN107171915B (en) Communication protocol changing method and device
CN107147552B (en) Method and device for remotely controlling return letter reading
JP2019129336A (en) Electronic control device, monitoring method and program
CN112261512A (en) Master station remote control method, device, storage medium and equipment of unbalanced polling protocol
CN111010286A (en) Intelligent registration method and device based on serial bus, electronic equipment and medium
JP2012109831A (en) Communication system
CN111371922B (en) Automatic setting algorithm for address of network node without master and slave in network
CN114124821B (en) Method, device, equipment and storage medium for transmitting data between modules in chip
CN118138386A (en) Device communication method, system, device, storage medium and product
CN114670764B (en) Method and device for controlling whole electric automobile to sleep and electronic control unit

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