CN110045675A - Data processing method, data processing module based on PLC - Google Patents
Data processing method, data processing module based on PLC Download PDFInfo
- Publication number
- CN110045675A CN110045675A CN201910388333.9A CN201910388333A CN110045675A CN 110045675 A CN110045675 A CN 110045675A CN 201910388333 A CN201910388333 A CN 201910388333A CN 110045675 A CN110045675 A CN 110045675A
- Authority
- CN
- China
- Prior art keywords
- data
- plc
- sampled data
- sampled
- domain
- 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
Links
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/05—Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
- G05B19/054—Input/output
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B2219/00—Program-control systems
- G05B2219/10—Plc systems
- G05B2219/11—Plc I-O input output
- G05B2219/1103—Special, intelligent I-O processor, also plc can only access via processor
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Automation & Control Theory (AREA)
- Programmable Controllers (AREA)
Abstract
The present invention provides a kind of data processing method based on PLC, is applied to PLC, which comprises judges whether to meet sampled data preservation condition, if so, carrying out in next step;It obtains present sample data and present sample data is saved in appointed buffer domain;Judge whether the quantity of the sampled data in the appointed buffer domain reaches target value, if so, carrying out in next step, otherwise continuing described to judge whether the step for meeting sampled data preservation condition;Sampled data in the appointed buffer domain is packaged and delivered to host computer.Sampled data is first saved in the appointed buffer domain of PLC by method provided by the invention, when sampled data output reaches target value, all sampled datas in the domain of appointed buffer are packaged again and are independently sent to host computer, such data processing method can guarantee the data acquisition integrality of host computer, also avoid waste PLC resource.
Description
Technical field
The present invention relates to data processing fields, and in particular to a kind of data processing method based on PLC, data processing mould
Block.
Background technique
PLC is a kind of universal industrial automatic control device with high reliability, its strong, reliability with ability
High, configuration is flexibly, programming is simple, easy to use, is easy to the advantages that extending, but PLC is in data storage, graphical display, user
Interface etc. function is poor, therefore would generally combine PLC with host computer, realizes that the two has complementary advantages.
For host computer when acquiring the sampled data of PLC, the method for generalling use configuration software, host computer passes through configuration software
Data acquisition instructions are issued to PLC, PLC carries out real time data upload according to data acquisition instructions.Under normal conditions, due to PLC
The data update cycle there was only several milliseconds, and the most fast refresh time of the data between host computer configuration software and PLC is far from
Only several milliseconds, such data acquisition modes can allow host computer not acquire complete data, while waste PLC money
Source.
Summary of the invention
In view of this, the application provides a kind of data processing method based on PLC, data processing module, PLC first will sampling
Data are saved in the appointed buffer domain of PLC, when sampled data output reaches target value, then by the institute in the domain of appointed buffer
There is sampled data to be packaged and be independently sent to host computer, such data processing method can guarantee that the data of host computer have acquired
Whole property also avoids waste PLC resource.In order to solve the above technical problems, technical solution provided by the invention is as follows:
Data processing method based on PLC is applied to PLC, which comprises
Judge whether to meet sampled data preservation condition, if so, carrying out in next step;
It obtains present sample data and present sample data is saved in appointed buffer domain;
Judge whether the quantity of the sampled data in the appointed buffer domain reaches target value, if so, carrying out next
Otherwise step continues described to judge whether the step for meeting sampled data preservation condition;
Sampled data in the appointed buffer domain is packaged and delivered to host computer.
Further, it is provided with data in the PLC and saves position, and position is saved to the data and assigns initial value A, it is described
Judge whether that the step for meeting sampled data preservation condition includes:
Judge whether that meeting data saves trigger condition, if so, carrying out in next step, being otherwise unsatisfactory for sampled data preservation
Condition;
It is B that the value for controlling data preservation position is jumped by A, after the value that the data save position becomes B, meets data
Sampling hold condition.
Further, it is clocked flip that the data, which save trigger condition,.
Further, after present sample data being saved in appointed buffer domain, the data is controlled and save the value of position by B
Jump is A, while re-starting clocked flip.
Further, the appointed buffer domain includes:
Target value indicates area: for target value C to be arranged;
Present sample data sequence valve indicates area: for the sequence valve D of present sample data to be arranged;
Sampled data storage area: including the sub- storage area of N number of sampled data, each sub- storage area of sampled data is for saving one
A sampled data.
Further, the storage volume of the sub- storage area of each sampled data is r byte, when the preservation present sample number
According to when, the present sample data are saved in (D × r- (r-1)) a byte of the sampled data storage area.
Further, the value of r is 2.
Further, the step for sampled data by the appointed buffer domain is packaged and delivered to host computer
Later include: the sampled data emptied in the appointed buffer domain, then judges whether to meet sampled data guarantor described in progress
The step for depositing condition.
Data processing module based on PLC, comprising:
First judgment module: meet sampled data preservation condition for judging whether;
Data acquisition preserving module: for obtaining present sample data and will be current when meeting sampled data preservation condition
Sampled data is saved in appointed buffer domain;
Second judgment module: for judging whether the quantity of the sampled data in the appointed buffer domain reaches target
Value;
Data transmission blocks: by institute when the quantity for the sampled data in the appointed buffer domain reaches target value
The sampled data stated in the domain of appointed buffer is packaged and delivered to host computer.
In data processing method provided by the present application based on PLC, sampled data is first saved in the specified slow of PLC by PLC
Rush in region, when sampled data output reaches target value, then by the domain of appointed buffer all sampled datas be packaged and it is autonomous
It is sent to host computer, such data processing method can guarantee the data acquisition integrality of host computer, also avoid waste PLC
Resource.
Detailed description of the invention
Fig. 1 is a kind of data processing method flow chart based on PLC shown according to an exemplary embodiment.
Fig. 2 is a kind of composition schematic diagram of the appointed buffer of PLC shown according to an exemplary embodiment.
Fig. 3 is a kind of data processing module structural block diagram based on PLC shown according to an exemplary embodiment.
Specific embodiment
It is with reference to the accompanying drawing and specific real in order to make those skilled in the art more fully understand technical solution of the present invention
Applying example, the present invention is described in further detail.
Embodiment 1
As shown in Figure 1, being applied to PLC the present embodiment provides a kind of data processing method based on PLC, which is characterized in that
The described method includes:
S1: judging whether to meet sampled data preservation condition, if so, carrying out in next step;
S2: present sample data are obtained and present sample data are saved in appointed buffer domain;
S3: judging whether the quantity of the sampled data in the appointed buffer domain reaches target value, if so, carrying out down
Otherwise one step continues described to judge whether the step for meeting sampled data preservation condition;
S4: the sampled data in the appointed buffer domain is packaged and delivered to host computer.
The present embodiment is different from host computer and issues a data acquisition instructions, and PLC uploads the data processing side of a data
Formula, the present embodiment can inside PLC from be about to sampled data successively or by preset condition (such as every certain numerical value time protect
A sampled data is deposited, the clocked flip said below is equivalent to, the frequency for saving sampled data can be equal to the sampled data of PLC
Refreshing frequency, might be less that or the sampled data refreshing frequency greater than PLC, according to sampling rate requirement come fixed)
First be saved in the specified buffer of PLC, due to inside PLC it is every save the time that a data occupy be far smaller than PLC with it is upper
Machine carries out the time that a data transmission occupies according to data acquisition instructions, can effectively improve resource utilization, each in PLC
After refreshing sampled data, the sampled data refreshed every time can be stored in appointed buffer in time by PLC, in appointed buffer
It when sampled data reaches target value, then is packaged and is independently sent to host computer, to reduce host computer and the interaction time of PLC
Number, has saved the operation resource of PLC, while ensure that the timeliness and integrality of the sampled data for being sent to host computer.In addition,
When implementing the present embodiment, sampled data type can be left original data type, not need to compress or do other processing, thus
The computational burden for reducing PLC, the data for being transferred to host computer can be for original data type integer type, in host computer to receiving
Data parsing when, corresponding parsing can be done according to the rule of correspondence, for example be transferred to the corresponding sampled data of data 0 of host computer
For input voltage 0V, the corresponding sampled data of data 32000 for being transferred to host computer is input voltage 10V, then in parsing
Only need to carry out to actually enter voltage value calculating by linear ratio relation.
Preferably, data can be set in the PLC of the present embodiment saves position, and position is saved to the data and is assigned initially
Value A, described to judge whether the step for meeting sampled data preservation condition, i.e. step S1 includes:
S11: judging whether that meeting data saves trigger condition, if so, carrying out in next step, being otherwise unsatisfactory for sampled data
Preservation condition;
S22: it is B that the value for controlling data preservation position is jumped by A, after the value that the data save position becomes B, is met
Data sampling preservation condition.
When implementing the present embodiment, it can be clocked flip that data, which save trigger condition, and the function of clocked flip can pass through
The timer of PLC is realized, for example it is 0 that data, which save the initial value of position, and the time of clocked flip is 20 milliseconds, every 20 milliseconds,
It is 1 that the value that data save position is jumped by 0, meets data preservation condition this when, and PLC control obtains the present sample number of PLC
Appointed buffer domain is saved according to and by present sample data.
Work is saved in order to continue subsequent sampled data, the present embodiment is further comprised the steps of: present sample data
After being saved in appointed buffer domain, it is A that the value for controlling data preservation position is jumped by B, while re-starting clocked flip.It presses
It is described according to citing above, that is to say, that PLC control obtains the present sample data of PLC and is saved in present sample data
Behind the domain of appointed buffer, it is 0 that data, which save the value of position by 1 jump, timer reclocking, in time to 20 milliseconds when, data are protected
The value for depositing position is again 1 by 0 jump, reciprocation cycle, until the sampled data output of appointed buffer reaches target value, such as 100.
Preferably, the appointed buffer domain in the present embodiment may include:
Target value indicates area: for target value C to be arranged;
Present sample data sequence valve indicates area: for the sequence valve D of present sample data to be arranged;
Sampled data storage area: including the sub- storage area of N number of sampled data, each sub- storage area of sampled data is for saving one
A sampled data.
Preferably, the storage volume of the sub- storage area of each sampled data in the present embodiment can be r byte, work as guarantor
When depositing the present sample data, the present sample data are saved in (D × r- (r- of the sampled data storage area
1)) a byte.
Preferably, the value of r is 2.
As shown in Fig. 2, as an example, in the present embodiment, target value C is 100, r 2, the specified buffering in the present embodiment
The target value instruction area in region indicates that present sample data sequence valve instruction area is indicated with VW202, appointed buffer with VW200
The sampled data storage area VW204, VW205 in domain ..., VW403 indicate, wherein VW204, VW205 ..., VW403 distinguish table
Show the storage volume of 1 byte, the time of clocked flip is 20 milliseconds, and the initial value that data save position is 0, when clocked flip,
It is 1 that the value that data save position is jumped by 0, and when initial, sampled data is not preserved in sampled data storage area, and the value of VW200 is
100, VW202 value is that 0 expression prepares to save first sampled data, and after periodically starting, the value of VW202 is 1, is indicated wait protect
The sequence valve for the present sample data deposited is 1, and when timing reaches 20 milliseconds, it is 1 that the value that data save position is jumped by 0, by
It is 1 in the value of VW202 at this time, therefore present sample data is saved in (1 × 2- (2-1)) a word of sampled data storage area
Section, that is, present sample data is saved in VW204, and after saving first sampled data, the value of VW202 adds 1, i.e.,
The value of VW202 is 2, indicates that the sequence valve of present sample data to be saved is 2, it is 0 that the value that data save position is jumped by 1, weight
Newly start new clocked flip, when timing reaches 20 milliseconds, it is 1 that the value that data save position is jumped by 0, by present sample number
VW206 is saved according to (2 × 2- (2-1)) a byte for being saved in sampled data storage area, that is, by present sample data
In, and so on, it is known that the 100th sampled data is saved in (100 × 2- (2-1)) a word of sampled data storage area
Section, that is, the 100th sampled data is saved in VW402, when the sampling of the sampled data storage area in appointed buffer domain
After data volume reaches 100, all sampled datas are packaged and delivered to host computer.
Preferably, the step for sampled data by the appointed buffer domain is packaged and delivered to host computer
Later include: the sampled data emptied in the appointed buffer domain, then judges whether to meet sampled data guarantor described in progress
The step for depositing condition.
Embodiment 2
As shown in figure 3, the present embodiment provides a kind of data processing modules based on PLC, comprising:
First judgment module: meet sampled data preservation condition for judging whether;
Data acquisition preserving module: for obtaining present sample data and will be current when meeting sampled data preservation condition
Sampled data is saved in appointed buffer domain;
Second judgment module: for judging whether the quantity of the sampled data in the appointed buffer domain reaches target
Value;
Data transmission blocks: by institute when the quantity for the sampled data in the appointed buffer domain reaches target value
The sampled data stated in the domain of appointed buffer is packaged and delivered to host computer.
Concrete operations mode about the data processing module based on PLC has carried out retouching in detail in embodiment of the method
It states, is not set forth in detail herein.
The above is only the preferred embodiment of the present invention, it is noted that above-mentioned preferred embodiment is not construed as pair
Limitation of the invention, protection scope of the present invention should be defined by the scope defined by the claims..For the art
For those of ordinary skill, without departing from the spirit and scope of the present invention, several improvements and modifications can also be made, these change
It also should be regarded as protection scope of the present invention into retouching.
Claims (9)
1. the data processing method based on PLC is applied to PLC, which is characterized in that the described method includes:
Judge whether to meet sampled data preservation condition, if so, carrying out in next step;
It obtains present sample data and present sample data is saved in appointed buffer domain;
Judge whether the quantity of the sampled data in the appointed buffer domain reaches target value, if so, carry out in next step, it is no
Judge whether the step for meeting sampled data preservation condition described in then continuing;
Sampled data in the appointed buffer domain is packaged and delivered to host computer.
2. the data processing method according to claim 1 based on PLC, which is characterized in that be provided with data in the PLC
Position is saved, and position is saved to the data and assigns initial value A, it is described to judge whether the step for meeting sampled data preservation condition
Include:
Judge whether that meeting data saves trigger condition, if so, in next step, be otherwise unsatisfactory for sampled data and save item
Part;
It is B that the value for controlling data preservation position is jumped by A, after the value that the data save position becomes B, meets data sampling
Preservation condition.
3. the data processing method according to claim 2 based on PLC, which is characterized in that the data save triggering item
Part is clocked flip.
4. the data processing method according to claim 3 based on PLC, which is characterized in that save present sample data
To after the domain of appointed buffer, it is A that the value for controlling data preservation position is jumped by B, while re-starting clocked flip.
5. the data processing method according to claim 1 based on PLC, which is characterized in that the appointed buffer domain packet
It includes:
Target value indicates area: for target value C to be arranged;
Present sample data sequence valve indicates area: for the sequence valve D of present sample data to be arranged;
Sampled data storage area: including the sub- storage area of N number of sampled data, each sub- storage area of sampled data is adopted for saving one
Sample data.
6. the data processing method according to claim 5 based on PLC, which is characterized in that each sampled data storage
The storage volume in area is r byte, and when saving the present sample data, the present sample data are saved in described adopt
(D × r- (r-1)) a byte of sample region of data storage.
7. the data processing method according to claim 6 based on PLC, which is characterized in that the value of r is 2.
8. the data processing method according to claim 1 based on PLC, which is characterized in that described by the specified buffering
It include: to empty adopting in the appointed buffer domain after the step for sampled data in region is packaged and delivered to host computer
Then sample data judge whether the step for meeting sampled data preservation condition described in progress.
9. the data processing module based on PLC characterized by comprising
First judgment module: meet sampled data preservation condition for judging whether;
Data acquisition preserving module: for obtaining present sample data when meeting sampled data preservation condition and by present sample
Data are saved in appointed buffer domain;
Second judgment module: for judging whether the quantity of the sampled data in the appointed buffer domain reaches target value;
Data transmission blocks: by the finger when quantity for the sampled data in the appointed buffer domain reaches target value
Sampled data in the domain of buffer set is packaged and delivered to host computer.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910388333.9A CN110045675A (en) | 2019-05-10 | 2019-05-10 | Data processing method, data processing module based on PLC |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910388333.9A CN110045675A (en) | 2019-05-10 | 2019-05-10 | Data processing method, data processing module based on PLC |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110045675A true CN110045675A (en) | 2019-07-23 |
Family
ID=67281457
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910388333.9A Pending CN110045675A (en) | 2019-05-10 | 2019-05-10 | Data processing method, data processing module based on PLC |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110045675A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114363323A (en) * | 2022-01-06 | 2022-04-15 | 东莞市云雀科技有限公司 | Intelligent data uploading method for PLC |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102497450A (en) * | 2011-12-28 | 2012-06-13 | 北京华电天仁电力控制技术有限公司 | Two-stage-system-based distributed data compression processing method |
CN104460488A (en) * | 2014-11-04 | 2015-03-25 | 山东中烟工业有限责任公司 | Method for improving analysis accuracy of process data of feeding machine |
CN104639393A (en) * | 2015-01-07 | 2015-05-20 | 烽火通信科技股份有限公司 | Passive optical network flow whole-network acquisition device and passive optical network flow whole-network acquisition method |
CN104850573A (en) * | 2014-11-25 | 2015-08-19 | 北汽福田汽车股份有限公司 | Data collection method and device |
CN106535253A (en) * | 2016-11-23 | 2017-03-22 | 北京必创科技股份有限公司 | Method for dynamic acquisition and transmission of wireless data |
CN207424638U (en) * | 2017-10-11 | 2018-05-29 | 四川恒星食品有限公司 | A kind of thick broad-bean sauce automatic filling control system |
CN108572613A (en) * | 2017-03-14 | 2018-09-25 | 欧姆龙株式会社 | control device, information processing method |
CN109189721A (en) * | 2018-08-27 | 2019-01-11 | 中国科学院电工研究所 | A kind of real-time data storage method |
CN109450926A (en) * | 2018-12-06 | 2019-03-08 | 成都路行通信息技术有限公司 | A kind of travelling data packet compression opportunity calculation method and data packet compressing device |
CN109560858A (en) * | 2018-12-06 | 2019-04-02 | 西南电子技术研究所(中国电子科技集团公司第十研究所) | High-speed real data acquisition transmission module |
-
2019
- 2019-05-10 CN CN201910388333.9A patent/CN110045675A/en active Pending
Patent Citations (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102497450A (en) * | 2011-12-28 | 2012-06-13 | 北京华电天仁电力控制技术有限公司 | Two-stage-system-based distributed data compression processing method |
CN104460488A (en) * | 2014-11-04 | 2015-03-25 | 山东中烟工业有限责任公司 | Method for improving analysis accuracy of process data of feeding machine |
CN104850573A (en) * | 2014-11-25 | 2015-08-19 | 北汽福田汽车股份有限公司 | Data collection method and device |
CN104639393A (en) * | 2015-01-07 | 2015-05-20 | 烽火通信科技股份有限公司 | Passive optical network flow whole-network acquisition device and passive optical network flow whole-network acquisition method |
CN106535253A (en) * | 2016-11-23 | 2017-03-22 | 北京必创科技股份有限公司 | Method for dynamic acquisition and transmission of wireless data |
CN108572613A (en) * | 2017-03-14 | 2018-09-25 | 欧姆龙株式会社 | control device, information processing method |
JP2018151918A (en) * | 2017-03-14 | 2018-09-27 | オムロン株式会社 | Control device, data structure, and information processing method |
CN207424638U (en) * | 2017-10-11 | 2018-05-29 | 四川恒星食品有限公司 | A kind of thick broad-bean sauce automatic filling control system |
CN109189721A (en) * | 2018-08-27 | 2019-01-11 | 中国科学院电工研究所 | A kind of real-time data storage method |
CN109450926A (en) * | 2018-12-06 | 2019-03-08 | 成都路行通信息技术有限公司 | A kind of travelling data packet compression opportunity calculation method and data packet compressing device |
CN109560858A (en) * | 2018-12-06 | 2019-04-02 | 西南电子技术研究所(中国电子科技集团公司第十研究所) | High-speed real data acquisition transmission module |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114363323A (en) * | 2022-01-06 | 2022-04-15 | 东莞市云雀科技有限公司 | Intelligent data uploading method for PLC |
CN114363323B (en) * | 2022-01-06 | 2024-06-07 | 东莞市云雀科技有限公司 | Intelligent data uploading method for PLC |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101211277B (en) | Method of selecting one of execution schedules of guest OS and virtual machine monitor employing the method | |
KR101603751B1 (en) | Instruction word compression apparatus and method for instruction level parallelism computer | |
Mantel | Why stepdown procedures in variable selection | |
CN110347398A (en) | A kind of packaging method and device of application program | |
CN105653474B (en) | A kind of allocating cache controller towards coarseness dynamic reconfigurable processor | |
CN107943577A (en) | Method and apparatus for scheduler task | |
CN110045675A (en) | Data processing method, data processing module based on PLC | |
CN105844521A (en) | Transaction concurrence quantity control method and device | |
CN107798039B (en) | Data synchronization method and device | |
CN104461521A (en) | Application program playback method and system | |
CN104536780B (en) | A kind of electronic game resource high-efficiency loading method and system | |
CN103034480B (en) | A kind of embedded system timer implementation method | |
CN102625110A (en) | Caching system and caching method for video data | |
CN110955503B (en) | Task scheduling method and device | |
CN109617950A (en) | A kind of data-updating method, device, equipment and readable storage medium storing program for executing | |
CN107291506A (en) | A kind of method and apparatus at renewal APP interfaces | |
CN102411519A (en) | Process restoring method and device | |
CN110147509A (en) | Page furbishing method and device | |
US20150160968A1 (en) | Freezing a call stack | |
CN113242244A (en) | Data transmission method, device and system | |
CN106557352B (en) | A method of realizing the two-way execution of instruction set simulator forward and reverse | |
CN106547754A (en) | A kind of method and device of the dynamic load data in paging model | |
CN105589920B (en) | Method and apparatus for big data preanalysis | |
US8135853B1 (en) | Streaming data engine | |
CN106302125A (en) | A kind of solicited message is responded method, Apparatus and system |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190723 |