CHAPTER 7 EXAMPLES
Introduction
7.1 Self-maintenance
7.2 Making large time intervals
7.3 Delays of ON and OFF status
7.4 Counter over 9999
7.5 Alternate ON-OFF output
7.6 Automation of parking garage
7.7 Operating a charge and discharge process
7.8 Automation of product packaging
7.9 Automation of storage door
Introduction
Programming only related examples make up the first group of examples. They are given as separate small programs that can later be incorporated into larger ones. Second group consists of examples which can be applied to some real problems.
7.1 Self-maintenance
Program allows input to remain at ON status even when the condition that brought it to that status stops. Example in picture below illustrates how use of a key connected to the input IR000.00 changes IR010.01 output status to ON. By letting the key go, output IR010.01 is not reset. This is because IR010.01 output keeps itself at status ON through OR circuit (having IR000.00), and it stays in this status until key at input IR000.01 is pressed. Input IR000.01 is in I connection with the output pin IR010.01 which cancels out a condition, and resets an IR010.01 bit. Example of self-maintenance is quite frequent in specific applications. If a user was connected to IR010.01 output, START and STOP functions could be realized from two keys (without the use of switches). Specifically, input IR000.00 would be a START key, and IR000.01 would be a STOP key.
7.2 Making large time intervals
If it's necessary to make a bigger time interval of 999.9 seconds (9999x0.1s) two linked timers, or a timer and a counter can be used as in this example. Counter is set to count to 2000, and timer is set to 5 seconds which gives a time interval of 10.000 seconds or 2.77 hours. By executing a condition at IR000.00 input, timer begins to count. When it reaches the limit, it sets a flag TIM001 which interrupts the link and simultaneously resets a timer. Once 5 seconds have run out, flag TIM001 changes its status to ON and executes a condition at the counter input CNT002. When a counter numbers 2000 such changes in timer flag status, TIM001 sets its flag CNT002 which in turn executes a condition for IR010.00 to change status to ON. Time that has elapsed from the change of IR000.00 input status to ON and a change of IR010.00 input status to ON comes to 10.000 seconds.
Ladder Diagram:
7.3 Delays of ON and OFF status
Example shows how to make output (IR010.00) delay as opposed to ?(in relation to ?? unclear meaning) input (IR000.00). By executing a condition at IR000.00 input, timer TIM000 begins counting a set value 10 in steps of 0.1 seconds each. After one second has elapsed, it set its flag TIM000 which is a condition in changing output status IR010.00 to ON. Thus we accomplish a delay of one second between ON status of IR000.00 input and ON status IR010.00 input. By changing IR010.00 output status to ON, half of the condition for activation of the second timer is executed. Second half of the timer is executed when IR000.00 input changes status to OFF (normally closed contact). Timer TIM001 sets its flag TIM001 after one second, and interrupts a condition for keeping an output in ON status.
Ladder Diagram:
7.4 Counter over 9999
If you need to count over 9999 (maximum value for a counter), you can use two connected timers. First counter counts up to certain value, and the other one counts flag status changes of the first counter. Thus you get the possibility of counting up to a value which is a result of set values of the first and second counter. In an example at the bottom, first counter counts up to 1000, and second up to 20 which allows you to count to 20000. By executing a condition at IR000.00 input (line whose changes are followed is brought to it), first counter decreases its value by one. This is repeated until counter arrives at zero when it sets its flag CNT001 and simultaneously resets itself (is made ready for a new cycle of counting from 1000 to 0). Each setting of CNT001 influences the other counter which sets its flag after twenty settings of the first counter's flag. By setting CNT002 flag of the second counter, a condition is executed for an IR010.00 output to be activated and to stay in that status through self-maintenance.
Ladder Diagram:
Same effect can be achieved with a modified program below. First change is that there is a "switch" for the whole program, and this is IR000.00 input (program can accomplish its function only while this switch is active). Second change is that the line whose status is followed is brought to IR000.01 input. The rest is the same as in the previous version of the program. Counter CNT002 counts status changes of the CNT001 counter flag. When it numbers them, it changes the status of its flag CNT002 which executes the condition for status change of IR010.00 output. This changes IR010.00 output status after 20000 changes of input IR000.01.
Ladder Diagram:
7.5 Alternate ON-OFF output
Example makes a certain number of impulses of desired duration at PLC controller IR010.00 output. Number of impulses is given in instruction of the counter (here it is a constant #0010 or ten impulses) impulse duration in two timer instructions. First timer defines duration of ON status, and second one duration of OFF status of IR010.00 output bit. In the example these two durations are the same, but through assigning them different parameters they can differ so that duration of ON status can be different from duration of OFF status.
Program starts executing a condition at IR000.00 bit. Since a normally closed contact which refers to counter flag (that isn't set ) is linked with this IR000.00 bit in "I" circuit, this status of IR200.00 bit will change to ON. Bit IR200.00 keeps its status through self-maintenance until counter flag is not set and a condition interrupted.
When an IR200.00 bit is set, timers TIM001 and TIM002 start counting a set interval number at 0.1 s ( in the example, this number is 10 for the first timer, or 20 for the second timer, and this sets the period of one or two seconds). With both timers, a normally closed contact which refers to TIM002 timer flag is connected with IR200.00 bit. When this flag is set which happens every two seconds, both timers are reset. Timer TIM002 resets timer TIM001 and itself, and this starts a new cycle.
At the start of a program, IR010.00 output bit changes status to ON and stays in this status until TIM001 flag changes status to ON (after one second). By changing TIM001 flag status to ON, condition is broken (because it is represented as normally closed contact) and IR010.00 bit changes status to OFF.
IR010.00 output status changes to ON again when time has run out on TIM002 timer. This resets TIM001 timer and its flag which in turn executes a condition for status change of the IR010.00 output. Cycle is thus repeated until a counter numbers 10 changes of TIM001 flag status. With the change of status of CNT000 counter flag, a condition for an assisting bit IR200.00 is broken, and program stops working.
Ladder Diagram:
No comments:
Post a Comment