CN103136343A - Shared resource real-time interaction method - Google Patents

Shared resource real-time interaction method Download PDF

Info

Publication number
CN103136343A
CN103136343A CN2013100458299A CN201310045829A CN103136343A CN 103136343 A CN103136343 A CN 103136343A CN 2013100458299 A CN2013100458299 A CN 2013100458299A CN 201310045829 A CN201310045829 A CN 201310045829A CN 103136343 A CN103136343 A CN 103136343A
Authority
CN
China
Prior art keywords
variable
real
time
module
interaction method
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.)
Pending
Application number
CN2013100458299A
Other languages
Chinese (zh)
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.)
Shanghai Institute of Microsystem and Information Technology of CAS
Original Assignee
Shanghai Institute of Microsystem and Information Technology of CAS
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 Shanghai Institute of Microsystem and Information Technology of CAS filed Critical Shanghai Institute of Microsystem and Information Technology of CAS
Priority to CN2013100458299A priority Critical patent/CN103136343A/en
Publication of CN103136343A publication Critical patent/CN103136343A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a shared resource real-time interaction method. The method comprises the following steps of defining a real-time variable data structure used for storing shared data in a module; registering variable information in the real-time variable data structure; and automatically sending out a signal to inform other modules associated with the module to act when the value of the shared data changes. Without a traditional circulated data reading mode, the shared resource real-time interaction method can eliminate the memory and cost consumption caused by circulation.

Description

