Electronic – Creating ladder PLC logic using force inputs and outputs

plc

I am currently using Allen Bradley PLC and RSLogix Micro to program it. The problem is:

Create a ladder logic diagram for the following problem in which pump #1 and pump #2, alternately or
simultaneously, pump liquid.

• When the level switch closes, first pump #1 turns on. If pump #1 runs more than 30 seconds, then
pump #2 turns on. Both pumps continue operating until the level switch opens, indicating a lower
liquid level.

• When the level switch closes again, pump #2 turns on. Note that either pump #1 or pump #2 will
turn on first to discharge the liquid. Similarly, if pump #2 runs more than 30 seconds, then pump #1
turns on. Both pumps continue operating until the level switch opens, indicating a lower liquid level.
Therefore, either pump #1 or pump #2 discharges the liquid, or both pumps discharge the liquid.

Use the force function to close and open the level switch and turn the pumps on accordingly to
discharge the liquid level.

Use the force function to turn off (i.e., disable) one of the pumps. Now, run the program and
examine if it is working properly.

The updated solution:

enter image description here

The question is that I am not sure if I understand the alternating process between the two pumps.

3rd attempt: The first part of the problem.

enter image description here

4th attempt: So I tried to insert the "flip-flop". And I understand that XOR command is used to alternatively change the value of the B3:0/1. However, when I tried to put in RS Logix the program that you provided, I could not write the address B:3.0/1. Because, it said that address should be specified to the word level. And also the BSR command is represented different in RS Logix. Is represented as in the picture below:
enter image description here

Assuming that the flip flop is working and the values are changing alternately I wrote the program.
enter image description here

Thank you so much!
5th attempt: This time the program worked. And the pumps where energized alternatively.
enter image description here

Best Answer

You appear to be lacking understanding of how a PLC program is executed. The PLC code is scanned or executed every few milliseconds and the inputs read at the start of the scan and the outputs written at the end of each scan.

Attempt 1:

enter image description here

Figure 1. The problems.

  1. When I:0/0 turns on O:0/0 turns on in the PLC memory (but the output won't turn on until the end of the program scan).
  2. Since T:4/1 has not turned on yet the program turns off O:0/0. Since this is the last occurrence of O:0/0 before END this is what get's written to the output. Remember that the last rung to affect the output "wins".
  3. Same as (1) above.
  4. Same as (2) above.

How to fix:

  • Document your program. Assign names to your inputs and outputs, internal bits and timers.
  • Add comments to rungs to explain what each rung is doing.
  • Draw a timing or sequence diagram. This will clarify your thinking.
  • Outputs should only appear once in the program.
  • (If you need to) use bit memory, B:0/0, etc.. to keep track of status internally and then use those to control the outputs at the end of the scan.

The assignment has a bit of a twist in it because the outputs have to alternate. I suggest that you ignore this bit for now. Just get it working for the first sequence. Do that first and then update your post with the new code.

  • Delete rungs 0000 and 0002.
  • Write the logic for pump 1 on rung 0004.
  • Write the logic for pump 2 on rung 0005.

Tip: Reduce the window width before taking a screengrab so that the picture is legible in SE's 640 pixel wide image size. That way we'll be able to read it in the post.


Attempt 2:

enter image description here

Figure 2. This won't work because #1 Pump can never turn on.

Attempt 3:

OK, you've got that working. Now you need to make a bit "flip-flop" or alternate every time the float switch turns on. We won't use it yet - we'll just get it working. I'll give you the code for this as it's a bit tricky.

   I:0      B3:0               +XOR------------------+
---] [-----|OSR|---------------+ Source A: I:0/0     +--
     0         0               | Source B: B3:0/1    |
                               | Dest:     B3:0/1    |
                               +---------------------+

Figure 3. A flip-flop created using the XOR instruction.

Have a look at the SLC 500 Instruction Set page 118 to understand the operation of the XOR instruction.

If you get that working you can now use B:3.0/1 in your output logic with simple modification to the two pump output rungs. Report back again and try to explain how you think the XOR is working.

Attempt 4:

We have a few problems:

enter image description here

Figure 4. A few more problems.

  1. You forgot to say which PLC you're using so the instruction set may be different. You'll need to add the OSR in here. If it requires two bits then be careful not to use any that we're writing to elsewhere. I had written the address format incorrectly in Figure 3 and have corrected it.
  2. For the XOR to work we need to Source B to be the same as Dest.
  3. See 2.
  4. Think when B3:0/0 is going to turn on and off. (Try it in your program.) Then think about what will happen the outputs when it does turn on. Will that satisfy your requirements?
  5. Same as 4.

Once again, document as you go. You have omitted naming the bits. If you don't get into good habits with this you will suffer much pain in your career.

Related Topic