How to raise PLC to run efficiency

  • Time:
  • Click:162
  • source:ACHER CNC Machining
It is OK to be optimized through this method huge reduces program statement number, make a program more concise, readability is better, because do not need to make time-consuming type transition, the program runs efficiency to also get rising. And mathematical operation amount is larger, efficiency rises more apparent. Defect is to want to take up more the memory of two byte, VW0 cannot be used in the program later. But the RAM space of S7-200 is very large, it is exhaustless commonly, with 226 for exemple, have the RAM that amounts to 10K, never exceed 1K occasionally. Beautiful money buys these RAM, need not white need not, also need not be wasteful. Manage together, if byte variable often needs as mutual as word type variable transition, make byte variable take up the memory width of a word wastes a byte, avoid type changeover. Concrete move is as follows: 1.

According to the project effective demand, undertake functional piece plans to write a subprogram to be in the program that PLC neutron program is the opposite independence that for a few specific control the purpose weaves. Executive subprogram calls instruction CALL to wait, when if the condition is malcontent sufficient subprogram is called, the scanning of the program undertakes in the main program only, go scanning no longer this paragraph of subprogram, reduce needless sweep time so. 2.

Send DO to nod a method to control output to be met normally in the application of PLC as it is said with word or double word number much output is controlled, convey to nod a method to control output to be able to raise rate to DO with word or double word data, want the requirement that the basis uses actually only, reasonable allocation output address, commutation controls output to control a word, the pace that can reduce PLC program to carry out greatly is counted, accelerate the program traversal speed of PLC thereby. 3.

Pulse sparks in PLC of   of   of SET, RESET, use SET instruction is carried out only can, need not scan every time implement this directive, suit to be outputted with pulse very much (PLS/PLF) the instruction cooperates to use. Some engineerings personnel ignored this issue, the method that used convention comes drive SET instruction, increased run time of PLC program scanning inadvertently. 4.

Avoided type changeover, the method is as follows: It is with S7-200 exemple, its memory format and we commonly used PC as it happens is contrary, it is tall word advanced, low word is in after. So we can put word variable after two byte, when program initialization to clear of before two byte (must not use these two byte of the program elsewhere) . If we are defined, word variable the definition is in when the symbol VW2, the cost that holds VW0 at the same time is 0. VW2 can be used in the program with word visit this are variable, at the same time OK also VD0 with double word visit, avoided type changeover. When be being used to avoid promiscuous, had better distinguish with specific symbolic definition word type and double word type. Recommend kind of Hungarian nomenclature strongly here: Indicate variable kind with prefix, with initial the combination of great significant English word makes variable name. Oneself are used to the compose below in order to: B -- -- byte variable (Byte)     W -- -- word variable (Word)     D -- -- double word variable (Double)     R -- , , according to the individual the habit comes this, without formula, basically be benefit distinguishs at oneself. If name of variable of type of a word is VarName, to use the changeover skill in front, we can define so: WVarName -- -- VW2     DVarName -- -- VD0   is when program initialization VW0 to clear (if be the variable that does not need memory, direct DVarName to clear also but) perhaps be in setting of VW0 of data piece lieutenant general is 0. WVarName is used when needing to visit variable with word type later, when with double word the type visits variable, need uses DVarName. Did not need a type completely to change. Raise PLC to run efficiency, shorten the executive time when finishing same job. Remind: Abecedarian need not care about the practice with Baconian article, with the program legible, standard is a target, the function that finish asks can. 1, can use " word " when avoid to use as far as possible " double word " , when can using integer, avoid to use real number as far as possible. 2, of preferential use have more than needed (beyond hardware join) IB, IW, ID, QB, QW, QD, it is M next, s; 3, avoid data type changeover as far as possible, when must be being used, deposit intermediate variable with AC as far as possible, reduce changeover number. Or when process designing first obligate gives storage space, for instance: When putting integer with VW2, VW0 air vents need not, can undertake visitting the data in VW2 directly with the form of VD0; 4, decrease be not necessary network scanning, the network that can establish a condition to carry out (especially AIW, AQW) , classify makes a condition call in the subprogram (time for example interrupt) ; 5, with XOR the instruction realizes random take instead (this instruction somewhat difficulty, serious counterpoint needs more in debugging, the proposal when process designing is counted with the binary system) ; 6, in make sure craft asks premise falls, reduce appropriately produce discontinuous frequency; 7, the number that the subprogram should reduce a condition to judge as far as possible, parameter of normalization subprogram imports and exports, reduce code thereby redundant. 8, repeatability, time-consuming to having task, should use minute of periodic processing; Include among them: Achieve initialization job share to many cycle. Your the sampling time of many PID loop somewhat difference, arise in order to avoid inside same cycle many interrupt call, make scanning cycle evener and stable. 9, less to data-in subprogram is called, can judge data-in to whether have change first, if do not have change, can jump over a subprogram directly, reduce scanning cycle thereby. 10, arrange a variable in V area in V511 as far as possible.

7 inside, the VB/VW/VD variable with use tall frequency, arrangement is inside V4095, can shorten program scanning is periodic. 11, SM0.

0 if establish ties with other signal, increase an order only size and executive time, without other action (if the network is already contented left must contact, not necessary string together again receive SM0.

0) ; 12, not necessary when sharing signal, place many injunction in same network, the inn of pass in and out with meeting additional generation is operated (specific and OK turn into STL to analyse) , and if not be logistic requirement, should avoid transverse series connection, can reduce at least so " with " instruction. Advantage is to be put in a network merely, the feeling is a bit more compact. 13, reasonable use instantly IO dictates (decrease as far as possible use) the changeover time of immediate instruction of managing PLC processing. 14, computational result memory is used as far as possible in computation, and need not transfer memory. CNC Milling CNC Machining