[go: up one dir, main page]

CN102722535B - A kind of method avoiding the access conflict of modbus real-time data base - Google Patents

A kind of method avoiding the access conflict of modbus real-time data base Download PDF

Info

Publication number
CN102722535B
CN102722535B CN201210158291.8A CN201210158291A CN102722535B CN 102722535 B CN102722535 B CN 102722535B CN 201210158291 A CN201210158291 A CN 201210158291A CN 102722535 B CN102722535 B CN 102722535B
Authority
CN
China
Prior art keywords
instruction
database
modbus
renewal
control desk
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.)
Expired - Fee Related
Application number
CN201210158291.8A
Other languages
Chinese (zh)
Other versions
CN102722535A (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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201210158291.8A priority Critical patent/CN102722535B/en
Publication of CN102722535A publication Critical patent/CN102722535A/en
Application granted granted Critical
Publication of CN102722535B publication Critical patent/CN102722535B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of method avoiding the access conflict of modbus real-time data base, its process is in modbus main website, control desk carries out renewal rewards theory to database, and its instruction is cached to an instruction buffer, and contrasts with previous buffered instructions.Only have when instruction changes, this instruction is updated to database; This instruction is simultaneously preserved by instruction buffer; Described in the circular list of modbus main website, every bar has corresponding instruction buffer for the renewal rewards theory instruction of database, and before start enters circulation, these bufferings are eliminated.The method of the invention can be guaranteed in a multiple console modbus system, and when two control desks only have one to send instruction, the instruction of transmission is executed correctly.Then the method for real-time data base access conflict is solved.

Description

A kind of method avoiding the access conflict of modbus real-time data base
Technical field:
The present invention relates to devices communicating and data processing, particularly a kind of method avoiding the access conflict of modbus real-time data base.
Background technology:
On-the-spot in Industry Control, modbus receives as a kind of application protocol of maturation and disposes widely and apply.In instrument, sensor, electric operator etc., application is very ripe.Modbus is a request/response protocol, can implement on the circuits such as Ethernet, RS232, RS422, RS485, optical fiber.
When applying at the scene, be all generally by one or more modbus main website, by the asynchronous serial bus of RS232, RS422 or RS485, connect on-the-spot equipment (slave station); Control desk is by Ethernet or other bussing technique access modbus main website.In modbus main website, there is a real-time database, the order that control desk sends is updated to real-time data base, and modbus main website periodically can be issued to corresponding slave station these orders.
Modbus main website is responsible for: the service data and the state that obtain each slave station; Obtain the instruction of control desk; Forward slave station data to control desk; Forward console instruction to each slave station; These work above-mentioned generally periodically perform in a circulating manner.
As depicted in figs. 1 and 2, in single control feature of existing employing modbus agreement, control desk 101 connects the modbus main website 102 that comprises real-time data base 104, and this modbus main website connects some modbus slave stations 103.The process step of this system comprises:
S201: obtain console instruction;
S202: upgrade real-time data base;
S203: send instruction to slave station;
S204: obtain slave station state;
S205: upgrade real-time data base;
S206: send slave station state to control desk.
Above-mentioned steps moves in circles.
As shown in Fig. 3, Fig. 4 a and Fig. 4 b, in the multiple console system of existing employing modbus agreement, there is multiple control desk, i.e. the first control desk 301 and the second control desk 302.They connect the modbus main website 303 that comprises real-time data base 305, and this modbus main website connects some modbus slave stations 304.The process step of this system comprises:
Circulation process 1:
S411: obtain the first console instruction;
S412: upgrade real-time data base;
S413: obtain the second console instruction;
S414: upgrade real-time data base;
S415: send instruction to slave station;
S416: obtain slave station state;
S417: upgrade real-time data base;
S418: send slave station state to each control desk.
Circulation process 2:
S421: obtain the first console instruction;
S422: upgrade real-time data base;
S423: send instruction to slave station;
S424: obtain the second console instruction;
S425: upgrade real-time data base;
S426: send instruction to slave station;
S427: obtain slave station state;
S428: upgrade real-time data base;
S429: send slave station state to each control desk.
In above-mentioned flow process, modbus main website obtains instruction from two control desks respectively, and is transmitted to corresponding slave station.Because this is a cyclic process, when a control desk sending controling instruction, and when another one control desk does not send, the instruction that modbus main website reads from two control desks is different.Shown in Fig. 4 two kind of a circulation all can not ensure that effective steering order is sent to corresponding slave station; Meanwhile, when two control desks send instruction simultaneously, modbus main website can not ensure that the instruction of which control desk is preferentially performed.
Summary of the invention:
The present invention is directed to the modbus main station system of above-mentioned multiple console, provide and effectively control the solution with priority acccess control for multiple console.The method can effectively solve in multiple console modbus system, avoids the problem controlling to lose efficacy and controlled priority.
The concrete technical scheme of the present invention is as follows:
Avoid a method for modbus real-time data base access conflict, it is characterized in that, in modbus main website, control desk carries out renewal rewards theory to database, and its instruction is cached to an instruction buffer, and contrasts with previous buffered instructions.Only have when instruction changes, this instruction is updated to database; This instruction is simultaneously preserved by instruction buffer; Described in the circular list of modbus main website, every bar has corresponding instruction buffer for the renewal rewards theory instruction of database, and before start enters circulation, these bufferings are eliminated.
In such scheme, the instruction of described control desk is divided into A, B two class, and category-A instruction is database write instruction, and corresponding modbus function code is: 5,6,15,16; Category-B instruction is that database reads instruction, and corresponding modbus function code is: 1,2,3,4.
In such scheme, described for when controlling while multiple console, a priority is set to each control desk; The renewal rewards theory of database increases update mark simultaneously.
In such scheme, described update mark comprises priority three partial information of the time of renewal, the address realm of renewal and renewal.
In such scheme, described when the database update instruction of corresponding control desk is effective, first update instruction buffering, the then priority in this region and timestamp in comparison database; When the current priority once upgraded is lower than current renewal, update instruction is to database; When the current priority once upgraded is higher than current renewal, if update time, interval was greater than the interval of specifying, then update instruction is to database, otherwise will not upgrade.
The method of the invention can be guaranteed in a multiple console modbus system, and when two control desks only have one to send instruction, the instruction of transmission is executed correctly.Then the method for real-time data base access conflict is solved.In addition, the innovative point in method is:
(1) the database update operation of each control desk adopts the write operation based on change;
(2) update data of database of each control desk adopts intermediate buffer to store;
(3) each control desk can set priority, solves validity problem when simultaneously accessing.
Accompanying drawing illustrates:
The present invention is further illustrated below in conjunction with the drawings and specific embodiments.
Fig. 1 is single control desk system chart of existing employing modbus agreement.
Fig. 2 is the schematic flow sheet of modbus main website in existing single control feature.
Fig. 3 is the multiple console system chart of existing employing modbus agreement.
Fig. 4 a, Fig. 4 b are the schematic flow sheet of modbus main website in existing multiple console system.
The modbus main station system of the multiple console of Fig. 5 involved by the inventive method.
Embodiment:
The technological means realized to make the present invention, creation characteristic, reaching object and effect is easy to understand, below in conjunction with concrete diagram, setting forth the present invention further.
As shown in Figure 5, the modbus main station system of the multiple console involved by the inventive method.It comprises multiple control desks that such as the first control desk 510 and the second control desk 520 etc. are such.Wherein each control desk (510,520) is all connected with the real-time data base 531 of modbus main website 530; The instruction buffer (532,533) that connect corresponding to the first control desk 510 and the second control desk 520 respectively is also provided with inside modbus main website 530.Modbus main website 530 is also connected with several modbus slave stations 540 respectively.
The concrete grammar of whole invention is: in modbus main website, to the renewal rewards theory of database, (corresponding modbus function code is control desk: 5,6,15,16), instruction is cached to an instruction buffer, and contrasts with previous buffered instructions.Only have when instruction changes, this instruction is updated to database; This instruction is simultaneously preserved by instruction buffer.
In the circular list of modbus main website, every bar has corresponding instruction buffer for the renewal rewards theory instruction of database, and before start enters circulation, these bufferings are eliminated.
When this method can guarantee that two control desks only have one to send instruction, the instruction of transmission is executed correctly.
As shown in Figure 5, the instruction of control desk is divided into A, B two class, and category-A instruction is database write instruction, and corresponding modbus function code is: 5,6,15,16; Category-B instruction is that database reads instruction, and corresponding modbus function code is: 1,2,3,4.
In addition, control for while multiple console, also comprise:
(1) each control desk sets a priority;
(2) renewal rewards theory of database increases update mark, and this update mark comprises three partial informations:
1. the time upgraded;
2. the address realm upgraded;
3. the priority upgraded;
When the database update instruction of corresponding control desk is effective, first update instruction buffering, the then priority in this region and timestamp in comparison database.According to following logical renewal:
1., when the current priority once upgraded is lower than current renewal, update instruction is to database;
2., when the current priority once upgraded is higher than current renewal, if update time, interval was greater than the interval of specifying, then update instruction is to database, otherwise will not upgrade;
In addition, method as above has been successfully applied in the device that a kind of Ethernet changes to RS485 field bus protocol, this plant running modbus agreement; This method is not limited to modbus agreement, can adopt for similar request-reply agreement.
More than show and describe ultimate principle of the present invention and principal character and advantage of the present invention.The technician of the industry should understand; the present invention is not restricted to the described embodiments; what describe in above-described embodiment and instructions just illustrates principle of the present invention; without departing from the spirit and scope of the present invention; the present invention also has various changes and modifications, and these changes and improvements all fall in the claimed scope of the invention.Application claims protection domain is defined by appending claims and equivalent thereof.

Claims (2)

1. avoid a method for modbus real-time data base access conflict, it is characterized in that, in modbus main website, control desk carries out renewal rewards theory to database, and its instruction is cached to an instruction buffer, and contrasts with previous buffered instructions; Only have when instruction changes, this instruction is updated to database; This instruction is simultaneously preserved by instruction buffer; In the circular list of described modbus main website, every bar has corresponding buffered instructions for the renewal rewards theory instruction of database, and before start enters circulation, these buffered instructions are eliminated;
For when controlling while multiple control desk, a priority is set to each control desk; The renewal rewards theory of database increases update mark simultaneously;
Described update mark comprises priority three partial information of the time of renewal, the address realm of renewal and renewal;
When the database update instruction of corresponding control desk is effective, first update instruction buffering, the then priority in this region and timestamp in comparison database; When the current priority once upgraded is lower than current renewal, update instruction is to database; When the current priority once upgraded is higher than current renewal, if update time, interval was greater than the interval of specifying, then update instruction is to database, otherwise will not upgrade.
2. the method avoiding the access conflict of modbus real-time data base according to claim 1, is characterized in that, the instruction of described control desk is divided into A, B two class, and category-A instruction is database write instruction, and corresponding modbus function code is: 5,6,15,16; Category-B instruction is that database reads instruction, and corresponding modbus function code is: 1,2,3,4.
CN201210158291.8A 2012-05-21 2012-05-21 A kind of method avoiding the access conflict of modbus real-time data base Expired - Fee Related CN102722535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210158291.8A CN102722535B (en) 2012-05-21 2012-05-21 A kind of method avoiding the access conflict of modbus real-time data base

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210158291.8A CN102722535B (en) 2012-05-21 2012-05-21 A kind of method avoiding the access conflict of modbus real-time data base

Publications (2)

Publication Number Publication Date
CN102722535A CN102722535A (en) 2012-10-10
CN102722535B true CN102722535B (en) 2016-04-13

Family

ID=46948296

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210158291.8A Expired - Fee Related CN102722535B (en) 2012-05-21 2012-05-21 A kind of method avoiding the access conflict of modbus real-time data base

Country Status (1)

Country Link
CN (1) CN102722535B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104407591A (en) * 2014-11-27 2015-03-11 杭州优稳自动化系统有限公司 Communication management method for master station and slave station of Modbus device based on real-time database, and communication management system for master station and slave station of Modbus device based on real-time database
CN111181824B (en) * 2019-12-31 2021-10-12 苏州数言信息技术有限公司 Method for realizing master-slave dual-role node in Modbus RTU network
CN111212136B (en) * 2019-12-31 2022-10-18 北京力控华康科技有限公司 Modbus protocol-based data caching method, device and system and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0288713B1 (en) * 1987-04-29 1994-06-01 International Business Machines Corporation Concurrent multi-protocol I/O controller
CN1522409A (en) * 2001-06-09 2004-08-18 存储交易株式会社 A Parallel Control Scheme Considering Caching for Database Systems
CN101861572A (en) * 2007-11-19 2010-10-13 国际商业机器公司 Techniques for Controlling Access to Databases

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0288713B1 (en) * 1987-04-29 1994-06-01 International Business Machines Corporation Concurrent multi-protocol I/O controller
CN1522409A (en) * 2001-06-09 2004-08-18 存储交易株式会社 A Parallel Control Scheme Considering Caching for Database Systems
CN101861572A (en) * 2007-11-19 2010-10-13 国际商业机器公司 Techniques for Controlling Access to Databases

Also Published As

Publication number Publication date
CN102722535A (en) 2012-10-10

Similar Documents

Publication Publication Date Title
CN203311254U (en) Comprehensive control system of stage equipment
CN102722535B (en) A kind of method avoiding the access conflict of modbus real-time data base
EP2819376A1 (en) Data synchronization method and device
EP2866393A1 (en) Method and apparatus for determining virtual machine drifting
EP2637364A4 (en) METHOD, APPARATUS AND SYSTEM FOR ADDRESS RESOLUTION
MY180888A (en) Method and terminal for determining channel state information
MX2021014146A (en) Method, apparatus and system for communication between controllers in tsn.
DE502006006902D1 (en) TRANSPORTABLE, CONFIGURABLE INFORMATION CARRIER FOR DATA EXCHANGE BETWEEN ELECTRICAL EQUIPMENT AND METHOD THEREFOR
MY184439A (en) Terminal authentication method, apparatus, and system in passive optical network
CN102821023A (en) Method and device for dynamically migrating VLAN (virtual local area network) configuration
CN102638451A (en) Dynamic regrouping method for register list data of Modbus communication protocol
CN104008008A (en) Method for conducting multiplexing on debugging serial port in Linux system
CN101303677A (en) Method and system for controlling accessing direct memory as well as controller
CN102625170B (en) A kind of can the Set Top Box of plug and play tuning demodulator and method
EP2530881A4 (en) MEDIA ACCESS CONTROL ADDRESS PROTECTION METHOD AND SWITCH
CN102685146A (en) Control method for servo driver
CN102710356B (en) A kind of real time redundancy master station data synchronization method
CN101330343A (en) Synchronization method for rearrange state of net element internal cross unit
CN102437928B (en) Communication method capable of self-adaptively switching between two speeds of CAN (Controller Area Network) bus
CN104699649A (en) Multi-branch serial bus interface and data exchange method
CN104994181A (en) Method for displaying dynamic MAC address table in distributed OLT system
CN105488005B (en) A kind of three cushion space communication means of 1553B buses RT sending modes
CN101931830B (en) Method for upgrading secret key in Gigabit passive optical network and optical line terminal
CN205608465U (en) Operation and maintenance system based on information code recognition technology
CN103369417A (en) Configuration method of gigabit passive optical network terminal device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160413

Termination date: 20200521

CF01 Termination of patent right due to non-payment of annual fee