Need help with a project.

Hello guys I am beginner to PLCs. I'm currently working on a school project but I'M SUPER STUCK. We have a program that we have been working on little by little and now it's our midterm and I have these objectives below.

  1. Using the portion of your program that accounts for the Safety of your machine, create a latch to ensure your machine cannot start if an Emergency Stop Push Button is pressed. This condition must remain latched when the Emergency Stop Push Button is reset.
  2. Add a Reset Push Button to each Start/Stop Station that will reset your machine only when your machine is stopped.
I took my best shot at it but I'm in a rut. Can anyone check out my program and give me any pointers? I'm sure to someone experienced this is super simple lol. Many thanks in advance.

1.png.2.png3.png
 
I will start by saying that Emergency Stops shouldn't just be an input to a standard PLC. I don't want to spend any more time going down that rabbit hole, these is heaps of information to be read and understood before you start playing with safety circuits - but if have time here is one thread where you could read more about it - Safety and PLCs

You are actually very close....
Some points that I like about your logic - the XIO in Rung 0 ensures that the machine/motor(s) cannot start/run unless the machine is safe.
And Rung 4 is saying that if an Emergency Stop is pressed, then latch the machine unsafe bit.

What you have actually said (or programmed) is that if either Emergency Stops are pressed then latch the machine unsafe bit.

Now, you just have to combine the elements of Rungs 5 & 6 together.
By this, I mean think about the conditions that will see the machine unsafe bit unlatched.
I would say that to unlatch the machine unsafe bit, you want E/Stop 1 and E/Stop 2 not pressed, plus a signal from either reset push button.

What else I don't like if your Machine stopped bit - you don't really need it as it is shown here, as the Machine Unsafe is doing the same job (more or less).
Furthermore, a Machine Stopped bit should be driven from an input that confirms that the Machine has stopped - maybe something like a feedback signal from a de-energised contactor.

Also, how are your stop buttons wired? Normally open or Normally closed?
 
As @ianingram wrote, the logic of Rungs 0004 and 0005 that write the value of B3:0/2 MACHINE_STOPPED need to be combined into one rung that only writes that bits value once; see the TL;DR below (very important; do this first).

Also, I second @ianingram's statement that safety logic does not belong in standard PLCs. That said, what this assignment is doing is ensuring the PLC logic does not even try to start the machine after an E-Stop is detected, unless both the external E-Stop device has been cleared and the machine-unsafe bit in the PLC, latched by the E-Stop condition, has also been cleared by a reset action separate from the external E-Stop device itself. That extra PLC-reset step is unnecessary; in a properly-designed actual system, he E-Stop device would prevent the machine from running no matter what the PLC did.

The non-seal-in logic on rung 0005 is suspect: this rung looks like it resets value of the MACHINE_UNSAFE bit to 0 if the stop buttons at both station are not pressed, which would be the normal situation, while the program assignment indicates that there should be extra care taken before recovering from and Emergency Stop.. I suggest reading about De Morgan's Laws (see here) to take that concept from something you intuitively do without thinking about to a well-maintained and often-used tool in the toolbox.

But there is a bigger problem here: the assignment description mentions a Reset Push button to clear the unsafe state when the machine is stopped; the assignment description does not link the stop buttons to the state machine safety bit. Note particularly the distinction there between "when the machine is stopped" and "the stop buttons." Perhaps a better definition of "machine is stopped" would be "machine not running" i.e. a value of 0 in the B3:0/0 MACHINE_RUN B1 bit. It's also possible that, if there is any momentum in the system or motors, that the "machine stopped" state should only be true when the MACHINE_RUN bit's value has been 0 for several seconds, but I doubt you have been introduced to timers, integers and analog values yet.

Also, Rung 0006 has no output, so the program will not compile.

That said, the program does not use B3:0/2 MACHINE_STOPPED for anything yet, and once the logic is fixed to do what I think you wanted it to do, then the MACHINE_STOPPED bit it would have the same value as B3:0/1 MACHINE_UNSAFE anyway, so removing B3:0/2 MACHINE_STOPPED , and cleaning up the logic that assigns MACHINE_UNSAFE would be another solution.

Generally speaking, it appears you have grasped the fundamental concept of the Start/Stop Circuit pattern (see here), and have also the extended that concept where the Start and Stop elements of that pattern can be compound (multiple) instructions: the two Start button-pressed bits ORed (in parallel with the Seal-In on Rung 0000); the two Stop button-not-pressed bits ANDed (in series also on Rung 0000).

