This is a PLC Program to Maintain the Capacity of a Particular Classroom.
A classroom has a capacity of maximum 120 students. There are two doors, one for Entry and the other for Exit. When number of students in the classroom is less than 120, Entry door has a Green light on it which remains ON. When number of students in the classroom is 120 or more than that, Red light goes ON turning OFF the Green light which indicates that the classroom has reached its maximum capacity and is full.
- Considering the availability of two separate doors for Entry and Exit, two separate Proximity Switches can be used to detect entry and exit of students.
- One proximity switch is mounted at the Entry door and the other at the Exit door.
- Both the switches will generate two different outputs which can be then fed to PLC to operate the lights according to the Ladder Logic Program written in its memory.
- Counter must be used to count the number of students entering and exiting.
- Comparator must also be used to compare the count value with the given maximum capacity of 120.
Here is PLC program to Maintain the Capacity of a Particular Classroom, along with program explanation and run time test cases.
List of Inputs and Outputs I:1/0 = Proximity Switch to detect Entry of a student. (Input) I:1/1 = Proximity Switch to detect Exit of a student. (Input) O:1/1 = Red Light to indicate availability in the classroom (Output) O:1/0 = Light to indicate classroom’s maximum capacity. (Output) C5:0 = Counter to count the number of students entering. (Counter) C5:0 = Counter to count the number of students exiting. (Counter) LES = Comparator to compare the counter value
NOTE: Note here that the address of Counter Up and Counter Down is kept same. This must be kept same in order to decrement and increment the same value in the accumulator of CTU and CTD.
- For this problem maximum limit is set to 120.
- RUNG000- Whenever a student enters in the class, Proximity Switch 1 generates a pulse which increments counter by 1.
- RUNG001- Whenever a student exits from the class, Proximity Switch 2 generates a pulse which decrements counter by 1.
- RUNG002- When the number of students in the class is less than 120, Green Light goes ON.
- RUNG003- When the number of students in the class is 120 which is the maximum capacity of the class, Red Light goes ON.
- RUNG004- It terminates the program and the scan cycle is repeated again.
Input C5:0.ACC PS1 goes Low to High Incremented by 1 PS2 goes Low to High Decremented by 1
Comparator Output Source A(C5:0.ACC) < Source B (120) Green=ON, Red=OFF Source A(C5:0.ACC) = Source B (120) Green=OFF, Red=ON Source A(C5:0.ACC) ≥ Source B (120) C5:0.DN bit goes true.
Sanfoundry Global Education & Learning Series – PLC Algorithms.
To practice all PLC programs, here is complete set of 100+ PLC Problems and Solutions.