A kind of shared resource real-time interaction method
Technical field
The present invention relates to a kind of resource interaction method, particularly relate to a kind of shared resource (soft PLC variable) real-time interaction method.
Background technology
Soft PLC technology is to propose for the defective of conventional P LC.So-called soft PLC, it is based on PC, is based upon on certain operating system platform, realizes the functions such as calculating, control, storage and programming of conventional P LC by software approach, and completes field data by physical equipments such as I/O module and fieldbus.
No matter be that soft PLC or hard PLC(are referred to as conventional P LC here), its global variable is all the common data of all modules, and modules communicates by global variable, and the private data of modules is not included in common data.Global variable has copy in each module, and modules carries out computing and renewal by the data of copy to this module, after the circulation primary computing, just is updated to global variable, has so just realized the communication between modules.Each module is different to the access limit of global variable, only has the module that global variable is had a write permission just can upgrade data in global variable.Each module is as a process, and what the communication between process was adopted is that shared drive communicates.
If adopt the loop variable interactive mode of conventional P LC, for more real-time acquisition latest data, no matter whether really there are data to need to upgrade, must constantly reduce cycle period.And each circulation need to scan all modules, accurately to search the data that need renewal.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of shared resource real-time interaction method, makes real-time better, has saved the expense of extra cpu resource, internal memory and the bus brought due to circulation.
The technical solution adopted for the present invention to solve the technical problems is: a kind of shared resource real-time interaction method is provided, comprises the following steps:
(1) definition is used for the real-time variable data structure that data are shared in storage in module;
(2) registration variable information in the real-time variable data structure;
(3) when the value of sharing data changes, automatically send signal, notice is moved with other modules of described module relation.
Described real-time variable data structure is with a unique sign.
Also comprise in described step (1) and reserve a step that is used for the space of management variable; Described space is used for adding up registered name variable and variable data memory address.
In described step (3), module is determined affiliated partner by the unique attribute of variable, make variable and other module relations, after being successfully associated, in case variable signal is sent, the receiver port of other modules just receives this signal and real-time response, realizes the internal data real-time update.
Whether registered by judgment variable, or whether data type of a variable comes unanimously to determine whether association is successful.
Beneficial effect
Owing to having adopted above-mentioned technical scheme, the present invention compared with prior art has following advantage and good effect: the present invention has abandoned traditional circulation reading out data pattern, has eliminated the internal memory and the cost consumption that bring due to circulation.The present invention adopts the mode send and receive signal in addition, can be in real time and accurately notify corresponding module to upgrade, and the real-time of system and reliability have all obtained good lifting like this.In addition, adopt the module mode related with variable, can reduce the coupling of intermodule, make operation and control more convenient.
Description of drawings
Fig. 1 is schematic diagram of the present invention;
Fig. 2 is the concrete structural map of class Variable and class VariableItem in embodiment of the present invention;
Fig. 3 is variable and module relation schematic diagram in the present invention.
Embodiment
Below in conjunction with specific embodiment, further set forth the present invention.Should be understood that these embodiment only to be used for explanation the present invention and be not used in and limit the scope of the invention.Should be understood that in addition those skilled in the art can make various changes or modifications the present invention after the content of having read the present invention's instruction, these equivalent form of values fall within the application's appended claims limited range equally.
Embodiments of the present invention relate to a kind of shared resource real-time interaction method, comprise the following steps: definition is used for the real-time variable data structure that data are shared in storage in module; Registration variable information in the real-time variable data structure; When the value of sharing data changes, automatically send signal, notice is moved with other modules of described module relation.Concrete mode is as follows:
Adopt C++ as programming language in present embodiment.As shown in Figure 1, the present invention mainly is divided into four parts: variable-definition part 1, man-machine interface part 2, variable registration part 3, variable and module relation part 4.Wherein variable-definition part and variable and module relation part provide in Fig. 2 and Fig. 3 respectively again and illustrate.
Fig. 2 has listed the particular content of above-mentioned variable-definition part, comprises the chief component of class Variable and class VariableItem, and wherein the parameter of function is all omitted, and the number of members of class can add as required.The variable that the corresponding preamble of VariableItem is mentioned, Variable be the container mentioned of corresponding preamble, and namely the Variable container is in charge of each VariableItem object.A plurality of VariableItem objects are arranged in a Variable container.The Variable container can have the operation that the variableItem object carries out: registration (register_var), nullify (unregistere_var), read (list_var) etc.
The characteristics of VariableItem are that it has the variable_changed signal.The getSignalFromeType function judges the parameter of this variable variable_changed signal according to the type of variable storage data.The design determines that variable is called the variable uniqueness characteristic, so variable name can not repeat.What is called is completed the registration of a variable, be exactly to add a new VariableItem object in the Variable container, and according to the rale store of a variable name of an object in the member variable m_var_map of Variable container.
After the success of VariableItem object registration, if the value of object changes, namely the setValue function when the VariableItem object is called, when the module that perhaps has a write permission changes value in the VariableItem address by the pointer to member, the VariableItem object just sends the value_changed signal, but VariableItem object and be indifferent to the module that receives this signal.VariableItem object can with a plurality of module relations, but different modules has different authorities to it.
Fig. 3 is variable and module relation schematic diagram.Module has a variable name attribute, a variate-value attribute, a pointer variable, and at least one signaling interface function.Module is determined associated variable according to its variable name attribute.If the variable name property value was registered, for realizing the related of variable object and module, also need to define the connect method.During the application program operation, by the connect method, explicitly is realized the related of variable object signal and module by signal interface function.The connect method can be carried out the call parameters inspection in association, to guarantee the validity of the invocation of procedure.In Fig. 3, because modules A, B have variable name aaa attribute, the signal 1 of VariableItem object aaa just can be relevant with module B with modules A respectively.The connect method will be added these two associations to signal 1 calling in chained list successively.When signal 1 is triggered, the connect method will be called down respectively by the look-up-table function of variable object aaa and be designated as 1 and 2 function, thereby realize the real-time calling relation of signal and signaling interface.
In addition, the pointer that points to the aaa variable is arranged due to modules A, so modules A has write permission to VariableItem object aaa, can go to change by this pointer the value of aaa, and then trigger aaa and send signal, finally cause module B response.
Therefore, body design flow process of the present invention is:
A, at first design variable and container according to Fig. 2;
B, design one personal-machine interface, the user can fill in the information such as name variable, size, side-play amount as required successively, and variable of the same name can not repeated registration;
C, user submit to variable both to call the variable registration part, begin registration.If variable name is against regulation or registered, registration failure, return to master routine.If succeed in registration, program just generates a new VariableItem variable object, and this object is stored in the Variable container.When program was not moved under the PC environment, program also can be according to the variable auto registration of storage in addition.
D, call variable and module relation part, variable object is related with particular module, thus make particular module to the change real-time response of variable.

Claims (5)

1. a shared resource real-time interaction method, is characterized in that, comprises the following steps:
(1) definition is used for the real-time variable data structure that data are shared in storage in module;
(2) registration variable information in the real-time variable data structure;
(3) when the value of sharing data changes, automatically send signal, notice is moved with other modules of described module relation.
2. shared resource real-time interaction method according to claim 1, is characterized in that, described real-time variable data structure is with a unique sign.
3. shared resource real-time interaction method according to claim 1, is characterized in that, also comprises in described step (1) reserving a step that is used for the space of management variable; Described space is used for adding up registered name variable and variable data memory address.
4. shared resource real-time interaction method according to claim 1, it is characterized in that, in described step (3), module is determined affiliated partner by the unique attribute of variable, make variable and other module relations, after being successfully associated, in case variable signal is sent, the receiver port of other modules just receives this signal and real-time response, realizes the internal data real-time update.
5. whether shared resource real-time interaction method according to claim 4, is characterized in that, registered by judgment variable, or whether data type of a variable comes unanimously to determine whether association is successful.
CN2013100458299A 2013-02-05 2013-02-05 Shared resource real-time interaction method Pending CN103136343A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2013100458299A CN103136343A (en) 2013-02-05 2013-02-05 Shared resource real-time interaction method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2013100458299A CN103136343A (en) 2013-02-05 2013-02-05 Shared resource real-time interaction method