Also, it might be helpful to look at the State Coil/Fault Coil pattern (see here), which is similar to the Start/Stop Circuit pattern, but ensures the Trigger/Start condition is dominant over the Stop/Break condition. This might be how you want to write a value to the MACHINE_UNSAFE bit: if either the E-Stop device is active on the current scan cycle, or [the MACHINE_UNSAFE bit's value was 1 from the previous scan cycle and the Reset button is not pressed], then write a 1 to the MACHINE_UNSAFE bit.

TL;DR

Search for "duplicate destructive bits" on this forum. Almost everyone does this. Once. Those who go on to succeed never do it again ;).

I hope the teacher has taught about the scan cycle, and emphasized that PLC programming is primarily about time, and the scan cycle is the clock; when something happens is more important than what happens.

Also, all relay (Boolean) logic is based on three operations: AND; OR; NOT. In ladder logic:
  • ANDs are implemented as contacts/logic in series on a rung or branch;
  • ORs are implemented as contacts/logic in parallel branches
  • NOTs are implemented primarily using XIO -]/[- instructions for single bits, but other tricks are available (see again De Morgan's Laws).
 
I have these objectives below.
  1. Using the portion of your program that accounts for the Safety of your machine, create a [machine cannot start condition] latch to ensure your machine cannot start if an Emergency Stop Push Button is pressed. This [machine cannot start] condition must remain latched when the Emergency Stop Push Button is reset.
  2. Add a Reset Push Button to each Start/Stop Station that will reset your [latched] machine [cannot start condition] only when your machine is stopped.
I see a problem with item (2) of this assignment definition:
  • if this [machine cannot start condition] is True, then it makes sense to stop the machine
    • E.g. OP's Rung 0000 has XIO MACHINE_UNSAFE as the first contact on the rung,
      • which will write a value of 0 to the MACHINE_RUN bit if the value of MACHINE_UNSAFE bit is 0
        • i.e. OP's XIO MACHINE_UNSAFE contact encapsulates the [machine cannot start condition]
  • So any time an E-Stop (Emergency Stop Push Button) is pressed, the machine will stop i.e. MACHINE_RUN bit will be 0,
    • so the second half of item (2) of that assignment definition is redundant,
      • because the machine will already be stoppped.
I suppose OP could change their logic to remove the XIO MACHINE_UNSAFE contact from Rung 0000, so that rung would not reset the MACHINE_RUN bit value to 0 when an E-Stop is pressed and MACHINE_UNSAFE value becomes 1. They could instead AND an XIO MACHINE_UNSAFE contact in series with each XIC MACHINE_RUN contacts on Rungs 0001/0002/0003 to prevent those rungs from writing 1 values to the motor outputs.

An alternative would be to move the XIO MACHINE_UNSAFE contact on Rung 0000 so it is ANDed (in series with) the two start condition branches, but does not affect (override; is not ANDed /in-series with) the XIC MACHINE_RUN seal-in branch on Rung 0000.

Either way the MACHINE_RUN bit value will remain 1 when an E-Stop is pressed, which is a bad idea, of course, but seems the only way to make the second half of item (2) of the assignment description make any sense.

Then a rung could be created, probably using a State Coil/Fault Coil pattern, where the MACHINE_UNSAFE bit is written with a coil that is dependent on only the values of these relevant bits:
  • the two E-Stop inputs;
  • the Reset Push button input;
  • the MACHINE_RUN bit (i.e. "machine is stopped" condition is True when this bit's value is 0);
  • the MACHINE_UNSAFE bit (seal-in value from the previous scan cycle).



Another approach: instead of using XIO MACHINE_RUN as the "machine is stopped" condition, assume there is a MACHINE_STOPPED discrete input bit that comes from the process and is not written by the PLC, and use XIC MACHINE_STOPPED as the "machine is stopped" condition.
 
I will start by saying that Emergency Stops shouldn't just be an input to a standard PLC. I don't want to spend any more time going down that rabbit hole, these is heaps of information to be read and understood before you start playing with safety circuits - but if have time here is one thread where you could read more about it - Safety and PLCs

You are actually very close....
Some points that I like about your logic - the XIO in Rung 0 ensures that the machine/motor(s) cannot start/run unless the machine is safe.
And Rung 4 is saying that if an Emergency Stop is pressed, then latch the machine unsafe bit.

What you have actually said (or programmed) is that if either Emergency Stops are pressed then latch the machine unsafe bit.

Now, you just have to combine the elements of Rungs 5 & 6 together.
By this, I mean think about the conditions that will see the machine unsafe bit unlatched.
I would say that to unlatch the machine unsafe bit, you want E/Stop 1 and E/Stop 2 not pressed, plus a signal from either reset push button.

What else I don't like if your Machine stopped bit - you don't really need it as it is shown here, as the Machine Unsafe is doing the same job (more or less).
Furthermore, a Machine Stopped bit should be driven from an input that confirms that the Machine has stopped - maybe something like a feedback signal from a de-energised contactor.

Also, how are your stop buttons wired? Normally open or Normally closed?
At first I had them NC but I realized that NO made more sense.
 
So it looks like I should combine rung 5 and 6, would i do that by branching the 2 stop push buttons and 2 reset buttons together? (I should have mentioned that 2 resets are required)

I like @drbitboy's idea of removing the XIO MACHINE_UNSAFE contact from rung 0 and placing it in series with XIO MACHINE_RUN contacts on rung 1, 2, and 3. But how would the reset buttons come into play?

Also I will post the full outline of my assignment. I only posted the first 2 objectives as those were the ones that were giving me trouble but maybe it will also make things a little more clear.

1000013929.jpg
 
So it looks like I should combine rung 5[?] and 6[?], would i do that by branching the 2 stop push buttons and 2 reset buttons together? (I should have mentioned that 2 resets are required)

I assume those are typos because you need to combine rungs 0004 and 0005, because the current code is overwriting the value of MACHINE_UNSAFE on both Rung 0004 and Rung 0005, which means the value written by the logic on Rung 0004 will always be overwritten* by the logic on Rung 0005.

* though perhaps not changed because of the seal-in on Rung 0005, but still those duplicate destructive bits (OTE MACHINE_STOPPED on both rungs) are an anti-pattern that should be eliminated by combining rungs 0004 and 0005.

I like @drbitboy's idea of removing the XIO MACHINE_UNSAFE contact from rung 0 and placing it in series with XIO MACHINE_RUN contacts on rung 1, 2, and 3. But how would the reset buttons come into play?

The reset buttons would only affect the value written to the MACHINE_UNSAFE bit, because that bit's value being 1 tells you that an E-Stop event
  • is active during the current scan cycle (now) (one or both of the E-Stop discrete input values is 1),
  • AND/OR
  • was active during a past scan cycle, but is no longer (not now) active, but the MACHINE_UNSAFE value has not yet been reset to 0 by a E-Stop-Reset Push button.
The words highlighted in purple above are time words.

Note that if any E-Stop discrete input value is 1 for the current scan cycle, then MACHINE_UNSAFE's value should be written as 1 during this scan cycle even if the operator is holding in one of the E-Stop-Reset Push buttons for the current scan cycle; i.e. the logic that writes 1 to MACHINE_UNSAFE should be trigger-dominant.
 
I assume those are typos because you need to combine rungs 0004 and 0005, because the current code is overwriting the value of MACHINE_UNSAFE on both Rung 0004 and Rung 0005, which means the value written by the logic on Rung 0004 will always be overwritten* by the logic on Rung 0005.

* though perhaps not changed because of the seal-in on Rung 0005, but still those duplicate destructive bits (OTE MACHINE_STOPPED on both rungs) are an anti-pattern that should be eliminated by combining rungs 0004 and 0005.



The reset buttons would only affect the value written to the MACHINE_UNSAFE bit, because that bit's value being 1 tells you that an E-Stop event
  • is active during the current scan cycle (now) (one or both of the E-Stop discrete input values is 1),
  • AND/OR
  • was active during a past scan cycle, but is no longer (not now) active, but the MACHINE_UNSAFE value has not yet been reset to 0 by a E-Stop-Reset Push button.
The words highlighted in purple above are time words.

Note that if any E-Stop discrete input value is 1 for the current scan cycle, then MACHINE_UNSAFE's value should be written as 1 during this scan cycle even if the operator is holding in one of the E-Stop-Reset Push buttons for the current scan cycle; i.e. the logic that writes 1 to MACHINE_UNSAFE should be trigger-dominant.
How do I combine rung 4 and 5, don't I need the unlatch on rung 5? I am going to eliminate the MACHINE_STOPPED bit as that was a bit of a hail mary lol. Sorry I don't know that much so I get a bit confused.
 
You don't have to use latch/unlatch (OTL/OTU; although you can if you want to; see Sidebar below): you can implement the MACHINE_UNSAFE logic on a single rung that uses an OTE instruction to write either a 1 or a 0 to MASHINE_UNSAFE each time the rung is evaluated.

Relay ladder logic is a form of boolean logic, so there are only three operators: AND; OR; NOT.
  • AND in ladder is implemented via contacts (or logic) in series along a single rung or branch
  • OR in ladder is implemented via contacts (or logic) in parallel branches;
  • NOT in ladder is implemented via XIO contact for a single bit, or via De Morgan's Laws for compound logic.
How that applies to MACHINE_UNSAFE:

During each scan cycle, you want the MACHINE_UNSAFE value to be written as
  • 0 if no E-Stop Push buttons are depressed and any past E-Stop (when MACHINE_UNSAFE value was 1) has been reset
  • 1 if either
    • E-Stop Push button is depressed, regardless of the state of the Reset Push button
      • Let's call this the Fault or Trigger condition
        • Note that this is an input condition over which the program has no control
    • OR
    • both
      • the value of MACHINE_UNSAFE was 1 on the previousscan cycle
        • Let's call this the Seal-in condition
          • Note that, unlike the E-Stop, this is not an input condition, but it is a remembered state from the previous scan cycle
      • AND
      • the Reset Push button is released (i.e. is NOTdepressed)
        • Let's call the Reset Push button the Reset or Break condition
          • Note that, like the E-Stop, this an input condition over which the program has no control
So the key here is the regardless: the E-Stop Push button being depressed (Fault/Trigger condition) should override the state of the Reset Push button, so the only way to reset the value of MACHINE_UNSAFE from 1 back to 0 is by pressing the Reset Push button (Break condition) when (a time word) the E-Stop push button is no longer depressed. Stated more concisely, the logic is Trigger-Dominant i.e. the Trigger condition overrides the Break condition. See State Coil/Fault Coil pattern, especially the last paragraph:

Notice that if the fault condition is still “active” (i.e. the [E-Stop] is still [pressed]) then the [output] Fault [value] will [be 1]. This is what someone means when they say that “a fault must be cleared before it can be reset.”

So remembering (another time word) the value of a bit from a previous (another time word) scan cycle is achieved with a Seal-in i.e. an XIC that examines the value the bit before (another ...) that same bit is written with the OTE at the end of the rung.

Sidebar
How do I combine rung 4 and 5, don't I need the unlatch on rung 5?

If you want to implement that State Coil/Fault Coil pattern logic with OTL/OTU latches on separate rungs then the order in which the OTL/OTU are evaluated matters; specifically, you want the OTL, triggered by the E-Stop (Fault/Trigger condition) to be evaluated after (another time word) the OTU, triggered by the Reset (Break/Reset condition). See also Set/Reset pattern; N.B. "Trigger-dominant" is the same as "Set-dominant" at that link.

So you could do the following. Notes:
  • The single contacts are actually compound logic in your assignment:
    • XIC Reset on Rung 0004 here expresses "If either Reset1 or Reset2 is pressed"
    • XIO E-Stop on Rung 0004 here expresses "If neither E-Stop1 nor E-Stop2 is pressed"
    • XIC E-Stop on Rung 0005 here expresses "If either E-Stop1 or E-Stop2 is pressed"
    • I'll leave it to you and to De Morgan to convert this logic to your needs
  • The XIO E-Stop on Rung 0004 is sort of unnecessary:
    • If an E-Stop is pressed and a Reset is pressed and Rung 0004 without the XIO E-Stop resets MACHINE_UNSAFE's value to 0,
    • Then Rung 005 will still overwrite that 0 with a 1.
1728899177177.png
 
I will try to simplify this a bit if you are getting confused.

Lets say that you leave the XIO machine unsafe bit in Rung 0 as it is.

Then in Rung 4, either Emergency Stop will cause the machine unsafe bit to latch on.

Then, its all about the conditions that will allow you to unlatch the machine unsafe latch.
The conditions are;
Machine stopped (which could be a XIO of machine run)
and
Emergency Stop 1 not pressed (another XIO)
and
Emergency Stop 2 not pressed (another XIO)

and then
a reset signal from (I assume) either reset push buttons (XIC, but two of them)

I say to leave rung 0 as it is, so that if an Emergency Stop is pressed, another start signal would be required to get things moving again.
 
Thank you guys very much for your input you guys have been very helpful. I'll work on my program when I get home from work and then I'll post it again. I have to add timers and horns and stuff so it will look a bit different.
 
Screenshot 2024-10-14 222029.pngScreenshot 2024-10-14 222102.pngScreenshot 2024-10-14 222123.pngScreenshot 2024-10-14 222240.pngScreenshot 2024-10-14 222257.png


So, I tried doing what I could. It seems like it should work? I managed to create the motor start sequence in order of 1, 2, then 3, but I can't figure out how to stop them in a reverse sequence though.
 

Similar Topics

Hello All, I would consider myself a Moderate to Advanced Programmer when it comes to AB PLC's. However, i dont have much experience with HVAC...
10
Replies
979
Views
Hello everyone, I'm a Master's student in industrial electrical engineering, and I'm currently working on a PLC project as part of an academic...
5
Replies
811
Views
Hello everyone, I’m a Mechatronics student working on a project with Factory IO’s Converge Station and Allen Bradley PLC (Studio 5000). I managed...
17
Replies
3,833
Views
Hey guys, So I'm working on a new project adding an HMI and need some help. So far what I figured out is I'm going to buy a large 85" LCD TV hook...
4
Replies
2,501
Views
Hello! I need your assistance with the following issue. I need to upload project from 1756-L63 (v19.11) B Series controller for further diagnosis...
3
Replies
9,515
Views
Top