Invention content
Based on this, it is necessary to exist for sequence control method in general PLC and need to occupy larger PLC storage skies
Between, the low problem of control efficiency provides a kind of without occupying larger PLC memory spaces, sequential control in the high PLC of control efficiency
Method and system.
Sequence control method in a kind of PLC, including step:
Obtain preset order functional diagram action limitation function block, wherein action limitation function block limitation function include
Limitation time, delay time, pulse, effective set, step active homing, step set and keep and walk invalid delay and keep in vain
It is 1;
Obtain pre-set text programming variable, pre-set text programming variable be used in text programming language, storage with
Show the function of the step in the execution step alternate orders functional diagram of program;
According to preset changeover condition, the assignment of pre-set text programming variable is changed, call action limitation function block is in text
The function of sequential function chart action is realized in this programming language.
Sequence control system in a kind of PLC, including:
First acquisition module, the action limitation function block for obtaining preset order functional diagram, wherein action limitation function
The limitation function of block include limitation the time, delay time, pulse, effective set, step active homing, step in vain set and keep with
And the invalid delay of step remains 1;
Second acquisition module, for obtaining pre-set text programming variable, pre-set text programming variable is used in text
In programming language, the function of storage and the step in the execution step alternate orders functional diagram of display program;
Calling module, for according to preset changeover condition, changing the assignment of pre-set text programming variable, call action limit
Functional block processed realizes the function of sequential function chart action in text programming language.
Sequence control method and system in PLC of the present invention obtain the action limitation function block of preset order functional diagram, action
The limitation function of limitation function block includes limitation time, delay time, pulse, effective set, step active homing, the invalid setting of step
And keep, walk invalid delay and remain 1, pre-set text programming variable is obtained, pre-set text programming variable is used in text
In programming language, the function of storage and the step in the execution step alternate orders functional diagram of display program, according to default conversion stripes
Part changes the assignment of pre-set text programming variable, call action limitation function block realization sequence work(in text programming language
The function of energy figure action.In whole process, the function of sequential control is realized using text programming language, can not only be met sequence and be controlled
The requirement of system, and since text programming language compared to sequential function chart data has prodigious simplification, sequence work(can be overcome
Can scheme SFC need to occupy the defect of the larger memory spaces of PLC, realize that sequence is efficiently controlled with simple in PLC.
Specific implementation mode
Programming language includes text programming language ST and sequential function chart SFC in PLC, wherein sequential function chart SFC is compiled
Cheng Yuyan has programmed readability strong, can be visually seen very much the sequence of movement of equipment, when equipment fault be easy to find out therefore
Hinder the position that is in, do not need complicated interlocking program, it is easier to the advantages that design and maintenance system, however, for realization sequence
The above-mentioned diversification of functional diagram SFC programming languages, comprehensive its programming language of function are to want complicated compared to text programming language ST
Very much, and many contents of sequential function chart SFC programming languages are rarely employed in PLC sequential controls, to overcome sequence
Functional diagram SFC need to occupy the defect of the larger memory spaces of PLC, and the present invention considers to use text programming language in PLC sequential controls
ST realizes sequential function chart SFC, overcomes sequential function chart SFC that need to occupy the defect of the larger memory spaces of PLC, realizes suitable in PLC
Sequence is efficiently controlled with simple.
As shown in Figure 1, sequence control method in a kind of PLC, including step:
S200:Obtain the action limitation function block of preset order functional diagram, wherein the limitation function of action limitation function block
It sets and keeps in vain including limitation time, delay time, pulse, effective set, step active homing, step, walk invalid delay guarantor
Hold is 1.
In realizing PLC in sequence control procedure, sequential function chart partial function is can not be directly in textual programming language
It calls the turn and is directly realized by including no built-in instruction.The action limitation function block of preset order functional diagram, action limit are obtained herein
The limitation function of functional block processed includes mainly limitation time L, delay time D, pulse P, effective set N, step active homing R, step
It sets in vain and keeps and walk invalid delay and remain 1 (DS), call action limitation function block, in textual programming language
Realize that the function that sequential function chart partial function can not be directly realized by, other functions of sequential function chart can be compiled directly in textual
Journey language, which calls the turn, to be directly realized by.
S400:Pre-set text programming variable is obtained, pre-set text programming variable is used in text programming language, deposits
The function of storage and the step in the execution step alternate orders functional diagram of display program.
In text programming language, the function of storage and the step in the execution step alternate orders functional diagram of display program,
It can understand and record, show which step current PLC has gone to, such as current PLC is carrying out step 2, is programmed in text
In language, current this state of execution step 2 can be stored, and shown by external display device and be currently executing step 2,
It is convenient for programming personnel to understand actual conditions in this way.
S600:According to preset changeover condition, the assignment of pre-set text programming variable, call action limitation function block are changed
The function of sequential function chart action is realized in text programming language.
Preset changeover condition is preset, such as when receiving A data, and step will be executed by needing goes to step from 2
3, when receiving B data, step will be executed by needing jumps to 5 from 3, and preset changeover condition can like according to programmer, be accustomed to
And present procedure application scenarios are set and are stored to PLC.The assignment for changing pre-set text programming variable can
To be interpreted as assigning different numerical value to a function, to realize corresponding operation.The action limitation that invocation step S200 is obtained
Functional block realizes the function of sequential function chart action in text programming language, and specifically, main includes sequential function chart
The function and the oriented line of sequential function chart and the function of conversion of step action.
Sequence control method in PLC of the present invention obtains the action limitation function block of preset order functional diagram, action limitation work(
The limitation function of energy block sets and keeps in vain including limitation time, delay time, pulse, effective set, step active homing, step
And the invalid delay of step remains 1, obtains pre-set text programming variable, pre-set text programming variable is used to program in text
In language, storage and the function of the step in the execution step alternate orders functional diagram of display program are repaiied according to preset changeover condition
Change the assignment of pre-set text programming variable, call action limitation function block realizes that sequential function chart is dynamic in text programming language
Work energy.In whole process, the function of sequential control is realized using text programming language, can not only meet wanting for sequential control
It asks, and since text programming language compared to sequential function chart data has prodigious simplification, sequential function chart SFC can be overcome
The defect of the larger memory spaces of PLC need to be occupied, realizes that sequence is efficiently controlled with simple in PLC.
The technical solution that sequence control method in PLC of the present invention is explained in detail for a more step, below compiles simulation computer
Journey Language Processing process, explains in detail, it is noted that following English occur be programming language or operational order.
Step 1:Establishment or call action limitation function block, P_Action, D_Action, L_Action, N_Action,
R_Action, S_Action, DS_Action.
Step 2:Create or call textual programming variable, Action_Step:Int (currently performed step number), Step_
Sw_Con:Array [1 ... 255] of bool (step switch condition).
Step 3:It is assigned a value of 1 for Action_Step, substitutes the initial step Step_Sw_Con all elements assignment of SFC
For FALSE.
Step 4:Judge whether that receiving function starts order, and next step is entered when receiving.
Step 5:It executes and walks program by the execution of control requirement, when being received again by new function startup order, return to step
Rapid two.
As shown in Fig. 2, step S600 includes in one of the embodiments,:
S620:According to preset changeover condition, the assignment of pre-set text programming variable, call action limitation function block are changed
The function of the step action of sequential function chart is realized in text programming language.
S640:According to preset changeover condition, the assignment of modification pre-set text programming variable realizes having for sequential function chart
To the function of line and conversion.
The step holding function of sequential function chart is can not be directly in text programming language by calling stereotyped command to realize
Step action function, in this regard, needing the action limitation function block obtained in invocation step S200 to realize.Such as reception A
When data, step will be executed by needing goes to step 3 from 2, by the assignment of pre-set text programming variable from 2 modifications to 3, calls dynamic
It is restricted the function that functional block realizes the step action of sequential function chart in text programming language, step 3 is gone to, when reception B numbers
According to when, step will be executed by needing jumps to 5 from 3, by the assignment of pre-set text programming variable from 3 modifications to 5, call action limit
Functional block processed realizes the step action conversion function of sequential function chart in text programming language, and 5 are gone to step from step 3.
As shown in Fig. 2, further including after step S620 in one of the embodiments,:
S630:Built-in timer in PLC is resetted.
Due to being required for using timer function in each program step, in order to reduce the quantity of timer, that is, program is reduced
The memory headroom of occupancy can reset the timer used in textual programming in PLC, after step conversion in next journey
It is reused in sequence step.In the present embodiment, after being converted in step, timer in PLC is resetted, reduces the number of timer
Amount effectively reduces the memory headroom of program occupancy, i.e., further overcomes sequential function chart SFC that need to occupy the larger storages of PLC empty
Between defect, realize good effect.
As shown in Fig. 2, further including before step S200 in one of the embodiments,:
S120:Create the action limitation function block of sequential function chart.
S140:Create textual programming variable.
For ease of subsequent operation efficiently with it is coherent, in the present embodiment, create the action limitation function block of sequential function chart
And textual programming variable is created, to be directly acquired in subsequent operation.
Textual programming variable is 16 integers of no symbol or 16 integer variables in one of the embodiments,.
Textual programming variable is 16 integers of no symbol or 16 integer variables.
As shown in figure 3, sequence control system in a kind of PLC, including:
First acquisition module 200, the action limitation function block for obtaining preset order functional diagram, wherein action limitation
The limitation function of functional block sets and protects in vain including limitation time, delay time, pulse, effective set, step active homing, step
It holds and walks invalid delay and remain 1.
Second acquisition module 400, for obtaining pre-set text programming variable, pre-set text programming variable is used in text
In this programming language, the function of storage and the step in the execution step alternate orders functional diagram of display program.
Calling module 600 calls dynamic for according to preset changeover condition, changing the assignment of pre-set text programming variable
It is restricted the function that functional block realizes sequential function chart action in text programming language.
Sequence control system in PLC of the present invention, the action that the first acquisition module 200 obtains preset order functional diagram limit work(
Can block, action limitation function block limitation function include limitation the time, delay time, pulse, effective set, step active homing,
Step sets and keeps and walk invalid delay in vain remains 1, and the second acquisition module 400 obtains pre-set text programming variable,
Pre-set text programming variable is used in text programming language, the execution step alternate orders functional diagram of storage and display program
In step function, calling module 600 changes the assignment of pre-set text programming variable according to preset changeover condition, calls dynamic
It is restricted the function that functional block realizes sequential function chart action in text programming language.In whole process, programmed using text
Language realizes the function of sequential control, can not only meet the requirement of sequential control, and since text programming language is compared to suitable
Sequence function diagram data has prodigious simplification, can overcome sequential function chart SFC that need to occupy the defect of the larger memory spaces of PLC, real
Sequence is efficiently controlled with simple in existing PLC.
As shown in figure 4, calling module 600 includes in one of the embodiments,:
First call unit 620 is adjusted for according to preset changeover condition, changing the assignment of pre-set text programming variable
The function of the step action of sequential function chart is realized in text programming language with action limitation function block.
Second call unit 640, for being realized according to the assignment of preset changeover condition, modification pre-set text programming variable
The oriented line of sequential function chart and the function of conversion.
The function of the step action of sequential function chart can not be realized directly in text programming language, in this regard, needing to adjust
It is realized with the action limitation function block of the first acquisition module 200 acquisition.
As shown in figure 4, sequence control system further includes in PLC in one of the embodiments,:
Reset unit 630, for being resetted to built-in timer in PLC.
Due to needing to reduce journey using timer function in order to reduce the quantity of timer in each program step mostly
The memory headroom that sequence occupies can reset timer in PLC, reused in next program step after step conversion.
In the present embodiment, after being converted in step, reset unit 630 resets timer in PLC, reduces the quantity of timer, has
Effect reduces the memory headroom that program occupies, i.e., further overcomes sequential function chart SFC that need to occupy lacking for the larger memory spaces of PLC
It falls into, realizes good effect.
As shown in figure 4, sequence control system further includes in PLC in one of the embodiments,:
First creation module 120, the action limitation function block for creating sequential function chart.
Second creation module 140, for creating textual programming variable.
For ease of subsequent operation efficiently with it is coherent, in the present embodiment, the first creation module 120 creates sequential function chart
Limitation function block is acted, the second creation module 140 creates textual programming variable, to be directly acquired in subsequent operation.
Textual programming variable is 16 integers of no symbol or 16 integer variables in one of the embodiments,.
Textual programming variable is 16 integers of no symbol or 16 integer variables.
Only several embodiments of the present invention are expressed for above example, the description thereof is more specific and detailed, but can not
Therefore it is construed as limiting the scope of the patent.It should be pointed out that for those of ordinary skill in the art,
Under the premise of not departing from present inventive concept, various modifications and improvements can be made, these are all within the scope of protection of the present invention.
Therefore, the protection domain of patent of the present invention should be determined by the appended claims.