Publications (1)

Publication Number Publication Date
CN103136343A true CN103136343A (en) 2013-06-05

Family

ID=48496169

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2013100458299A Pending CN103136343A (en) 2013-02-05 2013-02-05 Shared resource real-time interaction method

Country Status (1)

Country Link
CN (1) CN103136343A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361044A (en) * 2014-10-29 2015-02-18 中国建设银行股份有限公司 Managing method and device for keeping parameter data consistent
CN109739661A (en) * 2018-12-27 2019-05-10 苏州思必驰信息科技有限公司 The method, apparatus and system of information updating between a kind of cooperative module
CN109783144A (en) * 2017-11-13 2019-05-21 深圳市创客工场科技有限公司 Processing method, device and the storage medium of variable in virtual environment interaction realization
CN114690702A (en) * 2022-06-02 2022-07-01 辰星(天津)自动化设备有限公司 Robot control system combining soft PLC and motion control

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1509000A (en) * 2002-12-15 2004-06-30 华为技术有限公司 Network element inside real-time data synchronizing method
US20060101064A1 (en) * 2004-11-08 2006-05-11 Sharpcast, Inc. Method and apparatus for a file sharing and synchronization system
US8010487B2 (en) * 2008-06-27 2011-08-30 Microsoft Corporation Synchronization and collaboration within peer-to-peer and client/server environments

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1509000A (en) * 2002-12-15 2004-06-30 华为技术有限公司 Network element inside real-time data synchronizing method
US20060101064A1 (en) * 2004-11-08 2006-05-11 Sharpcast, Inc. Method and apparatus for a file sharing and synchronization system
US8010487B2 (en) * 2008-06-27 2011-08-30 Microsoft Corporation Synchronization and collaboration within peer-to-peer and client/server environments

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
曹恒等: "软件设计模式在数控系统人机界面开发中的应用", 《华东理工大学学报(自然科学版)》, vol. 33, no. 6, 31 December 2007 (2007-12-31), pages 878 - 882 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104361044A (en) * 2014-10-29 2015-02-18 中国建设银行股份有限公司 Managing method and device for keeping parameter data consistent
CN104361044B (en) * 2014-10-29 2019-02-12 中国建设银行股份有限公司 A kind of management method that supplemental characteristic is consistent and device
CN109783144A (en) * 2017-11-13 2019-05-21 深圳市创客工场科技有限公司 Processing method, device and the storage medium of variable in virtual environment interaction realization
CN109739661A (en) * 2018-12-27 2019-05-10 苏州思必驰信息科技有限公司 The method, apparatus and system of information updating between a kind of cooperative module
CN114690702A (en) * 2022-06-02 2022-07-01 辰星(天津)自动化设备有限公司 Robot control system combining soft PLC and motion control
CN114690702B (en) * 2022-06-02 2022-08-23 辰星(天津)自动化设备有限公司 Robot control system combining soft PLC and motion control

Similar Documents

Publication Publication Date Title
CN102508784B (en) Data storage method of flash memory card in video monitoring equipment, and system thereof
CN103248667B (en) A kind of resource access method of distributed system and system
CN103714097A (en) Method and device for accessing database
US11768703B2 (en) GPU-shared dispatching and single-machine multi-card methods, systems, and devices
WO2023082537A1 (en) Network operating system design method based on mimetic database
CN105677597A (en) Data writing method and device
CN105808736A (en) List data updating method, apparatus and system
CN103136343A (en) Shared resource real-time interaction method
CN110674055B (en) Cache consistency simulation verification method for component level and component joint level
CN102023843A (en) Function calling method and device as well as smart card
CN103020003A (en) Multi-core program determinacy replay-facing memory competition recording device and control method thereof
CN103488523A (en) Page access method, page access device and server
CN103136215A (en) Data read-write method and device of storage system
CN104239412B (en) The data mapping to thesaurus and correlation technique, system and computer-readable medium are applied in data repository
CN101673358A (en) Method and device for managing authority in workflow component based on authority component
CN109412830A (en) The cured method, apparatus of Adapter Name, computer equipment and storage medium
CN101075220A (en) Simulator and method for bus arbitraction
CN105446770A (en) Centralized storage method capable of saving memory chips and multi-functional module system
CN108959149A (en) A kind of multi-core processor interaction bus design method based on shared drive
CN102521277A (en) Access method of database platform
CN104281587A (en) Connection establishing method and device
CN100449498C (en) Data storage device
CN105095149A (en) Batched processing method and device for system-on-chip parameters
CN110399354B (en) Partition exchange method and device for database
CN105183668A (en) Cache refreshing method and 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
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20130605