Tuesday, June 13, 2023

Counter with PLC

Classroom Vacancy Index

The application of a 'Counter' with PLC is illustrated here using a Ladder diagram. A model classroom is being considered, where 20 students can be accommodated. If there are fewer than 20 students present in the room, a Green Lamp will light up on top of the entry door, indicating at least one vacant seat inside the room. If there are 20 or more students present in the room, the Green Lamp will turn off, and a Red Lamp will light up above the door. The classroom has two doors: one for entry and the other for exit only. This means that if the number of students inside the room is less than 20, the Green light will be on, and if it is equal to or greater than 20, the Red light will be on.

The complete process functions automatically with two sensors fitted on the entry and exit doors. Proximity switches or Magnetic sensors can be employed as the sensors, providing signals every time a door is opened. Each signal coming from the entry door sensor represents one student entering, while the signal from the exit door sensor indicates one student leaving the classroom. By evaluating and comparing these signals within a counter, the PLC turns on the Green or Red Lamp. Therefore, if the result of adding the total entry and exit signals is less than 20, the Green Lamp will light up, and if it is equal to or greater than 20, the Red Lamp will light up. The image below demonstrates the positions of the lamps and the location of sensors with the entry and exit doors in a classroom.

 

 

Before starting Ladder programming, let's introduce the input/output elements and the counter using PLC. In this setup, we will be using two proximity switches to sense the open/close condition of the Entry and Exit doors. A proximity switch is a non-contact switching device that generates a switching signal (usually 24V DC) when a metallic object is detected in front of its sensing face. In this case, the proximity switch is fixed on the wall, and the sensing element (usually an iron plate) is placed on the door.

The switching signal from the proximity switch is considered as a normally open (NO) contact, and when activated, it provides a 24V DC signal to the PLC. Two push-button switches are used in this system: one to start the system and the other to reset it. Additionally, two 24V DC lamps (Green and Red) are used as output elements in conjunction with the PLC. In this setup, C1 is an Up-Down Counter with a Preset Value (PV) of 20, which functions as the counting element.

 

Input elements  

Entry Sensor (Proximity)                    = I1.0

Exit sensor (Proximity)                       = I1.1

Start switch (Push type)                      = I1.2

Reset switch (Push type)                    = I1.3

 

Output elements 

Green Light                                         = Q0.1

Red Light                                            = Q0.2

 

Counter 

Up-Down Counter                              = C1

 

Interfacing of elements with PLC

The following diagram is illustrating the hardware configuration or interfacing of different Input and Output elements with PLC.


 

Ladder diagram

Two separate Rungs, presenting the complete Ladder diagram and Rung-1 describing all the signals related to a Counter, and the ON/OFF logic of the Lamps are written with Rung-2.  


 

 

Proximity sensor inputs from the entry and exit are connected to the PLC, using the Input addresses I1.0 and I1.1, respectively. The C1 Counter being used here is a count Up-Down type (signified by S_CUD), capable of both up-counting and down-counting. The input signal I1.0 from the entry sensor represents the count-up (CU) signal for the Counter. This means that every time the entry door opens, a signal pulse will be transferred to the CU point, and the Counter will sum up those signals. Similarly, the signal from the exit sensor input I1.1 is considered the count-down (CD) signal. When the exit door opens, a signal pulse will be transferred to the CD point, and the Counter will subtract it from the summing value. Since the Counter only recognizes the rising edge of the counting signal, the total count value does not depend on how long the signal pulse is ON. In other words, the counting value will not depend on the duration of the Entry and Exit doors being open or closed.

A Start switch with input I1.2 is connected to the Set-point (S), and pressing the switch will make the Counter ready for counting according to the Preset Value (PV), which is 20 in this case. After that, the Counter will compile (add or subtract) all the signals reaching the CU and CD points. When the accumulated count value equals the PV, the Counter will set its 'Q' point to Logic-1. Since the output coil Q0.1 is enabled by the 'Q' point, the status of the output coil Q0.1 will also become Logic-1. A Reset switch with input status I1.3 is connected to the Reset point (R). Pressing the reset switch will reset all the counting values to zero and return the Counter to its initial state.

With a preset value (PV) of 20, the output coil Q0.1 will be energized when the total cumulative count of signals reaching the CU and CD points becomes equal to 20. Initially, the Green Lamp will always be lit, as the output coil Q0.2 is activated with NC Contact logic (Rung-2). The status of Q0.1 will remain Logic-0 until the cumulative count value reaches 19. From a count value of 20, the status of Q0.1 becomes Logic-1, and the Red Lamp associated with it will light up. The output coil Q0.2 will also become Logic-0, turning off the Green Lamp. In other words, the Green Lamp will light up with fewer than 20 students, and the Red Lamp will glow with 20 or more students present inside the classroom. 

Timing Diagram

The complete sequential operations are illustrated in the following 'Timing diagram' of the Counter.

 

The first and second lines of the Timing diagram represent the signals arriving from the sensors, corresponding to the Entry and Exit doors, respectively. The Reset signal input is depicted by the third line. The fourth line shows the cumulative count value of the Counter. The fifth and sixth lines indicate the ON and OFF sequence of the Red and Green lights, respectively. In this diagram, ten students are shown passing through the Entry door, as indicated by the first line, and five students leaving the room (second line) through the Exit door. Then, fifteen students enter, and three students exit. The cumulative count values of the incoming signals (entry and exit) are shown on the 'Count-value' timing diagram. Looking at the fifth and sixth lines of the timing diagram, the Green Lamp will remain ON primarily until the count value approaches 20. 

 

 

 

 

 

  

No comments:

Post a Comment

Popular Posts